In-Context Learning
The ability of large language models to learn new tasks from examples provided directly in the prompt, without any model retraining or fine-tuning. You include a few input-output examples in your prompt, and the model generalizes the pattern to handle new inputs. In-context learning is what makes AI agents adaptable: a support agent can learn your company's response style from 3-5 examples, a sales agent can match your email tone from a few samples, and a coding agent can follow your project's conventions from example code.
Example
A sales agent prompt includes 3 examples of emails that got replies from enterprise prospects. The agent generalizes the pattern—short subject lines, specific pain points, clear CTA—and applies it to new prospects without any model training.
Frequently asked questions
- How is in-context learning different from fine-tuning?
- In-context learning happens at inference time through prompt examples—no training required, changes are instant, and you pay per-token for the examples. Fine-tuning modifies the model's weights through a training process—it's slower to set up, costs more upfront, but doesn't consume context window space at inference time. Use in-context learning for quick adaptation; fine-tuning for deep behavioral changes.