Positional bias is a systematic failure mode in large language models where the probability of retrieving and utilizing a piece of information is directly dependent on its ordinal position within the context window. This phenomenon manifests primarily as the primacy effect (strong recall of information at the very beginning) and the recency effect (strong recall of information at the very end), creating a significant performance trough for data located in the middle of a long input sequence, a phenomenon specifically termed "lost in the middle."
Glossary
Positional Bias

What is Positional Bias?
Positional bias is the systematic tendency of a language model to assign different levels of importance or attention to information based solely on its location within the input sequence, such as the primacy or recency effect.
This bias directly undermines retrieval-augmented generation architectures and multi-document summarization tasks, where critical source documents placed in the center of a prompt are often ignored or hallucinated over. Mitigation strategies involve re-ordering content to place high-priority entities at the extreme ends of the prompt, applying context distillation to compress inputs, or utilizing maximum marginal relevance algorithms to ensure salient information is not buried by redundant filler content.
Core Characteristics of Positional Bias
The systematic tendency of a language model to assign different levels of importance to information based solely on its position within the input sequence, manifesting primarily as primacy and recency effects.
The Primacy Effect
The model's tendency to assign disproportionate attention weight to tokens at the very beginning of the context window. This occurs because initial tokens set the 'activation context' for subsequent processing. In practical terms, instructions and critical facts placed at the start of a prompt often dominate the model's internal representation, sometimes overriding contradictory information placed later. This is a direct consequence of the causal attention mask in decoder-only transformers, where early tokens influence all later tokens but not vice versa.
The Recency Effect
The model's strong bias toward information appearing at the very end of the input sequence. This is driven by the short-term memory dynamics of the transformer's hidden states, where the final tokens' representations are freshest in the residual stream. In Retrieval-Augmented Generation (RAG) systems, this often causes the model to over-prioritize the last retrieved document chunk, even if a more relevant passage appeared in the middle of the context.
Impact on Summarization
Positional bias directly corrupts the salience estimation process in abstractive summarization. When summarizing a long document, models exhibit a strong tendency to extract or paraphrase content from the first and last paragraphs, while omitting critical details from the body. This violates factual consistency when the core argument resides in the middle. Mitigation strategies include semantic chunking and re-ordering content to place high-salience information at the extremes.
Mitigation: Attention Calibration
Techniques to counteract positional bias include:
- Positional Interpolation: Adjusting rotary position embeddings (RoPE) to extend the effective context window without retraining.
- Attention with Restarts: Resetting attention sinks periodically to refresh the model's focus.
- Context Re-ordering: Strategically placing the most critical instructions or documents at the beginning and end of the prompt, with less critical filler in the middle.
- Contrastive Decoding: Amplifying the signal from tokens that would otherwise be ignored due to their position.
Positional Encoding's Role
The root cause of positional bias lies in the positional encoding mechanism itself. Whether using learned absolute positions, sinusoidal encodings, or Rotary Position Embeddings (RoPE), the model learns to associate specific positional signals with importance. RoPE, while effective for length extrapolation, still exhibits a decay in attention scores for distant token pairs, reinforcing the U-shaped attention pattern that causes the 'lost in the middle' problem.
Frequently Asked Questions
Clear, technical answers to the most common questions about how the position of information within a prompt or document influences the output of large language models and AI-generated summaries.
Positional bias is the systematic tendency of a large language model to assign different levels of importance or attention to information based solely on its position within the input sequence, rather than on its intrinsic relevance. This phenomenon manifests primarily through two well-documented effects: the primacy effect, where the model overweights information presented at the very beginning of a context window, and the recency effect, where it overweights information at the very end. This bias is a direct consequence of the transformer architecture's self-attention mechanism and the way positional encodings are learned during pre-training. For practitioners, this means that the placement of a critical instruction or a key fact within a prompt can dramatically alter the model's output, making it a central concern in prompt engineering and generative summarization control.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Positional Bias vs. Related Attention Phenomena
Distinguishing positional bias from structurally similar but mechanistically distinct transformer attention behaviors that affect content prioritization.
| Feature | Positional Bias | Lost in the Middle | Recency Effect | Primacy Effect |
|---|---|---|---|---|
Core mechanism | Systematic attention weight skew based on absolute or relative token position within the input sequence | Performance degradation when retrieving information from the central portion of long context windows | Disproportionate recall and influence assigned to items appearing at the end of a sequence | Disproportionate recall and influence assigned to items appearing at the beginning of a sequence |
Primary locus | Attention layer weight distributions and positional encoding vectors | Mid-sequence token representations in deep transformer layers | Final tokens in the input sequence during autoregressive generation | Initial tokens in the input sequence during encoding |
Context length dependency | Amplifies as sequence length increases beyond effective positional encoding range | Emerges specifically in long-context scenarios exceeding 4K tokens | Present regardless of sequence length but magnified in longer contexts | Present regardless of sequence length but most pronounced in shorter sequences |
Mitigation strategy | Rotary Position Embedding (RoPE) with adjusted base frequency, attention scaling, or position interpolation | Document reordering placing critical information at extremities, explicit positional prompting | Explicit instruction to weigh all evidence equally, reverse-chronological ordering | Mid-document placement of critical content, attention redistribution techniques |
Empirical benchmark | LongBench, L-Eval multi-document QA tasks measuring position-agnostic accuracy | Multi-document QA with controlled evidence placement at 25%, 50%, and 75% positions | Free recall tasks measuring probability of retrieving final list items | Free recall tasks measuring probability of retrieving initial list items |
Relationship to summarization quality | Causes over-representation of opening and closing content in generated summaries | Causes omission of centrally located key facts from extractive and abstractive summaries | Causes summary conclusions to overweight final document sections | Causes summary introductions to overweight opening document sections |
Token-level manifestation | Attention scores exhibit U-shaped distribution across sequence positions | Retrieval accuracy follows inverted-U curve with minimum at approximately 50% context depth | Logit probability mass concentrates on tokens semantically related to recent context | Logit probability mass concentrates on tokens semantically related to initial context |
Architectural root cause | Interaction between sinusoidal or learned positional encodings and self-attention softmax normalization | Hidden state saturation in middle layers combined with attention dilution across many tokens | Autoregressive decoding bias where next-token prediction is conditioned most strongly on proximal tokens | Initial token representations serve as attention sinks accumulating disproportionate weight |
Related Terms
Explore the key phenomena and techniques related to how information position within a context window affects model attention, retrieval accuracy, and output quality.
Lost in the Middle
A documented phenomenon where large language models exhibit a significant performance drop when retrieving and using information located in the middle of a long context window, favoring the beginning and end. This directly results from positional bias, as the model's attention mechanisms struggle to maintain focus on centrally-located tokens. In multi-document question-answering tasks, accuracy can degrade by over 20% when critical evidence is placed in the middle third of the input. Mitigation strategies include:
- Reordering documents to place the most critical information at the start or end
- Using retrieval-augmented generation to shorten effective context length
- Applying prompt compression to reduce non-essential tokens
Primacy Effect
The tendency of language models to assign disproportionately higher weight to information presented at the very beginning of the input sequence. This cognitive bias, inherited from human psychology, means that instructions, definitions, or facts placed in the first few sentences of a prompt exert outsized influence on the entire generation. In summarization tasks, sentences from the opening paragraph of a source document are statistically more likely to appear in the output. Engineers exploit this by:
- Placing system prompts and critical constraints at the absolute start
- Front-loading few-shot examples before user queries
- Using the BLUF (Bottom Line Up Front) content structure to ensure key conclusions are prioritized
Recency Effect
The complementary bias where models assign elevated importance to information at the end of the input sequence. This is particularly pronounced in decoder-only transformer architectures, where the final tokens have direct causal influence on the next predicted token. The recency effect can override earlier instructions if contradictory information appears late in the prompt. Practical implications include:
- Repeating critical constraints at the end of long prompts as a reinforcement mechanism
- Placing the user's actual query as the final element before generation
- Awareness that adversarial 'prompt injection' attacks often exploit recency by appending overriding instructions
U-Shaped Attention Curve
The characteristic attention distribution pattern observed in long-context evaluations, where retrieval accuracy forms a U-shape when plotted against input position. Performance is highest at the beginning (primacy) and end (recency), with a pronounced dip in the middle. Research from Stanford and UC Berkeley demonstrated this effect across multiple model architectures, including GPT-4 and Claude. Key characteristics:
- The depth of the 'valley' increases with context length
- Multi-query tasks exacerbate the middle-information degradation
- This pattern challenges the assumption that extended context windows automatically improve comprehension
Context Distillation
The process of compressing a large, complex prompt or set of instructions into a smaller, more efficient set of soft prompts or vectors that elicit the same behavior from a language model. This technique directly combats positional bias by reducing the total token count, thereby shrinking the 'middle' where information is lost. Methods include:
- Training a smaller student model to mimic the behavior of a larger model with a full prompt
- Using gradient-based optimization to find minimal trigger tokens
- Applying prompt compression algorithms like LLMLingua to remove non-essential tokens while preserving semantic intent
Content Reordering Strategies
Deliberate restructuring of input sequences to align with known positional bias patterns and maximize the likelihood that critical information receives adequate attention. This is a practical mitigation technique for RAG systems and summarization pipelines. Effective strategies include:
- Interleaving: Distributing key facts at regular intervals rather than clustering them
- Edge-stacking: Placing the most critical evidence at both the beginning and end of the context window
- Query-first ordering: Presenting the user's question immediately before the retrieved documents to leverage recency
- Diversity shuffling: Randomizing document order across multiple inference calls to average out positional effects

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us