Why a 200-Page SOP Breaks Chat AI: Stanford Lost in the Middle Research
Stanford and UC Berkeley researchers showed that LLMs miss clauses buried in the middle of long PDFs - even with 128k+ context windows. Here is how RAG and reranking fix it at work.
Uploading an entire 200-page receiving SOP or supplier contract into chat feels easy, but research explains why it fails on the exact rule you need.
## The U-shaped attention curve
In the landmark Stanford and UC Berkeley study Lost in the Middle: How Language Models Use Long Contexts, researchers found that language models retrieve facts accurately near the beginning or end of a prompt, but accuracy drops sharply when the answer sits in the middle.
- A late-delivery penalty clause on page 78 or an updated cut-off time buried inside a 150-page manual is routinely skipped or guessed.
- Bigger context windows (128k to 1M tokens) increase cost and latency without fixing mid-document attention loss.
## How we fix long-document accuracy in Session 3
- Structure-aware chunking: Split SOPs and price tables by heading and section instead of blind character counts.
- Two-stage retrieval and reranking: Fetch candidate clauses with hybrid search, then pass only the top clean chunks to the model.
- Mandatory source citations and abstention: Force the agent to cite the exact page number or refuse to guess when two pages conflict or data is missing.