PACE: Keeping the Right Tokens in the KV Cache Is Not Enough for Long-Horizon LLM Agents
Abstract
Long-horizon LLM agents accumulate sessions of up to millions of tokens, far more key-value (KV) cache than one GPU holds, so serving systems keep a small budget of tokens and evict the rest. Eviction methods differ in which tokens they keep but share one goal: that the tokens a later step needs are still cached. We show this is not enough. In 100K-token coding sessions on Qwen3-8B with a 2,048-token budget, a planner-guided policy that keeps over 99% of the needed tokens resident still fails late steps increasingly often: its accuracy falls from 93% to 64% as the gap between a definition and its use grows from 2K to 90K tokens, at residency 0.996. The needed tokens are resident but unretrievable: what grows is their rotary-position distance to the query. We present PACE (Planner-Aware Context Engine), a KV-cache engine that couples plan-aware retention, in which the agent's planner tells the cache which context future steps will read, with bounded positions, which renumber kept tokens so their rotary distance to the query stays below 8K at any session length. In a pre-registered evaluation on fresh tasks, PACE passes 97% of hidden unit tests at 100K tokens, against 42% for H2O and 3% for SnapKV under the same budget, and needs both components: either alone reaches 63% (the combination beats each, p < 10-4). The result holds with length: in 1M- and 2M-token sessions on one 24 GB GPU, with definitions written 0.9M and 1.8M tokens before use, PACE passes 99% and 100% of checks and recalls every session fact, while bounded positions without foresight falls from 33% to 13%; PACE holds under 0.7 GB of KV state where the full cache would need 147-295 GB. Renumbering is exact, costs no measurable perplexity, and adds 9% wall time. On Mistral-7B, whose coding ability caps it at 40% even with nothing evicted, PACE stays at that ceiling while retention alone falls below it.
Create a lesson
Related papers
Plug-and-Play Verifier for Decoupling Process Reward in Stabilizing Long-Horizon Agentic Reasoning
Shared title terminology · Mingwei Xu, Jieyuan Pei, Binghao Tu et al.
Reliable Prerequisite-Aware Learning Path Recommendation under Uncertain Knowledge Structures: Long-Horizon Evaluation and Cross-Dataset Validation
Shared title terminology · M. M. Golam Hafiz, A. K. M. Shahriar Emtiaz, Safia Akter Simi et al.
When2What: A Timing-Conditioned Framework for Long-Horizon Forecasting of Continuous Cardiovascular Waveforms
Shared title terminology · Chaoqi Zhang, Shujie Yan, Zhao Zhang et al.
Coordinated Mixed-Precision KV Cache Quantization for Efficient LLM-based Multi-agent Systems
Shared title terminology · Weizhong Huang, Jinchao Zhang, Xiawu Zheng
Direct Feedback Policy Optimization for AI Coding Agents
Shared title terminology · Fei Ding
S^2LMR: Supervised Sequential Long-Context Multi-Step Retriever
Shared title terminology · Qiang Hu, Kaiyi Ji