MORAIDICTIONNAIRE IA
Fondamentaux

In-Context Learning (ICL)

A model's ability to learn a task on the fly, purely from examples placed in the prompt.

Picture an assistant you show two or three worked examples to before asking your real question — and which, without ever being retrained, instantly grasps the pattern and reproduces it. That is exactly In-Context Learning (ICL): the ability of large language models to learn a task directly from the examples placed in the prompt, without any update to their weights.

Learning without retraining

Unlike fine-tuning, which actually modifies the model's parameters, ICL changes nothing. Everything happens at inference time: the provided examples (the demonstrations) condition the prediction. Three regimes are distinguished by the number of examples:

Regime Examples given Typical use
Zero-shot 0 Instruction only
One-shot 1 Convey the expected format
Few-shot 2 to ~50 Stabilize a complex pattern

How it works

The model estimates the most likely continuation conditioned on the entire supplied context:

$$ P(y \mid x, \; {(x_1, y_1), \dots, (x_k, y_k)}) $$

The example pairs act as an implicit template: the model infers the underlying rule, then applies it to the new input $x$. It is an emergent property, observed mainly at large scale.

Strengths and limits

In-context learning turns the prompt itself into a programming interface: you no longer reconfigure the model, you simply show it the example.

Explore the full AI dictionary →