Agentic Cache Engineering: Agents Managing Their Own KV Cache Cut Costs 7.1% Further

mrdrozdov · x · 2026-10-22

dairai highlighted a paper on KV cache management for long-running agents, with Rulin Shao adding extension ideas.

Problem: When an agent summarizes or trims its history, prefix changes invalidate all cached KV entries after it, forcing expensive re-prefill of retained context.

Approach — cache engineering: The agent gets two primitives to operate on its own KV cache: one removes entries from future attention, the other shifts positions of remaining keys. The trajectory text stays unchanged, preserving cache across context edits.

Results: Recursive self-improvement applied to cache policies cuts cost by another 7.1% over expert-designed policies.

Discussion: Shao proposes adding an LLM request argument so agents can tell the serving system when to re-prefill the suffix cache when context edits introduce conflicting information — calling cache-space context management an exciting optimization space.

Related event: Tsinghua Team Propposes Cache Engineering for Agents, Cutting KV Cache Costs 27.7%(4 posts)→

Original post →

More from coding & agent

coding & agent channel →