hyxmmm commited on
Commit
190b790
β€’
1 Parent(s): 6d48592

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +153 -3
README.md CHANGED
@@ -1,3 +1,153 @@
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-0625-Qwen2-7B 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-0625](https://huggingface.co/datasets/BAAI/Infinity-Instruct) and showing favorable results on AlpacaEval 2.0 and MT-Bench.
19
+
20
+ ## **News**
21
+
22
+ - πŸ”₯πŸ”₯πŸ”₯[2024/07/09] We release the model weights of [InfInstruct-Mistral-7B 0625](https://huggingface.co/BAAI/Infinity-Instruct-3M-0625-Mistral-7B), [InfInstruct-Qwen2-7B 0625](https://huggingface.co/BAAI/Infinity-Instruct-3M-0625-Qwen2-7B), [InfInstruct-Llama3-8B 0625](https://huggingface.co/BAAI/Infinity-Instruct-3M-0625-Llama3-8B), [InfInstruct-Llama3-70B 0625](https://huggingface.co/BAAI/Infinity-Instruct-3M-0625-Llama3-70B), and [InfInstruct-Yi-1.5-9B 0625](https://huggingface.co/BAAI/Infinity-Instruct-3M-0625-Yi-1.5-9B).
23
+
24
+ - πŸ”₯πŸ”₯πŸ”₯[2024/07/09] We release the chat dataset [Infinity-Instruct-0625](https://huggingface.co/datasets/BAAI/Infinity-Instruct), it is a upgraded version of the Infinity-Instruct-0613.
25
+
26
+ - πŸ”₯πŸ”₯πŸ”₯[2024/06/28] We release the model weight of [InfInstruct-Llama3-70B 0613](https://huggingface.co/BAAI/Infinity-Instruct-3M-0613-Llama3-70B). It shows favorable results on AlpacaEval 2.0 compared to GPT4-0613 without RLHF.
27
+
28
+ - πŸ”₯πŸ”₯πŸ”₯[2024/06/21] We release the model weight of [InfInstruct-Mistral-7B 0613](https://huggingface.co/BAAI/Infinity-Instruct-3M-0613-Mistral-7B). It shows favorable results on AlpacaEval 2.0 compared to Mixtral 8x7B v0.1, Gemini Pro, and GPT-3.5 without RLHF.
29
+
30
+ - πŸ”₯πŸ”₯πŸ”₯[2024/06/13] We share the intermediate result of our data construction process (corresponding to the [InfInstruct-3M](https://huggingface.co/datasets/BAAI/Infinity-Instruct) in the table below). Our ongoing efforts focus on risk assessment and data generation. The finalized version with 10 million instructions is scheduled for release in late June.
31
+
32
+ ## **Training Details**
33
+
34
+ <p align="center">
35
+ <img src="fig/trainingflow.png">
36
+ </p>
37
+
38
+ Infinity-Instruct-3M-0625-Qwen2-7B 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 Qwen2-7B, and get the foundational instruct model Infinity-Instruct-3M-Qwen2-7B. Then we finetune the Infinity-Instruct-3M-Qwen2-7B to get the stronger chat model Infinity-Instruct-3M-0625-Qwen2-7B. Here is the training hyperparamers.
39
+
40
+ ```bash
41
+ epoch: 3
42
+ lr: 1e-5
43
+ min_lr: 0
44
+ lr_warmup_steps: 40
45
+ lr_decay_style: cosine
46
+ weight_decay: 0.0
47
+ adam_beta1: 0.9
48
+ adam_beta2: 0.95
49
+ global_batch_size: 528
50
+ clip_grad: 1.0
51
+ ```
52
+
53
+ 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!
54
+
55
+ ## **Benchmark**
56
+
57
+ | **Model** | **MT-Bench** | **AlpacaEval2.0** |
58
+ |:-------------------------------:|:------------:|:-----------------:|
59
+ | OpenHermes-2.5-Mistral-7B* | 7.5 | 16.2 |
60
+ | Mistral-7B-Instruct-v0.2 | 7.6 | 17.1 |
61
+ | Llama-3-8B-Instruct | 8.1 | 22.9 |
62
+ | GPT 3.5 Turbo 0613 | 8.4 | 22.7 |
63
+ | Mixtral 8x7B v0.1 | 8.3 | 23.7 |
64
+ | Gemini Pro | -- | 24.4 |
65
+ | Qwen2-7B-instruct | 8.4 | -- |
66
+ | InfInstruct-3M-0625-Qwen2-7B* | 8.3 | 21.87 |
67
+
68
+ *denote the model is finetuned without reinforcement learning from human feedback (RLHF).
69
+
70
+ We evaluate Infinity-Instruct-3M-0625-Qwen2-7B 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.
71
+
72
+ ## **How to use**
73
+
74
+ Infinity-Instruct-3M-0625-Qwen2-7B adopt the same chat template of [Qwen2-7B-Instruct](https://huggingface.co/Qwen/Qwen2-7B-Instruct):
75
+
76
+ ```bash
77
+ <|im_start|>system
78
+ You are a helpful assistant.<|im_end|>
79
+ <|im_start|>user
80
+ How are you?<|im_end|>
81
+ <|im_start|>assistant
82
+ Hi!<|im_end|>
83
+ <|im_start|>user
84
+ How are you?<|im_end|>
85
+ ```
86
+
87
+ To apply this model and template in conversation scenarios, you can refer to the following code:
88
+
89
+ ```python
90
+ from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
91
+ import torch
92
+ device = "cuda" # the device to load the model onto
93
+
94
+ model = AutoModelForCausalLM.from_pretrained("BAAI/Infinity-Instruct-3M-0625-Qwen2-7B",
95
+ torch_dtype=torch.bfloat16,
96
+ device_map="auto"
97
+ )
98
+ tokenizer = AutoTokenizer.from_pretrained("BAAI/Infinity-Instruct-3M-0625-Qwen2-7B")
99
+
100
+ prompt = "Give me a short introduction to large language model."
101
+ messages = [
102
+ {"role": "user", "content": prompt}
103
+ ]
104
+
105
+ text = tokenizer.apply_chat_template(
106
+ messages,
107
+ tokenize=False,
108
+ add_generation_prompt=True
109
+ )
110
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
111
+
112
+ logits_processor = LogitsProcessorList(
113
+ [
114
+ MinLengthLogitsProcessor(1, eos_token_id=tokenizer.eos_token_id),
115
+ TemperatureLogitsWarper(0.7),
116
+ ]
117
+ )
118
+
119
+ generated_ids = model.generate(
120
+ model_inputs.input_ids,
121
+ logits_processor=logits_processor,
122
+ max_new_tokens=512
123
+ )
124
+
125
+ generated_ids = [
126
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
127
+ ]
128
+
129
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
130
+ print(response)
131
+ ```
132
+
133
+ ## **Disclaimer**
134
+
135
+ 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.
136
+
137
+ ##
138
+
139
+ ## **Citation**
140
+ Our paper, detailing the development and features of the **Infinity Instruct** dataset and finetuned models, will be released soon on arXiv. Stay tuned!
141
+
142
+ ```
143
+ @article{InfinityInstruct2024,
144
+ title={Infinity Instruct},
145
+ author={Beijing Academy of Artificial Intelligence (BAAI)},
146
+ journal={arXiv preprint arXiv:2406.XXXX},
147
+ year={2024}
148
+ }
149
+ ```
150
+
151
+
152
+
153
+