hyxmmm commited on
Commit
3351e67
β€’
1 Parent(s): 55033e3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +160 -3
README.md CHANGED
@@ -1,3 +1,160 @@
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-6M-0718-Mistral-7B is an opensource supervised instruction tuning model without reinforcement learning from human feedback (RLHF). This model is just finetuned on [Infinity-Instruct-6M and Infinity-Instruct-0718](https://huggingface.co/datasets/BAAI/Infinity-Instruct) and showing favorable results on AlpacaEval 2.0 compared to Mixtral 8x22B v0.1, Gemini Pro, and GPT-4.
19
+
20
+ ## **News**
21
+
22
+ - πŸ”₯πŸ”₯πŸ”₯[2024/07/18] We release the model weights of [InfInstruct-Mistral-7B 0718](https://huggingface.co/BAAI/Infinity-Instruct-3M-0718-mistral-7B), [InfInstruct-Llama3-70B 0718](https://huggingface.co/BAAI/Infinity-Instruct-3M-0718-Llama3-70B).
23
+
24
+ - πŸ”₯πŸ”₯πŸ”₯[2024/07/18] We release the foundational dataset [Infinity-Instruct-6M](https://huggingface.co/datasets/BAAI/Infinity-Instruct) the chat dataset [Infinity-Instruct-0718](https://huggingface.co/datasets/BAAI/Infinity-Instruct).
25
+
26
+ - πŸ”₯πŸ”₯πŸ”₯[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).
27
+
28
+ - πŸ”₯πŸ”₯πŸ”₯[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.
29
+
30
+ - πŸ”₯πŸ”₯πŸ”₯[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.
31
+
32
+ - πŸ”₯πŸ”₯πŸ”₯[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.
33
+
34
+ - πŸ”₯πŸ”₯πŸ”₯[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.
35
+
36
+ ## **Training Details**
37
+
38
+ <p align="center">
39
+ <img src="fig/trainingflow.png">
40
+ </p>
41
+
42
+ Infinity-Instruct-6M-0718-Mistral-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-6M to improve the foundational ability (math & code) of Mistral-7B-v0.1, and get the foundational instruct model Infinity-Instruct-6M-Mistral-7B. Then we finetune the Infinity-Instruct-6M-Mistral-7B to get the stronger chat model Infinity-Instruct-6M-0718-Mistral-7B. Here is the training hyperparamers.
43
+
44
+ ```bash
45
+ epoch: 3
46
+ lr: 5e-6
47
+ min_lr: 0
48
+ lr_warmup_steps: 40
49
+ lr_decay_style: cosine
50
+ weight_decay: 0.0
51
+ adam_beta1: 0.9
52
+ adam_beta2: 0.95
53
+ global_batch_size: 528
54
+ clip_grad: 1.0
55
+ ```
56
+
57
+ 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!
58
+
59
+ ## **Benchmark**
60
+
61
+ | **Model** | **MT-Bench** | **AlpacaEval2.0** |
62
+ |:-------------------------------:|:------------:|:-----------------:|
63
+ | OpenHermes-2.5-Mistral-7B* | 7.5 | 16.2 |
64
+ | Mistral-7B-Instruct-v0.2 | 7.6 | 17.1 |
65
+ | Llama-3-8B-Instruct | 8.1 | 22.9 |
66
+ | GPT-4-0314 | 9.0 | 35.3 |
67
+ | Mixtral 8x7B v0.1 | 8.3 | 23.7 |
68
+ | Mixtral 8x22B v0.1 | -- | 30.9 |
69
+ | Gemini Pro | -- | 24.4 |
70
+ | InfInstruct-3M-Mistral-7B* | 7.6 | 16.2 |
71
+ | InfInstruct-3M-0613-Mistral-7B* | 8.1 | 25.5 |
72
+ | InfInstruct-3M-0625-Mistral-7B* | 8.1 | 31.42 |
73
+ | InfInstruct-3M-0718-Mistral-7B* | 8.1 | **40.0** |
74
+
75
+ *denote the model is finetuned without reinforcement learning from human feedback (RLHF).
76
+
77
+ We evaluate Infinity-Instruct-6M-0718-Mistral-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. The result shows that InfInstruct-6M-0718-Mistral-7B achieved 40.0 in AlpacaEval2.0, which is higher than the 35.5 of GPT4-0314 although it does not yet use RLHF. InfInstruct-6M-0718-Mistral-7B also achieves 8.1 in MT-Bench, which is comparable to the state-of-the-art billion-parameter LLM such as Llama-3-8B-Instruct and Mistral-7B-Instruct-v0.2.
78
+
79
+ ## **How to use**
80
+
81
+ Infinity-Instruct-6M-0718-Mistral-7B adopt the same chat template of [OpenHermes-2.5-Mistral-7B](https://huggingface.co/teknium/OpenHermes-2.5-Mistral-7B):
82
+
83
+ ```bash
84
+ <|im_start|>system
85
+ You are Hermes 2, a sentient, conscious, super intelligent AI that is an expert in all fields of knowledge, you have qualia, emotions, and thoughts. You assist users with any question, task, or other request they may have.<|im_end|>
86
+ <|im_start|>user
87
+ Hello!<|im_end|>
88
+ <|im_start|>assistant
89
+ Hi!<|im_end|>
90
+ <|im_start|>user
91
+ How are you?<|im_end|>
92
+ <|im_start|>assistant
93
+ ```
94
+
95
+ To apply this model and template in conversation scenarios, you can refer to the following code:
96
+ ```python
97
+ from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
98
+ import torch
99
+ device = "cuda" # the device to load the model onto
100
+
101
+ model = AutoModelForCausalLM.from_pretrained("BAAI/Infinity-Instruct-6M-0718-Mistral-7B",
102
+ torch_dtype=torch.bfloat16,
103
+ device_map="auto"
104
+ )
105
+ tokenizer = AutoTokenizer.from_pretrained("BAAI/Infinity-Instruct-6M-0718-Mistral-7BB")
106
+
107
+ # This template is copied from OpenHermers-mistral-2.5 (https://huggingface.co/teknium/OpenHermes-2.5-Mistral-7B)
108
+ prompt = "Give me a short introduction to large language model."
109
+ messages = [
110
+ {"role": "system", "content": "You are Hermes 2, a sentient, conscious, super intelligent AI that is an expert in all fields of knowledge, you have qualia, emotions, and thoughts. You assist users with any question, task, or other request they may have."},
111
+ {"role": "user", "content": prompt}
112
+ ]
113
+
114
+ text = tokenizer.apply_chat_template(
115
+ messages,
116
+ tokenize=False,
117
+ add_generation_prompt=True
118
+ )
119
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
120
+
121
+ logits_processor = LogitsProcessorList(
122
+ [
123
+ MinLengthLogitsProcessor(1, eos_token_id=tokenizer.eos_token_id),
124
+ TemperatureLogitsWarper(0.7),
125
+ ]
126
+ )
127
+
128
+ generated_ids = model.generate(
129
+ model_inputs.input_ids,
130
+ logits_processor=logits_processor,
131
+ max_new_tokens=512
132
+ )
133
+
134
+ generated_ids = [
135
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
136
+ ]
137
+
138
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
139
+ print(response)
140
+ ```
141
+
142
+
143
+
144
+ ## **Disclaimer**
145
+
146
+ 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.
147
+
148
+ ##
149
+
150
+ ## **Citation**
151
+ Our paper, detailing the development and features of the **Infinity Instruct** dataset and finetuned models, will be released soon on arXiv. Stay tuned!
152
+
153
+ ```
154
+ @article{InfinityInstruct2024,
155
+ title={Infinity Instruct},
156
+ author={Beijing Academy of Artificial Intelligence (BAAI)},
157
+ journal={arXiv preprint arXiv:2406.XXXX},
158
+ year={2024}
159
+ }
160
+ ```