Zhaozhao
← All notes

Retrieval is a compression problem

22 August 2026 · 8 min read

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.

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:

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.

retrieval context