Pre-training, code and reasoning
×Stage · GLM-5
A corpus of code, mathematics and science, 9T tokens at a 4K context: code and reasoning come early in training.
Next-token prediction
In words
At every position the model gives each token of the vocabulary a probability of coming next; the loss is the negative logarithm of the probability it gave the token that does come next, averaged over the sequence.
: the token at position ; : the probability the model, reading the tokens before it, gave that token; : the sequence length.
- Multi-token prediction. Extra modules predict tokens further ahead than the next one, and their cross-entropy, times a weight λ, is added to the loss.
Next-token prediction as drawn for DeepSeek‑V3.2‑Exp →That plate also draws multi-token prediction, fill-in-the-middle and DeepSeek-V3’s sequence-wise balance loss.
- Tokens
- 9T
- Context
- 4K
Not disclosed Batch · Steps
Architecture at this stageThe model as drawn but with dense MLA attention, no indexer.
All settings7
- Tokens
- 9T, the code and reasoning corpus
- Context
- 4K
- Data
- Code from refreshed snapshots of code hosts and code-bearing web pages, 28% more unique tokens after fuzzy deduplication, with quality-aware sampling and classifiers for low-resource languages; mathematics and science from web pages, books and papers, scored by language models, with no synthetic or AI-generated dataThe report describes this data without naming its stage; it is placed here by the corpus names of Figure 5 (p. 4).
- Objective
- Next-token prediction, with multi-token prediction: three MTP layers that share their parameters during training
- Learning rate
- Warm-up from 0 to 2×10⁻⁴, then decay to 4×10⁻⁵ by the end of pre-training; cosine decay and a batch-size warm-up as for GLM-4.5
- Optimizer
- Muon, as for GLM-4.5, with “Muon Split”: the up-projections of queries, keys and values are orthogonalized head by head; attention logits stay stable with no clipping
- Trainable
- Every parameter
Sources4
- GLM5-2602.15763v2.pdf, p. 4Tokens, Context, Trainable
- GLM5-2602.15763v2.pdf, p. 8Data
- GLM5-2602.15763v2.pdf, p. 5Objective, Optimizer
- GLM5-2602.15763v2.pdf, p. 36Learning rate, Optimizer