ImageNet classification with deep convolutional neural networks
Alex Krizhevsky, Ilya Sutskever et al.
14
Citations
0
Influential Citations
Conference on Empirical Methods in Natural Language Processing
Venue
2025
Year
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.
This paper addresses a critical yet overlooked aspect of in-context learning (ICL): the position of demonstrations within the prompt. While prior work has focused on demo selection and ordering, the authors show that simply moving demos from the start to the end of the user message can flip over 30% of predictions on QA tasks. This finding has immediate practical implications for anyone deploying LLMs in production, where consistency and reliability are paramount. The work also raises important questions about the reproducibility of ICL results, as small changes in prompt formatting can lead to large shifts in output.
The paper makes several key innovations:
Key quantitative results:
This work has broad implications for prompt engineering, LLM evaluation, and fairness. Practitioners can immediately adopt the recommendation to place demos at the start of prompts for more stable and accurate outputs. The findings also highlight a potential confound in existing ICL benchmarks, where demo position may have been uncontrolled. Future work should explore whether DPP bias interacts with other prompt components (e.g., chain-of-thought) and whether it extends to closed-source models. The paper sets a new standard for reporting prompt structure in ICL experiments.
Alex Krizhevsky, Ilya Sutskever et al.
Ashish Vaswani, Noam Shazeer et al.
Douglas M. Bates, Martin Mächler et al.
Diederik P. Kingma, Jimmy Ba