Information Systems Technology Adoption and Management Artificial Intelligence in Agriculture

Context Windows Are Not Memory, and the Gap Is Costing You Accuracy

Research shows models reliably miss facts buried in the middle of long prompts—even well within their advertised token limits

S.J. Nam 7 min read
Context Windows Are Not Memory, and the Gap Is Costing You Accuracy

The Window Is Not a Room

Ask a chatbot to summarize a 200-page contract, then ask it a question about a clause buried on page 90, and something strange happens: it does noticeably worse than if that same clause sat on page 1 or page 200. This isn't a bug report from an angry user. It's a documented, reproducible property of how large language models process text, and it points to an uncomfortable truth the industry's own marketing obscures: the "context window" everyone brags about in millions of tokens is not memory in any meaningful sense. It's an attention budget, and budgets get spent unevenly.

That distinction — window versus memory — is the whole argument of this essay. Model providers keep shipping bigger windows (Google's Gemini line pushed past a million tokens, OpenAI moved from an 8,000-token GPT-4 to a 128,000-token GPT-4 Turbo, Anthropic's Claude went from 100,000 to 200,000 tokens within a year) as if scale alone solves recall. But the evidence suggests something closer to the opposite: simply stuffing more text into a model's context can make it worse at using any particular fact inside that text, because attention isn't a filing cabinet — it's a spotlight, and spotlights have a shape.

Stateless by Design

Start with the part almost no consumer product explains clearly: a language model does not remember your previous conversation the way a person does. Between one API call and the next, the model's weights don't change. There is no learning happening mid-conversation, no neuron quietly updating to store "the user's dog is named Biscuit." What actually happens is far more mechanical — and, once you see it, faintly absurd. Every time you send a message, the system re-feeds the entire conversation transcript back into the model from scratch, token by token, and the model re-derives its "understanding" of everything by computing attention across that whole sequence again.

This is why products like ChatGPT's "memory" feature or various AI assistants' "long-term memory" are not evidence that the underlying model learned to remember. They're retrieval systems bolted on top: a separate database logs facts about you, and before each new response, relevant snippets get silently re-inserted into the prompt. The model isn't remembering; it's being re-briefed. That's not a criticism — it's a reasonably clever workaround for a real limitation — but conflating the workaround with genuine memory is exactly the kind of category error that makes people expect human-like continuity from a fundamentally discontinuous process.

The Valley in the Middle

The clearest empirical demonstration of this comes from a body of research on how models use long contexts, most notably the "Lost in the Middle" study by Nelson Liu and colleagues, which tested models on multi-document question-answering tasks where the answer's position within the context was deliberately varied. The finding: performance traced a U-shape. Models were reliably good at using information at the very beginning of a context and at the very end, and measurably worse at using information buried in the middle — even when the total context length was well within the model's stated limit, and even for models explicitly marketed as "long-context." Simply having room for the answer wasn't the same as being able to find it.

This matters because it inverts the intuitive fix. If a model forgets something, the instinctive response is to give it more context — paste in the whole document, the whole email thread, the whole codebase. But if the relevant fact lands in that middle valley, more context can bury it deeper rather than surface it. Bigger windows don't just fail to help in this scenario; the structural bias toward the edges means adding irrelevant padding to the middle actively degrades retrieval of what's already there. Context rot, as some researchers have started calling the general degradation of instruction-following and recall as sequences lengthen, is a real cost, not a rounding error.

The Retrieval Workaround, Done Honestly

This is where retrieval-augmented generation earns its keep, and it's worth being precise about what RAG actually is, because casual explainers often flatten it into "giving the AI a search engine." The original formulation, from Patrick Lewis and coauthors at Facebook AI Research in 2020, paired a pretrained parametric model with a non-parametric memory — a dense vector index the model could query — explicitly to combine a language model's fluency with a retrieval system's precision, rather than asking the model to hold everything in its own weights or its own context at once.

The honest way to understand RAG, then, isn't "more memory" but "less context, chosen better." Instead of shoving an entire knowledge base into the prompt and hoping the U-shaped attention curve doesn't bury the answer, a retrieval system fetches only the handful of passages most likely to matter and places them where the model's attention is strongest. Done well, a tightly curated 4,000-token prompt built from retrieval can outperform a sloppy million-token dump of raw documents — not because the model got smarter, but because the odds of the right fact landing in a dead zone dropped sharply. This is the industry's actual practice, even as its marketing keeps selling window size as the headline number.

The Quadratic Tax Nobody Advertises

There's a structural reason providers didn't just make every window infinite from the start, and it's pure arithmetic: the self-attention mechanism at the heart of the transformer architecture compares every token to every other token, so compute and memory cost scale roughly with the square of sequence length. Doubling a context window doesn't double the cost — it roughly quadruples it, before engineering tricks like key-value caching and sparse or windowed attention variants claw some of that back. A million-token context window is a genuine feat of systems engineering, but it is also, unavoidably, an expensive one, and that expense is a big part of why "needle in a haystack" tests — burying a single specific fact inside a huge synthetic document and checking whether the model can find it — became the industry's go-to benchmark. Passing that test tells you a model can locate a needle. It says nothing about whether the model can reason well about ten related needles scattered across a haystack, which is the situation real work actually produces.

What Bigger Windows Are Really Buying You

None of this means longer context windows are worthless — they're genuinely useful for tasks like holding an entire codebase or legal filing in view for a single, well-structured query. But the growth in headline token counts has outpaced the growth in something harder to market: reliable, uniform recall across that entire span. The industry sells context length as a proxy for memory because it's a single, comparable number that fits in a press release, the way megapixels once stood in for camera quality. What actually determines whether an AI system "remembers" the thing you told it forty messages ago is a messier combination of where that fact landed in the reconstructed prompt, whether a retrieval layer thought to resurface it, and how much unrelated text is competing for the model's attention in between. Until that combination gets easier to describe than "the window is bigger now," people are going to keep being surprised — and occasionally burned — when a machine that can hold a million tokens still can't hold onto the one that mattered.

References

Related Essays

The Guessing Instinct That Retrieval Never Touches
Information Systems Technology Adoption and Management

The Guessing Instinct That Retrieval Never Touches

A language model asked the same factual question three times gave three confident, wrong answers. The real culprit isn't broken software — it's benchmarks that reward bluffing over honesty, a flaw retrieval-augmented generation can narrow but never actually cure.

S.J. Nam, Ph.D Jul 7, 2026 7 min read
The Bottleneck Was Never the Vector
Information Systems Software Development

The Bottleneck Was Never the Vector

Vector-search benchmarks measure the one part every engine already optimized and ignore the thing that actually breaks production retrieval: filtering against live business data. That reframes the entire pgvector vs Qdrant vs Pinecone debate.

S.J. Nam, Ph.D Jul 4, 2026 7 min read
Search Engines Quietly Abandoned Recall, Not Just Improved It
Information Systems Information Retrieval

Search Engines Quietly Abandoned Recall, Not Just Improved It

Precision is easy to report; recall requires counting every relevant document that exists, which nobody has done since the web outgrew ten blue links. The AI search industry hasn't solved that problem — it has stopped mentioning it.

S.J. Nam, Ph.D Jul 2, 2026 7 min read
The Filing Clerk Beats the Genius: Why Hybrid Search Works
Information Systems Information Retrieval

The Filing Clerk Beats the Genius: Why Hybrid Search Works

Vector search misses exact strings; keyword search misses meaning. The reason hybrid retrieval works isn't that it's smarter — it's that it refuses to trust either retriever's confidence, and hands the decision to a score-blind referee.

S.J. Nam, Ph.D Jul 1, 2026 7 min read