arXiv:2611.00391cs.DCOct 2026

Manuscript Offprint

arXiv:2611.00391

Rethinking KV Cache Eviction for Agentic LLM Serving

Jiakun Fan, Han Meng, Yuxuan Xia, Hao Mark Chen, Dong Li, Dimitrios S. Nikolopoulos

ABSTRACT

Key-value (KV) caches impose substantial memory pressure on large language model serving systems, requiring cache eviction when capacity is insufficient. Existing mechanisms typically evict KV from the ends of cached sequences to preserve prefix sharing across requests. However, agent workloads repeatedly reuse long histories across successive turns. Recomputing the KV cache for tokens near the end of a sequence is substantially more expensive than for earlier tokens because their attention computation involves longer histories. To address this problem, we propose preserving shared prefixes and evicting the KV cache from the beginning of the remaining history while retaining the cached suffix. We build Penelope around this strategy by co-designing the eviction policy, KV recomputation, and unified GPU–CPU cache management. Returning requests reuse the KV cache retained in GPU or CPU memory and recompute only missing segments while preserving reuse of the cached suffix. We implement Penelope in SGLang and evaluate it on three Qwen3 model sizes using real agent traces. Compared with SGLang, Penelope reduces mean time to first token by up to 60% and job completion time by up to 37% with a GPU-only cache, and by up to 76% and 60% with a two-tier GPU–CPU cache.

1 INTRODUCTION

Large language models generate tokens autoregressively (Vaswani et al., 2017), with each new token attending to the preceding context. To avoid recomputing the keys and values of previous tokens at every decoding step, serving systems store them in a key-value (KV) cache. The cache grows with sequence length, and serving many requests concurrently places substantial pressure on GPU memory. Beyond reuse during decoding, systems such as vLLM (Kwon et al., 2023) and SGLang (Zheng et al., 2024) retain KV cache after a request completes, allowing subsequent requests with matching prefixes to reuse previously computed results. Retaining these histories saves computation but also consumes limited cache capacity, making eviction necessary as new requests compete for space.

Cache eviction involves two decisions: which cached histories to reclaim space from, and which portions of those histories to remove. Mainstream serving engines, including vLLM (Kwon et al., 2023) and SGLang (Zheng et al., 2024), use least recently used (LRU) policies to guide cache eviction. Concurrent work further shows that more sophisticated replacement policies often provide limited gains over LRU for prefix caching (Liu et al., 2026). While LRU prioritizes cached content by recency, it does not by itself specify

which portion of a cached sequence to remove. Existing engines typically evict KV from the ends of cached sequences: vLLM releases a request's blocks starting from its tail (vLLM Team, 2026), and SGLang removes leaf nodes of its radix tree (Zheng et al., 2024). This choice follows the structure of prefix reuse: a cached token can be reused only when the request matches the prefix through that position. Requests that diverge later can still share the earlier prefix. Evicting from the end therefore preserves a contiguous prefix that can be reused by a broader set of requests.

However, evicting from the end removes the tokens that are most expensive to recompute. When evicted history is accessed again, its missing KV cache must be recomputed. Under causal attention, each token attends to all preceding tokens, so tokens near the end of a sequence require more attention computation to recompute than earlier tokens. Prior work exploits this asymmetry. Pensieve (Yu et al., 2025) evicts from the beginning of a conversation's history in multi-turn chat; AsymCache (Shi et al., 2026) weighs hit rate against position-dependent recomputation cost when evicting blocks; and a trace study of prefix caching (Liu et al., 2026) recommends partially evicting cached nodes from their beginning.

Agent workloads amplify the cost asymmetry but also make it harder to exploit. An LLM agent (Yao et al., 2023; Yang et al., 2024) issues successive model requests while carrying out a task, incorporating previous interactions and tool results into later requests, so its history grows and is reused across turns. Three characteristics of these workloads call

¹Virginia Polytechnic Institute and State University ²University of California, Merced ³New York University ⁴Imperial College London. Correspondence to: Jiakun Fan jiakunfan@vt.edu, Dimitrios S. Nikolopoulos dsn@vt.edu.

Preprint.

Figure

Figure 1. Request latency after evicting about 30% of cached tokens starting at position 2K or from the end (Qwen3-8B, one H100). Labels give the speedup of evicting from 2K.

for revisiting position-aware eviction. First, agent workloads involve long contexts. In the TraceLab coding-agent dataset (Zhu et al., 2026b), the median request contains approximately 132K input tokens, and 79% of requests exceed 64K tokens. At these lengths, the position of evicted tokens matters more: in a single-request experiment with Qwen3-8B on one H100 GPU, evicting 30% of the cached tokens starting at position 2K rather than from the end speeds up the next request by 1.14× at 8K tokens but 2.93× at 128K (Figure 1). Second, agent workloads widely share prefixes. Requests to the same agent carry identical system prompts and tool definitions (Srivatsa et al., 2025; Zhang et al., 2026), and multi-agent workflows invoke specialized agents that share long fixed prompts (Pan et al., 2025b). In Claude Code traces from Trace Commons (Trace Commons, 2026), sessions begin with a shared prefix of about 15.6K tokens, so the beginning of a history is often content that other sessions reuse. Third, long contexts quickly exhaust GPU memory, making CPU offloading a standard way to extend cache capacity (Gao et al., 2024; Qin et al., 2025). The eviction policy must account for the two-tier GPU–CPU cache rather than GPU memory alone.

We therefore build on position-aware eviction with head-first eviction, which retains LRU-based history selection but evicts KV from the beginning of the selected history rather than its end. Applying it to agent workloads requires addressing three challenges. First, evicting from the beginning may remove shared prefixes, reducing prefix reuse and causing additional recomputation, so the system must locate where the shared prefix ends and evict only after it. Second, evicting an earlier segment leaves a gap before the retained suffix. Conventional prefix-cache lookup identifies only the contiguous cached prefix, so reusing the suffix requires the system to track and recompute missing segments without repeating computation for tokens whose KV cache remains

available. Third, with CPU offloading, independent eviction decisions in GPU and CPU memory can disrupt the intended head-first eviction order, requiring coordination across the two tiers.

To address these challenges, we present Penelope, a serving system that co-designs the eviction policy, KV recomputation, and unified GPU–CPU cache management around head-first eviction. First, Penelope preserves shared prefixes and applies head-first eviction to the remaining history, releasing only the blocks needed. Second, it tracks missing segments and selectively recomputes them while reusing the retained suffix. Third, it manages GPU and CPU memory as a single logical cache, selecting segments for eviction across both tiers and coordinating data migration so that moving cached segments does not introduce additional evictions.

We implement Penelope in SGLang and evaluate it on three Qwen3 model sizes using real agent traces under GPU-only and GPU–CPU configurations. Compared with SGLang, Penelope reduces mean time to first token (TTFT) by up to 60% and job completion time (JCT) by up to 37% with a GPU-only cache, and by up to 76% and 60% with a two-tier GPU–CPU cache.

This paper makes the following contributions:

  • Analyze how agent workloads amplify the position asymmetry of recomputation cost, and identify the challenges of exploiting it (Section 2).

  • Design Penelope, which evicts from the beginning of histories after shared prefixes, recomputes missing segments while reusing retained suffixes, and coordinates eviction and migration across GPU and CPU memory (Section 3).

  • Implement Penelope in SGLang and evaluate it with real agent traces across three model sizes, with GPU-only and two-tier GPU–CPU caches (Section 5).

References (27)