Apply to my task
arXiv:2510.05381 ★ 86 Oct 6, 2025

Retrieve-then-Reason: How Context Length Kills Reasoning Even With Perfect Retrieval

Key result

The paradox: a model retrieves information with 100% accuracy yet loses up to 85% of its reasoning accuracy. The problem isn't search quality — it's that the context is too long. The Retrieve-then-Reason method lets you solve tasks over long documents without losing accuracy — it turns a long-context task into a short-context one. Division of labor: first extract the evidence in a separate request, then reason over a short context. Llama-3.1-8B finds the conditions in 970 out of 1000 problems but drops 24.2% in solving accuracy — the method wins those points back.

01

TL;DR

The study shows that models lose 13.9–85% of their accuracy as context length grows, even when they retrieve all the information with 100% accuracy. Even when the distracting tokens are replaced with whitespace. Even when every distraction is fully masked out and the model sees only the relevant information.

LLMs can't effectively use information in a long context, even when they can find it. Llama-3.1-8B (128K tokens) accurately extracts the conditions for 970 out of 1000 MMLU problems at 30K tokens — yet its solving accuracy drops by 24.2% compared to short versions of the same problems. Distraction isn't the culprit: the drop happens when the text is replaced with whitespace, when the evidence is placed right before the question, even with all distractions masked. The cause is the sheer length of the context, not retrieval quality.

The fix: Retrieve-then-Reason — the model first extracts the evidence from the long context, then solves the problem in a fresh short prompt containing only that evidence. It turns a long-context task into a short-context one. On GPT-4o in the RULER benchmark it adds +4% on top of an already strong baseline (88% → 92%).


Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1 (separate request): Extraction
The model gets the long context + an instruction to quote the relevant passages
→ Output: exact quotes of the information you need

STEP 2 (new request): Solving
New prompt = [extracted passages] + [question]
→ Output: the final answer based on the short version of the context

03

Example in Action

Task: A 50-message thread with a client about launching an ad campaign. Somewhere in the middle they mentioned the budget, the channels and the timeline. You need to put together a proposal. When you paste the whole thread into a prompt with "write a proposal," the model gets confused and misses details — the long context gets in the way of reasoning, even though the information is right there.

Prompt (Step 1 — Extraction):

Here is my email thread with a client about an ad campaign:

[the whole thread, 50 messages]

Find and quote EXACTLY (word for word) every message where the client mentions:
- The campaign budget
- Ad channels
- Launch dates
- Creative requirements

Copy each relevant message in full. Don't make anything up, don't shorten anything.

Prompt (Step 2 — Solving on a short context):

Here's what the client said about the ad campaign:

[messages extracted in Step 1]

Based on this information, write a proposal.

Result:
In Step 1 the model returns 4-6 specific messages with the details. In Step 2, working on a short context, it accounts for every condition precisely and drafts the proposal without gaps. Instead of wandering through 50 messages, it focuses on a tight digest.


04

Why It Works

LLMs are good at extracting information from long text when the task is simply to find and quote. But when they have to hold a long context in "working memory" and solve a problem at the same time, performance drops.

The attention mechanism works like this: the longer the context, the more computation per token, and the weaker the link between the relevant parts. Even if the model "sees" all the evidence, it uses it worse when reasoning over long distances.

The method sidesteps this through a division of labor: first compression (pulling out what matters), then reasoning on the compressed data. Short context = less noise in attention, more precise work with the information. It's the difference between "find the needle in the haystack and solve a problem with it" vs. "here's the needle, solve the problem" — the second is easier, even though the needle is the same.

Prompt control knobs:

  • Extraction instructions in Step 1: "quote exactly" vs. "paraphrase briefly" — the first for accuracy, the second for compression
  • Completeness check: add "Make sure you didn't miss anything, reread the context" — insurance against gaps
  • Format in Step 2: from "give the answer" to "lay out your reasoning step by step" — changes the depth of analysis

05

Prompt Template

STEP 1 (first request — extraction):

{long_context}

Find and quote EXACTLY (word for word) every passage that mentions:
{search_criteria_list}

Copy each relevant passage in full. Don't make anything up, don't shorten anything.

---

STEP 2 (second request — solving):

Here is the relevant information:

{passages_extracted_in_step_1}

{your_question}

