In-context learning
In-context learning is when a language model adapts its behaviour from examples shown in the prompt — no weights change, no fine-tuning.
In-context learning (ICL) is the foundation of every prompting technique that supplies demonstrations. Few-shot prompting is the most common form. The model uses the examples as a soft specification of the task and generalises from them at inference time. ICL works because pretrained models have learned to model the underlying distribution well enough that a handful of examples shifts their behaviour meaningfully. Long-context models (Gemini 2 Pro, Claude with long context) now support 'many-shot' ICL — hundreds of examples — which can approach fine-tune quality for narrow tasks without changing weights.
When to use in-context learning
- Steering tone, format, or domain-specific style.
- When you cannot fine-tune (closed model, low data).
- Tasks with edge cases that zero-shot keeps missing.
Common mistakes
- Using non-representative examples.
- Forgetting that ICL is sensitive to example ORDER, not just content.
FAQ
What is in-context learning?
In-context learning is when a language model adapts its behaviour from examples shown in the prompt — no weights change, no fine-tuning.
When should I use in-context learning?
Steering tone, format, or domain-specific style. When you cannot fine-tune (closed model, low data). Tasks with edge cases that zero-shot keeps missing.
What are the most common mistakes with in-context learning?
Using non-representative examples. Forgetting that ICL is sensitive to example ORDER, not just content.
Related terms
- Few-shot prompting — Few-shot prompting supplies 2–10 input–output examples inside the prompt so the model imitates the pattern on a new input.
- Zero-shot prompting — Zero-shot prompting asks the model to perform a task with no examples — only the instruction and the input.
- System prompt — A system prompt is the high-priority instruction block that defines a model's role, constraints, and default behaviors for an entire conversation.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/in-context-learning.md.