Showing an AI the same examples in a different order can flip nearly half its answers — sequence matters as much as content.
Why is in-context learning brittle to the order of examples presented?
This explores why the *sequence* in which few-shot examples appear — not their content — can swing a model's answers, and what the corpus reveals about where that fragility comes from.
This explores why the order of examples, independent of what those examples actually say, can make or break in-context learning. The sharpest evidence in the corpus is almost startling: simply moving an identical block of demonstrations from the start of a prompt to the end can swing accuracy by up to 20% and flip nearly half of all predictions, with the effect holding across different task types How much does demo position alone affect in-context learning accuracy?. So brittleness isn't only about picking bad examples — position itself is a lever the model is silently pulling.
Why would position matter at all? One clue comes from how models actually generate reasoning token by token. When a model predicts each next token, it leans heavily on the tokens immediately preceding it — this 'local memorization' accounts for up to two-thirds of reasoning errors, and it worsens as inputs get longer or drift from the training distribution Where do memorization errors arise in chain-of-thought reasoning?. If the model is disproportionately anchored to whatever sits closest in the sequence, then reordering examples changes what's 'nearby' at each decision point, and the output shifts accordingly. Order isn't cosmetic; it changes the local context the model is copying from.
There's a deeper structural reason too. For sequential tasks, in-context learning only works when the context contains whole trajectories from the same setting — 'burstiness' — rather than scattered isolated examples Why do trajectories matter more than individual examples for in-context learning?. This reframes the fragility: the model isn't averaging over a bag of demonstrations, it's reading the prompt as a structured sequence and inferring the task from its shape. Break the coherent ordering and you break the signal the model was using to figure out what you want. The same lesson appears in conversation, where models lock onto premature assumptions from early turns and can't recover — order determines which guess gets cemented first Why do language models fail in gradually revealed conversations?.
If order is a liability, it's also a tool — and this is the turn most readers won't expect. Researchers have started ordering demonstrations *deliberately* to exploit the effect rather than suffer it. One approach ranks examples by how sparse their internal activations are, feeding harder (sparse) examples before easier (dense) ones like a curriculum, with no difficulty labels required Can representation sparsity order few-shot demonstrations effectively?. Another treats example selection as a formal experimental-design problem, choosing the sequence that most reduces uncertainty about the test set Can optimal experimental design improve few-shot example selection?. The brittleness and the opportunity are the same phenomenon viewed from opposite sides.
Underneath all of it sits a tension the corpus keeps circling: the model is constantly negotiating between what it learned in training and what you're showing it now. When prior associations are strong enough, in-context information gets overridden entirely, and prompting alone can't fix it Why do language models ignore information in their context?. Order is one of the few knobs that shifts that balance without retraining — which is exactly why a fragile, position-sensitive model is also a surprisingly steerable one.
Sources 7 notes
Repositioning an identical demo block from prompt start to end swaps up to 20% accuracy and flips nearly half of predictions. This spatial effect operates independently of demo content and spans multiple task types.
STIM framework identifies local, mid-range, and long-range memorization sources in CoT reasoning. Local memorization—based on preceding tokens—accounts for up to 67% of reasoning errors, especially as complexity increases and distributional shift occurs.
In-context learning for sequential decision-making requires full or partial trajectories from the same environment level, not just isolated examples. This structural property—trajectory burstiness—allows models to generalize across vastly different tasks without weight updates.
Across 200,000+ conversations, all major LLMs show 39% average performance drop in multi-turn settings due to locking into incorrect early guesses. Agent mitigations recover only 15-20% of this loss.
Sparsity-Guided Curriculum In-Context Learning uses last-layer activation sparsity to order demonstrations from sparse (harder) to dense (easier), yielding considerable performance improvements. This approach requires no external difficulty labels and works across diverse in-context learning tasks.
Show all 7 sources
AIPD frames demonstration selection as budgeted active learning, choosing examples that maximally reduce test-set uncertainty. Two algorithms (GO and SAL) outperformed similarity-based methods across small, medium, and large language models.
Research demonstrates that LMs generate outputs inconsistent with their context because parametric knowledge from training dominates over in-context information. Textual prompting alone cannot override strong priors; causal intervention in representations is required.
Papers this line draws on 8
The research behind the notes this line reads — ranked by how closely each paper relates.
- In-Context Principle Learning from Mistakes
- Beyond Accuracy: Evaluating the Reasoning Behavior of Large Language Models -- A Survey
- Generalization to New Sequential Decision Making Tasks with In-Context Learning
- Learning To Retrieve Prompts for In-Context Learning
- Where to show Demos in Your Prompt: A Positional Bias of In-Context Learning
- Schema-learning and rebinding as mechanisms of in-context learning and emergence
- Deciphering the Factors Influencing the Efficacy of Chain-of-Thought: Probability, Memorization, and Noisy Reasoning
- Experimental Design for Active Transductive Inference in Large Language Models