In-context learning vs Fine-tuning
Adapt in the prompt, or adapt in the weights
In-context learning adapts at inference by putting examples in the prompt; fine-tuning adapts by updating weights. Reach for prompting first; fine-tune when you cannot get there.
In-context learning
Glossary →Teach the model at inference time by including examples in the prompt (few-shot) or a well-crafted instruction. No weight updates, no training run, no separate checkpoint.
Best for: Fast iteration and formats that keep changing.
Fine-tuning
Glossary →Update the model's weights on a curated dataset. The learned behavior is baked into the checkpoint and does not have to be re-explained each request. LoRA and full fine-tuning are the common variants.
Best for: Stable formats at high query volume.
At a glance
| Dimension | In-context learning | Fine-tuning |
|---|---|---|
| Where learning lives | Prompt (inference-time) | Weights (training-time) |
| Iteration speed | Minutes | Hours to days |
| Cost profile | Per-query input tokens | One-time train + serve |
| Ships in | Prompt template | Model checkpoint |
| Handles rare edge cases | Yes (add an example) | Only if in training data |
| Best for | Ambiguous format, iteration | Stable format, high volume |
Key differences
- 1ICL happens at inference; fine-tuning happens at training time
- 2ICL costs per-query context tokens; fine-tuning costs a training run once
- 3Fine-tuning ships behavior in the checkpoint; ICL ships it in the prompt template
- 4Iteration on prompts is minutes; iteration on fine-tunes is hours to days
- 5At high volume, moving a stable pattern from prompt to weights saves a lot of tokens
In the interview
- Fine-tuning as a default reflex before trying prompting
- Claiming fine-tuning teaches new facts (weights are unreliable for factual recall)
- Ignoring that fine-tuning locks the format
- Missing that ICL scales up to the context window ceiling
How to choose
Start with prompting. Fine-tune when the format is stable and per-query cost matters.
Common misconceptions
Myth: Fine-tuning is always better on domain data.
Reality: RAG plus few-shot usually beats fine-tuning on the same dataset and budget for factual recall. Fine-tuning wins on behavior and format, not on knowledge.
Myth: In-context learning does not scale.
Reality: It scales fine up to the context-window ceiling and iterates far faster than any fine-tune loop.
Memory aid
ICL is showing three examples before each task; fine-tuning is teaching until the model remembers.
Can you combine them?
The mature pattern is both: fine-tune for the behavior and format, and rely on ICL in the prompt for the last-mile edge cases and per-user personalization.
Related topics
Related comparisons
Chain-of-thought vs Tree-of-thought
Linear step by step reasoning vs branching search
DDP vs FSDP vs ZeRO
Three ways to shard distributed LLM training across GPUs
Distillation vs Quantization
Two orthogonal ways to shrink a large language model
DPO vs PPO
Direct Preference Optimization vs Proximal Policy Optimization for RLHF
LoRA vs Full Fine-tuning
Parameter-efficient adaptation vs updating all model weights
RAG vs Fine-tuning
Two approaches to giving LLMs domain specific knowledge