File size: 10,717 Bytes
36c5dd8
1c1fbe8
 
99d4ddd
1c1fbe8
 
 
 
99d4ddd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36c5dd8
26acde1
1c1fbe8
c6096a9
2cef59c
a918de5
31f4a53
 
 
 
072a2d4
 
 
 
2cef59c
49d159b
2cef59c
 
 
35fd7c6
 
 
58cff80
35fd7c6
 
42657ea
2cef59c
 
452b014
1c1fbe8
35fd7c6
a3880e9
 
6906a66
a3880e9
1c1fbe8
3420c8a
aa9df8d
2cef59c
 
 
aa9df8d
8a7d167
fe01884
8a7d167
 
 
 
407f850
0ae9d99
 
407f850
0ae9d99
 
407f850
8a7d167
407f850
0ae9d99
bfa3f60
1c1fbe8
2cef59c
 
 
 
 
 
 
 
 
 
 
 
 
9b907ca
2ef47fe
a5b96ac
 
 
 
4971eab
1c1fbe8
7c8f87a
1c1fbe8
2cef59c
9d36b85
2cef59c
 
9d36b85
2cef59c
8aec4ce
 
 
 
 
 
 
5e0fd38
8aec4ce
 
5e0fd38
8aec4ce
 
 
 
35fd7c6
1c1fbe8
 
35fd7c6
 
1c1fbe8
 
35fd7c6
1c1fbe8
35fd7c6
1c1fbe8
 
e0ff8da
 
 
 
 
 
c3e2f4f
1a82a23
4857ea8
 
 
 
 
 
 
 
 
 
e0ff8da
 
4857ea8
99d4ddd
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
---
language:
- en
license: apache-2.0
library_name: transformers
tags:
- nlp
- llm
pipeline_tag: text-generation
model-index:
- name: K2
  results:
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: IFEval (0-Shot)
      type: HuggingFaceH4/ifeval
      args:
        num_few_shot: 0
    metrics:
    - type: inst_level_strict_acc and prompt_level_strict_acc
      value: 22.52
      name: strict accuracy
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=LLM360/K2
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: BBH (3-Shot)
      type: BBH
      args:
        num_few_shot: 3
    metrics:
    - type: acc_norm
      value: 28.22
      name: normalized accuracy
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=LLM360/K2
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: MATH Lvl 5 (4-Shot)
      type: hendrycks/competition_math
      args:
        num_few_shot: 4
    metrics:
    - type: exact_match
      value: 2.04
      name: exact match
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=LLM360/K2
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: GPQA (0-shot)
      type: Idavidrein/gpqa
      args:
        num_few_shot: 0
    metrics:
    - type: acc_norm
      value: 3.58
      name: acc_norm
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=LLM360/K2
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: MuSR (0-shot)
      type: TAUR-Lab/MuSR
      args:
        num_few_shot: 0
    metrics:
    - type: acc_norm
      value: 8.55
      name: acc_norm
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=LLM360/K2
      name: Open LLM Leaderboard
  - task:
      type: text-generation
      name: Text Generation
    dataset:
      name: MMLU-PRO (5-shot)
      type: TIGER-Lab/MMLU-Pro
      config: main
      split: test
      args:
        num_few_shot: 5
    metrics:
    - type: acc
      value: 22.27
      name: accuracy
    source:
      url: https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard?query=LLM360/K2
      name: Open LLM Leaderboard
---
# K2: a fully-reproducible large language model outperforming Llama 2 70B using 35% less compute

LLM360 demystifies the training recipe used for Llama 2 70B with K2. K2 is fully transparent, meaning we’ve open-sourced all artifacts, including code, data, model checkpoints, intermediate results, and more.

<center><img src="k2_eval_table.png" alt="k2 eval table" /></center>

## About K2:
* 65 billion parameter LLM
* Tokens: 1.4T
* Languages: English
* Models Released: base, chat model
* Trained in 2 stages
* License: Apache 2.0