What to fill in:

  • {long_context} — an email thread, document, log, any long text
  • {search_criteria_list} — what to look for: dates, numbers, requirements, mentions of topics
  • {passages_extracted_in_step_1} — the output of the first request, pasted here
  • {your_question} — the final task: write a report, give a recommendation, make a decision

🚀 Quick start — paste into the chat:

Here's the Retrieve-then-Reason template. Adapt it to my task: [your task].
Ask me questions to fill in the fields.

[paste the template above]

The model will ask what your long context is (an email thread, a document, a log?), what exactly needs to be extracted, and what the final question is — because Step 1 needs clear search criteria and Step 2 needs a concrete task on the short data. It'll take the pattern and adapt it to your case.


06

Limitations

⚠️ Depends on retrieval: If the model can't extract the information (a weak model, a very complex context, poorly worded criteria), the method won't help — the problem shows up as early as Step 1.

⚠️ Extra request: Doubles the number of API calls, adding latency and token costs.

⚠️ Risk of losing context: If Step 1 doesn't extract everything important, Step 2 works with incomplete data and may miss nuances.

⚠️ Doesn't fix retrieval: The method helps you use what was found, but doesn't improve the search itself — that's a separate problem.


07

How They Tested It

The team took 5 models (Llama-3.1-8B, Mistral-7B, GPT-4o, Claude-3.5, Gemini-2.0) and tested them on math (GSM8K), questions (MMLU), code (HumanEval) and a synthetic task (Variable Summation). Each problem was stretched by inserting distracting tokens between the evidence and the question — from 0 to 30K tokens (Paul Graham essays as filler).

The key difference from other work: retrieval was measured separately via exact match — the model had to quote the evidence word for word. A single mismatched character meant 0 points. That's stricter than "got the gist but paraphrased." This made it possible to isolate the effect of retrieval: if the model quotes exactly, retrieval is perfect, and any drop in solving accuracy has a different cause.

The results were surprising: for Llama-3.1-8B at 30K tokens, retrieval fell by only 10%, but solving accuracy fell by 24%. In other words, the model sees the information (it can quote it) but can't use it effectively for reasoning!

Three control experiments to pin down the cause:

  1. Replaced the essays with whitespace — minimal distraction. The drop got smaller, but was still up to -20% at 30K whitespace tokens. So it's not just about semantic noise.
  2. Moved the evidence to the end, right before the question (instead of the beginning). Distance between evidence and question = 0. The drop remained. So it's not the "Lost-in-the-middle" effect.
  3. Masked out ALL distractions — the model sees only the evidence and the question, identical to the short version, but separated by a 30K-token mask. The drop is still there: -21% on MMLU. So the culprit is length itself, not the content of the distractions.

Conclusion: Even under ideal conditions (exact retrieval, no distractions, close positioning), the model reasons worse in a long context. It's not a retrieval bug or a position issue — it's a fundamental limitation of working with long sequences.

Closed-source models are more stable: GPT-4o and Gemini-2.0 drop by 1-8% (vs. 20-30% for open-source), but they degrade too. An anomaly: Claude-3.5 on MMLU crashed by -67.6% at 30K whitespace tokens — this needs a closer look; it may be specific to the model or the dataset.

The Retrieve-then-Reason mitigation was tested on RULER (QA tasks over documents): on GPT-4o it gave +4% on QA2 with a 32K context (68.4% → 72.4%). Modest, but consistent across all lengths. With weaker baselines, the effect is bigger.


08

Original from the Paper

An example prompt for Step 1 (extraction) from the RULER experiments:

Read the question based on the given documents. Choose the documents most relevant
to the question and copy them fully WORD BY WORD.

The following are given documents.

{context}

Read the question. Choose the documents most relevant to the question and copy them
fully WORD BY WORD. Only give me the relevant documents and do not output any other
words. Do not make up documents. Do not repeat documents. Use "# Document <number>"
at the start of each document, then copy its full content.

Question:
{question}

Context: This is the exact version for the RULER QA tasks, where the model picks the relevant documents from a set and quotes them in full. Step 2 used the standard RULER prompt, "Answer based on given documents," with the documents extracted in Step 1 instead of the full set.


09

Resources

"Context Length Alone Hurts LLM Performance Despite Perfect Retrieval"
Yufeng Du, Minyang Tian, Srikanth Ronanki, Subendhu Rongali, Sravan Bodapati, Aram Galstyan, Azton Wells, Roy Schwartz, Eliu A Huerta, Hao Peng
University of Illinois at Urbana-Champaign, Amazon, USC, Argonne National Laboratory, Hebrew University, University of Chicago


