Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- HuggingFaceH4/ultrachat_200k
|
4 |
+
- HuggingFaceH4/ultrafeedback_binarized
|
5 |
+
- meta-math/MetaMathQA
|
6 |
+
- WizardLM/WizardLM_evol_instruct_V2_196k
|
7 |
+
- Intel/orca_dpo_pairs
|
8 |
+
language:
|
9 |
+
- en
|
10 |
+
tags:
|
11 |
+
- causal-lm
|
12 |
+
extra_gated_fields:
|
13 |
+
Name: text
|
14 |
+
Email: text
|
15 |
+
Country: text
|
16 |
+
Organization or Affiliation: text
|
17 |
+
I ALLOW Stability AI to email me about new model releases: checkbox
|
18 |
+
license: other
|
19 |
+
---
|
20 |
+
# `StableLM Zephyr 3B`
|
21 |
+
|
22 |
+
## Model Description
|
23 |
+
|
24 |
+
`StableLM Zephyr 3B` is a 3 billion parameter instruction tuned inspired by [HugginFaceH4's Zephyr 7B](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) training pipeline this model was trained on a mix of publicly available datasets, synthetic datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290), evaluation for this model based on
|
25 |
+
[MT Bench](https://tatsu-lab.github.io/alpaca_eval/) and [Alpaca Benchmark](https://tatsu-lab.github.io/alpaca_eval/)
|
26 |
+
|
27 |
+
## Usage
|
28 |
+
|
29 |
+
`StableLM Zephyr 3B` uses the following instruction format:
|
30 |
+
```
|
31 |
+
<|user|>
|
32 |
+
List 3 synonyms for the word "tiny"<|endoftext|>
|
33 |
+
<|assistant|>
|
34 |
+
1. Dwarf
|
35 |
+
2. Little
|
36 |
+
3. Petite<|endoftext|>
|
37 |
+
```
|
38 |
+
|
39 |
+
This format is also available through the tokenizer's `apply_chat_template` method:
|
40 |
+
|
41 |
+
```python
|
42 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
43 |
+
|
44 |
+
tokenizer = AutoTokenizer.from_pretrained('stabilityai/stablelm-zephyr-3b')
|
45 |
+
model = AutoModelForCausalLM.from_pretrained(
|
46 |
+
'stabilityai/stablelm-zephyr-3b',
|
47 |
+
trust_remote_code=True,
|
48 |
+
device_map="auto"
|
49 |
+
)
|
50 |
+
|
51 |
+
prompt = [{'role': 'user', 'content': 'List 3 synonyms for the word "tiny"'}]
|
52 |
+
inputs = tokenizer.apply_chat_template(
|
53 |
+
prompt,
|
54 |
+
add_generation_prompt=True,
|
55 |
+
return_tensors='pt'
|
56 |
+
)
|
57 |
+
|
58 |
+
tokens = model.generate(
|
59 |
+
inputs.to(model.device),
|
60 |
+
max_new_tokens=1024,
|
61 |
+
temperature=0.8,
|
62 |
+
do_sample=True
|
63 |
+
)
|
64 |
+
|
65 |
+
print(tokenizer.decode(tokens[0], skip_special_tokens=False))
|
66 |
+
```
|
67 |
+
|
68 |
+
You can also see how to run a performance optimized version of this model [here](https://github.com/openvinotoolkit/openvino_notebooks/blob/main/notebooks/273-stable-zephyr-3b-chatbot/273-stable-zephyr-3b-chatbot.ipynb) using [OpenVINO](https://docs.openvino.ai/2023.2/home.html) from Intel.
|
69 |
+
|
70 |
+
## Model Details
|
71 |
+
|
72 |
+
* **Developed by**: [Stability AI](https://stability.ai/)
|
73 |
+
* **Model type**: `StableLM Zephyr 3B` model is an auto-regressive language model based on the transformer decoder architecture.
|
74 |
+
* **Language(s)**: English
|
75 |
+
* **Library**: [Alignment Handbook](https://github.com/huggingface/alignment-handbook.git)
|
76 |
+
* **Finetuned from model**: [stabilityai/stablelm-3b-4e1t](https://huggingface.co/stabilityai/stablelm-3b-4e1t)
|
77 |
+
* **License**: [StabilityAI Non-Commercial Research Community License](https://huggingface.co/stabilityai/stablelm-zephyr-3b/raw/main/LICENSE). If you want to use this model for your commercial products or purposes, please contact us [here](https://stability.ai/contact) to learn more.
|
78 |
+
* **Contact**: For questions and comments about the model, please email `[email protected]`
|
79 |
+
|
80 |
+
### Training Dataset
|
81 |
+
|
82 |
+
The dataset is comprised of a mixture of open datasets large-scale datasets available on the [HuggingFace Hub](https://huggingface.co/datasets):
|
83 |
+
1. SFT Datasets
|
84 |
+
- HuggingFaceH4/ultrachat_200k
|
85 |
+
- meta-math/MetaMathQA
|
86 |
+
- WizardLM/WizardLM_evol_instruct_V2_196k
|
87 |
+
- Open-Orca/SlimOrca
|
88 |
+
2. Preference Datasets:
|
89 |
+
- HuggingFaceH4/ultrafeedback_binarized
|
90 |
+
- Intel/orca_dpo_pairs
|
91 |
+
|
92 |
+
## Performance
|
93 |
+
|
94 |
+
### MT-Bench and Alpaca Bench
|
95 |
+
|
96 |
+
|
97 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/6310474ca119d49bc1eb0d80/8WIZS6dAlu5kSH-382pMl.png" alt="mt_bench_plot" width="600"/>
|
98 |
+
|
99 |
+
| Model | Size | Alignment | MT-Bench (score) | AlpacaEval (win rate %) |
|
100 |
+
|-------------|-----|----|---------------|--------------|
|
101 |
+
| **StableLM Zephyr 3B** 🪁 | 3B | DPO | 6.64 | 76.00 |
|
102 |
+
| StableLM Zephyr (SFT only) | 3B | SFT | 6.04 | 71.15 |
|
103 |
+
| Capybara v1.9 | 3B | dSFT | 5.94 | - |
|
104 |
+
| MPT-Chat | 7B |dSFT |5.42| -|
|
105 |
+
| Xwin-LM v0.1 | 7B| dPPO| 6.19| 87.83|
|
106 |
+
| Mistral-Instruct v0.1 | 7B| - | 6.84 |-|
|
107 |
+
| Zephyr-7b-α |7B| dDPO| 6.88| -|
|
108 |
+
| Zephyr-7b-β| 7B | dDPO | 7.34 | 90.60 |
|
109 |
+
| Falcon-Instruct | 40B |dSFT |5.17 |45.71|
|
110 |
+
| Guanaco | 65B | SFT |6.41| 71.80|
|
111 |
+
| Llama2-Chat | 70B |RLHF |6.86| 92.66|
|
112 |
+
| Vicuna v1.3 | 33B |dSFT |7.12 |88.99|
|
113 |
+
| WizardLM v1.0 | 70B |dSFT |7.71 |-|
|
114 |
+
| Xwin-LM v0.1 | 70B |dPPO |- |95.57|
|
115 |
+
| GPT-3.5-turbo | - |RLHF |7.94 |89.37|
|
116 |
+
| Claude 2 | - |RLHF |8.06| 91.36|
|
117 |
+
| GPT-4 | -| RLHF |8.99| 95.28|
|
118 |
+
|
119 |
+
## Other benchmarks:
|
120 |
+
| Task | Value |
|
121 |
+
|-----------------------|---------------------------|
|
122 |
+
| ARC (25-shot) | 47.0 |
|
123 |
+
| HellaSwag (10-shot) | 74.2 |
|
124 |
+
| MMLU (5-shot) | 46.3 |
|
125 |
+
| TruthfulQA (0-shot) | 46.5 |
|
126 |
+
| Winogrande (5-shot) | 65.5 |
|
127 |
+
| GSM8K (5-shot) | 42.3 |
|
128 |
+
| BigBench (Avg) | 35.26 |
|
129 |
+
| AGI Benchmark (Avg) | 33.23 |
|
130 |
+
|
131 |
+
### Training Infrastructure
|
132 |
+
|
133 |
+
* **Hardware**: `StableLM Zephyr 3B` was trained on the Stability AI cluster across 8 nodes with 8 A100 80GBs GPUs for each nodes.
|
134 |
+
* **Code Base**: We use our internal script for SFT steps and used [HuggingFace Alignment Handbook script](https://github.com/huggingface/alignment-handbook) for DPO training.
|
135 |
+
|
136 |
+
## Commitment to Ethical AI
|
137 |
+
In line with our responsibility towards ethical AI development, `StableLM Zephyr 3B` is released with a focus on ensuring safety, reliability, and appropriateness in its applications. To this end, we have evaluated `StableLM Zephyr 3B` on 488 malicious prompts and used standard protocols to assess the harmfulness of its outputs. Compared to Zephyr-7b-β, `StableLM Zephyr 3B` reduces the number of harmful outputs as assessed by GPT-4 by 55. Additionally, we performed an internal red teaming event targeting the following abuse areas:
|
138 |
+
* **Self-Harm Methods**: (Suicide Methods, Encouragement of Self-Harm, Methods and encouragement of Eating Disorders)
|
139 |
+
* **Misinformation**: (Health, Conspiracy Theories, Social Unrest/Conflict, Political Misinformation, & Climate change)
|
140 |
+
* **Hate Speech**: (Race, Stereotypes, Immigrants, Gender, Personally Identifiable Information such as Social security numbers, Full names, ID numbers, Email addresses, and telephone numbers)
|
141 |
+
|
142 |
+
We have incorporated the findings of our malicious prompts evaluation and red teaming event into our release. Users are encouraged to fine-tune and evaluate the model to suit their specific needs, considering the potential biases and limitations found in `StableLM Zephyr 3B` and inherent in other LLM models.
|
143 |
+
|
144 |
+
## Use and Limitations
|
145 |
+
|
146 |
+
### Intended Use
|
147 |
+
|
148 |
+
The model is intended to be used as a foundational base model for application-specific fine-tuning. Developers must evaluate and fine-tune the model for safe performance in downstream applications.
|
149 |
+
|
150 |
+
### Limitations and Bias
|
151 |
+
|
152 |
+
This model is not trained against adversarial inputs. We strongly recommend pairing this model with an input and output classifier to prevent harmful responses.
|
153 |
+
|
154 |
+
Through our internal red teaming, we discovered that while the model will not output harmful information if not prompted to do so, it is willing to output potentially harmful outputs or misinformation when the user requests it. Using this model will require guardrails around your inputs and outputs to ensure that any outputs returned are not misinformation or harmful. Additionally, as each use case is unique, we recommend running your own suite of tests to ensure proper performance of this model. Finally, do not use the models if they are unsuitable for your application, or for any applications that may cause deliberate or unintentional harm to others.
|