AI GLOSSARY · AI CONCEPTS
In-context learning (ICL)
Definition
In-context learning is a language model picking up a task from instructions and examples written in its prompt, with no retraining. The model's weights do not change, and the effect lasts only for that prompt.
Also called: ICL, in context learning, ICL LLM, in-context learning LLM, in-context learning in LLMs.
In plain language
In-context learning means showing an AI what you want inside your message instead of training it beforehand. If you paste three emails with the tone you like and ask for a fourth, the model tends to match the pattern. It is like handing a colleague a few finished samples and asking for one more. Nothing is saved: start a new conversation and the model has forgotten the samples. IBM notes that results can change noticeably when you alter the number, order or format of the examples, and that the technique can struggle in specialised fields such as law or medicine.
Technical definition
In-context learning is the ability of a pre-trained language model to infer a task from demonstrations and instructions placed in its input and to apply the same input-to-output mapping to a new input. The GPT-3 paper (Brown et al., arXiv 2005.14165) applies the model to tasks using only text interaction, with no gradient updates or fine-tuning. IBM states that the model does not update its weights during the process; the examples act as temporary guidance inside the context window. IBM also reports sensitivity to the number, order and formatting of examples, and stronger in-context ability in larger models. IBM lists zero-shot, one-shot and few-shot prompts, which differ in how many examples they include.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Guide · Illustrative, not executed
Prompt Engineering for Agents vs Chat Models
- What you see
- The guide lists pitfalls of agent prompts, including that an agent copies a flaw from an example, and says to use 3 to 5 examples inside example tags, following Anthropic's prompting guidance.
- Why it exercises the concept
- Examples in a prompt are in-context learning in practice, and the guide shows both the benefit and the way a flawed example gets copied.
Skill by Skill Almanac · Illustrative, not executed
regex-from-labeled-examples 37/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A Python regular expression proposed from labeled match and non-match strings, then proven against every supplied example in a row-by-row table.
- Why it exercises the concept
- The input is a set of labelled examples, as in a few-shot prompt. The skill then checks the answer against every example, which is the check that a model's pattern-matching on examples does not give you.
Skill by Skill Almanac · Illustrative, not executed
prompt-writing 57/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- A prompt written with a fixed structure and linted for gaps, with injection rules and a numeric test plan.
- Why it exercises the concept
- Because results can shift with the wording and the examples, a prompt needs a test plan. This skill ties prompt changes to a test.
Coding tool · Illustrative, not executed
Claude Code
- What to try
/context- What you see
- Claude Code shows what is currently occupying the session's context.
- Why it exercises the concept
- In-context learning works only on what is in the context window. This command lets you see what the model is being given before you add more examples.
How it shows up when you use agents
When you give a coding agent a sample, you are using in-context learning. A pasted function that shows your naming style, a test file offered as the model to follow, or a rule plus two examples in a project instruction file all work this way. The context window holds them, and the model adapts its answer to the pattern without any retraining. The prompt-level versions are few-shot prompting and, with no examples, zero-shot learning.
What breaks when it is misunderstood: people think the agent has learned their style for good. It has not. IBM states that the model does not update its weights during the process, so a new session starts from nothing unless the examples are loaded again, for instance through a project instruction file. A second failure is a bad example. The prompt engineering guide for agents warns that an agent copies a flaw from an example. A third is overloading: examples occupy space in the window.
Next action: choose two or three clean, representative examples, put them where the agent reads them at the start of each session, and check one output against your standard. If results are inconsistent, change the order or format of the examples before adding more, since IBM reports that these affect results. Consider fine-tuning only if prompt-level examples cannot carry the task.
Common confusions
- In-context learning versus fine-tuning. In-context learning changes the input and leaves the weights alone. Fine-tuning changes the weights. See Fine-tuning.
- Learning versus remembering. The word learning here means adapting inside one prompt. It is not memory across sessions.
- Examples versus instructions. A prompt can carry a written instruction, examples, or both. The GPT-3 paper describes tasks specified purely through text interaction.
- Few examples versus no examples. Zero-shot, one-shot and few-shot prompts differ in how many examples they contain, not in the mechanism.
Related terms
Terms that mention In-context learning (ICL)
1 terms mention this one
More in AI concepts
Sources
- Language Models are Few-Shot Learners, arXiv (Brown et al.) (accessed 2026-11-24)
- What is in-context learning?, IBM (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.
Review record
Last verified
Drafted by claude-sonnet-5-5; sources and example targets checked by claude-haiku-5-5 source check; claude-sonnet-5-5 editor pass on 2026-11-24. Last verified .
This entry is still in review, so it is not listed in search engines yet.
Change log (2)
- : First version.
- : Verifier pass: removed absolute, aligned shot types with IBM.