flydust commited on
Commit
dd34258
·
verified ·
1 Parent(s): 57628f2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +162 -28
README.md CHANGED
@@ -1,40 +1,68 @@
1
- ---
2
- base_model: Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1
3
- tags:
4
- - alignment-handbook
5
- - trl
6
- - dpo
7
- - generated_from_trainer
8
- datasets:
9
- - princeton-nlp/llama3-ultrafeedback-armorm
10
- model-index:
11
- - name: Llama-3.1-8B-Magpie-Align-v0.1
12
- results: []
13
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- This model is a fine-tuned version of [Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1](https://huggingface.co/Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1) on the princeton-nlp/llama3-ultrafeedback-armorm dataset.
16
- It achieves the following results on the evaluation set:
17
- - Loss: 0.3290
18
- - Rewards/chosen: -4.8185
19
- - Rewards/rejected: -6.6901
20
- - Rewards/accuracies: 0.8952
21
- - Rewards/margins: 1.8716
22
- - Logps/rejected: -867.8638
23
- - Logps/chosen: -686.8736
24
- - Logits/rejected: -0.5907
25
- - Logits/chosen: -0.5749
26
 
27
- ## Model description
 
 
 
28
 
29
- More details will be added soon.
30
 
31
- ## Benchmark
32
 
33
  - **MT-Bench: 8.375 (1st Turn), 7.650 (Second Turn), 8.013 (Average)**
34
  - **Alpaca Eval 2 (GPT-4-Turbo-1106): 45.73 (LC), 52.79 (WR)**
35
  - **Arena Hard: 42.4**
36
 
37
- ## Training procedure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  ### Training hyperparameters
40
 
@@ -67,3 +95,109 @@ The following hyperparameters were used during training:
67
  - Pytorch 2.3.1+cu121
68
  - Datasets 2.20.0
69
  - Tokenizers 0.19.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1
3
+ tags:
4
+ - alignment-handbook
5
+ - trl
6
+ - dpo
7
+ - generated_from_trainer
8
+ datasets:
9
+ - princeton-nlp/llama3-ultrafeedback-armorm
10
+ model-index:
11
+ - name: Llama-3.1-8B-Magpie-Align-v0.1
12
+ results: []
13
+ license: llama3.1
14
+ language:
15
+ - en
16
+ ---
17
+
18
+ ![Magpie](https://cdn-uploads.huggingface.co/production/uploads/653df1323479e9ebbe3eb6cc/FWWILXrAGNwWr52aghV0S.png)
19
+ ## 🔥 Chat with Magpie [Here](https://huggingface.co/spaces/flydust/Chat-with-Magpie)!
20
+
21
+ # 🐦 Llama-3.1-8B-Magpie-Align-v0.1
22
+
23
+ Project Web: [https://magpie-align.github.io/](https://magpie-align.github.io/)
24
+
25
+ Online Model Demo: [https://huggingface.co/spaces/flydust/Chat-with-Magpie](https://huggingface.co/spaces/flydust/Chat-with-Magpie)
26
+
27
+ Arxiv Technical Report: [https://arxiv.org/abs/2406.08464](https://arxiv.org/abs/2406.08464)
28
+
29
+ Codes: [https://github.com/magpie-align/magpie](https://github.com/magpie-align/magpie)
30
+
31
+ ## 🧐 About This Model
32
 
33
+ This model is an aligned version of [meta-llama/Meta-Llama-3.1-8B](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B). We apply the following pipeline:
 
 
 
 
 
 
 
 
 
 
34
 
35
+ We first perform SFT using:
36
+ * [Magpie-Align/Magpie-Pro-MT-300K-v0.1](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-MT-300K-v0.1), and
37
+ * [Magpie-Align/Magpie-Reasoning-150K](https://huggingface.co/datasets/Magpie-Align/Magpie-Reasoning-150K)
38
+ * **SFT Model Checkpoint:** [Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1](https://huggingface.co/Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1)
39
 
40
+ We then perform DPO on the [princeton-nlp/llama3-ultrafeedback-armorm](https://huggingface.co/datasets/princeton-nlp/llama3-ultrafeedback-armorm) dataset.
41
 
42
+ The overall performance is much better than the official Llama-3.1-8B-Instruct Model!
43
 
44
  - **MT-Bench: 8.375 (1st Turn), 7.650 (Second Turn), 8.013 (Average)**
45
  - **Alpaca Eval 2 (GPT-4-Turbo-1106): 45.73 (LC), 52.79 (WR)**
46
  - **Arena Hard: 42.4**
47
 
48
+ ## 👀 Other Information
49
+
50
+ **License**: Please follow [Meta Llama 3 Community License](https://llama.meta.com/llama3/license) (Data) and [Meta Llama 3.1 Community License](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/LICENSE) (Model).
51
+
52
+ **Conversation Template**: Please use Llama 3 **official chat template** for the best performance.
53
+
54
+ **How to use it?** Please check the official [Llama 3.1 repository](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct#how-to-use) for detailed instructions. Simply replace the original `model_id` with this model id.
55
+
56
+ ---
57
+ # Alignment Pipeline
58
+
59
+ The detailed alignment pipeline is as follows.
60
+
61
+ ## Stage 1: Supervised Fine-tuning
62
+
63
+ We use [Axolotl](https://github.com/OpenAccess-AI-Collective/axolotl) for SFT. Please refer to the model card of [SFT checkpoint](https://huggingface.co/Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1) for detailed configurations.
64
+
65
+ ## Stage 2: Direct Preference Optimization
66
 
67
  ### Training hyperparameters
68
 
 
95
  - Pytorch 2.3.1+cu121
96
  - Datasets 2.20.0
97
  - Tokenizers 0.19.1
98
+
99
+ <details><summary>See alignment handbook config</summary>
100
+
101
+ ```yaml
102
+ # Customized Configs
103
+ model_name_or_path: Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1
104
+ hub_model_id: Magpie-Align/Llama-3.1-8B-Magpie-Align-v0.1
105
+ output_dir: /data/zhangchen_xu/alignment_handbook_out/Llama-3.1-8B-Magpie-Align-v0.1
106
+ run_name: Llama-3.1-8B-Magpie-Align-v0.1
107
+
108
+ dataset_mixer:
109
+ princeton-nlp/llama3-ultrafeedback-armorm: 1.0
110
+ dataset_splits:
111
+ - train
112
+ - test
113
+ preprocessing_num_workers: 64
114
+
115
+ # DPOTrainer arguments
116
+ bf16: true
117
+ beta: 0.01
118
+ learning_rate: 1.0e-6
119
+ gradient_accumulation_steps: 16
120
+ per_device_train_batch_size: 2
121
+ per_device_eval_batch_size: 4
122
+ num_train_epochs: 1
123
+ max_length: 2048
124
+ max_prompt_length: 1800
125
+ warmup_ratio: 0.1
126
+ logging_steps: 1
127
+ lr_scheduler_type: cosine
128
+ optim: adamw_torch
129
+
130
+ torch_dtype: null
131
+ use_flash_attention_2: true
132
+ do_eval: true
133
+ evaluation_strategy: steps
134
+ eval_steps: 100
135
+ gradient_checkpointing: true
136
+ gradient_checkpointing_kwargs:
137
+ use_reentrant: False
138
+ log_level: info
139
+ push_to_hub: true
140
+ save_strategy: "steps"
141
+ save_steps: 100
142
+ save_total_limit: 1
143
+ seed: 42
144
+ report_to:
145
+ - wandb
146
+ ```
147
+ </details><be>
148
+
149
+ ---
150
+
151
+ ## Paper Abstract
152
+
153
+ <details><summary>Click Here</summary>
154
+ High-quality instruction data is critical for aligning large language models (LLMs). Although some models, such as Llama-3-Instruct, have open weights, their alignment data remain private, which hinders the democratization of AI. High human labor costs and a limited, predefined scope for prompting prevent existing open-source data creation methods from scaling effectively, potentially limiting the diversity and quality of public alignment datasets. Is it possible to synthesize high-quality instruction data at scale by extracting it directly from an aligned LLM? We present a self-synthesis method for generating large-scale alignment data named Magpie. Our key observation is that aligned LLMs like Llama-3-Instruct can generate a user query when we input only the left-side templates up to the position reserved for user messages, thanks to their auto-regressive nature. We use this method to prompt Llama-3-Instruct and generate 4 million instructions along with their corresponding responses. We perform a comprehensive analysis of the extracted data and select 300K high-quality instances. To compare Magpie data with other public instruction datasets, we fine-tune Llama-3-8B-Base with each dataset and evaluate the performance of the fine-tuned models. Our results indicate that in some tasks, models fine-tuned with Magpie perform comparably to the official Llama-3-8B-Instruct, despite the latter being enhanced with 10 million data points through supervised fine-tuning (SFT) and subsequent feedback learning. We also show that using Magpie solely for SFT can surpass the performance of previous public datasets utilized for both SFT and preference optimization, such as direct preference optimization with UltraFeedback. This advantage is evident on alignment benchmarks such as AlpacaEval, ArenaHard, and WildBench.
155
+ </details><be>
156
+
157
+ ## 📚 Citation
158
+
159
+ If you find the model, data, or code useful, please cite our paper:
160
+ ```
161
+ @article{xu2024magpie,
162
+ title={Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing},
163
+ author={Zhangchen Xu and Fengqing Jiang and Luyao Niu and Yuntian Deng and Radha Poovendran and Yejin Choi and Bill Yuchen Lin},
164
+ year={2024},
165
+ eprint={2406.08464},
166
+ archivePrefix={arXiv},
167
+ primaryClass={cs.CL}
168
+ }
169
+ ```
170
+
171
+ Please also cite the creators of preference datasets:
172
+
173
+ SimPO paper:
174
+ ```
175
+ @article{meng2024simpo,
176
+ title={{SimPO}: Simple preference optimization with a reference-free reward},
177
+ author={Meng, Yu and Xia, Mengzhou and Chen, Danqi},
178
+ journal={arXiv preprint arXiv:2405.14734},
179
+ year={2024}
180
+ }
181
+ ```
182
+
183
+ UltraFeedback paper:
184
+ ```
185
+ @article{cui2023ultrafeedback,
186
+ title={{UltraFeedback}: Boosting language models with high-quality feedback},
187
+ author={Cui, Ganqu and Yuan, Lifan and Ding, Ning and Yao, Guanming and Zhu, Wei and Ni, Yuan and Xie, Guotong and Liu, Zhiyuan and Sun, Maosong},
188
+ journal={arXiv preprint arXiv:2310.01377},
189
+ year={2023}
190
+ }
191
+ ```
192
+
193
+ ArmoRM paper:
194
+ ```
195
+ @article{wang2024interpretable,
196
+ title={Interpretable Preferences via Multi-Objective Reward Modeling and Mixture-of-Experts},
197
+ author={Wang, Haoxiang and Xiong, Wei and Xie, Tengyang and Zhao, Han and Zhang, Tong},
198
+ journal={arXiv preprint arXiv:2406.12845},
199
+ year={2024}
200
+ }
201
+ ```
202
+
203
+ **Questions?** Please contact [Zhangchen](https://zhangchenxu.com/) by email.