A legal-tech team sends a 300-page contract in a single request; the model's window could hold it three times over. Asked whether the contract has an early-termination penalty, the model says it doesn't. The penalty clause sits on page 140. The vendor's needle-in-a-haystack chart was solid green, and when an engineer moves the clause to the first page, the model finds it at once. Nothing was cut off. The model saw the clause and still missed it.
The common misconception
"If the document fits in the context window, the model reads every part of it equally well." It's a natural assumption:
Context windows are sold as capacity, and capacity sounds like a guarantee: so many tokens, so many pages.
In software, data loaded into memory is equally accessible at any address.
Attention lets every token look at every other token directly, so nothing should be "too far away".
Model announcements show needle-in-a-haystack charts with near-perfect scores across the whole window.
It's a half-truth. The model can attend to any token in its input, and simple lookups often succeed. But "can" isn't "reliably will", and the popular tests measure the easiest case.
What actually happens
Three things affect how well a model uses a fact in its context: how much text surrounds it, where it sits, and how directly the question points at it.
Fitting is a size limit
The is how much text a request can hold. It says nothing about how well each part will be used. Anthropic's engineering team describes : as the number of tokens grows, the model's ability to recall information from its context decreases. They call it a gradient rather than a cliff, so there's no warning line where the trouble starts.
Position matters: lost in the middle
Liu and colleagues gave models a question with 20 retrieved documents, about 4,000 tokens, exactly one of which held the answer, and moved that document from first to last. Accuracy traced a U-shape: highest when the answer was at the beginning or end, lowest in the middle. GPT-3.5-Turbo dropped by more than 20%, and in the worst positions it did worse than when it got no documents at all and answered from memory.
That was a short input. The problem isn't only about huge contexts: it's about where the important part lands. The study also found that extended-context versions of the same models were no better at using an input that fit both.
Needle tests are the easy case
A hides one sentence in filler text and asks for it back, usually with words copied from that sentence. RULER kept the idea but added harder tasks, such as tracing a chain of variable assignments or aggregating information spread across the input. Of 17 models that all claimed windows of 32,000 tokens or more and scored nearly perfectly on the plain needle test, only half held satisfactory performance at 32,000.
NoLiMa removed the shortcut: its questions share few words with the fact they need, so the model has to make the connection rather than match text. Of 13 models claiming at least 128,000 tokens, 11 fell below half of their short-context score at 32,000 tokens. GPT-4o, one of the best, went from 99.3% to 69.7%. The authors note that newer models have improved, but the decline still starts at lengths well below the advertised window.
Why it happens
Anthropic's engineering post gives the intuition. In a transformer, every token attends to every other, which makes n² pairwise relationships for n tokens, so attention is spread thinner as the input grows; they call it an attention budget that every new token depletes. And models see fewer long sequences than short ones in training, so they have less practice at long-range lookups.
Measure it on your own data
Benchmarks use other documents and other questions. This script plants one fact at five depths of your real documents and asks a question phrased the way a user would, not copied from the fact.
Python · recall_check.py
import anthropicclient = anthropic.Anthropic()chunks = load_chunks() # your real documents, split into paragraphsFACT = "Staging database credentials are rotated every 45 days."# Phrase the question differently from the fact, like real users doQUESTION = "How long can the test environment keep the same DB login?"def answer_with_fact_at(depth): docs = chunks[:] docs.insert(int(depth * len(docs)), FACT) # 0.0 = start, 1.0 = end prompt = "\n\n".join(docs) + f"\n\nUsing the documents above: {QUESTION}" reply = client.messages.create( model="claude-opus-5-5", max_tokens=16000, messages=[{"role": "user", "content": prompt}], ) return next(b.text for b in reply.content if b.type == "text")for depth in [0.0, 0.25, 0.5, 0.75, 1.0]: hits = sum("45" in answer_with_fact_at(depth) for _ in range(3)) print(f"fact at {depth:.0%} of the context: {hits}/3 correct")
Run it at the input sizes your feature really sends, then with half as much context. If the middle depths or the longer input score worse, you've found your budget before your users did.
Myth
Reality
If it fits, the model reads all of it
It can attend to all of it, but recall falls with length
Position in the prompt doesn't matter
The start and end are used best, the middle worst
A perfect needle chart proves long-context skill
Copied-word lookups are the easy case; paraphrased tasks degrade early
A bigger window means better use of context
Extended-context versions used the same input no better
More context is always safer
Every extra token competes for attention, so irrelevant text costs accuracy
How to apply it in your project
Send lessRetrieve the relevant sections instead of whole documents. Anthropic's advice is to find the smallest set of high-signal tokens that gets the job done.
Put documents first and the question lastAnthropic's guide recommends long inputs at the top and the query at the end, which improved response quality by up to 30% in its tests, especially with complex, multi-document inputs.
Label each documentWrap documents in tags with their source, so the model can tell them apart and you can trace an answer to its origin.
Test at your real lengths and positionsRun a positional check like the one above with questions phrased like your users', and re-run it when you change models or grow the context.
Key takeaways
The context window limits how much fits; it doesn't guarantee how well each part is used.
Facts at the start and end of the input are used most reliably; the middle is weakest.
Recall declines well before the window is full, especially when the question doesn't repeat the fact's words.
Near-perfect needle-in-a-haystack charts measure the easy case.
Send less, order it well, ask for quotes, and measure at your real lengths.
التعليقات (0)