Can I Buy Your KV Cache?
25 points
2 hours ago
| 8 comments
| arxiv.org
| HN
wren6991
18 minutes ago
[-]
Prefix caching is already widely deployed by all providers, right? llama.cpp does it. vLLM does it. I'm sure everyone hosting LLMs for a living does it. This paper seems to focus entirely on prefixes (i.e. the prefilled content is rooted at 0). This is... nothing.

The referenced CacheBlend paper (https://arxiv.org/pdf/2405.16444) which tries to stitch together multiple independent prefills looks more interesting and is new to me. The problem it's trying to solve is:

* KV projections for a given token at a given layer are a function of the residual at that layer,

* which is a function of the attention contribution of the previous layer,

* which is a (nonlinear) function of all earlier tokens' KV values at the previous layer.

This is what stops you from just pasting KV blocks together. Intuitively it might feel like you could do the equivalent of an MPEG deblocking filter to fix up the edges, but there's no guarantee the tokens that need fixing up are at the beginning of the KV block, so they have to be sneaky about it.

Unfortunately while that paper is quite verbose it's lacking in detail in the most important part: how they perform the approximate KV recomputation. It looks like the rough idea is that they fully recompute the KV for the first layer, and use the deviation between the recompute and the original cached KV as a heuristic for how important it is to recompute the full KV values (i.e. all remaining layers) for that token. They use that to derive a mask for the tokens which most strongly attend to the earlier context, then do a sparse update of those tokens.

What's still unclear is how this actually ends up being a performance win, given that the sparse update for each token still requires the exact KV for all the prior tokens in order to actually arrive at the correct value. It just kind of recurses the problem instead of fixing it. Maybe they just use the precomputed KV for the other tokens as input, and live with the approximation?

I think this is already somewhat pragmatically solved: just don't pull huge documents into context. Give the LLM tools to search them and retrieve the fragments that are actually relevant.

reply
dannyw
2 minutes ago
[-]
Yeah, I'm really not sure what the point of this paper is. Every non-toy environment does prefix caching.
reply
lumost
1 hour ago
[-]
The KV cache is order dependent and dependent on the context of tokens which exist before the KV cache.

There are some transformation approaches to re-use the kv cache across inferences, but none are in wide use due to accuracy concerns following the transformation.

reply
Eridrus
1 hour ago
[-]
The paper has a section on "Reusing precomputed KV across queries" which talks about how other papers have tried to address this problem, but yeah, this paper adds nothing on its own besides a catchy title.
reply
dgellow
1 hour ago
[-]
Just curious, do you have links to read more about transformations or other techniques for KV cache reuse?
reply
evrydayhustling
1 hour ago
[-]
All major model providers offer prefix caching, which is this.
reply
lumost
53 minutes ago
[-]
No, reusing segments of the kv cache for different purposes in an order independent manner is an active research area.
reply
dgellow
42 minutes ago
[-]
Any keyword or paper I can search for?
reply
dvmazur
14 minutes ago
[-]
AsyncResoning[1] does a trick of that sort to give agents concurrent cache views.

You basically have two agents look at the same cache under different views. Say agent_0 gets [a_1, a_0] and agent_1 gets [a_0, a_1]. They also write to this cache concurrently while decoding. To solve positional embedding inconsistencies they rotate the query projections for each block (a_0 and a_1) separately.

The computations you get that way do not exactly match the setup where you would naively prefill on every step, but are close enough.

Same trick could be used for the setup discussed here, I guess: prefill the document cache separately (p), prepend the system prompt (s) and get a cache view [s, p] from which you can then decode.

1. https://arxiv.org/abs/2512.10931

reply
TZubiri
11 minutes ago
[-]
Absolute slop paper. Replace document with text and you'll get it.

"People are asking the same questions and an answer is generated every time, what if we could like cache the questions and their answers..."

Sounds like someone was using chatgpt to understand how chatgpt works and then asked it to generate a paper based on his proposal to improve it.

reply
mistercow
1 hour ago
[-]
> Then the part that matters: where the KV lives

When your abstract was clearly generated by an LLM and not curated to at least make it sound human, it does not make me want to read your paper.

reply
numeri
12 minutes ago
[-]
especially because this is the most painfully glaring flaw in their plan. Their solution is for an inference provider to... store the KV cache (which they can compute!) on-premise, on their own disks, but pay some third party for it?
reply
TuringNYC
33 minutes ago
[-]
Seems Cloudflare is now doing this for scraping, so makes sense to continue down the pipeline!
reply
tonetegeatinst
1 hour ago
[-]
Does anyone have a good recommendation for explaining or as a primer on KV cache?
reply
wren6991
9 minutes ago
[-]
If you want the actual maths instead of handwaving, I recommend: https://arxiv.org/abs/2207.09238

For something gentler, 3Blue1Brown: https://www.youtube.com/watch?v=eMlx5fFNoYc (this is part of a series)

reply
plutomeetsyou
57 minutes ago
[-]
convert this question to KV cache and give it to your agent
reply
refulgentis
32 minutes ago
[-]
This paper doesn't make any sense - for background, I've maintained an AI client that's cross-platform, cross-provider, and integrates llama.cpp since 2022. I don't know why they think "agents" don't share prefill work - paid providers cache on the prefill text, llama.cpp, same, and I specifically hooked up llama.cpp so it can do subsets as well. i.e. all the agents would reuse the cache

It reads like it started from an underspecification of "agents" x a strain of pop-wisdom about "KV cache" that I've seen enter mainstream discourse over the past 3 months that is Not Even Wrong, then, they solved a non-existent problem.

EDIT: based on the rest of comments either requesting a primer on terms, or, pointing out it makes errors in even more obvious ways, flagging.

reply
christianqchung
23 minutes ago
[-]
I don't think Luoyuan Zhang is necessarily doing this, but I'm pretty sure lots of people are using arxiv as a glorified blog and hoping no one notices.
reply
sghiassy
1 hour ago
[-]
A truly global singleton
reply
root-parent
2 hours ago
[-]
Lambda computing for prompts?
reply