TokenPilot: Cache-Efficient Context Management for LLM Agents

πŸ“… 2026-06-15
πŸ“ˆ Citations: 0
✨ Influential: 0
πŸ“„ PDF
πŸ€– AI Summary
This work addresses the escalating inference costs in long-horizon LLM agent execution caused by accumulating context, where existing pruning or memory eviction strategies often disrupt prompt cache continuity, leading to prefix mismatches and cache invalidation. To tackle this, the authors propose TokenPilot, a dual-granularity context management framework that globally employs ingestion-aware compression to stabilize the prompt prefix and filter environmental noise, while locally applying a lifetime-aware eviction mechanism to conservatively offload context once its task relevance diminishes. TokenPilot is the first approach to achieve efficient context compression without compromising cache continuity, effectively balancing textual sparsity and cache efficacy. Experiments on PinchBench and Claw-Eval demonstrate that TokenPilot reduces inference costs by up to 61%/56% in isolated mode and 61%/87% in continuous mode, with no degradation in task performance, and has been integrated into LightMem2.
πŸ“ Abstract
As LLM agents are deployed in long-horizon sessions, context accumulation drives up inference costs. Existing approaches utilize text pruning or dynamic memory eviction to minimize token footprints; however, their unconstrained sequence mutations alter layouts, introducing prefix mismatches and cache invalidation. This reveals a critical trade-off between text sparsity and prompt cache continuity. To address this, we present TokenPilot, a dual-granularity context management framework. Globally, Ingestion-Aware Compaction acts as a framework harness to stabilize prompt prefixes and eliminate open-world environmental noise at the ingestion gate. Locally, Lifecycle-Aware Eviction monitors the ongoing residual utility of context segments, enforcing a conservative batch-turn schedule to offload content segments only when task relevance expires. Experiments on PinchBench and Claw-Eval under both isolated and continuous modes demonstrate that TokenPilot reduces costs by 61% and 56% in isolated mode, and 61% and 87% in continuous mode, while maintaining competitive performance compared to prior systems. TokenPilot has been integrated into LightMem2 at https://github.com/zjunlp/LightMem2.
Problem

Research questions and friction points this paper is trying to address.

context management
LLM agents
prompt cache
token efficiency
cache invalidation
Innovation

Methods, ideas, or system contributions that make the work stand out.

cache-efficient
context management
LLM agents
dual-granularity
prompt cache continuity
πŸ”Ž Similar Papers
B
Buqiang Xu
Zhejiang University
Z
Zirui Xue
Zhejiang University
D
Dianmou Chen
University of Electronic Science and Technology of China
C
Chenyang Fu
Xi’an University of Electronic Science and Technology
C
Chiyu Wu
HomologyAI
C
Caiying Huang
Xi’an University of Electronic Science and Technology
C
Chen Jiang
Zhejiang University
Jizhan Fang
Jizhan Fang
MS student of Artificial Intelligence,Zhejiang University
Trustworthy AIContinue learningAI memory
X
Xinle Deng
Zhejiang University
Y
Yijun Chen
Zhejiang University
Yunzhi Yao
Yunzhi Yao
Zhejiang University
Knowledge MechanismKnowledge Edit
Xuehai Wang
Xuehai Wang
Department of Learning, Informatics, Management & Ethics, Karolinska Institutet
Machine learningImmunologyBiomedical AIOncologyMultimodal
J
Jin Shang
HomologyAI
G
Gong Yu
HomologyAI
Ningyu Zhang
Ningyu Zhang
Ph.D. Student, Vanderbilt University
artificial intelligencelearning analyticslearning environments