The news. On August 20, 2026, an arXiv paper argued that long-context inference should be treated as a joint model-and-cache-policy problem rather than a serving-only compression problem. Its method finetunes a transformer while applying the target sparse-attention KV selection policy, so the weights adapt to the information that will remain available at inference. The authors report the method runs on a single NVIDIA A100 with 40 GB, name H2O as the leading policy in their experiments, and release the KeysAndValues library for long-context inference and finetuning. Read the paper →

Picture a student who spends every night of term at a desk with the whole shelf open — eight textbooks, every page reachable, nothing they might need more than an arm's length away. They get very good at working that way. Then they walk into the exam and the shelf is gone; all they are allowed is one index card. The problem is not that the card is small. It is that every study habit they built assumed the shelf, so they never learned which facts had to be on the card in the first place.

That student is a long-context language model, and the shelf is its KV cache. During training, every past token's keys and values are there to be attended to. During serving they are not, because keeping them all is what makes long context expensive — the cache grows linearly with the sequence, and past some length it is the thing that decides how many requests fit on a GPU. So production systems evict: drop the oldest entries, keep a sliding window, or keep whichever tokens have drawn the most attention so far and discard the rest.

Remove earliest tokens first

pos 0pos 1pos 2pos 3pos 4pos 5pos 6pos 7
The
cat
sat
on
a
very
soft
mat
■ kept in cache■ evicted

The mismatch is the whole point: the policy that decides what to forget is applied to weights that were trained with nothing forgotten. Every one of those eviction rules is a decision made after training, on a model that has no idea it is coming. The student walks in expecting the shelf. Whatever the eviction rule gets wrong, the model has no learned habit to fall back on, because the habit it does have — route this query's attention through those particular keys — assumes keys that are no longer in the cache.

The paper's move is to hand the student the index card on the first night of term. It finetunes the model with the target KV selection policy already switched on, so the weights are updated under exactly the conditions they will be served under. When the policy drops a key during training, the gradient sees a model that has to get the answer right without it, and the weights adjust to lean on the keys the policy keeps. The card and the studying are chosen together, which is where the name co-adaptation comes from — the same reason the practice matters more than the card's size.

Hold the budget fixed and it is easier to see what is being repaired. Suppose you can afford a cache of 4,000 tokens while the context runs to 32,000 — a policy that keeps one key in eight. Train densely, and the weights spent every step of finetuning attending across all 32,000; at serving time 28,000 of them — 7 of every 8 past keys — are simply gone from the cache it attends over. A policy like H2O does not drop them at random; it keeps the tokens that have drawn the most attention so far. But nothing during that dense finetuning told the weights a selection was coming, or which 4,000 it would leave. Now finetune under the same policy: the model is trained against 4,000 and served against 4,000. The budget did not change and the cache did not get bigger — the training distribution just stopped disagreeing with the serving one (illustrative: the paper does not publish this breakdown, and real budgets vary by model and workload).

Serving-only compressionPolicy-aware finetuning
When the KV policy is chosenafter training, at deploymentbefore finetuning, as part of it
What the weights know about itnothingthey were updated with it applied
Which keys are available while the weights updateevery past keyonly the ones the policy keeps
Reported hardware to train this way~a single 40 GB NVIDIA A100 (setup-dependent, as reported by the authors)

What makes this an attention result rather than a serving one is where it moves the decision. Compression work asks how few bytes can carry this cachequantize the entries, share them across heads, score each one and evict the losers. Some of those are architectural or training-aware in their own right, but none of them changes what the weights learn about the selection they will be served under. This paper puts that selection into the finetuning instead, changing the lesson: from "drop old KV tokens after training" to "train the model under the same forgetting policy it will serve with." The paper is 39 pages with no figures and reports H2O as its strongest policy; the released library is the part most people will touch first.

Goes deeper in: LLM Internals → KV Cache → KV Cache in Production

Related explainers

Frequently Asked Questions

Check what you knowMap your AI & GPU knowledge across every track — free, role-based