Lune

EMNLP2025Top-tier venue

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

Kwesi A. Cobbina, Tianyi Zhou

Abstract

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, system prompt, and user message in LLM input are varied. This bias, we refer to as DEMOS' POSITION IN PROMPT bias (DPP bias). We design a systematic evaluation pipeline to study this type of positional bias across classification, QA, summarization, and reasoning tasks. We introduce two metrics, ACCURACY-CHANGE and PREDICTION-CHANGE, to quantify net gains and output volatility induced by demos' position change. 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 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 in QA tasks. Smaller models are most affected by this sensitivity, though even large models do remain marginally affected on complex tasks.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

3 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Efficient Streaming Language Models with Attention Sinks cites FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity cites Calibrate Before Use: Improving Few-shot Performance of Language Models
  • In-Context Learning as Rate–Distortion Optimization cites Calibrate Before Use: Improving Few-shot Performance of Language Models
  • Fair-CCD: Mitigating Bias in Large Language Models for Tabular Classification Through Context-Contrastive Decoding cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
  • Chain-of-Thought Prompting Elicits Reasoning in Large Language Models cites Calibrate Before Use: Improving Few-shot Performance of Language Models
  • Efficient Reasoning with Balanced Thinking cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. Efficient Reasoning with Balanced ThinkingYulin Li, Tengyao Tu, Li Ding, Junjie Wang et al.ICLR 2026 · 7 citations
  2. In-Context Learning as Rate–Distortion OptimizationJiayu Zhang, Changbang Li, Canran XiaoICML 2026
  3. Fair-CCD: Mitigating Bias in Large Language Models for Tabular Classification Through Context-Contrastive DecodingDonghan Liu, Han Sun, Zhaohui Wang, Qin Li et al.ACL 2026

Builds on11

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  2. FlashAttention-2: Faster Attention with Better Parallelism and Work PartitioningTri DaoICLR 2024 · 2,600 citations
  3. Calibrate Before Use: Improving Few-shot Performance of Language ModelsZihao Zhao, Eric Wallace, Shi Feng, Dan Klein et al.ICML 2021 · 1,843 citations
  4. Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han et al.ICLR 2024 · 1,714 citations
  5. Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order SensitivityYao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel et al.ACL 2022 · 1,494 citations

Related papers

  1. Characterizing Positional Bias in Large Language Models: A Multi-Model Evaluation of Prompt Order EffectsPatrick Schilcher, Dominik Karasin, Michael Schöpf, Haisam Saleh et al.EMNLP Findings 2025 · 1 citation
  2. How Many Demonstrations Do You Need for In-context Learning?Jiuhai Chen, Lichang Chen, Chen Zhu, Tianyi ZhouEMNLP Findings 2023 · 12 citations
  3. Rapid Selection and Ordering of In-Context Demonstrations via Prompt Embedding ClusteringKha Pham, Hung Le, Man Ngo, Truyen TranICLR 2025
  4. Hierarchical Demonstration Order Optimization for Many-shot In-Context LearningYinhan He, Wendy Zheng, Song Wang, Zaiyi Zheng et al.NeurIPS 2025 · 2 citations
  5. Selecting Demonstrations for Many-Shot In-Context Learning via Gradient MatchingJianfei Zhang, Bei Li, Jun Bai, Rumei Li et al.ACL Findings 2025
Dusk over the sea between two cliffs drawn in fine vertical lines