brorjt commited on
Commit
fa8d238
·
verified ·
1 Parent(s): ae70af9

Upload no-base

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 +46 -113
README.md CHANGED
@@ -9,7 +9,6 @@ tags:
9
  - norwegian
10
  - bokmaal
11
  - nynorsk
12
- - continual-pretraining
13
  - qwen3
14
  - in5640
15
  - bigfamtllm
@@ -17,120 +16,32 @@ tags:
17
 
18
  # no-base
19
 
20
- The **Norwegian model trained from scratch**: the reference of the experiment, pretrained for 49,600 iterations on Norwegian with its own Norwegian tokenizer.
21
 
22
  | | |
23
  |---|---|
24
- | Trained from | (random initialisation) |
25
- | Norwegian tokens read | 26,004,684,800 |
26
- | Data | Bokmål 85 %, Nynorsk 15 % (HPLT 4.0; the Nynorsk shards are repeated about 3.5 times) |
27
- | Tokenizer | Norwegian BPE, 32,000 tokens (Bokmål and Nynorsk; the team's `mix_BM7_2_NN8_1`) |
28
- | Parameters | 2,115,305,088 (2,045,673,088 without the tied embedding matrix) |
29
- | Context length | 4,096 tokens |
30
- | Type | base model (pretrained only: not instruction-tuned, not safety-tuned) |
31
 
32
- ## The experiment
33
 
34
- 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?
35
 
36
- 1. Three base models, identical except for language and tokenizer (same architecture, 26.0B tokens each): Norwegian, Danish, and multilingual without Norwegian.
37
- 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.
38
- 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.
39
- 4. Every checkpoint is evaluated as it is and after a short annealing on high-quality Norwegian data.
40
 
41
- | Stage | As trained | Annealed |
42
- |---|---|---|
43
- | Norwegian, from scratch (the reference) | [no-base](https://huggingface.co/BigFamTLLM/no-base) | [no-base-anneal](https://huggingface.co/BigFamTLLM/no-base-anneal) |
44
- | Danish, from scratch | [da-base](https://huggingface.co/BigFamTLLM/da-base) | [da-base-anneal](https://huggingface.co/BigFamTLLM/da-base-anneal) |
45
- | Multilingual (no Norwegian), from scratch | [ml-base](https://huggingface.co/BigFamTLLM/ml-base) | [ml-base-anneal](https://huggingface.co/BigFamTLLM/ml-base-anneal) |
46
- | Danish → Norwegian tokenizer, embeddings only | [da-emb](https://huggingface.co/BigFamTLLM/da-emb) | [da-emb-anneal](https://huggingface.co/BigFamTLLM/da-emb-anneal) |
47
- | 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) |
48
- | Multilingual → Norwegian tokenizer, embeddings only | [ml-emb](https://huggingface.co/BigFamTLLM/ml-emb) | [ml-emb-anneal](https://huggingface.co/BigFamTLLM/ml-emb-anneal) |
49
- | 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) |
50
-
51
- ## Training
52
-
53
- - 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.
54
- - 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.
55
- - 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.
56
- - 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).
57
- - 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.
58
- - 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.
59
-
60
- ## Evaluation
61
-
62
- NorEval 1.1 with lm-evaluation-harness (0 and 1 shot) and the team's robustness suite (noised versions of three NorEval datasets), run `20261102-174506`.
63
-
64
- - Parameters: 2,115,305,088 | perplexity on Norwegian text: 7.17
65
-
66
- ### NorEval 1.1, 0shot
67
-
68
-
69
- | Group | Metric | Score | Stderr |
70
- |---|---|---|---|
71
- | nob_language | em_first | 0.209 | 0.003 |
72
- | nob_orthography | acc | 0.839 | 0.013 |
73
- | nob_reading | f1 | 0.192 | 0.006 |
74
- | nob_world | acc | 0.292 | 0.002 |
75
- | nno_language | em_first | 0.398 | 0.021 |
76
- | nno_world | acc | 0.297 | 0.005 |
77
-
78
- Per dataset (primary metric of NorEval 1.1; one score per prompt variant):
79
-
80
- | Dataset | Metric | Mean over prompts | Best prompt | Prompts | Random |
81
- |---|---|---|---|---|---|
82
- | ncb | acc | 0.839 | 0.839 | 1 | 0.500 |
83
- | norbelebele | acc | 0.265 | 0.338 | 7 | 0.250 |
84
- | norcommonsenseqa_nno | acc | 0.244 | 0.358 | 5 | 0.200 |
85
- | norcommonsenseqa_nob | acc | 0.245 | 0.371 | 5 | 0.200 |
86
- | noridiom_nno | em_first | 0.398 | 0.584 | 5 | 0.000 |
87
- | noridiom_nob | em_first | 0.209 | 0.381 | 5 | 0.000 |
88
- | noropenbookqa_nno | acc | 0.258 | 0.311 | 5 | 0.250 |
89
- | noropenbookqa_nob | acc | 0.300 | 0.396 | 5 | 0.250 |
90
- | norquad | f1 | 0.192 | 0.252 | 5 | 0.000 |
91
- | nortruthfulqa_mc_nno | acc | 0.407 | 0.702 | 5 | 0.233 |
92
- | nortruthfulqa_mc_nob | acc | 0.432 | 0.736 | 5 | 0.232 |
93
- | nrk_quiz_qa_nno | acc | 0.299 | 0.433 | 5 | 0.279 |
94
- | nrk_quiz_qa_nob | acc | 0.294 | 0.388 | 5 | 0.284 |
95
-
96
- ### NorEval 1.1, 1shot
97
-
98
-
99
- | Group | Metric | Score | Stderr |
100
  |---|---|---|---|
101
- | nob_language | em_first | 0.230 | 0.003 |
102
- | nob_orthography | acc | 0.874 | 0.011 |
103
- | nob_reading | f1 | 0.205 | 0.006 |
104
- | nob_world | acc | 0.296 | 0.002 |
105
- | nno_language | em_first | 0.458 | 0.021 |
106
- | nno_world | acc | 0.310 | 0.005 |
107
-
108
- Per dataset (primary metric of NorEval 1.1; one score per prompt variant):
109
-
110
- | Dataset | Metric | Mean over prompts | Best prompt | Prompts | Random |
111
- |---|---|---|---|---|---|
112
- | ncb | acc | 0.874 | 0.874 | 1 | 0.500 |
113
- | norbelebele | acc | 0.270 | 0.341 | 7 | 0.250 |
114
- | norcommonsenseqa_nno | acc | 0.248 | 0.368 | 5 | 0.200 |
115
- | norcommonsenseqa_nob | acc | 0.248 | 0.383 | 5 | 0.200 |
116
- | noridiom_nno | em_first | 0.458 | 0.618 | 5 | 0.000 |
117
- | noridiom_nob | em_first | 0.230 | 0.431 | 5 | 0.000 |
118
- | noropenbookqa_nno | acc | 0.264 | 0.311 | 5 | 0.250 |
119
- | noropenbookqa_nob | acc | 0.294 | 0.385 | 5 | 0.250 |
120
- | norquad | f1 | 0.205 | 0.273 | 5 | 0.000 |
121
- | nortruthfulqa_mc_nno | acc | 0.432 | 0.719 | 5 | 0.233 |
122
- | nortruthfulqa_mc_nob | acc | 0.411 | 0.789 | 5 | 0.232 |
123
- | nrk_quiz_qa_nno | acc | 0.313 | 0.459 | 5 | 0.279 |
124
- | nrk_quiz_qa_nob | acc | 0.303 | 0.398 | 5 | 0.284 |
125
-
126
- ### Robustness (acc_norm; change vs. clean in brackets)
127
-
128
- | Dataset | clean | typo10 | typo25 | aeoa | nynorsk | swedish | danish | english | distractor | misleading |
129
- |---|---|---|---|---|---|---|---|---|---|---|
130
- | belebele | 0.301 | 0.290 (-0.011) | 0.301 (+0.000) | 0.296 (-0.006) | 0.306 (+0.004) | 0.302 (+0.001) | 0.296 (-0.006) | 0.298 (-0.003) | 0.311 (+0.010) | 0.092 (-0.209) |
131
- | commonsense | 0.434 | 0.414 (-0.020) | 0.406 (-0.028) | 0.420 (-0.014) | 0.437 (+0.003) | 0.439 (+0.005) | 0.437 (+0.003) | 0.431 (-0.003) | 0.380 (-0.054) | 0.087 (-0.347) |
132
- | nrkquiz | 0.373 | 0.364 (-0.009) | 0.357 (-0.016) | 0.363 (-0.010) | 0.376 (+0.003) | 0.370 (-0.003) | 0.367 (-0.006) | 0.363 (-0.010) | 0.371 (-0.002) | 0.050 (-0.323) |
133
- | mean change | – | -0.013 | -0.015 | -0.010 | 0.003 | 0.001 | -0.003 | -0.005 | -0.015 | -0.293 |
134
 
135
  ## Usage
136
 
@@ -138,13 +49,35 @@ Per dataset (primary metric of NorEval 1.1; one score per prompt variant):
138
  import torch
139
  from transformers import AutoModelForCausalLM, AutoTokenizer
140
 
141
- repo = "BigFamTLLM/no-base"
142
- tokenizer = AutoTokenizer.from_pretrained(repo)
143
- model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16)
144
  inputs = tokenizer("Oslo er hovedstaden i", return_tensors="pt")
145
- print(tokenizer.decode(model.generate(**inputs, max_new_tokens=30)[0]))
 
146
  ```
147
 
148
- ## Limitations
149
 
150
- 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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  - norwegian
10
  - bokmaal
11
  - nynorsk
 
12
  - qwen3
13
  - in5640
14
  - bigfamtllm
 
16
 
17
  # no-base
18
 
19
+ Norwegian model trained from scratch on 26B tokens of Bokmål and Nynorsk with our own 32k tokenizer. This is the reference model of the project.
20
 
21
  | | |
22
  |---|---|
23
+ | Trained from | scratch |
24
+ | Norwegian tokens seen | 26.00B |
25
+ | Tokenizer | Norwegian, 32k |
26
+ | Parameters | 2.12B |
27
+ | Context length | 4,096 |
 
 
28
 
29
+ Base model only, not instruction tuned.
30
 
31
+ ## Results
32
 
33
+ NorEval 1.1:
 
 
 
34
 
35
+ | Task group | Metric | 0-shot | 1-shot |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  |---|---|---|---|
37
+ | nob_language | em_first | 0.209 | 0.230 |
38
+ | nob_orthography | acc | 0.839 | 0.874 |
39
+ | nob_reading | f1 | 0.192 | 0.205 |
40
+ | nob_world | acc | 0.292 | 0.296 |
41
+ | nno_language | em_first | 0.398 | 0.458 |
42
+ | nno_world | acc | 0.297 | 0.310 |
43
+
44
+ Robustness (noisy versions of three NorEval tasks): 0.369 on clean input, -0.039 on average under noise.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  ## Usage
47
 
 
49
  import torch
50
  from transformers import AutoModelForCausalLM, AutoTokenizer
51
 
52
+ tokenizer = AutoTokenizer.from_pretrained("BigFamTLLM/no-base")
53
+ model = AutoModelForCausalLM.from_pretrained("BigFamTLLM/no-base", dtype=torch.bfloat16)
54
+
55
  inputs = tokenizer("Oslo er hovedstaden i", return_tensors="pt")
56
+ output = model.generate(**inputs, max_new_tokens=30)
57
+ print(tokenizer.decode(output[0]))
58
  ```
59
 
60
+ ## Training
61
 
62
+ - Qwen3 architecture: 36 layers, hidden size 2176, 34 attention heads (17 KV heads), tied embeddings.
63
+ - 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).
64
+ - Data from HPLT 4.0. The Norwegian mix is 85% Bokmål and 15% Nynorsk.
65
+ - Tokenizer swap: tokens shared by both vocabularies keep their embedding, new tokens start from the mean of the old tokenizer's pieces.
66
+ - Annealing: 916 steps (0.48B tokens) of high-quality Bokmål and Nynorsk, linear decay to 0.
67
+ - Converted to Hugging Face format with Megatron-Bridge. The configs are adjusted so the model also loads in transformers 4.x.
68
+
69
+ ## Project
70
+
71
+ 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:
72
+
73
+ | | As trained | Annealed |
74
+ |---|---|---|
75
+ | Norwegian from scratch | [no-base](https://huggingface.co/BigFamTLLM/no-base) | [no-base-anneal](https://huggingface.co/BigFamTLLM/no-base-anneal) |
76
+ | Danish from scratch | [da-base](https://huggingface.co/BigFamTLLM/da-base) | [da-base-anneal](https://huggingface.co/BigFamTLLM/da-base-anneal) |
77
+ | Multilingual from scratch | [ml-base](https://huggingface.co/BigFamTLLM/ml-base) | [ml-base-anneal](https://huggingface.co/BigFamTLLM/ml-base-anneal) |
78
+ | Danish, embeddings only | [da-emb](https://huggingface.co/BigFamTLLM/da-emb) | [da-emb-anneal](https://huggingface.co/BigFamTLLM/da-emb-anneal) |
79
+ | 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) |
80
+ | Multilingual, embeddings only | [ml-emb](https://huggingface.co/BigFamTLLM/ml-emb) | [ml-emb-anneal](https://huggingface.co/BigFamTLLM/ml-emb-anneal) |
81
+ | 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) |
82
+
83
+ These are research models trained on web text. They can produce wrong or offensive output and are not meant for production use.