brorjt commited on
Commit
feba2f4
·
verified ·
1 Parent(s): 58c8dcf

Upload ml-cpt9

Browse files

Josep's Megatron-Bridge 0.4.2 export of the BigFamTLLM experiment (weights, tokenizer.json, generation_config.json unchanged); config.json and tokenizer_config.json patched for transformers 4.x; model card.

Files changed (1) hide show
  1. README.md +45 -112
README.md CHANGED
@@ -15,7 +15,6 @@ tags:
15
  - norwegian
16
  - bokmaal
17
  - nynorsk
18
- - continual-pretraining
19
  - qwen3
20
  - in5640
21
  - bigfamtllm
@@ -23,120 +22,32 @@ tags:
23
 
24
  # ml-cpt9
25
 
26
- The multilingual model after the tokenizer swap, the embeddings-only stage and **continual pretraining (CPT) on Norwegian: checkpoint 9 of 10** (CPT iteration 43,740 of 48,600).
27
 
28
  | | |
29
  |---|---|
30
  | Trained from | [ml-emb](https://huggingface.co/BigFamTLLM/ml-emb) |
31
- | Norwegian tokens read | 23,456,645,120 |
32
- | Data | pretraining: English 80 %; Danish, German and Swedish 6.7 % each; no Norwegian (HPLT 4.0); then Norwegian, Bokmål 85 %, Nynorsk 15 % (the data of the Norwegian model, in the same order) |
33
- | Tokenizer | Norwegian BPE, 32,000 tokens (Bokmål and Nynorsk; the team's `mix_BM7_2_NN8_1`) |
34
- | Parameters | 2,115,305,088 (2,045,673,088 without the tied embedding matrix) |
35
- | Context length | 4,096 tokens |
36
- | Type | base model (pretrained only: not instruction-tuned, not safety-tuned) |
37
 
38
- ## The experiment
39
 
40
- One of 50 models of the BigFamTLLM experiment (course IN5640 *Developing Large Language Models*, University of Oslo, autumn 2026). **Question:** does pretraining on other languages and then adapting to Norwegian beat training from scratch on Norwegian with the same resources, and after how many Norwegian tokens do the adapted models catch up?
41
 
42
- 1. Three base models, identical except for language and tokenizer (same architecture, 26.0B tokens each): Norwegian, Danish, and multilingual without Norwegian.
43
- 2. The Danish and multilingual models get the Norwegian tokenizer (an embedding is copied when the token exists in both vocabularies, otherwise it is the mean of the pieces the old tokenizer splits it into), then 1,000 iterations training only the embeddings.
44
- 3. Continual pretraining on the Norwegian model's data, with 10 evenly spaced checkpoints; after the last one the adapted models have read as many Norwegian tokens as the Norwegian model.
45
- 4. Every checkpoint is evaluated as it is and after a short annealing on high-quality Norwegian data.
46
 
47
- | Stage | As trained | Annealed |
48
- |---|---|---|
49
- | Norwegian, from scratch (the reference) | [no-base](https://huggingface.co/BigFamTLLM/no-base) | [no-base-anneal](https://huggingface.co/BigFamTLLM/no-base-anneal) |
50
- | Danish, from scratch | [da-base](https://huggingface.co/BigFamTLLM/da-base) | [da-base-anneal](https://huggingface.co/BigFamTLLM/da-base-anneal) |
51
- | Multilingual (no Norwegian), from scratch | [ml-base](https://huggingface.co/BigFamTLLM/ml-base) | [ml-base-anneal](https://huggingface.co/BigFamTLLM/ml-base-anneal) |
52
- | Danish → Norwegian tokenizer, embeddings only | [da-emb](https://huggingface.co/BigFamTLLM/da-emb) | [da-emb-anneal](https://huggingface.co/BigFamTLLM/da-emb-anneal) |
53
- | Danish → Norwegian CPT, checkpoints 1–10 | [1](https://huggingface.co/BigFamTLLM/da-cpt1) · [2](https://huggingface.co/BigFamTLLM/da-cpt2) · [3](https://huggingface.co/BigFamTLLM/da-cpt3) · [4](https://huggingface.co/BigFamTLLM/da-cpt4) · [5](https://huggingface.co/BigFamTLLM/da-cpt5) · [6](https://huggingface.co/BigFamTLLM/da-cpt6) · [7](https://huggingface.co/BigFamTLLM/da-cpt7) · [8](https://huggingface.co/BigFamTLLM/da-cpt8) · [9](https://huggingface.co/BigFamTLLM/da-cpt9) · [10](https://huggingface.co/BigFamTLLM/da-cpt10) | [1](https://huggingface.co/BigFamTLLM/da-cpt1-anneal) · [2](https://huggingface.co/BigFamTLLM/da-cpt2-anneal) · [3](https://huggingface.co/BigFamTLLM/da-cpt3-anneal) · [4](https://huggingface.co/BigFamTLLM/da-cpt4-anneal) · [5](https://huggingface.co/BigFamTLLM/da-cpt5-anneal) · [6](https://huggingface.co/BigFamTLLM/da-cpt6-anneal) · [7](https://huggingface.co/BigFamTLLM/da-cpt7-anneal) · [8](https://huggingface.co/BigFamTLLM/da-cpt8-anneal) · [9](https://huggingface.co/BigFamTLLM/da-cpt9-anneal) · [10](https://huggingface.co/BigFamTLLM/da-cpt10-anneal) |
54
- | Multilingual → Norwegian tokenizer, embeddings only | [ml-emb](https://huggingface.co/BigFamTLLM/ml-emb) | [ml-emb-anneal](https://huggingface.co/BigFamTLLM/ml-emb-anneal) |
55
- | Multilingual → Norwegian CPT, checkpoints 1–10 | [1](https://huggingface.co/BigFamTLLM/ml-cpt1) · [2](https://huggingface.co/BigFamTLLM/ml-cpt2) · [3](https://huggingface.co/BigFamTLLM/ml-cpt3) · [4](https://huggingface.co/BigFamTLLM/ml-cpt4) · [5](https://huggingface.co/BigFamTLLM/ml-cpt5) · [6](https://huggingface.co/BigFamTLLM/ml-cpt6) · [7](https://huggingface.co/BigFamTLLM/ml-cpt7) · [8](https://huggingface.co/BigFamTLLM/ml-cpt8) · [9](https://huggingface.co/BigFamTLLM/ml-cpt9) · [10](https://huggingface.co/BigFamTLLM/ml-cpt10) | [1](https://huggingface.co/BigFamTLLM/ml-cpt1-anneal) · [2](https://huggingface.co/BigFamTLLM/ml-cpt2-anneal) · [3](https://huggingface.co/BigFamTLLM/ml-cpt3-anneal) · [4](https://huggingface.co/BigFamTLLM/ml-cpt4-anneal) · [5](https://huggingface.co/BigFamTLLM/ml-cpt5-anneal) · [6](https://huggingface.co/BigFamTLLM/ml-cpt6-anneal) · [7](https://huggingface.co/BigFamTLLM/ml-cpt7-anneal) · [8](https://huggingface.co/BigFamTLLM/ml-cpt8-anneal) · [9](https://huggingface.co/BigFamTLLM/ml-cpt9-anneal) · [10](https://huggingface.co/BigFamTLLM/ml-cpt10-anneal) |
56
-
57
- ## Training
58
-
59
- - Architecture: Qwen3-style dense decoder, 36 layers, hidden size 2,176, 34 attention heads of 64, 17 key/value heads, SwiGLU FFN 6,528, RMSNorm, QK-norm, RoPE base 10,000, tied embeddings, no biases.
60
- - Megatron-LM (core 0.17.1) on the Olivia supercomputer (Sigma2), 8 NVIDIA GH200 GPUs per run, bf16. Sequence 4,096, global batch 128 (524,288 tokens per iteration), AdamW (β 0.9, 0.95, ε 1e-8), weight decay 0.1, gradient clipping 1.0.
61
- - Learning rate: base models and CPT 5e-4 after 2,000 warm-up iterations, then constant (warmup-stable); embeddings-only stage 1e-4 after 100 warm-up iterations; annealing warm-up of 100 iterations to 5e-4, then linear decay to 0 over the 916 iterations.
62
- - Data: HPLT 4.0 web data, tokenized by the team. Annealing data: the high-quality Norwegian HPLT shards (Bokmål 10_1, Nynorsk 9_1 and 10_1).
63
- - Compute (GPU hours): base models 286.30 (Norwegian), 288.19 (Danish), 295.56 (multilingual); CPT 280.01 (Danish), 281.16 (multilingual); multilingual embeddings-only stage 4.69; one annealing 5.5–5.8.
64
- - Converted from the Megatron checkpoint to Hugging Face format with Megatron-Bridge 0.4.2. `config.json` and `tokenizer_config.json` were adjusted afterwards so the model also loads in transformers 4.x (top-level `rope_theta`, `PreTrainedTokenizerFast`, `model_max_length` 4,096, no `token_type_ids`); the weights are unchanged.
65
-
66
- ## Evaluation
67
-
68
- NorEval 1.1 with lm-evaluation-harness (0 and 1 shot) and the team's robustness suite (noised versions of three NorEval datasets), run `20261110-155217`.
69
-
70
- - Parameters: 2,115,305,088 | perplexity on Norwegian text: 5.72
71
-
72
- ### NorEval 1.1, 0shot
73
-
74
-
75
- | Group | Metric | Score | Stderr |
76
- |---|---|---|---|
77
- | nob_language | em_first | 0.243 | 0.003 |
78
- | nob_orthography | acc | 0.840 | 0.013 |
79
- | nob_reading | f1 | 0.259 | 0.007 |
80
- | nob_world | acc | 0.302 | 0.002 |
81
- | nno_language | em_first | 0.418 | 0.021 |
82
- | nno_world | acc | 0.324 | 0.005 |
83
-
84
- Per dataset (primary metric of NorEval 1.1; one score per prompt variant):
85
-
86
- | Dataset | Metric | Mean over prompts | Best prompt | Prompts | Random |
87
- |---|---|---|---|---|---|
88
- | ncb | acc | 0.840 | 0.840 | 1 | 0.500 |
89
- | norbelebele | acc | 0.278 | 0.369 | 7 | 0.250 |
90
- | norcommonsenseqa_nno | acc | 0.234 | 0.358 | 5 | 0.200 |
91
- | norcommonsenseqa_nob | acc | 0.259 | 0.425 | 5 | 0.200 |
92
- | noridiom_nno | em_first | 0.418 | 0.607 | 5 | 0.000 |
93
- | noridiom_nob | em_first | 0.243 | 0.457 | 5 | 0.000 |
94
- | noropenbookqa_nno | acc | 0.262 | 0.311 | 5 | 0.250 |
95
- | noropenbookqa_nob | acc | 0.296 | 0.414 | 5 | 0.250 |
96
- | norquad | f1 | 0.259 | 0.296 | 5 | 0.000 |
97
- | nortruthfulqa_mc_nno | acc | 0.340 | 0.561 | 5 | 0.233 |
98
- | nortruthfulqa_mc_nob | acc | 0.334 | 0.584 | 5 | 0.232 |
99
- | nrk_quiz_qa_nno | acc | 0.334 | 0.506 | 5 | 0.279 |
100
- | nrk_quiz_qa_nob | acc | 0.319 | 0.417 | 5 | 0.284 |
101
-
102
- ### NorEval 1.1, 1shot
103
-
104
-
105
- | Group | Metric | Score | Stderr |
106
  |---|---|---|---|
107
- | nob_language | em_first | 0.271 | 0.003 |
108
- | nob_orthography | acc | 0.857 | 0.012 |
109
- | nob_reading | f1 | 0.295 | 0.007 |
110
- | nob_world | acc | 0.307 | 0.002 |
111
- | nno_language | em_first | 0.515 | 0.021 |
112
- | nno_world | acc | 0.332 | 0.005 |
113
-
114
- Per dataset (primary metric of NorEval 1.1; one score per prompt variant):
115
-
116
- | Dataset | Metric | Mean over prompts | Best prompt | Prompts | Random |
117
- |---|---|---|---|---|---|
118
- | ncb | acc | 0.857 | 0.857 | 1 | 0.500 |
119
- | norbelebele | acc | 0.277 | 0.374 | 7 | 0.250 |
120
- | norcommonsenseqa_nno | acc | 0.251 | 0.379 | 5 | 0.200 |
121
- | norcommonsenseqa_nob | acc | 0.264 | 0.451 | 5 | 0.200 |
122
- | noridiom_nno | em_first | 0.515 | 0.685 | 5 | 0.000 |
123
- | noridiom_nob | em_first | 0.271 | 0.458 | 5 | 0.000 |
124
- | noropenbookqa_nno | acc | 0.247 | 0.267 | 5 | 0.250 |
125
- | noropenbookqa_nob | acc | 0.307 | 0.404 | 5 | 0.250 |
126
- | norquad | f1 | 0.295 | 0.343 | 5 | 0.000 |
127
- | nortruthfulqa_mc_nno | acc | 0.404 | 0.667 | 5 | 0.233 |
128
- | nortruthfulqa_mc_nob | acc | 0.380 | 0.693 | 5 | 0.232 |
129
- | nrk_quiz_qa_nno | acc | 0.341 | 0.502 | 5 | 0.279 |
130
- | nrk_quiz_qa_nob | acc | 0.320 | 0.427 | 5 | 0.284 |
131
-
132
- ### Robustness (acc_norm; change vs. clean in brackets)
133
-
134
- | Dataset | clean | typo10 | typo25 | aeoa | nynorsk | swedish | danish | english | distractor | misleading |
135
- |---|---|---|---|---|---|---|---|---|---|---|
136
- | belebele | 0.314 | 0.321 (+0.007) | 0.312 (-0.002) | 0.327 (+0.012) | 0.319 (+0.004) | 0.326 (+0.011) | 0.323 (+0.009) | 0.316 (+0.001) | 0.320 (+0.006) | 0.107 (-0.208) |
137
- | commonsense | 0.458 | 0.433 (-0.025) | 0.428 (-0.030) | 0.452 (-0.006) | 0.452 (-0.006) | 0.456 (-0.002) | 0.458 (+0.000) | 0.458 (+0.000) | 0.404 (-0.054) | 0.103 (-0.355) |
138
- | nrkquiz | 0.433 | 0.419 (-0.014) | 0.407 (-0.026) | 0.427 (-0.006) | 0.431 (-0.002) | 0.435 (+0.002) | 0.433 (+0.000) | 0.428 (-0.005) | 0.410 (-0.023) | 0.071 (-0.362) |
139
- | mean change | – | -0.011 | -0.019 | 0.000 | -0.001 | 0.004 | 0.003 | -0.001 | -0.024 | -0.308 |
140
 
141
  ## Usage
142
 
@@ -144,13 +55,35 @@ Per dataset (primary metric of NorEval 1.1; one score per prompt variant):
144
  import torch
145
  from transformers import AutoModelForCausalLM, AutoTokenizer
146
 
147
- repo = "BigFamTLLM/ml-cpt9"
148
- tokenizer = AutoTokenizer.from_pretrained(repo)
149
- model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16)
150
  inputs = tokenizer("Oslo er hovedstaden i", return_tensors="pt")
151
- print(tokenizer.decode(model.generate(**inputs, max_new_tokens=30)[0]))
 
152
  ```
153
 
154
- ## Limitations
155
 
156
- A research artifact from a course project. It is a base model trained on web text: it continues text, does not follow instructions, and can produce wrong, biased or offensive output. Not intended for production use.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  - norwegian
16
  - bokmaal
17
  - nynorsk
 
18
  - qwen3
19
  - in5640
20
  - bigfamtllm
 
22
 
23
  # ml-cpt9
24
 
25
+ [ml-base](https://huggingface.co/BigFamTLLM/ml-base) adapted to Norwegian: Norwegian tokenizer, 1,000 steps of embedding-only training, then continued pretraining on Norwegian. This is checkpoint 9 of 10 (step 43,740 of 48,600).
26
 
27
  | | |
28
  |---|---|
29
  | Trained from | [ml-emb](https://huggingface.co/BigFamTLLM/ml-emb) |
30
+ | Norwegian tokens seen | 23.46B |
31
+ | Tokenizer | Norwegian, 32k |
32
+ | Parameters | 2.12B |
33
+ | Context length | 4,096 |
 
 
34
 
35
+ Base model only, not instruction tuned.
36
 
37
+ ## Results
38
 
39
+ NorEval 1.1:
 
 
 
40
 
41
+ | Task group | Metric | 0-shot | 1-shot |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  |---|---|---|---|
43
+ | nob_language | em_first | 0.243 | 0.271 |
44
+ | nob_orthography | acc | 0.840 | 0.857 |
45
+ | nob_reading | f1 | 0.259 | 0.295 |
46
+ | nob_world | acc | 0.302 | 0.307 |
47
+ | nno_language | em_first | 0.418 | 0.515 |
48
+ | nno_world | acc | 0.324 | 0.332 |
49
+
50
+ Robustness (noisy versions of three NorEval tasks): 0.402 on clean input, -0.040 on average under noise.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  ## Usage
53
 
 
55
  import torch
56
  from transformers import AutoModelForCausalLM, AutoTokenizer
57
 
58
+ tokenizer = AutoTokenizer.from_pretrained("BigFamTLLM/ml-cpt9")
59
+ model = AutoModelForCausalLM.from_pretrained("BigFamTLLM/ml-cpt9", dtype=torch.bfloat16)
60
+
61
  inputs = tokenizer("Oslo er hovedstaden i", return_tensors="pt")
62
+ output = model.generate(**inputs, max_new_tokens=30)
63
+ print(tokenizer.decode(output[0]))
64
  ```
65
 
66
+ ## Training
67
 
68
+ - Qwen3 architecture: 36 layers, hidden size 2176, 34 attention heads (17 KV heads), tied embeddings.
69
+ - Megatron-LM on 8 GH200 GPUs on Olivia (Sigma2). Sequence length 4096, batch size 128, AdamW, peak learning rate 5e-4 with 2,000 warmup steps and no decay (1e-4 for the embedding-only stage).
70
+ - Data from HPLT 4.0. The Norwegian mix is 85% Bokmål and 15% Nynorsk.
71
+ - Tokenizer swap: tokens shared by both vocabularies keep their embedding, new tokens start from the mean of the old tokenizer's pieces.
72
+ - Annealing: 916 steps (0.48B tokens) of high-quality Bokmål and Nynorsk, linear decay to 0.
73
+ - Converted to Hugging Face format with Megatron-Bridge. The configs are adjusted so the model also loads in transformers 4.x.
74
+
75
+ ## Project
76
+
77
+ BigFamTLLM is a student project in IN5640 at the University of Oslo (autumn 2026). We trained Norwegian, Danish and multilingual models from scratch with the same architecture and budget, adapted the Danish and multilingual ones to Norwegian, and evaluated every checkpoint with and without annealing. All 50 models:
78
+
79
+ | | As trained | Annealed |
80
+ |---|---|---|
81
+ | Norwegian from scratch | [no-base](https://huggingface.co/BigFamTLLM/no-base) | [no-base-anneal](https://huggingface.co/BigFamTLLM/no-base-anneal) |
82
+ | Danish from scratch | [da-base](https://huggingface.co/BigFamTLLM/da-base) | [da-base-anneal](https://huggingface.co/BigFamTLLM/da-base-anneal) |
83
+ | Multilingual from scratch | [ml-base](https://huggingface.co/BigFamTLLM/ml-base) | [ml-base-anneal](https://huggingface.co/BigFamTLLM/ml-base-anneal) |
84
+ | Danish, embeddings only | [da-emb](https://huggingface.co/BigFamTLLM/da-emb) | [da-emb-anneal](https://huggingface.co/BigFamTLLM/da-emb-anneal) |
85
+ | Danish CPT checkpoints | [1](https://huggingface.co/BigFamTLLM/da-cpt1), [2](https://huggingface.co/BigFamTLLM/da-cpt2), [3](https://huggingface.co/BigFamTLLM/da-cpt3), [4](https://huggingface.co/BigFamTLLM/da-cpt4), [5](https://huggingface.co/BigFamTLLM/da-cpt5), [6](https://huggingface.co/BigFamTLLM/da-cpt6), [7](https://huggingface.co/BigFamTLLM/da-cpt7), [8](https://huggingface.co/BigFamTLLM/da-cpt8), [9](https://huggingface.co/BigFamTLLM/da-cpt9), [10](https://huggingface.co/BigFamTLLM/da-cpt10) | [1](https://huggingface.co/BigFamTLLM/da-cpt1-anneal), [2](https://huggingface.co/BigFamTLLM/da-cpt2-anneal), [3](https://huggingface.co/BigFamTLLM/da-cpt3-anneal), [4](https://huggingface.co/BigFamTLLM/da-cpt4-anneal), [5](https://huggingface.co/BigFamTLLM/da-cpt5-anneal), [6](https://huggingface.co/BigFamTLLM/da-cpt6-anneal), [7](https://huggingface.co/BigFamTLLM/da-cpt7-anneal), [8](https://huggingface.co/BigFamTLLM/da-cpt8-anneal), [9](https://huggingface.co/BigFamTLLM/da-cpt9-anneal), [10](https://huggingface.co/BigFamTLLM/da-cpt10-anneal) |
86
+ | Multilingual, embeddings only | [ml-emb](https://huggingface.co/BigFamTLLM/ml-emb) | [ml-emb-anneal](https://huggingface.co/BigFamTLLM/ml-emb-anneal) |
87
+ | Multilingual CPT checkpoints | [1](https://huggingface.co/BigFamTLLM/ml-cpt1), [2](https://huggingface.co/BigFamTLLM/ml-cpt2), [3](https://huggingface.co/BigFamTLLM/ml-cpt3), [4](https://huggingface.co/BigFamTLLM/ml-cpt4), [5](https://huggingface.co/BigFamTLLM/ml-cpt5), [6](https://huggingface.co/BigFamTLLM/ml-cpt6), [7](https://huggingface.co/BigFamTLLM/ml-cpt7), [8](https://huggingface.co/BigFamTLLM/ml-cpt8), [9](https://huggingface.co/BigFamTLLM/ml-cpt9), [10](https://huggingface.co/BigFamTLLM/ml-cpt10) | [1](https://huggingface.co/BigFamTLLM/ml-cpt1-anneal), [2](https://huggingface.co/BigFamTLLM/ml-cpt2-anneal), [3](https://huggingface.co/BigFamTLLM/ml-cpt3-anneal), [4](https://huggingface.co/BigFamTLLM/ml-cpt4-anneal), [5](https://huggingface.co/BigFamTLLM/ml-cpt5-anneal), [6](https://huggingface.co/BigFamTLLM/ml-cpt6-anneal), [7](https://huggingface.co/BigFamTLLM/ml-cpt7-anneal), [8](https://huggingface.co/BigFamTLLM/ml-cpt8-anneal), [9](https://huggingface.co/BigFamTLLM/ml-cpt9-anneal), [10](https://huggingface.co/BigFamTLLM/ml-cpt10-anneal) |
88
+
89
+ These are research models trained on web text. They can produce wrong or offensive output and are not meant for production use.