MORTIS: Compiler-Guided KV-Cache Management for LLM Agent Programs
Xiaoyu Ma, Jayanaka L. Dantanarayana, Savini Kashmira, Baichuan Li, Lingjia Tang, Jason Mars
Abstract
Existing agent serving systems divide each prompt into a reusable prefix and an opaque suffix, managing the KV-cache at this coarse granularity without distinguishing the components within each part. We observe that prompt components differ in which LLM calls share their values and how long those values remain reusable, a property we term intra-prompt heterogeneity. Our key insight is that, in frameworks that generate prompts from typed LLM function calls, these components correspond to program variables, allowing compiler analysis to recover their sharing patterns and lifetimes. We present MORTIS, a compiler-serving co-design that combines this analysis with runtime observations to improve KV-cache management. MORTIS reorders prompt components to expose additional prefix reuse and uses their predicted reuse and lifetimes to guide cache retention, eviction, and prefetching. Our evaluation shows that MORTIS achieves up to 1.99x job completion time (JCT) speedup and 1.97x throughput improvement over SGLang, with geometric-mean speedups of 1.45x and 1.49x, respectively.
Create a lesson
Metadata
- Comments
- 10 pages
Related papers
ActKV: Efficient LLM Agents through Action-Guided KV Cache Management
Shared title terminologycs.OSZihan Wang, Cheng Tang, Lei Gong et al.
Capture the lifecycle: KV Cache management in ReAct Agents with KVTether
Shared title terminologycs.OSKaihua Fu, Yukun Zhou, Chaokun Chang et al.
SARIA: Persistence-Aware KV Caching with Coordinated DRAM--SSD Reload for LLM Agents
Shared title terminologycs.OSHui Li, Qihui Zhou, Xiao Yan et al.
Characterizing Predictability-Latency Trade-offs of KV-Cache SSD Offloading in LMCache for LLM Serving Systems
Shared title terminologycs.OSYing He, Dingsen Shi, Yanbo Dai et al.
Range: Decoupling KV-Cache Reuse Granularity from Storage Work
Shared title terminologycs.OSDingsen Shi, Jiahao Zhang, Liqiang Lv et al.
Memorix: Managing Memory Selections for AI Agents
Shared title terminologycs.OSJing Zhang, Xiaguannan Song, Dong Du et al.