K2 was developed as a collaboration between [MBZUAI](https://mbzuai.ac.ae/institute-of-foundation-models/), [Petuum](https://www.petuum.com/), and [LLM360](https://www.llm360.ai/).

## LLM360 Model Performance and Evaluation Collection

The LLM360 Performance and Evaluation Collection is a robust evaluations set consisting of general and domain specific evaluations to assess model knowledge and function. 


Evaluations include standard best practice benchmarks, medical, math, and coding knowledge. More about the evaluations can be found [here](https://www.llm360.ai/evaluation.html).


<center><img src="k2_table_of_tables.png" alt="k2 big eval table"/></center>


Detailed analysis can be found on the K2 Weights and Biases project [here](https://wandb.ai/llm360/K2?nw=29mu6l0zzqq)


## K2 Gallery
The K2 gallery allows one to browse the output of various prompts on intermediate K2 checkpoints, which provides an intuitive understanding on how the model develops and improves over time. This is inspired by The Bloom Book.

[View K2 gallery here](https://huggingface.co/spaces/LLM360/k2-gallery)

## Datasets and Mix

The following data mix was used to train K2 and achieve results in line with Llama 2 70B. 

The full data sequence can be found [here](https://huggingface.co/datasets/LLM360/K2Datasets/tree/main) 

| Dataset      | Starting Tokens      | Multiplier      | Total Tokens      |% of Total      |
| ----------- | ----------- | ----------- | ----------- | ----------- |
| dm-math   | 4.33B        | 3x       | 13B       | 1%       |
| pubmed-abstracts   | 4.77B        | 3x       | 14.3B       | 1.1%       |
| uspto   | 4.77B        | 3x       | 14.3B       | 1.1%       |
| pubmed-central   | 26B        | 1x       | 26B       | 2%       |
| [redpajama.arxiv](https://huggingface.co/datasets/cerebras/SlimPajama-627B)   | 27.3B        | 1x       | 27.3B       | 2.1%       |
| [starcoder.spm](https://huggingface.co/datasets/bigcode/starcoderdata)   | 67.6B        | 0.5x       | 33.8B       | 2.6%       |
| [starcoder.fim](https://huggingface.co/datasets/bigcode/starcoderdata)   | 67.6B        | 0.5x       | 33.8B       | 2.6%       |
| [redpajama.stackexchange](https://huggingface.co/datasets/cerebras/SlimPajama-627B)   | 61.1B        | 1x       | 61.1B       | 4.7%       |
| [starcoder](https://huggingface.co/datasets/bigcode/starcoderdata)   | 132.6B        | 0.5x       | 66.3B       | 5.1%       |
| [pile-of-law](https://huggingface.co/datasets/pile-of-law/pile-of-law)   | 76.7B        | 1x       | 76.7B       | 5.9%       |
| [redpajama.book](https://huggingface.co/datasets/cerebras/SlimPajama-627B)   | 80.6B        | 1x       | 80.6B       | 6.2%       |
| s2orc   | 107.9B        | 1x       | 107.9B       | 8.3%       |
| [redpajama.wikipedia](https://huggingface.co/datasets/cerebras/SlimPajama-627B)   | 22.1B        | 6x       | 132.6B       | 10.2%       |
| [refinedweb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb)   | 612.3B        | 1x       | 612.3B       | 47.1%       |
| Totals   | -        | -       | 1.3T       | 100%       |


# LLM360 Reasearch Suite

## Stage 2 - Last 10 Checkpoints
| Checkpoints      |  |
| ----------- | ----------- |
| [Checkpoint 380](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_380)     | [Checkpoint 375](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_375)       |
| [Checkpoint 379](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_379)   | [Checkpoint 374](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_374)        |
| [Checkpoint 378](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_378)   | [Checkpoint 373](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_373)        |
| [Checkpoint 377](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_377)   | [Checkpoint 372](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_372)        |
| [Checkpoint 376](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_376)   | [Checkpoint 371](https://huggingface.co/LLM360/K2/tree/ministage2_ckpt_371)        |

## Stage 1 - Last 10 Checkpoints
| Checkpoints      |  |
| ----------- | ----------- |
| [Checkpoint 360](https://huggingface.co/LLM360/K2/tree/ckpt_360)     | [Checkpoint 355](https://huggingface.co/LLM360/K2/tree/ckpt_355)       |
| [Checkpoint 359](https://huggingface.co/LLM360/K2/tree/ckpt_359)   | [Checkpoint 354](https://huggingface.co/LLM360/K2/tree/ckpt_354)        |
| [Checkpoint 358](https://huggingface.co/LLM360/K2/tree/ckpt_358)   | [Checkpoint 353](https://huggingface.co/LLM360/K2/tree/ckpt_353)        |
| [Checkpoint 357](https://huggingface.co/LLM360/K2/tree/ckpt_357)   | [Checkpoint 352](https://huggingface.co/LLM360/K2/tree/ckpt_352)        |
| [Checkpoint 356](https://huggingface.co/LLM360/K2/tree/ckpt_356)   | [Checkpoint 351](https://huggingface.co/LLM360/K2/tree/ckpt_351)        |

[to find all branches: git branch -a]

## LLM360 Pretraining Suite
We provide step-by-step reproducation tutorials for tech enthusiasts, AI practitioners and academic or industry researchers who want to learn pretraining techniques [here](https://www.llm360.ai/pretraining.html).

## LLM360 Developer Suite
We provide step-by-step finetuning tutorials for tech enthusiasts, AI practitioners and academic or industry researchers [here](https://www.llm360.ai/developer.html).

# Loading K2
```python
from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("LLM360/K2")
model = AutoModelForCausalLM.from_pretrained("LLM360/K2")

prompt = 'what is the highest mountain on earth?'

input_ids = tokenizer(prompt, return_tensors="pt").input_ids
gen_tokens = model.generate(input_ids, do_sample=True, max_new_tokens=128)

print("-"*20 + "Output for model"  + 20 * '-')
print(tokenizer.batch_decode(gen_tokens)[0])
```



## About LLM360
LLM360 is an open research lab enabling community-owned AGI through open-source large model research and development.


LLM360 enables community-owned AGI by creating standards and tools to advance the bleeding edge of LLM capability and empower knowledge transfer, research, and development. 

We believe in a future where artificial general intelligence (AGI) is created by the community, for the community. Through an open ecosystem of equitable computational resources, high quality data, and flowing technical knowledge, we can ensure ethical AGI development and universal access for all innovators.

[Visit us](https://www.llm360.ai/)

## Citation

**BibTeX:**

```bibtex
@article{K2,
      title={LLM360 K2-65B: Scaling Up Fully Transparent Open-Source LLMs}, 
      author={
      Zhengzhong Liu and Bowen Tan
      and Hongyi Wang and Willie Neiswanger and Tianhua Tao
      and Haonan Li and Fajri Koto and Yuqi Wang and Suqi Sun
      and Omkar Pangarkar and Richard Fan and Yi Gu and Victor Miller
      and Liqun Ma and Liping Tang and Nikhil Ranjan and Yonghao Zhuang
      and Guowei He and Renxi Wang and Mingkai Deng and Robin Algayres 
      and Yuanzhi Li and Zhiqiang Shen and Preslav Nakov
      and Eric Xing      
      },
      year={2024},
}

```
# [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard)
Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_LLM360__K2)

|      Metric       |Value|
|-------------------|----:|
|Avg.               |14.53|
|IFEval (0-Shot)    |22.52|
|BBH (3-Shot)       |28.22|
|MATH Lvl 5 (4-Shot)| 2.04|
|GPQA (0-shot)      | 3.58|
|MuSR (0-shot)      | 8.55|
|MMLU-PRO (5-shot)  |22.27|