Where to show Demos in Your Prompt: A Positional Bias of In-Context Learning
Not on the map. Why?
Abstract (arXiv)
In-context learning (ICL) is a critical emerging capability of large language models (LLMs), enabling few-shot learning during inference by including a few demonstrations (demos) in the prompt. However, it has been found that ICL's performance can be sensitive to the choices of demos and their order. This paper investigates an unexplored new positional bias of ICL for the first time: we observe that the predictions and accuracy can drift drastically when the positions of demos, the system prompt, and the user message in LLM input are varied. We refer to this bias as DEMOS' POSITION IN PROMPT (DPP) bias. We design a systematic evaluation pipeline to study this type of positional bias across classification, question answering, summarization, and reasoning tasks. We introduce two metrics, ACCURACY-CHANGE and PREDICTION-CHANGE, to quantify net gains and output volatility induced by changes in the demos' position. Extensive experiments on ten LLMs from four open-source model families (QWEN, LLAMA3, MISTRAL, COHERE) verify that the bias significantly affects their accuracy and predictions: placing demos at the start of the prompt yields the most stable and accurate outputs with gains of up to +6 points. In contrast, placing demos at the end of the user message flips over 30% of predictions without improving correctness on QA tasks. Smaller models are most affected by this sensitivity, though even large models remain marginally affected on complex tasks.
Key facts. Cited by 13 papers in the map (data through 14 Oct 2026). Builds on 34 of its 48 references that are in the map. First posted on arXiv 30 Jul 2025.
Builds on
34 of 48 references.
References · 34
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021Training Verifiers to Solve Math Word Problemscited by 10,109
- 2020Measuring Massive Multitask Language Understandingcited by 7,963
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,886
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
- 2017A Broad-Coverage Challenge Corpus for Sentence Understanding through Inferencecited by 2,682
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,330
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
22 more
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
- 2018Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarizationcited by 1,317
- 2017Get To The Point: Summarization with Pointer-Generator Networkscited by 1,292
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
- 2015Teaching Machines to Read and Comprehendcited by 1,049
- 2022In-context Learning and Induction Headscited by 964
- 2022LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scalecited by 906
- 2020Aligning AI With Shared Human Valuescited by 723
- 2021Prompt Programming for Large Language Models: Beyond the Few-Shot Paradigmcited by 606
- 2021Do Prompt-Based Models Really Understand the Meaning of their Prompts?cited by 326
- 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
- 2023Speak Foreign Languages with Your Own Voice: Cross-Lingual Neural Codec Language Modelingcited by 167
- 2023Birth of a Transformer: A Memory Viewpointcited by 161
- 2024Aya Expanse: Combining Research Breakthroughs for a New Multilingual Frontiercited by 129
- 2024Mind Your Format: Towards Consistent Evaluation of In-Context Learning Improvementscited by 83
- 2022Structured Prompting: Scaling In-Context Learning to 1,000 Examplescited by 81
- 2023Sensitivity, Performance, Robustness: Deconstructing the Effect of Sociodemographic Promptingcited by 81
- 2022Self-Generated In-Context Learning: Leveraging Auto-regressive Language Models as a Demonstration Generatorcited by 68
- 2024Let's Learn Step by Step: Enhancing In-Context Learning Ability with Curriculum Learningcited by 47
- 2023Auto-ICL: In-Context Learning without Human Supervisioncited by 18
Built on by
Citing papers per year: 2025: 1; 2026: 12.
13 papers.
Sort:
By area:
- 2026Large Language Model Reasoning Failurescited by 21
- 2026A Structural Theory of Position Bias in Transformerscited by 5
- 2026Efficient Reasoning with Balanced Thinkingcited by 4
- 2025Robustness is Important: Limitations of LLMs for Data Fittingcited by 2
- 2026Understanding the Dynamics of Demonstration Conflict in In-Context Learningcited by 2
- 2026MemCtrl: Using MLLMs as Active Memory Controllers on Embodied Agentscited by 1
- 2026How Confident Is the First Token? An Uncertainty-Calibrated Prompt Optimization Framework for Large Language Model Classification and Understandingcited by 1
- 2026PLR: Plackett-Luce for Reordering In-Context Learning Examplescited by 1
- 2026Where to Place the Query? Unveiling and Mitigating Positional Bias in In-Context Learning for Diffusion LLMs via Decoding Dynamicscited by 1
- 2026Are LLMs Positionally Consistent Ordinal Classifiers? A Systematic Evaluationcited by 1
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generationcited by 0
- 2026RAMPART: Registry-based Agentic Memory with Priority-Aware Runtime Transformationcited by 0
- 2026Are LLMs Positionally Consistent Ordinal Classifiers? A Systematic Evaluation9 Aug 2026
- 2026Supervision versus Demonstration-Based In-Context Learning for Multiword Expression Classification5 Jun 2026
- 2026RAMPART: Registry-based Agentic Memory with Priority-Aware Runtime Transformation3 Jun 2026
- 2026Where to Place the Query? Unveiling and Mitigating Positional Bias in In-Context Learning for Diffusion LLMs via Decoding Dynamics26 Apr 2026
- 2026PLR: Plackett-Luce for Reordering In-Context Learning Examples22 Mar 2026
- 2026Efficient Reasoning with Balanced Thinking12 Mar 2026
- 2026Understanding the Dynamics of Demonstration Conflict in In-Context Learning3 Mar 2026
- 2026How Confident Is the First Token? An Uncertainty-Calibrated Prompt Optimization Framework for Large Language Model Classification and Understanding23 Feb 2026
- 2026A Structural Theory of Position Bias in Transformers18 Feb 2026
- 2026Large Language Model Reasoning Failures5 Feb 2026
- 2026MemCtrl: Using MLLMs as Active Memory Controllers on Embodied Agents28 Jan 2026
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generation28 Jan 2026
1 more
- 2026Large Language Model Reasoning Failurescited by 21
- 2026Efficient Reasoning with Balanced Thinkingcited by 4
- 2026Efficient Reasoning with Balanced Thinking12 Mar 2026
- 2026Large Language Model Reasoning Failures5 Feb 2026
- 2026A Structural Theory of Position Bias in Transformerscited by 5
- 2025Robustness is Important: Limitations of LLMs for Data Fittingcited by 2
- 2026PLR: Plackett-Luce for Reordering In-Context Learning Examplescited by 1
- 2026Where to Place the Query? Unveiling and Mitigating Positional Bias in In-Context Learning for Diffusion LLMs via Decoding Dynamicscited by 1
- 2026Are LLMs Positionally Consistent Ordinal Classifiers? A Systematic Evaluationcited by 1
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generationcited by 0
- 2026Supervision versus Demonstration-Based In-Context Learning for Multiword Expression Classificationcited by 0
- 2026Are LLMs Positionally Consistent Ordinal Classifiers? A Systematic Evaluation9 Aug 2026
- 2026Supervision versus Demonstration-Based In-Context Learning for Multiword Expression Classification5 Jun 2026
- 2026Where to Place the Query? Unveiling and Mitigating Positional Bias in In-Context Learning for Diffusion LLMs via Decoding Dynamics26 Apr 2026
- 2026PLR: Plackett-Luce for Reordering In-Context Learning Examples22 Mar 2026
- 2026A Structural Theory of Position Bias in Transformers18 Feb 2026
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generation28 Jan 2026
- 2025Robustness is Important: Limitations of LLMs for Data Fitting27 Aug 2025