flydust commited on
Commit
7e420dd
·
verified ·
1 Parent(s): 22e6a31

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +313 -27
README.md CHANGED
@@ -1,52 +1,225 @@
1
  ---
2
  license: llama3
3
- base_model: Magpie-Align/Llama-3-8B-Magpie-Mix-RC
4
  tags:
5
  - alignment-handbook
 
6
  - trl
7
  - dpo
8
- - generated_from_trainer
9
- - trl
10
- - dpo
11
  - generated_from_trainer
12
  datasets:
13
  - princeton-nlp/llama3-ultrafeedback-armorm
 
 
 
14
  model-index:
15
- - name: Llama-3-8B-Magpie-Mix-RC-UltraDPO-07
16
  results: []
 
 
 
17
  ---
18
 
19
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
20
- should probably proofread and complete it, then remove this comment. -->
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- [<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/uw-nsl/huggingface/runs/67yyhon0)
23
- # Llama-3-8B-Magpie-Mix-RC-UltraDPO-07
24
 
25
- This model is a fine-tuned version of [Magpie-Align/Llama-3-8B-Magpie-Mix-RC](https://huggingface.co/Magpie-Align/Llama-3-8B-Magpie-Mix-RC) on the princeton-nlp/llama3-ultrafeedback-armorm dataset.
26
- It achieves the following results on the evaluation set:
27
- - Loss: 0.3853
28
- - Rewards/chosen: -4.4256
29
- - Rewards/rejected: -6.0430
30
- - Rewards/accuracies: 0.875
31
- - Rewards/margins: 1.6173
32
- - Logps/rejected: -871.3292
33
- - Logps/chosen: -715.6917
34
- - Logits/rejected: -1.1545
35
- - Logits/chosen: -1.1333
36
 
37
- ## Model description
38
 
39
- More information needed
40
 
41
- ## Intended uses & limitations
 
 
 
 
42
 
43
- More information needed
44
 
45
- ## Training and evaluation data
46
 
47
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
- ## Training procedure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  ### Training hyperparameters
52
 
@@ -81,3 +254,116 @@ The following hyperparameters were used during training:
81
  - Pytorch 2.3.1+cu121
82
  - Datasets 2.20.0
83
  - Tokenizers 0.19.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: llama3
3
+ base_model: meta-llama/Meta-Llama-3-8B
4
  tags:
5
  - alignment-handbook
6
+ - axolotl
7
  - trl
8
  - dpo
9
+ - sft
 
 
10
  - generated_from_trainer
11
  datasets:
12
  - princeton-nlp/llama3-ultrafeedback-armorm
13
+ - Magpie-Align/Magpie-Pro-MT-300K-v0.1
14
+ - Magpie-Align/Magpie-Reasoning-150K
15
+ - Magpie-Align/Magpie-Qwen2-Pro-200K-Chinese
16
  model-index:
17
+ - name: Magpie-Align/Llama-3-8B-Magpie-Align-v0.3
18
  results: []
19
+ language:
20
+ - en
21
+ - zh
22
  ---
23
 
24
+ ![Magpie](https://cdn-uploads.huggingface.co/production/uploads/653df1323479e9ebbe3eb6cc/FWWILXrAGNwWr52aghV0S.png)
25
+ ## 🔥 Chat with Magpie [Here](https://huggingface.co/spaces/flydust/Chat-with-Magpie)!
26
+
27
+ # 🐦 Llama-3-8B-Magpie-Align-v0.3
28
+
29
+ Project Web: [https://magpie-align.github.io/](https://magpie-align.github.io/)
30
+
31
+ Online Model Demo: [https://huggingface.co/spaces/flydust/Chat-with-Magpie](https://huggingface.co/spaces/flydust/Chat-with-Magpie)
32
+
33
+ Arxiv Technical Report: [https://arxiv.org/abs/2406.08464](https://arxiv.org/abs/2406.08464)
34
+
35
+ Codes: [https://github.com/magpie-align/magpie](https://github.com/magpie-align/magpie)
36
+
37
+ ## 🧐 About This Model
38
 
39
+ This model is an aligned version of [meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B). We apply the following pipeline:
 
40
 
41
+ We first perform SFT using:
42
+ * [Magpie-Align/Magpie-Pro-MT-300K-v0.1](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-MT-300K-v0.1)
43
+ * [Magpie-Align/Magpie-Reasoning-150K](https://huggingface.co/datasets/Magpie-Align/Magpie-Reasoning-150K)
44
+ * [Magpie-Align/Magpie-Qwen2-Pro-200K-Chinese](https://huggingface.co/datasets/Magpie-Align/Magpie-Qwen2-Pro-200K-Chinese)
45
+ * **SFT Model Checkpoint:** [Magpie-Align/Llama-3-8B-Magpie-Align-SFT-v0.3](https://huggingface.co/Magpie-Align/Llama-3-8B-Magpie-Align-SFT-v0.3)
 
 
 
 
 
 
46
 
47
+ We then perform DPO on the [princeton-nlp/llama3-ultrafeedback-armorm](https://huggingface.co/datasets/princeton-nlp/llama3-ultrafeedback-armorm) dataset.
48
 
49
+ The overall performance is much better than the official Llama-3-8B-Instruct Model! Plus, it can answer Chinese queries frequently, thanks to our new [Chinese instruction dataset](https://huggingface.co/datasets/Magpie-Align/Magpie-Qwen2-Pro-200K-Chinese)!
50
 
51
+ - **Alpaca Eval 2 (vs GPT-4-Turbo-1106): 48.58 (LC), 50.36 (WR)**
52
+ - **Alpaca Eval 2 (vs Llama-3-8B-Instruct): 73.65 (LC), 75.81 (WR)**
53
+ - **Arena Hard: 42.2**
54
+ - **WildBench WB-Score: 41.1**
55
+ - **Zero-Eval GSM: 50.0**
56
 
57
+ ## 🔥 Model Performance
58
 
59
+ We compare our Llama-3-8B-Magpie-Align with official and other **open-aligned LLMs** that have been fine-tuned from base models and have publicly released their training datasets. The results are as follows:
60
 
61
+ ```
62
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
63
+ | Aligned Model ID | MT-Bench | | | Alpaca Eval 2 | | Alpaca Eval 2 | | Arena Hard |
64
+ | | | | | (GPT-4-Turbo-1106) | | (Llama-3-8B-Instruct) | | |
65
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
66
+ | | R1 | R2 | AVG | LC WR | WR | LC WR | WR | Score |
67
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
68
+ | meta-llama/Meta-Llama-3-8B-Instruct | 8.31 | 7.65 | 7.98 | 22.92 | 22.57 | 50 | 50 | 20.6 |
69
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
70
+ | princeton-nlp/Llama-3-Base-8B-SFT-DPO | 8.12 | 7.23 | 7.67 | 17.71 | 15.34 | 43.73 | 38.80 | 14.8 |
71
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
72
+ | NousResearch/Hermes-2-Pro-Llama-3-8B | 8.05 | 7.35 | 7.70 | 15.60 | 12.86 | 36.37 | 30.52 | 11.5 |
73
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
74
+ | allenai/llama-3-tulu-2-dpo-8b | 7.71 | 7.15 | 7.43 | 14.89 | 14.8 | 35.43 | 35.42 | 11.7 |
75
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
76
+ | cognitivecomputations/dolphin-2.9-llama3-8b | 7.97 | 6.98 | 7.47 | 12.50 | 8.79 | 32.67 | 22.80 | 8.2 |
77
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
78
+ | openchat/openchat-3.6-8b-20240522 | 7.83 | 7.23 | 7.53 | 17.70 | 12.53 | 41.30 | 30.79 | 6.7 |
79
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
80
+ | Magpie-Align/Llama-3-8B-Magpie-Align-v0.1 | 8.01 | 7.63 | 7.82 | 38.52 | 38.47 | 69.37 | 70.05 | 32.4 |
81
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
82
+ | Magpie-Align/Llama-3-8B-Magpie-Align-v0.2 | 7.81 | 7.64 | 7.73 | 49.86 | 51.98 | 75.17 | 78.20 | 37.5 |
83
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
84
+ | Magpie-Align/Llama-3-8B-Magpie-Align-v0.3 | 7.82 | 7.51 | 7.67 | 48.58 | 50.36 | 73.65 | 75.81 | 42.2 |
85
+ +---------------------------------------------+----------+------+------+--------------------+-------+-----------------------+-------+------------+
86
+ ```
87
 
88
+ ## 👀 Other Information
89
+
90
+ **License**: Please follow [Meta Llama 3 Community License](https://llama.meta.com/llama3/license).
91
+
92
+ **Conversation Template**: Please use Llama 3 **official chat template** for the best performance.
93
+
94
+ **How to use it?** Please check the official [Llama 3 repository](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct#how-to-use) for detailed instructions. Simply replace the original `model_id` with `Magpie-Align/Llama-3-8B-Magpie-Align-SFT-v1.0`.
95
+
96
+
97
+ The detailed training pipeline is as follows.
98
+
99
+ ## Stage 1: Supervised Fine-tuning
100
+
101
+ We use [Axolotl](https://github.com/OpenAccess-AI-Collective/axolotl) for SFT.
102
+
103
+ ### Training hyperparameters
104
+
105
+ The following hyperparameters were used during training:
106
+ - learning_rate: 2e-05
107
+ - train_batch_size: 1
108
+ - eval_batch_size: 1
109
+ - seed: 42
110
+ - distributed_type: multi-GPU
111
+ - num_devices: 4
112
+ - gradient_accumulation_steps: 32
113
+ - total_train_batch_size: 128
114
+ - total_eval_batch_size: 4
115
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
116
+ - lr_scheduler_type: cosine
117
+ - lr_scheduler_warmup_steps: 98
118
+ - num_epochs: 2
119
+
120
+ ### Training results
121
+
122
+ | Training Loss | Epoch | Step | Validation Loss |
123
+ |:-------------:|:------:|:----:|:---------------:|
124
+ | 0.8616 | 0.0019 | 1 | 0.8870 |
125
+ | 0.5554 | 0.2013 | 106 | 0.5568 |
126
+ | 0.5067 | 0.4027 | 212 | 0.5065 |
127
+ | 0.4728 | 0.6040 | 318 | 0.4865 |
128
+ | 0.4681 | 0.8054 | 424 | 0.4740 |
129
+ | 0.4563 | 1.0067 | 530 | 0.4662 |
130
+ | 0.4115 | 1.1944 | 636 | 0.4642 |
131
+ | 0.3993 | 1.3957 | 742 | 0.4620 |
132
+ | 0.4048 | 1.5971 | 848 | 0.4613 |
133
+ | 0.4167 | 1.7984 | 954 | 0.4611 |
134
+
135
+
136
+ ### Framework versions
137
+
138
+ - Transformers 4.42.3
139
+ - Pytorch 2.3.1+cu121
140
+ - Datasets 2.19.1
141
+ - Tokenizers 0.19.1
142
+
143
+ *Internal name for identification: Llama-3-8B-Magpie-Mix-RC*. Please change the model name in the below Axolotl config.
144
+
145
+ [<img src="https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/axolotl-ai-cloud/axolotl)
146
+ <details><summary>See axolotl config</summary>
147
+
148
+ axolotl version: `0.4.1`
149
+ ```yaml
150
+ base_model: meta-llama/Meta-Llama-3-8B
151
+ model_type: LlamaForCausalLM
152
+ tokenizer_type: AutoTokenizer
153
+
154
+ load_in_8bit: false
155
+ load_in_4bit: false
156
+ strict: false
157
+
158
+ datasets:
159
+ - path: Magpie-Align/Magpie-Reasoning-150K
160
+ type: sharegpt
161
+ conversation: llama3
162
+ - path: Magpie-Align/Magpie-Qwen2-Pro-200K-Chinese
163
+ type: sharegpt
164
+ conversation: llama3
165
+ - path: Magpie-Align/Magpie-Pro-MT-300K-v0.1
166
+ type: sharegpt
167
+ conversation: llama3
168
+ dataset_prepared_path: last_run_prepared
169
+ val_set_size: 0.001
170
+ output_dir: axolotl_out/Llama-3-8B-Magpie-Mix-RC
171
+
172
+ sequence_len: 8192
173
+ sample_packing: true
174
+ eval_sample_packing: false
175
+ pad_to_sequence_len: true
176
+
177
+ wandb_project: SynDa
178
+ wandb_entity:
179
+ wandb_watch:
180
+ wandb_name: Llama-3-8B-Magpie-Mix-RC
181
+ wandb_log_model:
182
+ hub_model_id: Magpie-Align/Llama-3-8B-Magpie-Mix-RC
183
+
184
+ gradient_accumulation_steps: 32
185
+ micro_batch_size: 1
186
+ num_epochs: 2
187
+ optimizer: paged_adamw_8bit
188
+ lr_scheduler: cosine
189
+ learning_rate: 2e-5
190
+
191
+ train_on_inputs: false
192
+ group_by_length: false
193
+ bf16: auto
194
+ fp16:
195
+ tf32: false
196
+
197
+ gradient_checkpointing: true
198
+ gradient_checkpointing_kwargs:
199
+ use_reentrant: false
200
+ early_stopping_patience:
201
+ resume_from_checkpoint:
202
+ logging_steps: 1
203
+ xformers_attention:
204
+ flash_attention: true
205
+
206
+ warmup_ratio: 0.1
207
+ evals_per_epoch: 5
208
+ eval_table_size:
209
+ saves_per_epoch: 1
210
+ debug:
211
+ deepspeed:
212
+ weight_decay: 0.0
213
+ fsdp:
214
+ fsdp_config:
215
+ special_tokens:
216
+ pad_token: <|end_of_text|>
217
+
218
+ ```
219
+
220
+ </details><br>
221
+
222
+ ## Stage 2: Direct Preference Optimization
223
 
224
  ### Training hyperparameters
225
 
 
254
  - Pytorch 2.3.1+cu121
255
  - Datasets 2.20.0
256
  - Tokenizers 0.19.1
257
+
258
+ <details><summary>See alignment handbook config</summary>
259
+
260
+ ```yaml
261
+ # Customized Configs
262
+ model_name_or_path: Magpie-Align/Llama-3-8B-Magpie-Align-SFT-v0.3
263
+ hub_model_id: Magpie-Align/Llama-3-8B-Magpie-Align-v0.3-RC
264
+ output_dir: alignment_handbook_out/Llama-3-8B-Magpie-Align-v0.3-RC
265
+ run_name: Llama-3-8B-Magpie-Align-v0.3-RC
266
+
267
+ dataset_mixer:
268
+ princeton-nlp/llama3-ultrafeedback-armorm: 1.0
269
+ dataset_splits:
270
+ - train
271
+ - test
272
+ preprocessing_num_workers: 24
273
+
274
+ # DPOTrainer arguments
275
+ bf16: true
276
+ beta: 0.01
277
+ learning_rate: 0.7e-6
278
+ gradient_accumulation_steps: 8
279
+ per_device_train_batch_size: 2
280
+ per_device_eval_batch_size: 4
281
+ num_train_epochs: 1
282
+ max_length: 2048
283
+ max_prompt_length: 1800
284
+ warmup_ratio: 0.1
285
+ logging_steps: 1
286
+ lr_scheduler_type: cosine
287
+ optim: adamw_torch
288
+
289
+ torch_dtype: null
290
+ use_flash_attention_2: true
291
+ do_eval: true
292
+ evaluation_strategy: steps
293
+ eval_steps: 100
294
+ gradient_checkpointing: true
295
+ gradient_checkpointing_kwargs:
296
+ use_reentrant: False
297
+ log_level: info
298
+ push_to_hub: true
299
+ save_strategy: "steps"
300
+ save_steps: 100
301
+ save_total_limit: 1
302
+ seed: 42
303
+ report_to:
304
+ - wandb
305
+ ```
306
+ </details><be>
307
+
308
+ ## Downstream Performance (Lighteval)
309
+ | Datasets | Llama-3-8B-Magpie-Align-v0.3 |
310
+ | :--- | :---: |
311
+ | MMLU (5) | 65.69 |
312
+ | ARC (25) | 63.23 |
313
+ | HellaSwag (25) | 82.15 |
314
+ | TruthfulQA (0) | 60.97 |
315
+ | Winogrande (5) | 73.64 |
316
+
317
+ ## Paper Abstract
318
+
319
+ <details><summary>Click Here</summary>
320
+ 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.
321
+ </details><be>
322
+
323
+ ## 📚 Citation
324
+
325
+ If you find the model, data, or code useful, please cite our paper:
326
+ ```
327
+ @article{xu2024magpie,
328
+ title={Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing},
329
+ author={Zhangchen Xu and Fengqing Jiang and Luyao Niu and Yuntian Deng and Radha Poovendran and Yejin Choi and Bill Yuchen Lin},
330
+ year={2024},
331
+ eprint={2406.08464},
332
+ archivePrefix={arXiv},
333
+ primaryClass={cs.CL}
334
+ }
335
+ ```
336
+
337
+ Please also cite the creators of preference datasets:
338
+
339
+ SimPO paper:
340
+ ```
341
+ @article{meng2024simpo,
342
+ title={{SimPO}: Simple preference optimization with a reference-free reward},
343
+ author={Meng, Yu and Xia, Mengzhou and Chen, Danqi},
344
+ journal={arXiv preprint arXiv:2405.14734},
345
+ year={2024}
346
+ }
347
+ ```
348
+
349
+ UltraFeedback paper:
350
+ ```
351
+ @article{cui2023ultrafeedback,
352
+ title={{UltraFeedback}: Boosting language models with high-quality feedback},
353
+ 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},
354
+ journal={arXiv preprint arXiv:2310.01377},
355
+ year={2023}
356
+ }
357
+ ```
358
+
359
+ ArmoRM paper:
360
+ ```
361
+ @article{wang2024interpretable,
362
+ title={Interpretable Preferences via Multi-Objective Reward Modeling and Mixture-of-Experts},
363
+ author={Wang, Haoxiang and Xiong, Wei and Xie, Tengyang and Zhao, Han and Zhang, Tong},
364
+ journal={arXiv preprint arXiv:2406.12845},
365
+ year={2024}
366
+ }
367
+ ```
368
+
369
+ **Questions?** Please contact [Zhangchen](https://zhangchenxu.com/) by email.