J38 commited on
Commit
2e9d8e5
1 Parent(s): aacf045

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +182 -0
README.md ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model Card for Pubmed GPT 2.7B
2
+
3
+ PubMed GPT 2.7B is new language model trained exclusively on biomedical abstracts and papers from [The Pile](https://pile.eleuther.ai/). This GPT-style model can achieve strong results on a variety of biomedical NLP tasks, including a new state of the art performance of 50.3% accuracy on the MedQA biomedical question answering task.
4
+
5
+ As an autoregressive language model, PubMed GPT 2.7B is also capable of natural language generation. However, we have only begun to explore the generation capabilities and limitations of this model, and we emphasize that this model’s generation capabilities are for research purposes only and not suitable for production. In releasing this model, we hope to advance both the development of biomedical NLP applications and best practices for responsibly training and utilizing domain-specific language models; issues of reliability, truthfulness, and explainability are top of mind for us.
6
+
7
+ This model was a joint collaboration of [Stanford CRFM](https://crfm.stanford.edu/) and [MosaicML](https://www.mosaicml.com/).
8
+
9
+
10
+ # Table of Contents
11
+
12
+ - [Model Card for Pubmed GPT 2.7B](#model-card-for--model_id-)
13
+ - [Table of Contents](#table-of-contents)
14
+ - [Table of Contents](#table-of-contents-1)
15
+ - [Model Details](#model-details)
16
+ - [Model Description](#model-description)
17
+ - [Uses](#uses)
18
+ - [Direct Use](#direct-use)
19
+ - [Downstream Use](#downstream-use)
20
+ - [Out-of-Scope Use](#out-of-scope-use)
21
+ - [Bias, Risks, and Limitations](#bias-risks-and-limitations)
22
+ - [Recommendations](#recommendations)
23
+ - [Training Details](#training-details)
24
+ - [Training Data](#training-data)
25
+ - [Training Procedure](#training-procedure)
26
+ - [Preprocessing](#preprocessing)
27
+ - [Speeds, Sizes, Times](#speeds-sizes-times)
28
+ - [Evaluation](#evaluation)
29
+ - [Testing Data, Factors & Metrics](#testing-data-factors--metrics)
30
+ - [Testing Data](#testing-data)
31
+ - [Factors](#factors)
32
+ - [Metrics](#metrics)
33
+ - [Results](#results)
34
+ - [Model Examination](#model-examination)
35
+ - [Environmental Impact](#environmental-impact)
36
+ - [Technical Specifications](#technical-specifications)
37
+ - [Model Architecture and Objective](#model-architecture-and-objective)
38
+ - [Compute Infrastructure](#compute-infrastructure)
39
+ - [Hardware](#hardware)
40
+ - [Software](#software)
41
+ - [Citation](#citation)
42
+ - [Model Card Contact](#model-card-contact)
43
+ - [How to Get Started with the Model](#how-to-get-started-with-the-model)
44
+
45
+
46
+ # Model Details
47
+
48
+ ## Model Description
49
+
50
+ <!-- Provide a longer summary of what this model is/does. -->
51
+ PubMed GPT 2.7B is new language model trained exclusively on biomedical abstracts and papers from [The Pile](https://pile.eleuther.ai/). This GPT-style model can achieve strong results on a variety of biomedical NLP tasks, including a new state of the art performance of 50.3% accuracy on the MedQA biomedical question answering task.
52
+
53
+ As an autoregressive language model, PubMed GPT 2.7B is also capable of natural language generation. However, we have only begun to explore the generation capabilities and limitations of this model, and we emphasize that this model’s generation capabilities are for research purposes only and not suitable for production. In releasing this model, we hope to advance both the development of biomedical NLP applications and best practices for responsibly training and utilizing domain-specific language models; issues of reliability, truthfulness, and explainability are top of mind for us.
54
+
55
+ This model was a joint collaboration of [Stanford CRFM](https://crfm.stanford.edu/) and [MosaicML](https://www.mosaicml.com/).
56
+
57
+
58
+ - **Developed by:** Stanford CRFM, MosaicML
59
+ - **Shared by [Optional]:** Stanford CRFM
60
+ - **Model type:** Language model
61
+ - **Language(s) (NLP):** en
62
+ - **License:** openrail
63
+
64
+ ## Direct Use
65
+
66
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
67
+ <!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
68
+
69
+ It is possible to use this model to generate text, which is useful for experimentation and understanding its capabilities. It should not be directly used for production or work that may directly impact people.
70
+
71
+
72
+ ## Downstream Use
73
+
74
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
75
+
76
+ The main way we have used this model is finetuning for downstream question answering tasks, and we recommend using this model that way.
77
+
78
+
79
+ ## Out-of-Scope Use
80
+
81
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
82
+
83
+ We do not recommend using this model for natural language generation in a production environment, finetuned or otherwise.
84
+
85
+
86
+
87
+
88
+ # Bias, Risks, and Limitations
89
+
90
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
91
+
92
+
93
+ Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.
94
+
95
+
96
+ ## Recommendations
97
+
98
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
99
+ While this model is capable of generating natural language text, we have only begun to explore this capability and its limitations. Understanding these limitations is especially important in a domain like medicine. Therefore, **we strongly recommend against using this model in production for natural language generation.**
100
+
101
+
102
+ # Training Details
103
+
104
+ ## Training Data
105
+
106
+ <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
107
+
108
+ This model was trained on the Pubmed Abstracts and Full Text from [The Pile](https://pile.eleuther.ai/).
109
+
110
+
111
+ ## Training Procedure
112
+
113
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
114
+
115
+ The model was trained on [MosaicML Cloud](https://www.mosaicml.com/cloud), a platform designed for large workloads like LLMs. Using the [Composer](https://github.com/mosaicml/composer) training library and [PyTorch FSDP](https://pytorch.org/docs/stable/fsdp.html), it was easy to enable multi-node training across 128 A100-40GB GPUs, and the total run was completed in ~6.25 days. The model was trained with batch size=1024 and sequence length=1024 for 300B tokens using Decoupled AdamW with the following settings:
116
+
117
+ | | |
118
+ | --- | ------ |
119
+ | lr | 1.6e-4 |
120
+ | eps | 1e-8 |
121
+ | betas | \[0.9, 0.95\] |
122
+ | weight decay | 1.6e-5 |
123
+
124
+
125
+ The training process was very smooth and did not suffer from any divergences.
126
+
127
+
128
+ As we were preparing the training run, we were unsure of the benefits of training out to 300B tokens for language model perplexity and downstream task performance. While most models of this scale (e.g. GPT Neo 2.7B) are trained to 300-400B tokens, the datasets those models use are vastly larger than PubMed. For instance, The Pile is 8x the size of its PubMed subcorpora.
129
+
130
+
131
+ Fortunately, we did continue to see steady perplexity improvements on the validation and training sets for the entirety of training, and preliminary experiments showed improved downstream task performance as we trained out to the full 300B tokens. Our takeaway from this was that it was indeed worth it to train for the full 300B tokens, even though this represented dramatically more passes through the data than comparable models.
132
+
133
+ ### Preprocessing
134
+
135
+ The model uses a custom tokenizer trained on the PubMed Abstracts. When building domain specific models we have found it important to use a tokenizer trained on in-domain text to maximize performance on downstream tasks. A key benefit is that common biomedical terms are represented as entire tokens.
136
+
137
+
138
+ For instance, all of these following terms are tokenized into single tokens by the biomedical tokenizer and multiple tokens by the standard GPT-2 tokenizer:
139
+
140
+
141
+ | | |
142
+ | --- | --- |
143
+ | chromatography | chrom/atography |
144
+ | cytotoxicity | cyt/ot/oxicity |
145
+ | Immunohistochemistry | Immun/oh/ist/ochemistry |
146
+ | photosynthesis | photos/ynthesis |
147
+ | probiotic | prob/iotic |
148
+
149
+
150
+ This allows the model to encode information about these concepts in their individual token representations rather than spread out across subword tokens like “oh” shared with many other terms.
151
+
152
+ # Environmental Impact
153
+
154
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
155
+
156
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
157
+
158
+ - **Hardware Type:** More information needed
159
+ - **Hours used:** More information needed
160
+ - **Cloud Provider:** More information needed
161
+ - **Compute Region:** More information needed
162
+ - **Carbon Emitted:** More information needed
163
+
164
+ # Technical Specifications
165
+
166
+ ## Model Architecture and Objective
167
+
168
+ Pubmed GPT 2.7B is a standard GPT-2 implementation (trained with Flash Attention) with the following hyperparameters:
169
+
170
+
171
+ | | |
172
+ | ----------- | ----- |
173
+ | hidden size | 2560 |
174
+ | heads | 20 |
175
+ | layers | 32 |
176
+ | vocab size | 28896 |
177
+ | sequence length| 1024 |
178
+
179
+
180
+ ## Compute Infrastructure
181
+
182
+ The model was trained on [MosaicML Cloud](https://www.mosaicml.com/cloud), a platform designed for large workloads like LLMs. Using the [Composer](https://github.com/mosaicml/composer) training library and [PyTorch FSDP](https://pytorch.org/docs/stable/fsdp.html), it was easy to enable multi-node training across 128 A100-40GB GPUs, and the total run was completed in ~6.25 days.