Papers
arxiv:2611.10240

PACE: Keeping the Right Tokens in the KV Cache Is Not Enough for Long-Horizon LLM Agents

Published on Nov 6

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.

Community

Hi everyone! I'm the author of PACE.

The core motivation behind this work:
Most KV-cache eviction policies assume that if an agent keeps the right tokens resident in memory, long-horizon recall is preserved. We found that even at >99% token retention, multi-turn agents degrade significantly as context grows.

The most overlooked part is Rotary Coordinate Drift: surviving tokens drift far behind the query in relative rotary distance, decaying attention scores on tokens that are still in GPU memory.

PACE couples three core mechanisms:

  1. Plan-Aware Retention (Planner Foresight): Translates the agent's plan into a foresight bonus to retain context future steps will need—soonest-needed first—rather than relying on reactive token scores.
  2. Bounded Positions & Exact Re-Rotation: Renumbers kept tokens in order so their relative distance to the query stays tightly bounded (L <= 8K) across 1M–2M token sessions, without model retraining.
  3. Plan-Guided Tiered Rehydration: Uses planner lookahead to anticipate and proactively page evicted context back from host RAM or remote storage into active GPU memory before an upcoming step executes.

Happy to discuss the math, runtime implementation details, or our 1M/2M-token benchmarks!

Sign up or log in to comment

Get this paper in your agent:

hf papers read 2611.10240
Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash

Models citing this paper 0

No model linking this paper

Cite arxiv.org/abs/2611.10240 in a model README.md to link it from this page.

Datasets citing this paper 0

No dataset linking this paper

Cite arxiv.org/abs/2611.10240 in a dataset README.md to link it from this page.

Spaces citing this paper 0

No Space linking this paper

Cite arxiv.org/abs/2611.10240 in a Space README.md to link it from this page.

Collections including this paper 1