mlsanityData to 14 Oct 2026

Where to show Demos in Your Prompt: A Positional Bias of In-Context Learning

arXiv 2507.22887 ↗First posted 30 Jul 2025cs.CL cs.AIcited by 13

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

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2024The Llama 3 Herd of Modelscited by 14,715
  3. 2021Training Verifiers to Solve Math Word Problemscited by 10,109
  4. 2020Measuring Massive Multitask Language Understandingcited by 7,963
  5. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
  6. 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,886
  7. 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
  8. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
  9. 2017A Broad-Coverage Challenge Corpus for Sentence Understanding through Inferencecited by 2,682
  10. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  11. 2015Character-level Convolutional Networks for Text Classificationcited by 2,330
  12. 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
22 more
  1. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  2. 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
  3. 2018Don't Give Me the Details, Just the Summary! Topic-Aware Convolutional Neural Networks for Extreme Summarizationcited by 1,317
  4. 2017Get To The Point: Summarization with Pointer-Generator Networkscited by 1,292
  5. 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
  6. 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
  7. 2015Teaching Machines to Read and Comprehendcited by 1,049
  8. 2022In-context Learning and Induction Headscited by 964
  9. 2022LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scalecited by 906
  10. 2020Aligning AI With Shared Human Valuescited by 723
  11. 2021Prompt Programming for Large Language Models: Beyond the Few-Shot Paradigmcited by 606
  12. 2021Do Prompt-Based Models Really Understand the Meaning of their Prompts?cited by 326
  13. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
  14. 2023Speak Foreign Languages with Your Own Voice: Cross-Lingual Neural Codec Language Modelingcited by 167
  15. 2023Birth of a Transformer: A Memory Viewpointcited by 161
  16. 2024Aya Expanse: Combining Research Breakthroughs for a New Multilingual Frontiercited by 129
  17. 2024Mind Your Format: Towards Consistent Evaluation of In-Context Learning Improvementscited by 83
  18. 2022Structured Prompting: Scaling In-Context Learning to 1,000 Examplescited by 81
  19. 2023Sensitivity, Performance, Robustness: Deconstructing the Effect of Sociodemographic Promptingcited by 81
  20. 2022Self-Generated In-Context Learning: Leveraging Auto-regressive Language Models as a Demonstration Generatorcited by 68
  21. 2024Let's Learn Step by Step: Enhancing In-Context Learning Ability with Curriculum Learningcited by 47
  22. 2023Auto-ICL: In-Context Learning without Human Supervisioncited by 18

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 1; 2026: 12.

13 papers.

Sort:

By area: