Back to LLMs Mind Map
中文·English
LLMsID: pretrain-training-details

Pre-Training Objectives & Optimizer Details

训练目标与优化器细节
🎯Core Definition
The mainstream pretraining objective is Next-Token Prediction (autoregressive cross-entropy L=logP(xtx<t)L = -\sum \log P(x_t | x_{<t})); code models often use FIM (Fill-in-the-Middle): the document is split into prefix/suffix/middle, and with ~50% probability the model predicts the middle from both sides, learning bidirectional context. The optimizer standard is AdamW (β₁=0.9, β₂=0.95, weight decay=0.1) with gradient clipping (global norm 1.0) and a warmup + cosine LR schedule; on a loss spike, training rolls back to the last checkpoint before the spike and resumes.
💡Use Cases
pretraining and continued pretraining, code LLM training, debugging divergence or exploding gradients.
Key Problems Solved
pure next-token prediction cannot use right-side context, limiting code completion — FIM sees both sides and markedly boosts code continuation; β₂=0.95 decays the second-moment estimate faster than the standard 0.999, better matching LLM gradient scales, and wd=0.1's strong weight decay curbs overfitting; clipping at 1.0 prevents single-step gradient explosions; a loss spike can destroy hours of training, and the rollback strategy reduces the cost to re-running only the minutes before the spike.
🎯5 High-Frequency Exam Points
1
Next-Token vs FIM objectives? How are FIM samples constructed?
2
Why β₂=0.95 and wd=0.1 in AdamW? Difference from standard Adam?
3
Role & implementation of gradient clipping (global vs per-parameter norm)?
4
Causes of loss spikes and how the rollback strategy works?
5
How to design the LR schedule (warmup + cosine decay)?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Pre-Training Objectives & Optimizer Details"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardPre-Training Data EngineeringNext CardTokenization: BPE / WordPiece

🔗 More LLMs Knowledge Cards

Agent & Tool CallingAlignment Tax & Preference DataScaled Dot-Product AttentionAttention Variants MHA/MQA/GQA