From Copying to Composition: How Language Models Develop In-Context Learning
Organizations: Scale AI · University of Arizona
Abstract
In-context learning (ICL) allows language models to adapt their behavior from instructions and demonstrations in a prompt, but accuracy alone does not reveal how contextual information controls their predictions. We study the acquisition and trainability of ICL with a controlled diagnostic that separates copying a nearby demonstration from integrating information across the prompt. Across 17 models, about a third prefer the copied answer, a few are undecided, and the rest prefer the rule-consistent answer, which goes with higher accuracy and with control by the requested value rather than the closest conflicting example. Checkpoint analyses show that models begin prioritizing task-relevant prompt tokens over conflicting examples long before their accuracy improves beyond chance level. In matched training experiments, synthetic documents that define endings and then query them shift models toward compositional responses on the controlled diagnostic, whereas fine-tuning on definition exercises built from rewritten real documents improves accuracy when prompts reassign label meanings. The results suggest that ICL is not acquired as a single, uniform capability. Instead, prompt control, answer preference, construction without candidates, and transfer can develop along distinct trajectories.
Figures & tables
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| measure (threshold) | crossing [95% interval] |
|---|---|
| OLMo-2-7B | |
| copy the stem ( ) | 11B [10, 12] |
| first feature correct ( ) | 76B [66, 88] |
| second feature correct ( ) | 338B [254, 480] |
| shown combinations, exact generation ( ) | 224B [143, 293] |
| held-out, four-choice accuracy ( ) | 1,464B [1,270, 1,675] |
| generations | ||||||
|---|---|---|---|---|---|---|
| Model | ranks first | correct | copied | other | one ending | |
| Pythia 410M | .91 | .03 | .01 | .13 | .30 | .56 |
| Qwen2.5 0.5B | .86 | .01 | .00 | .07 | .18 | .75 |
| Pythia 6.9B | .83 | .03 | .01 | .35 | .30 | .34 |
| Pythia 12B | .80 | .07 | .03 | .47 | .16 | .33 |
| Pythia 1.4B | .75 | .05 | .01 | .19 | .42 | .38 |
| closest example | question words | controls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Model | (unblocked) | ending | two lines | asked | other | unrelated | single-feature lines | their endings | [95% interval] | |
| Qwen2.5 0.5B ‡ | .88 | – | – | – | – | – | – | |||
| Pythia 12B | .84 | |||||||||
| Pythia 1.4B | .81 | |||||||||
| Pythia 2.8B | .79 | |||||||||
| OLMo-2 1B | .62 | † | † | † | ||||||
| Model | full | closest example | correct-ending lines | unrelated lines |
|---|---|---|---|---|
| Pythia 1.4B | ||||
| Pythia 2.8B | ||||
| Qwen3 0.6B | ||||
| OLMo-2 7B | ||||
| OLMo-2 13B | ||||
| Qwen3 1.7B |
| Released model | correct ranks first (of 320) | writes correct | closest ending | source | ||
| Marin-8B-Base † | 283 (0.88) | .62 | .02 | Marin Community (2025) | ||
| Comma-v0.1-1T † | 277 (0.87) | .50 | .06 | Kandpal et al. (2025) | ||
| SmolLM3-3B † | 271 (0.85) | .54 | .10 | Hugging Face (2025) | ||
| OLMo-3-7B † | 265 (0.83) | .43 | .05 | Team Olmo (2026) | ||
| Apertus-8B-2509 | 136 (0.42) | .15 | .23 | Swiss AI Initiative (2025) | ||
| OpenLLaMA-7B-v2 † | 55 (0.17) | .06 | .55 | OpenLM Research (2023) |
| Trajectory | correct ranks first | fitted accuracy threshold crossing | ||
|---|---|---|---|---|
| OLMo-2-7B | 630B | 630B | 1.7T | 1.79T |
| OLMo-2-13B | 2.5T | 336B | 2.5T | 2.2T |
| OLMo-2-1B | never | never | never | – |
| OLMo-7B (0424) | 838B | 838B | 2.0T | 1.6T |
| Pythia-1.4B | never | never | never | – |
| Pythia-2.8B | never | never | never | – |
| Model | [95% interval] | full prompt | closest ending | requested value | other value | unrelated lines | [95% interval] | predicted side | sign as predicted | unrelated 95% interval within nats |
| Pythia 1.4B | .81 [.77, .83] | ✓ | ✓ | |||||||
| Pythia 2.8B | .77 [.74, .79] | ✓ | ✓ | ✓ | ||||||
| Pythia 12B | .85 [.82, .87] | ✓ | ✓ | |||||||
| OLMo-2 1B | .57 [.53, .60] | – | – | – | ||||||
| Qwen3 0.6B | .53 [.50, .56] | – | – | – | ||||||
| OLMo-2 7B | .24 [.21, .27] | ✓ | ✓ | ✓ |
| Modification type | Original document (excerpt) | Exercise built from it: definitions query answer |
|---|---|---|
| Symbols as labels for passages, the rule shown only by demonstrations (type b) | “… Import databases into GIS software. …” (document dd98ff1b3ceb) | “Passage: Import databases into GIS software. Label: VENTRIX” “Passage: Identify locations and spatial extent of major climate hazards. Label: HOLPREN” “What is the label for: ’Data sources for assessing conditions and trends.’?” HOLPREN |
| A stated mapping that contradicts the document’s own names (type c) | “… Clemens’s research is focused on social movements, organizations, and American pol …” (document 72d352b5830b) | “California is called Wisconsin, Wisconsin is called Washington, and Washington is called California.” “what is the renamed version of the state that the original document calls ’California’?” Wisconsin |
| A small invented vocabulary with grammar rules (type e) | “… The Brewarrina Aboriginal Cultural Museum stands at a site which has been of great importance to Aboriginal people …” (document a7c757380862) | “mara = museum” “kelu = story” “silka = respect” “adding the suffix -oz to a noun marks more than one of that thing (plural)” “Translate into Bralin: ’respect”’ silka |
| Private codes bound to the document’s entities (type g) | “… Printable PDF Worksheets …” (document 5875e15ba879) | “The engineering team referred to the printable worksheet generator internally as Rontavex.” “Which nickname is bound to the attribute describing syncing marked statuses back after a device switch?” Dufaline |
| A mapping where the shown answer is wrong and only the given rule is right (type h) | “… Ensuring your safety while camping should be a top priority. …” (document f99176a67baa) | “Input: campsite selection distance from water Output: RV3” “Input: wildlife encounter bear-proof containers Output: RV2” “Input: campsite selection near water signal Output:” RV3 |
In-Context Learning
In-context learning studies how models adapt to new tasks from examples or instructions supplied at inference time, without changing their weights.
See all 386 papers