Research digest

Key result

The paradox: a model retrieves information with 100% accuracy yet loses up to 85% of its reasoning accuracy. The problem isn't search quality — it's that the context is too long. The Retrieve-then-Reason method lets you solve tasks over long documents without losing accuracy — it turns a long-context task into a short-context one. Division of labor: first extract the evidence in a separate request, then reason over a short context. Llama-3.1-8B finds the conditions in 970 out of 1000 problems but drops 24.2% in solving accuracy — the method wins those points back.

Principle

A model is good at extracting information from long text but bad at reasoning over it. Split it into two requests: the first — "find and quote what's relevant," the second — "solve the task using this short data". Step 1 compresses the context from 50 messages down to 4-6 relevant passages. Step 2 works on the compressed data with no noise in the attention mechanism — the model focuses only on what matters.

Why it works

The attention mechanism works like this: the longer the context, the more computation per token and the weaker the links between relevant parts. Even if the model "sees" all the evidence, it uses it worse when reasoning over long distances. Llama-3.1-8B extracts the conditions for 970 out of 1000 problems — but solving accuracy drops by 24.2% at 30K tokens. The study showed the drop happens even when the distracting text is replaced with whitespace, even when the evidence is placed right before the question. The cause is the length of the context itself. Short context = less noise in attention, more precise work with the information.

When to apply

For tasks over long documents → specifically when you need to make a decision based on scattered information (email threads, meeting notes, long reports), especially when a prompt with the full context gives vague or incomplete answers. NOT a fit for tasks that need the full context at once — translating a whole document, summarizing an entire thread while keeping every nuance.

Mini recipe

1. Extraction (first request): Give the model the long context + the instruction `Find and quote EXACTLY (word for word) every passage that mentions: [list of criteria]`. You'll get a compressed digest of what's relevant. 2. Solving (second request): New prompt = `Here is the relevant information: [passages extracted in Step 1]` + your final question. The model solves the task on short data without wandering through the long context.

Examples

[BAD]: `Here's a 50-message thread with a client about an ad campaign. Write a proposal based on their requirements` [GOOD]: Step 1: `Find and quote EXACTLY every message where the client mentions: budget, ad channels, launch dates, creative requirements`. Step 2: `Here's what the client said about the campaign: [extracted messages]. Based on this information, write a proposal`

In plain words

The problem isn't that models "forget" information in long texts — it's that they drown in it. This study kills the myth of infinite context windows: even if a model has perfect memory and finds the right quote with 100% accuracy, its ability to reason about that information drops by 14–85%. Once extra bulk lands in the prompt, the LLM's gears start grinding and it stops understanding what to do with all that data.

It's like trying to build a complicated Lego set while someone keeps dumping buckets of other pieces on your head. Even if you can clearly see the brick you need, just being buried under a mountain of plastic keeps you from focusing on the instructions. The researchers went to extremes: they replaced the extra text with whitespace and even fully masked the "noise," leaving the model only a few crumbs of useful data in a huge empty field. Same result — performance goes down the drain, because the sheer size of the workspace paralyzes the logic.

The numbers hit hard: accuracy drops by up to 85% when the task requires not just "find and show" but "think and solve." Models make great retriever dogs that fetch the stick from the bushes, but ask that dog to juggle and do mental math at the same time and it drops everything. The problem isn't the quality of data extraction (retrieval) — it's that long context physically breaks the attention mechanism, forcing the model to spend resources processing emptiness or irrelevant junk.

It was tested on hard logic problems, but the principle is universal for any work with documents. If you dump an hour-long call transcript into ChatGPT and ask for a strategy, you'll get shallow nonsense — not because the model is "dumb," but because the sheer volume of text ate its ability to analyze. Same goes for legal contracts and giant code logs: the longer the wall of text, the higher the chance the model hands you a hallucination or something simplistic instead of a deep conclusion.

Bottom line: long context is a marketing trap, not a cure-all. To get a sensible result, first cut out everything extra and feed the model only the concentrated essence. If you want the AI to actually think, use the "extract what matters first, then reason in a separate short request" pattern. Otherwise you're just paying for tokens that make your assistant dumber with every extra word.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Retrieve-then-Reason: How Context Length Kills Reasoning Even With Perfect Retrieval arXiv:2510.05381

Sign in to apply this study New accounts get 50 free credits.