in-context learning (ICL)
A language model infers a new task on the fly from examples and instructions entered into the conversation, without retraining.
In plain terms
Imagine a new colleague arrives at the office, and you do not send them to a course, but simply show them three completed forms: "this is how we do it". The fourth one they fill out the same way on their own. In-context learning is the same for language models: from the examples and descriptions in your request, the model infers what you expect from it.
It is useful because it requires no programmer, expensive computer, or weeks of training. It is enough to formulate the task clearly and attach some examples or necessary background material. In this way, the same general model adapts to your style, your table, or your rules within minutes.
It differs from traditional training in that the model's "brain" does not change at all during the process. What it understood from the examples is valid only for that specific conversation: in the next, empty conversation, it will not remember unless provided again.
How it works
- The model acquired general pattern recognition capabilities during its training on vast amounts of prior text; this knowledge is fixed.
- You include the task description, a few examples, or the document to be used in your request (the prompt); together, these form the context.
- When generating a response, the model considers the entire context at once and recognizes patterns within it: what output corresponds to what input, in what tone and format.
- It continues this pattern for the new case, meaning it responds as if it had learned the task, even though its internal settings (weights) have not changed.
- When the conversation ends or the context clears, the 'learned' pattern disappears; you must provide it again the next time.
An everyday example
You enter three previous customer email replies into a chatbot, then ask it to respond to a fourth complaint in the same style. The reply matches your salutation, length, and tone, even though the model was never trained on your company's correspondence.
Who is affected
A common misconception
Limits and risks
- The context window is finite: anything that does not fit is cut off or not accepted. With very long texts, the model more easily overlooks certain details, especially those in the middle, and responses become slower and more expensive.
- The model imitates bad, one-sided, or flawed examples just as diligently as good ones.
- The result is sensitive to the selection and order of examples, so for important tasks it is worth trying several variants and checking the answer.
- With cloud-based services, everything you type into the context goes to the provider, so personal or confidential corporate data should only be provided as examples with caution.
Similar, but not the same
- fine-tuning – Fine-tuning permanently rewrites a model's internal settings with new training data. In-context learning only guides the unchanged model for the duration of that specific request.
- prompt writing – Prompt engineering is the craft of formulating the request. In-context learning is the model's capability that allows well-written prompts and examples to have an effect at all.
- memory – Memory stores data about you between conversations in a separate storage and restores it to the context when needed. Learning within the context alone is lost once the conversation ends.
Related concepts
few-shot learning, zero-shot learning, one-shot learning
A brief history
Even GPT-2 (2019) showed that a language model can solve tasks without separate training, purely based on the request. The phenomenon came into focus in 2020, when OpenAI researchers, in their study on the GPT-3 model, demonstrated that a sufficiently large language model can solve new tasks from just a few examples included in the request. This study widely popularized the term "in-context learning." Since then, researchers have been investigating exactly what happens inside the model during this process.
Where things stand
As of late 2026, this is a basic capability of every large language model, and everyday prompt writing, document-augmented answering and the operation of agents are built on it. Context windows have grown significantly, so entire manuals or codebases can now be provided as 'examples'.
In the news
- Fully automated excavators deployed on construction sites; Skild AI unveils S1 robot foundation modelAug 31, 2026 · Ipar
Also known as
in-context learning · in-context learning · in-context learning · ICL
Sources
- Brown et al. (2020): Language Models are Few-Shot Learners (the original GPT-3 paper)
- Garg et al. (2022): What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.