← Back to concept explainers

Concept Fable

In-context learning

Conclusion first:In-Context Learning is the model's ability to temporarily adjust its behavior based on instructions, examples, and context in the prompt, without updating model weights. Few-shot, format examples, counterexamples, and task descriptions all make use of this ability. When enterprise Agents use In-Context Learning, the key lies in example selection, order, coverage, boundary descriptions, and evaluation; bad examples teach the model wrong patterns, and too many examples consume the context budget.

In-Context Learning · LLM Interaction

Read the story first. There is no rush to give a definition here; let the question grow on its own first.

Fable

The scribe who can copy after seeing three sample drafts

A new clerk arrived at the county office, with no time to start apprenticeship all over again. The secretary placed before him the official documents to be written that day, three old sample drafts, and a few rules, and said to handle it along these lines.

The scribe did not change the foundation of his craft, yet he could discern format, tone, trade-offs, and taboos from the sample drafts. The first notice was written presentably, and the master was very satisfied.

Later, as tasks increased, the secretary began casually stuffing in sample drafts. Some came from old systems, some were merely drafts, and some were similar to the current case but differed in key conditions. The scribe still learned the patterns in front of him, but what he learned was not necessarily correct.

Once he saw that three sample drafts all put the compensation reason at the end, so he did the same for a new case. But the new case needed to explain the risk first, otherwise the client would misunderstand. The samples taught the form but did not tell him the applicable boundaries.

The clerk first added a line about handling things flexibly. The scribe became even more wavering: sometimes following the sample draft, sometimes following instructions, sometimes treating an accidental wording as a mandatory rule. The vaguer the reminder, the more misreading on the spot.

Later, the secretary selected sample drafts again. Each sample draft covered a key situation and marked the input, output, basis for judgment, and what should not be imitated. The current case's objective was also placed before the sample drafts.

The scribe began to steadily borrow patterns: what was the same was the structure, what differed was the facts; what was transferable was the judgment criteria, what was not transferable was the details of old cases. The sample drafts were few but on time, and he performed as if he had temporarily learned a small set of rules.

The county office did not retrain the clerk, yet let him quickly adapt to a new task within the current materials. The adviser also remembered that examples placed in front of him would change how he wrote this time, so the examples had to be clean, relevant and bounded. Later the adviser kept a few bad drafts as well, but clearly wrote beside them what not to learn. When the clerk saw a similar case, he first compared the conditions, then borrowed the format. The materials in front of him were like a temporary little classroom set up on his desk; set up well, it could speed things up, but set up messily, it would teach the wrong method too. Later the clerk wrote faster, and the adviser became even more cautious about arranging materials. Because he knew that every sheet on the desk could temporarily change the clerk's choices this time. Later, during the review, everyone wrote this lesson into the daily rules: first see where on site the result was truly changed, then decide what to keep, what to repair and what to restrict.

Reveal

This story is about: in-context learning

In-Context Learning is the model's ability to temporarily adjust its behavior based on instructions, examples, and context in the prompt, without updating model weights. Few-shot, format examples, counterexamples, and task descriptions all make use of this ability. When enterprise Agents use In-Context Learning, the key lies in example selection, order, coverage, boundary descriptions, and evaluation; bad examples teach the model wrong patterns, and too many examples consume the context budget.

What matters is that it is not just a term, but a structural problem that repeatedly appears in real AI / Agent systems. Understanding it lets you judge when to add a model, when to change a process, and when to add governance.

Metaphor mapping

  • Scribe: the pretrained model
  • Three sample drafts: examples or demonstrations in the prompt
  • Did not take a new master: did not update the model weights
  • Old system sample: context examples that do not fit the current task
  • Mark the inputs, outputs, and basis for judgment: high-quality in-context example design
  • The goal of the current case is placed up front: the context organization of instructions and examples
  • Final insight: In-Context Learning is when a model temporarily absorbs a task pattern in the current context

Andy Ren Xu's judgment

The practical value of this concept is that it helps you break "AI features that look smart" into deliverable, verifiable, and governable units of work.

few-shot promptingpromptdemonstrationcontext window

Related distinctions

This concept is easily confused with adjacent concepts; it is recommended to continue to the comparison page.

京ICP备2026014272号