hyxmmm commited on
Commit
b971174
·
verified ·
1 Parent(s): 24bd305

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +135 -3
README.md CHANGED
@@ -1,3 +1,135 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - BAAI/Infinity-Instruct
5
+ language:
6
+ - en
7
+ ---
8
+ # Infinity Instruct
9
+
10
+ <p align="center">
11
+ <img src="fig/Bk3NbjnJko51MTx1ZCScT2sqnGg.png" width="300">
12
+ </p>
13
+ <p align="center">
14
+ <em>Beijing Academy of Artificial Intelligence (BAAI)</em><br/>
15
+ <em>[Paper][Code][🤗] (would be released soon)</em>
16
+ </p>
17
+
18
+ Infinity-Instruct-3M-0613-Llama3-70B is an opensource supervised instruction tuning model without reinforcement learning from human feedback (RLHF). This model is just finetuned on [Infinity-Instruct-3M and Infinity-Instruct-0613](https://huggingface.co/datasets/BAAI/Infinity-Instruct) and showing favorable results on AlpacaEval 2.0 compared to GPT4-0613.
19
+
20
+ ## **Training Details**
21
+
22
+ <p align="center">
23
+ <img src="fig/trainingflow.png">
24
+ </p>
25
+
26
+ Infinity-Instruct-3M-0613-Llama3-70B is tuned on Million-level instruction dataset [Infinity-Instruct](https://huggingface.co/datasets/BAAI/Infinity-Instruct). First, we apply the foundational dataset Infinity-Instruct-3M to improve the foundational ability (math & code) of Llama3-70B, and get the foundational instruct model Infinity-Instruct-3M-Llama3-70B. Then we finetune the Infinity-Instruct-3M-Llama3-70B to get the stronger chat model Infinity-Instruct-3M-0613-Llama3-70B. Here is the training hyperparamers.
27
+
28
+ ```bash
29
+ epoch: 3
30
+ lr: 5e-6
31
+ min_lr: 0
32
+ lr_warmup_steps: 40
33
+ lr_decay_style: cosine
34
+ weight_decay: 0.0
35
+ adam_beta1: 0.9
36
+ adam_beta2: 0.95
37
+ global_batch_size: 528
38
+ clip_grad: 1.0
39
+ ```
40
+
41
+ Thanks to [FlagScale](https://github.com/FlagOpen/FlagScale), we could concatenate multiple training samples to remove padding token and apply diverse acceleration techniques to the traning procudure. It effectively reduces our training costs. We will release our code in the near future!
42
+
43
+ ## **Benchmark**
44
+
45
+ | **Model** | **MT-Bench** | **AlpacaEval2.0** |
46
+ |:-------------------------------:|:------------:|:-----------------:|
47
+ | GPT 3.5 Turbo 0613 | 8.4 | 22.7 |
48
+ | Mixtral 8x7B v0.1 | 8.3 | 23.7 |
49
+ | Gemini Pro | -- | 24.4 |
50
+ | GPT4-0613 | 9.2 | 30.2 |
51
+ | Llama-3-70B-Instruct | 9.0 | 34.4 |
52
+ | InfInstruct-3M-0613-Llama3-70B* | 8.7 | **31.5** |
53
+
54
+ *denote the model is finetuned without reinforcement learning from human feedback (RLHF).
55
+
56
+ We evaluate Infinity-Instruct-3M-0613-Llama3-70B on the two most popular instructions following benchmarks. Mt-Bench is a set of challenging multi-turn questions including code, math and routine dialogue. AlpacaEval2.0 is based on AlpacaFarm evaluation set. Both of these two benchmarks use GPT-4 to judge the model answer. AlpacaEval2.0 displays a high agreement rate with human-annotated benchmark, Chatbot Arena. The result shows that InfInstruct-3M-0613-Llama3-70B achieved 31.2 in AlpacaEval2.0, which is higher than the 30.4 of GPT4-0613 Turbo although it does not yet use RLHF.
57
+
58
+ ## **How to use**
59
+
60
+ Infinity-Instruct-3M-0613-Llama3-70B adopt the same chat template of [Llama3-70B-instruct](https://huggingface.co/meta-llama/Meta-Llama-3-70B-Instruct):
61
+
62
+ ```bash
63
+ <|begin_of_text|><|start_header_id|>user<|end_header_id|>
64
+
65
+ How are you?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
66
+
67
+ Hi!<|eot_id|><|start_header_id|>user<|end_header_id|>
68
+
69
+ How are you?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
70
+ ```
71
+
72
+ To apply this model and template in conversation scenarios, you can refer to the following code:
73
+ ```python
74
+ from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
75
+ import torch
76
+ device = "cuda" # the device to load the model onto
77
+
78
+ model = AutoModelForCausalLM.from_pretrained("BAAI/Infinity-Instruct-3M-0613-Llama3-70B",
79
+ torch_dtype=torch.bfloat16,
80
+ device_map="auto"
81
+ )
82
+ tokenizer = AutoTokenizer.from_pretrained("BAAI/Infinity-Instruct-3M-0613-Llama3-70B")
83
+
84
+ prompt = "Give me a short introduction to large language model."
85
+ messages = [
86
+ {"role": "user", "content": prompt}
87
+ ]
88
+
89
+ text = tokenizer.apply_chat_template(
90
+ messages,
91
+ tokenize=False,
92
+ add_generation_prompt=True
93
+ )
94
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
95
+
96
+ logits_processor = LogitsProcessorList(
97
+ [
98
+ MinLengthLogitsProcessor(1, eos_token_id=tokenizer.eos_token_id),
99
+ TemperatureLogitsWarper(0.7),
100
+ ]
101
+ )
102
+
103
+ generated_ids = model.generate(
104
+ model_inputs.input_ids,
105
+ logits_processor=logits_processor,
106
+ max_new_tokens=512
107
+ )
108
+
109
+ generated_ids = [
110
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
111
+ ]
112
+
113
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
114
+ print(response)
115
+ ```
116
+
117
+
118
+
119
+ ## **Disclaimer**
120
+
121
+ The resources, including code, data, and model weights, associated with this project are restricted for academic research purposes only and cannot be used for commercial purposes. The content produced by any version of Infinity Instruct is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.
122
+
123
+ ##
124
+
125
+ ## **Citation**
126
+ Our paper, detailing the development and features of the **Infinity Instruct** dataset and finetuned models, will be released soon on arXiv. Stay tuned!
127
+
128
+ ```
129
+ @article{InfinityInstruct2024,
130
+ title={Infinity Instruct},
131
+ author={Beijing Academy of Artificial Intelligence (BAAI)},
132
+ journal={arXiv preprint arXiv:2406.XXXX},
133
+ year={2024}
134
+ }
135
+ ```