You have a 200k-token context with instructions and 50 documents. Where do you put what, and why?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
The governing result is lost in the middle (Liu et al., 2023): on multi-document QA, accuracy as a function of the relevant document's position is U-shaped - highest when the answer is at the beginning or end of the context, worst in the middle. The effect persisted even on explicitly long-context models, and while newer frontier models have improved substantially on needle-in-a-haystack retrieval, positional non-uniformity on reasoning-over-context tasks hasn't disappeared. Treat edge placement as free insurance.
Full worked answer with diagram
The governing result is lost in the middle (Liu et al., 2023): on multi-document QA, accuracy as a function of the relevant document's position is U-shaped - highest when the answer is at the beginning or end of the context, worst in the middle. The effect persisted even on explicitly long-context models, and while newer frontier models have improved substantially on needle-in-a-haystack retrieval, positional non-uniformity on reasoning-over-context tasks hasn't disappeared. Treat edge placement as free insurance.
Concrete layout:
- System prompt / standing rules at the very top - also required for prompt caching (stable prefix).
- Task instructions and output format next, before any documents.
- Documents in the middle, each individually delimited with stable IDs (
<doc id="7" source="...">), ordered so the most relevant documents sit at the edges of the document block - best candidates first, next-best last, weakest in the middle - rather than naively in retrieval-score order. - Restate the question and key instructions at the bottom. By generation time, the top instructions are 150k tokens away; the bottom restatement is adjacent to the tokens being generated. "Instructions at top AND bottom" is the standard, cheap, high-yield trick.
Additional practices a senior answer includes:
- Interrogate whether all 50 documents should be there. Stuffing weak retrievals hurts twice: distraction (models get worse when plausible-but-irrelevant text is present) and cost. Rerank and cut; more context is not monotonically better.
- Require cited doc IDs in the answer - improves groundedness and gives you an audit trail for evals.
- Structure beats prose: per-document metadata headers (title, date, source) help the model index into the pile.
- Watch the cache tradeoff: if documents vary per request, they belong after all stable content; if a large corpus is reused across many requests (long system context), pin it early and cache it.
Mention the eval: position-sensitivity is measurable - permute the gold document's position on a fixed QA set and plot accuracy by position for your actual model before assuming the U-curve's magnitude.
Worth sketching. A numbered stack with the dead zone marked explains the ordering choice faster than describing a U-curve in words.
flowchart TD
A["1. System and standing rules,<br/>cacheable prefix"] --> B["2. Task and output format"]
B --> C["3. Best documents first"]
C --> D["4. Weakest documents here"]
D --> E["5. Next-best documents last"]
E --> F["6. Question restated,<br/>adjacent to generation"]
D --> G["Lost-in-the-middle zone:<br/>put nothing load-bearing here"]
What a good answer covers
- The governing result is lost in the middle (Liu et al., 2023)
- The effect persisted even on explicitly long-context models, and while newer frontier models have…
- Treat edge placement as free insurance
- System prompt / standing rules at the very top - also required for prompt caching (stable prefix)
- Task instructions and output format next, before any documents
Key terms: lost in the middle · Documents in the middle · Require cited doc IDs · Structure beats prose · Watch the cache tradeoff
In the glossary: Lost in the middle · Accuracy · Prompt caching
Interviewer follow-ups to expect
How would you detect lost-in-the-middle empirically in production?
When is RAG-then-stuff worse than an agentic search-and-read loop over the corpus?
How does document ordering interact with prompt caching when the document set is semi-stable?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep