Pre-training 4K
×Pre-training starts at a sequence length of 4K, with dense attention.
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.
- Fill-in-the-middle. Inherited from DeepSeek-V3; the V4 report gives no rate.
- Multi-token prediction. Depth 1 (); is 0.3 for most of training and 0.1 once the learning rate starts to decay.
- Balance loss. Only a complement here, with : the load is balanced mainly with no loss, by biases moved at a speed of 0.001.
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, all pre-training
- 33T
- Context
- 4K
- Learning rate
- peak 2.0 × 10⁻⁴, end 2.0 × 10⁻⁵
- Batch
- up to 94.4M tokens
- Optimizer
- Muon; AdamW for embedding, head, RMSNorm
Not disclosed Tokens · Steps
Why
Loss spikes came with outliers in the MoE layers, which routing appears to amplify; computing the routing from earlier parameters (θ at step t − Δt) breaks that cycle, and clamping SwiGLU removes the outliers. DeepSeek-V4 report §4.2.3, p. 26
Architecture at this stageThe model as drawn with dense attention: CSA attends to every compressed entry; one MTP module trains beside it.
What the terms meanMuon
- Muon
- An optimizer for weight matrices: it keeps a momentum of the gradients and replaces each matrix’s momentum by its nearest orthogonal matrix (a few Newton–Schulz iterations), so every direction of the matrix is updated by a similar amount.
All settings12
- Tokens, all pre-training
- 33T tokens for V4-Pro (32T for V4-Flash), from a corpus of more than 32T tokens
- Data
- DeepSeek-V3’s pre-training data, refined: auto-generated and templated web content filtered out; mathematics and code; a larger multilingual corpus; long documents such as scientific papers and technical reports; agentic data added in a mid-training phase the report does not place
- Packing
- Documents from different sources packed to minimize truncation, with sample-level attention masking; DeepSeek-V3’s tokenizer and vocabulary of 128K with a few special tokens added; its token-splitting and fill-in-the-middle kept
- Objective
- Next-token prediction with multi-token prediction of depth 1 (loss weight 0.3 for most of training, 0.1 once the learning rate decays) and fill-in-the-middle, as in DeepSeek-V3
- Load balancing
- Auxiliary-loss-free, bias update speed 0.001; a sequence-level balance loss of weight 0.0001
- Optimizer
- Muon for most parameters (momentum 0.95, weight decay 0.1, update RMS rescaled to 0.18); AdamW for the embedding, the prediction head and the RMSNorm weights (β₁ 0.9, β₂ 0.95, ε 10⁻²⁰, weight decay 0.1); the same values as V4-Flash
- Learning rate
- Peak 2.0 × 10⁻⁴, ending at 2.0 × 10⁻⁵ by a cosine decay near the end; largely V4-Flash’s schedule, a linear warm-up over the first 2,000 steps and the peak held for most of training
- Batch
- Scheduled up from a small size to at most 94.4M tokens
- Stability
- SwiGLU clamped throughout, its linear part to [−10, 10] and its gate to at most 10; on a loss spike, a short rollback and Anticipatory Routing, routing indices computed from earlier parameters, for a while
- Trainable
- Every parameter
- Context
- 4K at the start
- Attention
- DensederivedV4-Pro “starts with a longer stage of dense attention” than V4-Flash, which is dense for its first 1T tokens and brings sparse attention in at a sequence length of 64K; the report says V4-Pro introduces it by the same strategy, and does not say at which length its dense stage ends.
Sources5
- DeepSeek-V4-2606.19348v1.pdf, p. 5Tokens, all pre-training
- DeepSeek-V4-2606.19348v1.pdf, p. 24Tokens, all pre-training, Data, Packing, Objective
- DeepSeek-V4-2606.19348v1.pdf, p. 25Tokens, all pre-training, Objective, Optimizer, Learning rate, Batch, Trainable, Context, Attention
- DeepSeek-V4-2606.19348v1.pdf, p. 4Objective
- DeepSeek-V4-2606.19348v1.pdf, p. 26Objective, Load balancing, Stability, Attention