natolambert
commited on
Commit
•
d87f426
1
Parent(s):
f09de2d
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- allenai/dolma
|
5 |
+
- allenai/tulu-v2-sft-mixture
|
6 |
+
- allenai/ultrafeedback_binarized_cleaned
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
---
|
10 |
+
|
11 |
+
|
12 |
+
<img src="https://allenai.org/olmo/olmo-7b-animation.gif" alt="OLMo Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
13 |
+
|
14 |
+
|
15 |
+
# Model Card for OLMo 7B Instruct
|
16 |
+
|
17 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
18 |
+
|
19 |
+
OLMo is a series of **O**pen **L**anguage **Mo**dels designed to enable the science of language models.
|
20 |
+
The OLMo base models are trained on the [Dolma](https://huggingface.co/datasets/allenai/dolma) dataset.
|
21 |
+
The adapted versions are trained on the [Tulu SFT mixture](https://huggingface.co/datasets/allenai/tulu-v2-sft-mixture) and, for the Instruct version, a [cleaned version of the UltraFeedback dataset](https://huggingface.co/datasets/allenai/ultrafeedback_binarized_cleaned).
|
22 |
+
We release all code, checkpoints, logs (coming soon), and details involved in training these models.
|
23 |
+
|
24 |
+
OLMo 7B Instruct and OLMo SFT are two adapted versions of these models trained for better question answering.
|
25 |
+
They show the performance gain that OLMo base models can achieve with existing fine-tuning techniques.
|
26 |
+
|
27 |
+
## Model Details
|
28 |
+
|
29 |
+
We release two adapted model versions:
|
30 |
+
The base models related to this adapted model are the following:
|
31 |
+
| Model | Training Method(s) | Datasets | Context Length |
|
32 |
+
|------|--------|---------|--|
|
33 |
+
| [OLMo 7B SFT](https://huggingface.co/allenai/OLMo-7B-SFT) | SFT | [Tulu 2 SFT Mix](https://huggingface.co/datasets/allenai/tulu-v2-sft-mixture) | 2048 |
|
34 |
+
| [OLMo 7B Instruct](https://huggingface.co/allenai/OLMo-7B-Instruct) | SFT + DPO | [Tulu 2 SFT Mix](https://huggingface.co/datasets/allenai/tulu-v2-sft-mixture) + [Ultrafeedback Cleaned](https://huggingface.co/datasets/allenai/ultrafeedback_binarized_cleaned) | 2048 |
|
35 |
+
|
36 |
+
|
37 |
+
The base models related to this adapted model are the following:
|
38 |
+
| Size | Training Tokens | Layers | Hidden Size | Attention Heads | Context Length |
|
39 |
+
|------|--------|---------|-------------|-----------------|----------------|
|
40 |
+
| [OLMo 1B](https://huggingface.co/allenai/OLMo-1B) | 3 Trillion |16 | 2048 | 16 | 2048 |
|
41 |
+
| [OLMo 7B](https://huggingface.co/allenai/OLMo-7B) | 2.5 Trillion | 32 | 4096 | 32 | 2048 |
|
42 |
+
| [OLMo 7B Twin 2T](https://huggingface.co/allenai/OLMo-7B-Twin-2T) | 2 Trillion | 32 | 4096 | 32 | 2048 |
|
43 |
+
|
44 |
+
|
45 |
+
### Model Description
|
46 |
+
|
47 |
+
<!-- Provide a longer summary of what this model is. -->
|
48 |
+
|
49 |
+
- **Developed by:** Allen Institute for AI (AI2)
|
50 |
+
- **Supported by:** Databricks, Kempner Institute for the Study of Natural and Artificial Intelligence at Harvard University, AMD, CSC (Lumi Supercomputer), UW
|
51 |
+
- **Model type:** a Transformer style autoregressive language model.
|
52 |
+
- **Language(s) (NLP):** English
|
53 |
+
- **License:** The code and model are released under Apache 2.0.
|
54 |
+
- **Contact:** Technical inquiries: `olmo at allenai dot org`. Press: `press at allenai dot org`
|
55 |
+
- **Date cutoff:** Feb./March 2023 based on Dolma dataset version.
|
56 |
+
|
57 |
+
|
58 |
+
### Model Sources
|
59 |
+
|
60 |
+
<!-- Provide the basic links for the model. -->
|
61 |
+
|
62 |
+
- **Project Page:** https://allenai.org/olmo
|
63 |
+
- **Repositories:**
|
64 |
+
- Core repo (training, inference, fine-tuning etc.): https://github.com/allenai/OLMo
|
65 |
+
- Evaluation code: https://github.com/allenai/OLMo-Eval
|
66 |
+
- Further fine-tuning code: https://github.com/allenai/open-instruct
|
67 |
+
- **Paper:** [Link](https://arxiv.org/abs/2402.00838)
|
68 |
+
- **Technical blog post:** https://blog.allenai.org/olmo-open-language-model-87ccfc95f580
|
69 |
+
- **W&B Logs:** https://wandb.ai/ai2-llm/OLMo-7B/reports/OLMo-7B--Vmlldzo2NzQyMzk5
|
70 |
+
<!-- - **Press release:** TODO -->
|
71 |
+
|
72 |
+
## Uses
|
73 |
+
|
74 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
75 |
+
|
76 |
+
### Inference
|
77 |
+
Quickly get inference running with the following required installation:
|
78 |
+
```bash
|
79 |
+
pip install ai2-olmo
|
80 |
+
```
|
81 |
+
Now, proceed as usual with HuggingFace:
|
82 |
+
```python
|
83 |
+
import hf_olmo
|
84 |
+
|
85 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
86 |
+
olmo = AutoModelForCausalLM.from_pretrained("allenai/OLMo-7B-Instruct")
|
87 |
+
tokenizer = AutoTokenizer.from_pretrained("allenai/OLMo-7B-Instruct")
|
88 |
+
message = ["Language modeling is "]
|
89 |
+
inputs = tokenizer(message, return_tensors='pt', return_token_type_ids=False)
|
90 |
+
# optional verifying cuda
|
91 |
+
# inputs = {k: v.to('cuda') for k,v in inputs.items()}
|
92 |
+
# olmo = olmo.to('cuda')
|
93 |
+
response = olmo.generate(**inputs, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
|
94 |
+
print(tokenizer.batch_decode(response, skip_special_tokens=True)[0])
|
95 |
+
>> 'Language modeling is the first step to build natural language generation...'
|
96 |
+
```
|
97 |
+
Alternatively, with the pipeline abstraction:
|
98 |
+
```python
|
99 |
+
import hf_olmo
|
100 |
+
|
101 |
+
from transformers import pipeline
|
102 |
+
olmo_pipe = pipeline("text-generation", model="allenai/OLMo-7B-Instruct")
|
103 |
+
print(olmo_pipe("Language modeling is "))
|
104 |
+
>> 'Language modeling is a branch of natural language processing that aims to...'
|
105 |
+
```
|
106 |
+
|
107 |
+
Or, you can make this slightly faster by quantizing the model, e.g. `AutoModelForCausalLM.from_pretrained("allenai/OLMo-7B-Instruct", torch_dtype=torch.float16, load_in_8bit=True)` (requires `bitsandbytes`).
|
108 |
+
The quantized model is more sensitive to typing / cuda, so it is recommended to pass the inputs as `inputs.input_ids.to('cuda')` to avoid potential issues.
|
109 |
+
|
110 |
+
Note, you may see the following error if `ai2-olmo` is not installed correctly, which is caused by internal Python check naming. We'll update the code soon to make this error clearer.
|
111 |
+
```bash
|
112 |
+
raise ImportError(
|
113 |
+
ImportError: This modeling file requires the following packages that were not found in your environment: hf_olmo. Run `pip install hf_olmo`
|
114 |
+
```
|
115 |
+
|
116 |
+
## Evaluation
|
117 |
+
|
118 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
119 |
+
|
120 |
+
Core model results for the 7B adapted models are found below.
|
121 |
+
|
122 |
+
| Model | MMLU 0-shot ↑ | AlpacaEval %win ↑ | ToxiGen % Toxic ↓ | TruthfulQA %Info+True ↑ |
|
123 |
+
|-----------------------|---------------|--------------------|--------------------|-------------------------|
|
124 |
+
| **OLMo (base)** | 28.3 | - | 81.4 | 31.6 |
|
125 |
+
| MPT Chat | 33.8 | 46.8 | 0.1 | 42.7 |
|
126 |
+
| Falcon Instruct | 25.2 | 14.0 | 70.7 | 27.2 |
|
127 |
+
| RPJ-INCITE Chat | 27.0 | 38.0 | 46.4 | 53.0 |
|
128 |
+
| Llama-2-Chat 7B | 46.8 | 87.3 | 0.0 | 26.3 |
|
129 |
+
| AI2 Tulu 2 7B | 50.4 | 73.9 | 7.0 | 51.7 |
|
130 |
+
| AI2 Tulu 2 7B DPO | 50.7 | 85.1 | 0.5 | - * |
|
131 |
+
| **[OLMo 7B SFT](https://huggingface.co/allenai/OLMo-7B-SFT)** | 47.3 | 57.0 | 14.4 | 41.2 |
|
132 |
+
| **[OLMo 7B Instruct](https://huggingface.co/allenai/OLMo-7B-Instruct)** | 46.2 | 69.3 | 1.7 | 52.0 |
|
133 |
+
|
134 |
+
*Following Ivision et al. 2023, we do not report Tulu 2 TruthfulQA scores due to test set contamination.
|
135 |
+
## Model Details
|
136 |
+
|
137 |
+
### Data
|
138 |
+
For training data details, please see the [Dolma](https://huggingface.co/datasets/allenai/dolma), [Tulu 2](https://huggingface.co/datasets/allenai/tulu-v2-sft-mixture), and [UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback) documentation.
|
139 |
+
|
140 |
+
### Architecture
|
141 |
+
|
142 |
+
|
143 |
+
### Hyperparameters
|
144 |
+
|
145 |
+
The hyperparameters for the two phases of training are below.
|
146 |
+
Certainly! Here's the table with SFT and DPO as rows:
|
147 |
+
|
148 |
+
| | Learning Rate | Beta | Epochs | Warmup | Weight Decay | Gradient Clipping | Maximum Sequence Length |
|
149 |
+
|-------------------------|---------------|------|--------|------------------------------------------------------------------------|--------------|-------------------|-------------------------|
|
150 |
+
| **SFT** | 2 × 10^-6 | N/A | 3 | Linear warmup for the first 3% of total training time, then cooldown to 0 | 0 | 0 | 2048 |
|
151 |
+
| **DPO** | 5 × 10^-7 | 0.1 | 3 | Linear warmup for the first 10% of total training time, then cooldown to 0| 0 | 0 | 2048 |
|
152 |
+
|
153 |
+
|
154 |
+
## Bias, Risks, and Limitations
|
155 |
+
|
156 |
+
The adapted OLMo models do not include a specific safety filter or safety training data.
|
157 |
+
While our model shows good scores relative to its peers on ToxiGen, like any base language model or fine-tuned model without safety filtering, it is relatively easy for a user to prompt these models to generate harmful and generally sensitive content.
|
158 |
+
Such content can also be produced unintentionally, especially in the case of bias, so we recommend users consider the risks of applications of this technology.
|
159 |
+
|
160 |
+
Otherwise, many facts from OLMo or any LLM will often not be true, so they should be checked.
|
161 |
+
|
162 |
+
|
163 |
+
## Citation
|
164 |
+
|
165 |
+
**BibTeX:**
|
166 |
+
|
167 |
+
```
|
168 |
+
@article{Groeneveld2023OLMo,
|
169 |
+
title={OLMo: Accelerating the Science of Language Models},
|
170 |
+
author={Groeneveld, Dirk and Beltagy, Iz and Walsh, Pete and Bhagia, Akshita and Kinney, Rodney and Tafjord, Oyvind and Jha, Ananya Harsh and Ivison, Hamish and Magnusson, Ian and Wang, Yizhong and Arora, Shane and Atkinson, David and Authur, Russell and Chandu, Khyathi and Cohan, Arman and Dumas, Jennifer and Elazar, Yanai and Gu, Yuling and Hessel, Jack and Khot, Tushar and Merrill, William and Morrison, Jacob and Muennighoff, Niklas and Naik, Aakanksha and Nam, Crystal and Peters, Matthew E. and Pyatkin, Valentina and Ravichander, Abhilasha and Schwenk, Dustin and Shah, Saurabh and Smith, Will and Subramani, Nishant and Wortsman, Mitchell and Dasigi, Pradeep and Lambert, Nathan and Richardson, Kyle and Dodge, Jesse and Lo, Kyle and Soldaini, Luca and Smith, Noah A. and Hajishirzi, Hannaneh},
|
171 |
+
journal={Preprint},
|
172 |
+
year={2024}
|
173 |
+
}
|
174 |
+
```
|
175 |
+
|
176 |
+
**APA:**
|
177 |
+
|
178 |
+
Groeneveld, D., Beltagy, I., Walsh, P., Bhagia, A., Kinney, R., Tafjord, O., Jha, A., Ivison, H., Magnusson, I., Wang, Y., Arora, S., Atkinson, D., Authur, R., Chandu, K., Cohan, A., Dumas, J., Elazar, Y., Gu, Y., Hessel, J., Khot, T., Merrill, W., Morrison, J., Muennighoff, N., Naik, A., Nam, C., Peters, M., Pyatkin, V., Ravichander, A., Schwenk, D., Shah, S., Smith, W., Subramani, N., Wortsman, M., Dasigi, P., Lambert, N., Richardson, K., Dodge, J., Lo, K., Soldaini, L., Smith, N., & Hajishirzi, H. (2024). OLMo: Accelerating the Science of Language Models. Preprint.
|
179 |
+
|
180 |
+
## Model Card Contact
|
181 |
+
|
182 |
+
|
183 |
+
For errors in this model card, contact Nathan or Jacob, `{nathanl, jacobm} at allenai dot org`.
|