Retrieval is a compression problem
Most teams describe retrieval-augmented generation as a search problem: given a query, find the most relevant documents. That framing is intuitive and it leads, almost inevitably, to a pipeline optimized for similarity. I have come to think it is the wrong frame. Retrieval is a compression problem, and the thing being compressed is the corpus into the context window.
The reframing
You have some large body of text and a fixed budget of tokens. You must choose a subset that maximizes the probability the model produces a correct answer. That is lossy compression: you are discarding information and hoping the discarded part was not the part that mattered.
Once you state it that way, several familiar problems stop looking like implementation details and start looking structural.
Chunk size is a compression ratio
Small chunks give you high resolution and low context efficiency. You retrieve many fragments, each precisely relevant, but you burn tokens on repeated boilerplate and on fragments that are individually meaningless without their neighbors.
Large chunks give you context and low resolution. You retrieve fewer items, each self-contained, but you spend most of your budget on text the query did not need.
Neither is correct in general. The right chunk size is a function of how information is distributed in your documents — and that distribution is not uniform. A policy document has answers concentrated in clauses; a technical manual has answers spread across procedures and their preconditions. Chunking them the same way is a compression decision made without looking at the data.
Similarity is a proxy, not the objective
Embedding similarity measures whether two texts are about the same thing. The objective is whether the retrieved text contains the information needed to answer. These diverge constantly.
- A question about an error code retrieves the page that mentions the code most often, not the page that explains what to do about it.
- A question about a policy exception retrieves the general policy, because it is longer and shares more vocabulary, and misses the one-paragraph exception.
- A question phrased in user language retrieves user-facing documentation, when the answer lives in an internal runbook with different vocabulary entirely.
In compression terms: similarity is a heuristic for choosing which bits to keep, and it is a lossy heuristic. High recall on a similarity metric does not imply the answer survived the cut.
More context is not more information
The instinct when retrieval fails is to retrieve more. This is the compression equivalent of increasing the bitrate without changing the codec. It helps up to a point, then it hurts, because irrelevant context is noise the model must filter, and models are imperfect filters.
There is a well-documented effect where adding distractor documents reduces accuracy even when the correct document is present. The model attends to the wrong evidence. This is not a bug in the model so much as a property of the compression scheme: you kept the answer, but you also kept a lot of things that look like answers.
The goal is not to retrieve everything relevant. It is to retrieve nothing irrelevant.
What changes if you take this seriously
Four practical shifts:
- Measure answer survival, not recall. For a sample of real queries, check whether the retrieved set contains the sentence that answers it. Recall@k on a similarity metric will not tell you this.
- Tune chunking per document type. Structure-aware chunking — following headings, clauses, function boundaries — usually beats fixed windows by a wide margin, because it aligns the cut with where information actually separates.
- Add a reranker before you add more candidates. A cross-encoder that scores query-document pairs directly is a better compressor than a wider net.
- Budget explicitly. Decide the token budget first, then fill it in order of expected information density. Most pipelines do the reverse: retrieve k items, then hope they fit.
The long-context complication
As context windows grow, one might expect retrieval to become less important. I think the opposite is closer to true. When the window is small, retrieval is about fitting. When the window is large, retrieval is about denoising — and denoising matters more, because a larger window gives more room for irrelevant text to dilute attention.
Retrieval does not go away when context gets cheap. It changes job description: from expanding capacity to protecting signal.