Zenaique

Where in a long prompt should you place the most critical context: at the start, the middle, or the end?

MCQ·Medium·4.0 · 0·~1 min·Asked atKrutrimMistral AIRephrase Ai·Relevant atAnthropicMicrosoftOpenAI
Attempt it
TL;DR

LLMs show a U-shape position bias on long prompts, attending most at the head and tail; put critical context in both regions and avoid the middle.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine giving a friend a giant list of instructions before they help you. They will probably remember the first few things you said and the last few things you said, and forget the stuff in the middle. Long prompts work the same way. The model pays more attention to the start of the context and the end, right before the actual question, than to anything sandwiched between them. So you put the things that really matter at both ends, and you treat the middle as the part the model is most likely to overlook.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Most prompt-engineering advice treats the prompt as flat text. Put your instructions in, put your examples in, put the query in, send it off. That mental model breaks once the prompt gets long, because the model does not actually attend evenly across the input. There is a measurable bias, and it shapes where you should place critical content.

The finding is sometimes called Lost in the Middle, after the 2023 paper that documented it cleanly. The shape of the bias is a U: high attention at the start, high attention at the end, low attention in the middle. The effect is large enough that it changes how you should order retrieved chunks in RAG, where you place system-level constraints, and how you restate the query.

The deep dive walks through the empirical claim, the structural reason it shows up, the production playbook that falls out of it, and the boundary conditions a senior interviewer wants you to name.

The empirical finding and why it sticks

The 2023 paper tested retrieval QA across long contexts. They inserted a relevant document at varying positions and asked the model to answer a question that required it. Accuracy was high when the document sat near the start, high near the end, and noticeably lower in the middle. The shape held across model sizes and across closed and open-weight families.

Follow-on work reproduced the curve on newer long-context models, including ones with rotary scaling, ALiBi, and YaRN-style extensions. The flat context window pitch (we go to 128k, 1M, etc.) does not erase the bias. It stretches the U, sometimes makes it shallower, but the middle is still measurably worse than the ends.

The practical reading is simple. Treat position in the prompt as a real input feature, not as a neutral container.

Why the U-shape exists
The production playbook
Interaction with structured delimiters and prompt caching
Boundary conditions to call out
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • Anthropic's RAG guidance for Claude Opus 4.7 explicitly recommends placing the most relevant retrieved document closest to the user query, citing the U-shape effect.
  • Perplexity orders retrieved web snippets so the strongest source lands just before the synthesis prompt, not in score descending dump order.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow does this change your retrieval ordering in a RAG pipeline?
A

Place the top-scoring chunk last (closest to query), next-best first, and let middle chunks fill the rest; cite the U-shape rationale.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Defaulting to 'put it at the top' or 'put it at the bottom', and ignoring that the middle of a long prompt is where models are measurably worst at retrieving information.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • The empirical U-shape finding and where it came from

  • How to order retrieved chunks for RAG

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Which of these are valid concerns when using LLM-as-judge for evaluation?
Multi-select·Medium