Skip to content
See How AI Works
← All explainers

Plain-language explainer

In-context learning, explained

How can a model learn from examples in the prompt without being retrained?

Put three examples of a task in your prompt and the model performs the fourth in the same pattern, with zero weight changes. That is in-context learning. It works because pretraining relentlessly rewarded continuing patterns, so pattern-following became one of the model's strongest reflexes. The learning is real but rented: it exists only inside the current context window, and it vanishes the moment the conversation ends.

Do not just read it. Operate the mechanism yourself in a short interactive lesson.

See it work: In-context learning: teaching without training β†’

Free, no code, no signup.

What people get wrong

  • The model permanently learned from my examples. Next conversation, they are gone. Only the context carried them.
  • Few-shot prompting is a form of training. No gradient, no weight change. It is pattern completion at inference time.
  • More examples always help. They spend context tokens, and inconsistent examples teach the wrong pattern.

Where you see it in real products

  • 'Here are three examples of our tone' system prompts run on this.
  • Formula-by-example features in spreadsheets are the same reflex.
  • Paste a writing sample and the model mimics it: in-context learning, live.

Related explainers

Part of See How AI Works, a free interactive course, where you learn how modern AI works by operating it, not watching videos.