RichardErkhov commited on
Commit
c1e8fce
·
verified ·
1 Parent(s): ff48ffa

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +513 -0
README.md ADDED
@@ -0,0 +1,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ FuseLLM-7B - bnb 8bits
11
+ - Model creator: https://huggingface.co/Wanfq/
12
+ - Original model: https://huggingface.co/Wanfq/FuseLLM-7B/
13
+
14
+
15
+
16
+
17
+ Original model description:
18
+ ---
19
+ language:
20
+ - en
21
+ license: apache-2.0
22
+ library_name: transformers
23
+ tags:
24
+ - llama
25
+ - open-llama
26
+ - mpt
27
+ - model-fusion
28
+ - fusellm
29
+ pipeline_tag: text-generation
30
+ model-index:
31
+ - name: FuseLLM-7B
32
+ results:
33
+ - task:
34
+ type: text-generation
35
+ name: Text Generation
36
+ dataset:
37
+ name: AI2 Reasoning Challenge (25-Shot)
38
+ type: ai2_arc
39
+ config: ARC-Challenge
40
+ split: test
41
+ args:
42
+ num_few_shot: 25
43
+ metrics:
44
+ - type: acc_norm
45
+ value: 53.24
46
+ name: normalized accuracy
47
+ source:
48
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=Wanfq/FuseLLM-7B
49
+ name: Open LLM Leaderboard
50
+ - task:
51
+ type: text-generation
52
+ name: Text Generation
53
+ dataset:
54
+ name: HellaSwag (10-Shot)
55
+ type: hellaswag
56
+ split: validation
57
+ args:
58
+ num_few_shot: 10
59
+ metrics:
60
+ - type: acc_norm
61
+ value: 78.72
62
+ name: normalized accuracy
63
+ source:
64
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=Wanfq/FuseLLM-7B
65
+ name: Open LLM Leaderboard
66
+ - task:
67
+ type: text-generation
68
+ name: Text Generation
69
+ dataset:
70
+ name: MMLU (5-Shot)
71
+ type: cais/mmlu
72
+ config: all
73
+ split: test
74
+ args:
75
+ num_few_shot: 5
76
+ metrics:
77
+ - type: acc
78
+ value: 47.93
79
+ name: accuracy
80
+ source:
81
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=Wanfq/FuseLLM-7B
82
+ name: Open LLM Leaderboard
83
+ - task:
84
+ type: text-generation
85
+ name: Text Generation
86
+ dataset:
87
+ name: TruthfulQA (0-shot)
88
+ type: truthful_qa
89
+ config: multiple_choice
90
+ split: validation
91
+ args:
92
+ num_few_shot: 0
93
+ metrics:
94
+ - type: mc2
95
+ value: 38.17
96
+ source:
97
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=Wanfq/FuseLLM-7B
98
+ name: Open LLM Leaderboard
99
+ - task:
100
+ type: text-generation
101
+ name: Text Generation
102
+ dataset:
103
+ name: Winogrande (5-shot)
104
+ type: winogrande
105
+ config: winogrande_xl
106
+ split: validation
107
+ args:
108
+ num_few_shot: 5
109
+ metrics:
110
+ - type: acc
111
+ value: 74.03
112
+ name: accuracy
113
+ source:
114
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=Wanfq/FuseLLM-7B
115
+ name: Open LLM Leaderboard
116
+ - task:
117
+ type: text-generation
118
+ name: Text Generation
119
+ dataset:
120
+ name: GSM8k (5-shot)
121
+ type: gsm8k
122
+ config: main
123
+ split: test
124
+ args:
125
+ num_few_shot: 5
126
+ metrics:
127
+ - type: acc
128
+ value: 14.33
129
+ name: accuracy
130
+ source:
131
+ url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=Wanfq/FuseLLM-7B
132
+ name: Open LLM Leaderboard
133
+ ---
134
+ <p align="center" width="100%">
135
+ </p>
136
+
137
+ <div id="top" align="center">
138
+
139
+ <p style="font-size: 32px; font-weight: bold;">Knowledge Fusion of Large Language Models</p>
140
+
141
+
142
+ <h4> |<a href="https://arxiv.org/abs/2401.10491"> 📑 Paper </a> |
143
+ <a href="https://huggingface.co/FuseAI"> 🤗 Huggingface Repo </a> |
144
+ <a href="https://github.com/fanqiwan/FuseLLM"> 🐱 Github Repo </a> |
145
+ </h4>
146
+
147
+ <!-- **Authors:** -->
148
+
149
+ _**Fanqi Wan<sup>†</sup>, Xinting Huang<sup>‡</sup>, Deng Cai<sup>‡</sup>, Xiaojun Quan<sup>†</sup>, Wei Bi<sup>‡</sup>, Shuming Shi<sup>‡</sup>**_
150
+
151
+
152
+ <!-- **Affiliations:** -->
153
+
154
+
155
+ _<sup>†</sup> Sun Yat-sen University,
156
+ <sup>‡</sup> Tencent AI Lab_
157
+
158
+ | Model | BBH | ARC-easy | ARC-challenge | BoolQ | HellaSwag | OpenBookQA |
159
+ |----------------------------------------------------------|-------|----------|---------------|-------|-----------|------------|
160
+ | OpenLLaMA-7B | 33.87 | 69.70 | 41.38 | 72.29 | 74.53 | 41.00 |
161
+ | MPT-7B | 33.38 | 70.12 | 42.15 | 74.74 | 76.25 | 42.40 |
162
+ | Llama-2-7B | 39.70 | 74.58 | 46.33 | 77.71 | 76.00 | 44.20 |
163
+ | Llama-2-CLM-7B | 40.44 | 74.54 | 46.50 | 76.88 | 76.57 | 44.80 |
164
+ | 🤗 [FuseLLM-7B](https://huggingface.co/Wanfq/FuseLLM-7B) | 41.75 | 75.04 | 47.44 | 78.13 | 76.78 | 45.40 |
165
+
166
+
167
+ | Model | MultiPL-E | TrivialQA | DROP | LAMBADA | IWSLT2017 | SciBench |
168
+ |----------------------------------------------------------|-----------|-----------|-------|---------|-----------|----------|
169
+ | OpenLLaMA-7B | 18.11 | 39.96 | 22.31 | 70.31 | 5.51 | 0.68 |
170
+ | MPT-7B | 17.26 | 28.89 | 23.54 | 70.08 | 5.49 | 0.88 |
171
+ | Llama-2-7B | 14.63 | 52.46 | 27.25 | 73.28 | 6.48 | 0.14 |
172
+ | Llama-2-CLM-7B | 14.83 | 53.14 | 28.51 | 73.45 | 6.91 | 0.94 |
173
+ | 🤗 [FuseLLM-7B](https://huggingface.co/Wanfq/FuseLLM-7B) | 15.56 | 54.49 | 28.97 | 73.72 | 6.75 | 1.65 |
174
+
175
+
176
+ </div>
177
+
178
+
179
+ ## News
180
+ - **Jan 22, 2024:** 🔥 We release [FuseLLM-7B](https://huggingface.co/Wanfq/FuseLLM-7B), which is the fusion of three open-source foundation LLMs with distinct architectures, including [Llama-2-7B](https://huggingface.co/meta-llama/Llama-2-7b-hf), [OpenLLaMA-7B](https://huggingface.co/openlm-research/open_llama_7b_v2), and [MPT-7B](https://huggingface.co/mosaicml/mpt-7b).
181
+
182
+
183
+ ## WIP
184
+
185
+ | Source LLMs | Target LLM |
186
+ |------------------------------------------------------|-------------------|
187
+ | Mixtral-8x7B-v0.1, SOLAR-10.7B-v1.0, Mistral-7B-v0.1 | Mistral-7B-v0.1 |
188
+ | Mixtral-8x7B-v0.1, SOLAR-10.7B-v1.0, Mistral-7B-v0.1 | SOLAR-10.7B-v1.0 |
189
+ | Mixtral-8x7B-v0.1, SOLAR-10.7B-v1.0, Mistral-7B-v0.1 | Mixtral-8x7B-v0.1 |
190
+
191
+ ## Contents
192
+
193
+ - [Overview](#overview)
194
+ - [Model Release](#model-release)
195
+ - [Quick Start](#quick-start)
196
+ - [Data Construction](#data-construction)
197
+ - [Training](#training)
198
+ - [Evaluation](#evaluation)
199
+ - [Citation](#citation)
200
+
201
+ ## Overview
202
+
203
+ In this study, we explore the realm of knowledge fusion for LLMs to create a unified model that combines the capabilities and distinctive strengths of multiple structurally diverse LLMs. To achieve this, we introduce FuseLLM, which first leverages the generative distributions of these source LLMs to externalize both their collective knowledge and individual strengths, and subsequently transfer them to the target LLM through lightweight continual training.
204
+
205
+ Unlike model ensemble approaches that require the **parallel deployment of multiple LLMs**, or weight merging techniques that are typically **limited to LLMs with identical architectures**, FuseLLM is designed to support **the fusion of multiple LLMs with diverse architectures into a more potent LLM**. By explicitly transferring their knowledge and capabilities to a single target LLM, FuseLLM offers a powerful and flexible solution for the knowledge fusion of LLMs.
206
+
207
+ <p align="center">
208
+ <img src="./assets/fig_1.png" width="95%"> <br>
209
+ </p>
210
+
211
+
212
+ ## Model Release
213
+
214
+ We release the FuseLLM-7B on 🤗 [Huggingface Models](https://huggingface.co/models?sort=trending&search=FuseLLM), which is the fusion of three popular open-source LLMs that possess distinct architectures and functionalities: [Llama-2-7B](https://huggingface.co/meta-llama/Llama-2-7b-hf), [OpenLLaMA-7B](https://huggingface.co/openlm-research/open_llama_7b_v2), and [MPT-7B](https://huggingface.co/mosaicml/mpt-7b).
215
+
216
+ Here are the evaluation results of FuseLLM.
217
+
218
+ ### General Reasoning & Commonsense Reasoning
219
+
220
+ We first show the performance of FuseLLM on Big-Bench Hard and CommonSense benchmarks, which evaluate the general reasoning and commonsense reasoning abilities respectively.
221
+
222
+ <p align="center">
223
+ <img src="./assets/fig_4.png" width="95%"> <br>
224
+ </p>
225
+
226
+ ### Code Generation & Text Generation
227
+
228
+ We then evaluate FuseLLM on MultiPL-E, which is a multilingual programming benchmark to assess the code generation performance. We also conduct experiments on several text generation benchmarks, including TrivialQA (question-answering), DROP (reading comprehension), LAMBADA (content analysis), IWSLT2017 (machine translation), and SCIBench (theorem application).
229
+
230
+ <p align="center">
231
+ <img src="./assets/fig_5.png" width="95%"> <br>
232
+ </p>
233
+
234
+ ### Instruction Following
235
+
236
+ FuseLLM is also applicable to the fusion of instruction-tuned LLMs. We further evaluate the Vicuna Benchmark, which assesses the instruction following ability.
237
+
238
+ <p align="center">
239
+ <img src="./assets/fig_6.png" width="50%"> <br>
240
+ </p>
241
+
242
+ ### FuseLLM vs. Knowledge Distillation
243
+
244
+ As knowledge distillation is also a method for enhancing the performance of LLMs by utilizing representations, we compare FuseLLM with Llama-2 KD, which is distilled from Llama-2 13B.
245
+
246
+ <p align="center">
247
+ <img src="./assets/fig_7.png" width="50%"> <br>
248
+ </p>
249
+
250
+ ### FuseLLM vs. Model Ensemble & Weight Merging
251
+
252
+ To compare FuseLLM with existing fusion methods (such as model ensemble and weight merging), we simulate scenarios to ensure model fusion with an identical structure where multiple source LLMs are derived from the same base model but are continually trained on different corpus. We then test the perplexity of these fusion methods on different benchmarks.
253
+
254
+
255
+ <p align="center">
256
+ <img src="./assets/fig_8.png" width="50%"> <br>
257
+ </p>
258
+
259
+ ## Quick Start
260
+
261
+ ### Setup
262
+
263
+ We use `python 3.9` in this project.
264
+
265
+ Then, we have to install all the libraries listed in `requirements.txt`.
266
+
267
+ ```bash
268
+ pip install -r requirements.txt
269
+ ```
270
+
271
+ ### Usage
272
+
273
+ ```python
274
+ from transformers import AutoTokenizer, AutoModelForCausalLM
275
+ tokenizer = AutoTokenizer.from_pretrained("Wanfq/FuseLLM-7B", use_fast=False)
276
+ model = AutoModelForCausalLM.from_pretrained("Wanfq/FuseLLM-7B", torch_dtype="auto")
277
+ model.cuda()
278
+ inputs = tokenizer("<your text here>", return_tensors="pt").to(model.device)
279
+ tokens = model.generate(
280
+ **inputs,
281
+ max_new_tokens=512,
282
+ temperature=0.6,
283
+ top_p=0.9,
284
+ do_sample=True,
285
+ )
286
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
287
+ ```
288
+
289
+ We also find `Exllama v2 Quantizations` version on [FuseLLM-7B-exl2](https://huggingface.co/bartowski/FuseLLM-7B-exl2), it uses [ExLlamaV2 v0.0.11](https://github.com/turboderp/exllamav2/releases/tag/v0.0.11) for quantization.
290
+
291
+ ## Data Construction
292
+
293
+ We use the [MiniPile](https://huggingface.co/datasets/JeanKaddour/minipile) dataset for continual training.
294
+
295
+ Here we show the scripts to obtain representations from multiple LLMs for model fusion.
296
+
297
+ 1. Split long text
298
+
299
+ ```bash
300
+ python ./src/utils/split_long_text.py \
301
+ --base_model_name_or_path "<path_to_llama_2_7b>" \
302
+ --blending_model_name_or_path "<path_to_open_llama_7b_v2>" \
303
+ --another_blending_model_name_or_path "<path_to_mpt_7b>" \
304
+ --dataset "<path_to_minipile>" \
305
+ --dataset_save_dir "<path_to_minipile_split>" \
306
+ --cache_dir "<path_to_cache_dir>" \
307
+ --block_size 2048 \
308
+ --preprocessing_num_workers 80
309
+ ```
310
+
311
+ 2. Get representations for each LLM
312
+
313
+ ```bash
314
+ # We split the dataset into 8 splits, then process each split on a GPU.
315
+ # Please run this script for llama_2_7b, open_llama_7b_v2, and mpt_7b.
316
+ for i in {0..7}; do
317
+ export CUDA_VISIBLE_DEVICES=${i}
318
+ python ./src/utils/forward_for_logits.py \
319
+ --model_name_or_path "<path_to_each_model>" \
320
+ --dataset "<path_to_minipile_split>" \
321
+ --dataset_save_dir "${i}_8_<path_to_minipile_split_each_model_representation>" \
322
+ --dataset_split_num 8 \
323
+ --dataset_index ${i} \
324
+ --cache_dir "<path_to_cache_dir>" \
325
+ --model_max_length 2048 \
326
+ --training_mode full \
327
+ --load_in_half bf16 \
328
+ --batch_size 8 \
329
+ --preprocessing_num_workers 80 \
330
+ --top_k_logits 10 \
331
+ --save_per_token_metric 2>&1 > "${i}_8_<path_to_log_file>" 2>&1 &
332
+ unset CUDA_VISIBLE_DEVICES
333
+ sleep 30
334
+ done
335
+
336
+ wait
337
+ ```
338
+
339
+ 3. Align representations from different LLMs
340
+
341
+ ```bash
342
+ # Get vocab mapping from different LLMs.
343
+
344
+ # llama_2_7b <-> open_llama_7b_v2
345
+ python ./src/utils/vocab_mapping.py \
346
+ --base_model_name_or_path "<path_to_llama_2_7b>" \
347
+ --blending_model_name_or_path "<path_to_open_llama_7b_v2>" \
348
+ --dataset_dir "<path_to_minipile_split>" \
349
+ --vocab_mapping_save_dir "<path_to_llama_2_7b_open_llama_7b_v2_vocab_mapping>" \
350
+ --cache_dir "<path_to_cache_dir>" \
351
+ --model_max_length 2048 \
352
+ --vocab_mapping_type "default" \
353
+ --num_process 1
354
+
355
+ # llama_2_7b <-> mpt_7b
356
+ python ./src/utils/vocab_mapping.py \
357
+ --base_model_name_or_path "<path_to_llama_2_7b>" \
358
+ --blending_model_name_or_path "<path_to_mpt_7b>" \
359
+ --dataset_dir "<path_to_minipile_split>" \
360
+ --vocab_mapping_save_dir "<path_to_llama_2_7b_mpt_7b_vocab_mapping>" \
361
+ --cache_dir "<path_to_cache_dir>" \
362
+ --model_max_length 2048 \
363
+ --vocab_mapping_type "default" \
364
+ --num_process 1
365
+ ```
366
+
367
+ ```bash
368
+ # Align representations from different LLMs.
369
+
370
+ # llama_2_7b <-> open_llama_7b_v2
371
+ for i in {0..7}; do
372
+ python ./src/utils/token_alignment.py \
373
+ --base_model_name_or_path "<path_to_llama_2_7b>" \
374
+ --blending_model_name_or_path "<path_to_open_llama_7b_v2>" \
375
+ --base_dataset_dir "${i}_8_<path_to_minipile_split_llama_2_7b_representation>" \
376
+ --blending_dataset_dir "${i}_8_<path_to_minipile_split_open_llama_7b_v2_representation>" \
377
+ --dataset_save_dir "${i}_8_<path_to_minipile_split_llama_2_7b_open_llama_7b_v2_aligned_representation>" \
378
+ --cache_dir "<path_to_cache_dir>" \
379
+ --model_max_length 2048 \
380
+ --preprocessing_num_workers 80 \
381
+ --batch_size 100 \
382
+ --blending_model_index 0 \
383
+ --vocab_align_type "soft" \
384
+ --vocab_mapping_save_dir "<path_to_llama_2_7b_open_llama_7b_v2_vocab_mapping>" \
385
+ --metric_level "sequence"
386
+ done
387
+
388
+ # llama_2_7b <-> mpt_7b
389
+ for i in {0..7}; do
390
+ python ./src/utils/token_alignment.py \
391
+ --base_model_name_or_path "<path_to_llama_2_7b>" \
392
+ --blending_model_name_or_path "<path_to_mpt_7b>" \
393
+ --base_dataset_dir "${i}_8_<path_to_minipile_split_llama_2_7b_open_llama_7b_v2_aligned_representation>" \
394
+ --blending_dataset_dir "${i}_8_<path_to_minipile_split_mpt_7b_representation>" \
395
+ --dataset_save_dir "${i}_8_<path_to_minipile_split_llama_2_7b_open_llama_7b_v2_mpt_7b_aligned_representation>" \
396
+ --cache_dir "<path_to_cache_dir>" \
397
+ --model_max_length 2048 \
398
+ --preprocessing_num_workers 80 \
399
+ --batch_size 100 \
400
+ --blending_model_index 1 \
401
+ --vocab_align_type "soft" \
402
+ --vocab_mapping_save_dir "<path_to_llama_2_7b_mpt_7b_vocab_mapping>" \
403
+ --metric_level "sequence"
404
+ done
405
+ ```
406
+
407
+ 4. Packing all features to speed up training.
408
+
409
+ ```bash
410
+ for i in {0..7}; do
411
+ python3 ./src/utils/packing.py \
412
+ --dataset_dir "${i}_8_<path_to_minipile_split_llama_2_7b_open_llama_7b_v2_mpt_7b_aligned_representation>" \
413
+ --dataset_save_dir "${i}_8_<path_to_miniplie_fusellm_processed>" \
414
+ --cache_dir "<path_to_cache_dir>" \
415
+ --model_max_length 2048 \
416
+ --preprocessing_num_workers 80 \
417
+ --batch_size 1000 \
418
+ --metric_level "sequence"
419
+ ```
420
+
421
+ The final processed data is at `${i}_8_<path_to_miniplie_fusellm_processed>`, where `i in {0..7}`.
422
+
423
+ ## Training
424
+
425
+ Here, we show the script for FuseLLM training.
426
+
427
+ ```bash
428
+ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
429
+
430
+ deepspeed --master_port=20001 ./src/train.py \
431
+ --training_mode full \
432
+ --deepspeed ./config/zero_stage2_config.json \
433
+ --model_name_or_path "<path_to_llama_2_7b>" \
434
+ --output_dir "<path_to_save_fusellm_7b>" \
435
+ --model_max_length 2048 \
436
+ --logging_steps 1 \
437
+ --save_strategy steps \
438
+ --save_steps 500 \
439
+ --save_total_limit 1 \
440
+ --evaluation_strategy steps \
441
+ --per_device_eval_batch_size 1 \
442
+ --logging_strategy steps \
443
+ --do_train \
444
+ --do_eval \
445
+ --bf16 True \
446
+ --tf32 True \
447
+ --warmup_ratio 0.008 \
448
+ --lr_scheduler_type cosine \
449
+ --dataset_name "0_8_<path_to_miniplie_fusellm_processed>,1_8_<path_to_miniplie_fusellm_processed>,2_8_<path_to_miniplie_fusellm_processed>,3_8_<path_to_miniplie_fusellm_processed>,4_8_<path_to_miniplie_fusellm_processed>,5_8_<path_to_miniplie_fusellm_processed>,6_8_<path_to_miniplie_fusellm_processed>,7_8_<path_to_miniplie_fusellm_processed>" \
450
+ --per_device_train_batch_size 1 \
451
+ --gradient_accumulation_steps 16 \
452
+ --num_train_epochs 1 \
453
+ --eval_steps 500 \
454
+ --optim adamw_torch \
455
+ --adam_beta1 0.9 \
456
+ --adam_beta2 0.95 \
457
+ --learning_rate 1e-5 \
458
+ --weight_decay 0.1 \
459
+ --max_grad_norm 1.0 \
460
+ --seed 42 \
461
+ --gradient_checkpointing True \
462
+ --use_flash_attn True \
463
+ --report_to tensorboard \
464
+ --do_distill \
465
+ --distill_with_ref_model True \
466
+ --distill_with_aligned_model_0 True \
467
+ --distill_with_aligned_model_1 True \
468
+ --distill_loss_type "ce" \
469
+ --distill_teacher_temperature 1.0 \
470
+ --lm_loss_weight 0.9 \
471
+ --distill_greater_as_gt True \
472
+ --distill_greater_as_gt_type "hard" \
473
+ --dataloader_num_workers 10 \
474
+ --remove_unused_columns False 2>&1 | tee "<path_to_log_file>"
475
+ ```
476
+
477
+ ## Evaluation
478
+
479
+ The evaluation code we used in our evaluation are list as follows:
480
+
481
+ - [Big-Bench Hard](https://github.com/allenai/open-instruct/tree/main/eval)
482
+ - [CommonSense: ARC-easy, ARC-challenge, BoolQ, HellaSwag, OpenBookQA](https://github.com/EleutherAI/lm-evaluation-harness/releases/tag/v0.3.0)
483
+ - [MultiPL-E](https://github.com/bigcode-project/bigcode-evaluation-harness)
484
+ - [Text Generation: TrivialQA, DROP, LAMBADA, IWSLT2017, SciBench](https://github.com/open-compass/opencompass)
485
+ - [Vicuna Bench](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge)
486
+
487
+ ## Citation
488
+
489
+ If you find this work is relevant with your research or applications, please feel free to cite our work!
490
+ ```
491
+ @inproceedings{wan2024knowledge,
492
+ title={Knowledge Fusion of Large Language Models},
493
+ author={Fanqi Wan and Xinting Huang and Deng Cai and Xiaojun Quan and Wei Bi and Shuming Shi},
494
+ booktitle={The Twelfth International Conference on Learning Representations},
495
+ year={2024},
496
+ url={https://openreview.net/pdf?id=jiDsk12qcz}
497
+ }
498
+ ```
499
+ # [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
500
+ Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_Wanfq__FuseLLM-7B)
501
+
502
+ | Metric |Value|
503
+ |---------------------------------|----:|
504
+ |Avg. |51.07|
505
+ |AI2 Reasoning Challenge (25-Shot)|53.24|
506
+ |HellaSwag (10-Shot) |78.72|
507
+ |MMLU (5-Shot) |47.93|
508
+ |TruthfulQA (0-shot) |38.17|
509
+ |Winogrande (5-shot) |74.03|
510
+ |GSM8k (5-shot) |14.33|
511
+
512
+
513
+