Pretraining vs fine-tuning: two key differences in data and objective.
Pretraining and fine-tuning both run the same underlying next-token loss on a transformer. So what actually distinguishes them? Name at least two key differences, one about the data, one about the training setup, and briefly explain why those differences exist.
Same next-token loss, totally different data and training setup. Pretraining: trillions of raw tokens, high LR, months. Fine-tuning: thousands of curated demos, low LR, hours.
Picture a person learning a language by reading every book and webpage they can get their hands on for a decade. They end up fluent but a bit unfocused. That is pretraining. Now picture the same person spending a single weekend with a tutor practising how to politely answer customer-support emails. The tutor does not teach them new vocabulary or grammar; the tutor teaches them style, tone, and which formats to use. That weekend is fine-tuning. The same brain, the same language, just a tiny bit of shaping on top. Same skill underneath, fresh manners on top. The decade builds the knowledge; the weekend installs the behaviour.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
6 min: same loss but different worlds + data shape and volume gap + LR and duration gap + loss masking in SFT + catastrophic forgetting + when each is the right tool.
| Dimension | Pretraining | Fine-tuning |
|---|---|---|
| Data volume | Trillions of tokens | Thousands to low millions of examples |
| Data shape | Raw text, no labels | Structured demos, often chat-formatted |
| Learning rate | 1e-4 to 6e-4 | 1e-5 to 2e-5 full, 1e-4 LoRA |
| Duration and hardware | Months on thousands of GPUs | Hours to days on tens of GPUs |
| Loss masking | Every token contributes | Prompt masked, response only |
| What changes | World knowledge built from scratch | Behaviour, format, style |
Real products, models, and research that use this idea.
- Llama 4 Maverick was pretrained on roughly 30T tokens at peak LR 3e-4, then SFT-fine-tuned on a curated dataset around 1e-5.
- DeepSeek V4 publishes its pretraining LR schedule (warmup + cosine to 1e-4) and its post-training LR (around 2e-5), illustrating the standard order of magnitude gap.
- OpenAI fine-tuning endpoints default to a learning rate multiplier around 0.1 relative to the base model's pretraining LR, a heuristic that mirrors the same gap.
- The Tulu and Zephyr open-weight families showed that 1-10k high-quality SFT examples at low LR can install instruction-following on a strong base model.
- Hugging Face TRL's SFTTrainer applies prompt masking by default, computing loss only on assistant turns when given a chat-format dataset.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does a high learning rate cause catastrophic forgetting during fine-tuning?
QWhy does SFT mask the prompt tokens from the loss?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Claiming pretraining and fine-tuning use different loss functions. They run the same next-token cross-entropy; what changes is the data, the learning rate, the duration, and which tokens contribute to the loss.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.