Safetensors
English
llama
alignment-handbook
trl
dpo
Generated from Trainer
Zhangchen Xu commited on
Commit
88d17cd
Β·
verified Β·
1 Parent(s): f98f101

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +124 -24
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  license: llama3.1
3
- base_model: Magpie-Align/Llama-3.1-8B-Magpie-SFT-650KR
4
  tags:
5
  - alignment-handbook
6
  - trl
@@ -12,40 +12,57 @@ tags:
12
  datasets:
13
  - Magpie-Align/Llama-3.1-70B-PO-100K-armorm
14
  model-index:
15
- - name: Llama-3.1-8B-Magpie-SFT-650KR-Magpo-Armorm-3.1-70B-05
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
- # Llama-3.1-8B-Magpie-SFT-650KR-Magpo-Armorm-3.1-70B-05
23
 
24
- This model is a fine-tuned version of [Magpie-Align/Llama-3.1-8B-Magpie-SFT-650KR](https://huggingface.co/Magpie-Align/Llama-3.1-8B-Magpie-SFT-650KR) on the Magpie-Align/Llama-3.1-70B-PO-100K-armorm dataset.
25
- It achieves the following results on the evaluation set:
26
- - Loss: 0.3328
27
- - Rewards/chosen: -4.8597
28
- - Rewards/rejected: -7.5767
29
- - Rewards/accuracies: 0.8900
30
- - Rewards/margins: 2.7170
31
- - Logps/rejected: -1107.7988
32
- - Logps/chosen: -829.9976
33
- - Logits/rejected: -0.8134
34
- - Logits/chosen: -0.8059
35
 
36
- ## Model description
37
 
38
- More information needed
39
 
40
- ## Intended uses & limitations
41
 
42
- More information needed
43
 
44
- ## Training and evaluation data
45
 
46
- More information needed
 
 
 
47
 
48
- ## Training procedure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  ### Training hyperparameters
51
 
@@ -76,10 +93,93 @@ The following hyperparameters were used during training:
76
  | 0.3342 | 0.7837 | 600 | 0.3354 | -4.7041 | -7.3342 | 0.8920 | 2.6301 | -1083.5503 | -814.4402 | -0.8081 | -0.7999 |
77
  | 0.3251 | 0.9144 | 700 | 0.3335 | -4.8366 | -7.5394 | 0.8880 | 2.7028 | -1104.0730 | -827.6954 | -0.8119 | -0.8042 |
78
 
79
-
80
  ### Framework versions
81
 
82
  - Transformers 4.43.3
83
  - Pytorch 2.4.0+cu121
84
  - Datasets 2.20.0
85
  - Tokenizers 0.19.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: llama3.1
3
+ base_model: Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.2
4
  tags:
5
  - alignment-handbook
6
  - trl
 
12
  datasets:
13
  - Magpie-Align/Llama-3.1-70B-PO-100K-armorm
14
  model-index:
15
+ - name: Llama-3.1-8B-Magpie-Align-v0.2
16
  results: []
17
+ language:
18
+ - en
19
  ---
20
 
21
+ ![Magpie](https://cdn-uploads.huggingface.co/production/uploads/653df1323479e9ebbe3eb6cc/FWWILXrAGNwWr52aghV0S.png)
22
+ ## πŸ”₯ Chat with Magpie [Here](https://huggingface.co/spaces/flydust/Chat-with-Magpie)!
23
 
24
+ # 🐦 Llama-3-8B-Magpie-Align-v0.3
25
 
26
+ Project Web: [https://magpie-align.github.io/](https://magpie-align.github.io/)
 
 
 
 
 
 
 
 
 
 
27
 
28
+ Online Model Demo: [https://huggingface.co/spaces/flydust/Chat-with-Magpie](https://huggingface.co/spaces/flydust/Chat-with-Magpie)
29
 
30
+ Arxiv Technical Report: [https://arxiv.org/abs/2406.08464](https://arxiv.org/abs/2406.08464)
31
 
32
+ Codes: [https://github.com/magpie-align/magpie](https://github.com/magpie-align/magpie)
33
 
34
+ ## 🧐 About This Model
35
 
36
+ 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:
37
 
38
+ We first perform SFT using:
39
+ * [Magpie-Align/Magpie-Llama-3.1-Pro-500K-Filtered](https://huggingface.co/datasets/Magpie-Align/Magpie-Llama-3.1-Pro-500K-Filtered)
40
+ * [Magpie-Align/Magpie-Reasoning-150K](https://huggingface.co/datasets/Magpie-Align/Magpie-Reasoning-150K)
41
+ * **SFT Model Checkpoint:** [Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.2](https://huggingface.co/Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.2)
42
 
43
+ We then perform DPO on the [Magpie-Align/Llama-3.1-70B-PO-100K-armorm](https://huggingface.co/datasets/Magpie-Align/Llama-3.1-70B-PO-100K-armorm) dataset.
44
+
45
+ The overall performance is much better than the official Llama-3.1-8B-Instruct Model!
46
+
47
+ - **Alpaca Eval 2 (vs GPT-4-Turbo-1106): 46.68 (LC), 53.42 (WR)**
48
+ - **Arena Hard: 43.2**
49
+
50
+
51
+ ## πŸ‘€ Other Information
52
+
53
+ **License**: Please follow [Meta Llama 3.1 Community License](https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/LICENSE).
54
+
55
+ **Conversation Template**: Please use Llama 3 **official chat template** for the best performance.
56
+
57
+ **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.
58
+
59
+ The detailed training 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.2) for detailed configurations.
64
+
65
+ ## Stage 2: Direct Preference Optimization
66
 
67
  ### Training hyperparameters
68
 
 
93
  | 0.3342 | 0.7837 | 600 | 0.3354 | -4.7041 | -7.3342 | 0.8920 | 2.6301 | -1083.5503 | -814.4402 | -0.8081 | -0.7999 |
94
  | 0.3251 | 0.9144 | 700 | 0.3335 | -4.8366 | -7.5394 | 0.8880 | 2.7028 | -1104.0730 | -827.6954 | -0.8119 | -0.8042 |
95
 
 
96
  ### Framework versions
97
 
98
  - Transformers 4.43.3
99
  - Pytorch 2.4.0+cu121
100
  - Datasets 2.20.0
101
  - Tokenizers 0.19.1
102
+
103
+ <details><summary>See alignment handbook config</summary>
104
+
105
+ ```yaml
106
+ # Customized Configs
107
+ model_name_or_path: Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.2
108
+ hub_model_id: Magpie-Align/Llama-3.1-8B-Magpie-Align-v0.2
109
+ output_dir: /data/zhangchen_xu/alignment_handbook_out/Llama-3.1-8B-Magpie-Align-v0.2
110
+ run_name: Llama-3.1-8B-Magpie-Align-v0.2
111
+
112
+ dataset_mixer:
113
+ Magpie-Align/Llama-3.1-70B-PO-100K-armorm: 1.0
114
+ dataset_splits:
115
+ - train
116
+ - test
117
+ preprocessing_num_workers: 64
118
+
119
+ # DPOTrainer arguments
120
+ bf16: true
121
+ beta: 0.01
122
+ learning_rate: 0.5e-6
123
+ gradient_accumulation_steps: 16
124
+ per_device_train_batch_size: 2
125
+ per_device_eval_batch_size: 4
126
+ num_train_epochs: 1
127
+ max_length: 2048
128
+ max_prompt_length: 1800
129
+ warmup_ratio: 0.1
130
+ logging_steps: 1
131
+ lr_scheduler_type: cosine
132
+ optim: adamw_torch
133
+
134
+ torch_dtype: null
135
+ use_flash_attention_2: true
136
+ do_eval: true
137
+ evaluation_strategy: steps
138
+ eval_steps: 100
139
+ gradient_checkpointing: true
140
+ gradient_checkpointing_kwargs:
141
+ use_reentrant: False
142
+ log_level: info
143
+ push_to_hub: true
144
+ save_strategy: "steps"
145
+ save_steps: 100
146
+ save_total_limit: 1
147
+ seed: 42
148
+ report_to:
149
+ - wandb
150
+ ```
151
+ </details><be>
152
+
153
+ ## Paper Abstract
154
+
155
+ <details><summary>Click Here</summary>
156
+ 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.
157
+ </details><be>
158
+
159
+ ## πŸ“š Citation
160
+
161
+ If you find the model, data, or code useful, please cite our paper:
162
+ ```
163
+ @article{xu2024magpie,
164
+ title={Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing},
165
+ author={Zhangchen Xu and Fengqing Jiang and Luyao Niu and Yuntian Deng and Radha Poovendran and Yejin Choi and Bill Yuchen Lin},
166
+ year={2024},
167
+ eprint={2406.08464},
168
+ archivePrefix={arXiv},
169
+ primaryClass={cs.CL}
170
+ }
171
+ ```
172
+
173
+ Please also cite the reward model for creating preference datasets:
174
+
175
+ ArmoRM paper:
176
+ ```
177
+ @article{wang2024interpretable,
178
+ title={Interpretable Preferences via Multi-Objective Reward Modeling and Mixture-of-Experts},
179
+ author={Wang, Haoxiang and Xiong, Wei and Xie, Tengyang and Zhao, Han and Zhang, Tong},
180
+ journal={arXiv preprint arXiv:2406.12845},
181
+ year={2024}
182
+ }
183
+ ```
184
+
185
+ **Questions?** Please contact [Zhangchen](https://zhangchenxu.com/) by email.