ml-emb / README.md
brorjt's picture
Upload ml-emb
9c6b8b7 verified
|
Raw History Blame Contribute Delete
5.71 kB
metadata
language:
  - en
  - da
  - de
  - sv
  - 'no'
  - nb
  - nn
library_name: transformers
pipeline_tag: text-generation
base_model: BigFamTLLM/ml-base
base_model_relation: finetune
tags:
  - norwegian
  - bokmaal
  - nynorsk
  - qwen3
  - in5640
  - bigfamtllm

ml-emb

ml-base with its tokenizer replaced by our Norwegian 32k tokenizer, followed by 1,000 steps on Norwegian text where only the embeddings were trained. This is the starting point for the continued pretraining.

Trained from ml-base
Norwegian tokens seen 0.52B
Tokenizer Norwegian, 32k
Parameters 2.12B
Context length 4,096

Base model only, not instruction tuned.

Results

NorEval 1.1:

Task group Metric 0-shot 1-shot
nob_language em_first 0.086 0.092
nob_orthography acc 0.779 0.831
nob_reading f1 0.108 0.161
nob_world acc 0.268 0.274
nno_language em_first 0.081 0.101
nno_world acc 0.250 0.261

Robustness (noisy versions of three NorEval tasks): 0.318 on clean input, -0.029 on average under noise.

Usage

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("BigFamTLLM/ml-emb")
model = AutoModelForCausalLM.from_pretrained("BigFamTLLM/ml-emb", dtype=torch.bfloat16)

inputs = tokenizer("Oslo er hovedstaden i", return_tensors="pt")
output = model.generate(**inputs, max_new_tokens=30)
print(tokenizer.decode(output[0]))

Training

  • Qwen3 architecture: 36 layers, hidden size 2176, 34 attention heads (17 KV heads), tied embeddings.
  • 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).
  • Data from HPLT 4.0. The Norwegian mix is 85% Bokmål and 15% Nynorsk.
  • Tokenizer swap: tokens shared by both vocabularies keep their embedding, new tokens start from the mean of the old tokenizer's pieces.
  • Annealing: 916 steps (0.48B tokens) of high-quality Bokmål and Nynorsk, linear decay to 0.
  • Converted to Hugging Face format with Megatron-Bridge. The configs are adjusted so the model also loads in transformers 4.x.

Project

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:

As trained Annealed
Norwegian from scratch no-base no-base-anneal
Danish from scratch da-base da-base-anneal
Multilingual from scratch ml-base ml-base-anneal
Danish, embeddings only da-emb da-emb-anneal
Danish CPT checkpoints 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Multilingual, embeddings only ml-emb ml-emb-anneal
Multilingual CPT checkpoints 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

These are research models trained on web text. They can produce wrong or offensive output and are not meant for production use.