Manuscript Offprint

arXiv:2609.31395

ActKV: Efficient LLM Agents through Action-Guided KV Cache Management

Zihan Wang, Cheng Tang, Lei Gong, Chao Wang, Wenqi Lou, Teng Wang, Xuehai Zhou

Zihan Wang

University of Science and Technology

of China

Hefei, China

wangzh196@mail.ustc.edu.cn

Chao Wang

University of Science and Technology

of China

Hefei, China

cswang@ustc.edu.cn

Cheng Tang

University of Science and Technology

of China

Hefei, China

sisyphustc@mail.ustc.edu.cn

Wenqi Lou

Suzhou Institute for Advanced

Research, University of Science and

Technology of China

Suzhou, China

louwenqi@ustc.edu.cn

Lei Gong

University of Science and Technology

of China

Hefei, China

leigong0203@ustc.edu.cn

Teng Wang

Suzhou Institute for Advanced

Research, University of Science and

Technology of China

Suzhou, China

wangt635@ustc.edu.cn

Xuehai Zhou

University of Science and Technology

of China

Hefei, China

xhzhou@ustc.edu.cn

Abstract

Agentic LLM inference accumulates long KV caches across iterative observation-reasoning-action loops, imposing substantial memory overhead and limiting serving throughput. Existing compression methods emphasize overall output quality, overlooking the asymmetric importance of actions in driving task progress. Our key idea is to establish a compression criterion that values KV entries by their contribution to action generation and prioritizes action quality. However, iterative execution, dynamic memory demands, and scattered action-critical entries pose challenges to eviction policies, budget allocation, and paged memory integration. To this end, we propose ActKV, the first KV cache compression framework tailored for agentic LLM inference. (i) Action-oriented KV cache eviction exploits stable action access patterns to retain entries critical to future actions, supporting reliable task progress under compression. (ii) Confidence-driven adaptive budget allocation uses LLM's intrinsic confidence to adapt the budget to evolving action-critical memory demands. (iii) Page-aware compression management standardizes compression into three primitives with customized kernels, realizing practical throughput gains. On long-trace tasks, ActKV retains an average of 98.53% of FullKV's accuracy with only 25.98% of its peak KV cache memory. It also achieves 3.97×3.97\times and 3.58×3.58\times FullKV's token and task throughput, delivering state-of-the-art performance.

Keywords: Agentic LLM Inference, KV Cache Compression

1 Introduction

Agents transform LLMs from passive question-answering into task-solving systems that perceive environments, reason, and act, reshaping how users interact with LLMs. The key is to introduce an intermediary agentic layer, forming a three-layer interaction architecture: user/environment, agentic framework, and LLM inference. The fundamental execution paradigm is iterative observation-reasoning-action loops, known as ReAct [36], which underpin modern agents like OpenClaw [21], Claude Code [1], and Codex [4]. As shown in Fig. 1, in each iteration, the agentic framework first collects environmental observations and extends LLM prompt. The LLM then reasons via chain-of-thought [29] for state understanding and deduction from accumulated traces. Finally, the LLM generates an action, which is executed by the agentic framework in environment. We view agents as complete systems formed by agentic frameworks and LLMs. Agentic LLM inference thus refers to the framework-driven inference process that repeatedly consumes observation tokens and generates reasoning and action tokens. Importantly, observation and reasoning remain largely internal within the agent, and are often hidden or useless to users, while what users care about is the task progress driven by actions.

Despite its potential for solving complex tasks, agentic inference incurs substantial KV cache overhead. Observation, reasoning, and action tokens accumulate as KV entries across interaction rounds, imposing heavy memory and computation costs on LLM serving systems. For example, a web shopping task with Qwen3-30B requires 25 iterations and about 35K tokens, consuming 3.20 GB of KV cache, with

Figure

Figure 1. Agentic Workflow

observation and reasoning entries accounting for over 99%. This overhead grows with concurrent requests in batched serving, limiting concurrency and throughput. Moreover, long KV sequences can dilute attention and degrade model accuracy. Thus, KV cache compression is essential for efficient and accurate agent deployment.

KV cache compression dynamically evicts redundant KV entries during inference while preserving accuracy. Although many methods exist, most target conventional text generation and generalize poorly to agentic inference. The fundamental mismatch lies in the generation objective: preserving overall output quality versus prioritizing action quality. In continuous text generation, all tokens contribute to output completeness, so existing methods fairly maintain quality of each token generation. By approximating near-future attention, they greedily evict KV entries that are lowly attended by next few tokens [17, 31, 37]. In agentic inference, however, token importance is asymmetric. Observation and reasoning tokens mainly support internal state understanding and deduction, but are often hidden or useless for users. Only action tokens affect environments and determine user task progress. Thus, uniform token treatment is inherently misaligned with prioritizing action quality. Even worse, short-sighted retention for near-future reasoning can harm subsequent actions (Section 3.1).

Our key idea is to establish a compression criterion that values each KV entry by its contribution to action generation and prioritizes action quality during compression, thereby aligning eviction with the outcome-driven nature of agentic inference. However, three challenges arise.

What to keep? Iterative execution calls for stable criteria to identify action-critical KV entries. Since successive actions build on accumulated observations and reasoning, compression must preserve KV entries needed for both current and future actions. However, evolving context makes current importance an uncertain indicator of future utility. This raises a fundamental question: do action-critical KV entries exhibit consistent attention patterns across iterations? Such regularities could provide a reliable basis for compression while preserving subsequent action quality.

How much to keep? Dynamic memory demands of action-critical KV entries require adaptive budget allocation. The KV cache budget controls the trade-off between memory footprint and generation quality. Across task types and difficulty levels, the number of action-critical KV entries varies with interaction rounds, observation lengths, and reasoning complexity [36]. However, existing methods typically profile full-KV memory consumption on specific tasks and apply predefined compression ratios during inference [3, 10]. Such budgets derived from workload-specific offline profiling fail to adapt to evolving action-critical memory demands.

How to compress efficiently? Scattered action-critical KV entries require reconciling compression with paged memory management. Agent deployment relies on serving systems (e.g., vLLM [27] and SGLang [39]), which use block-based KV management to reduce fragmentation and improve throughput. However, scattered action-critical entries require token-level eviction misaligned with block-level allocation. Most implementations remain limited to algorithmic validation. The few system-level approaches incur copying overhead offsetting compression gains [2] or rely on policy-specific adaptations lacking generality [23]. These limitations hinder practical memory savings from fine-grained eviction.

To address the challenges, we propose ActKV, the first KV cache compression framework tailored for agentic LLM inference, enabling accurate, memory-efficient, and high-throughput agent deployment through three components.

Action-oriented KV cache eviction prioritizes action generation quality during compression. We observe that actions generated within a given task exhibit similarities. First, each task involves a finite set of semantically related action types. Second, action arguments repeatedly draw on shared task context. Third, action outputs follow a standardized template [9]. Motivated by these semantic, contextual, and structural similarities, we examine attention maps and observe that action-critical KV entries form a stable subset across iterations but contribute intermittently (Section 3.1). Accordingly, we propose attention-aware Least Recently Frequently Used (LRFU) to retain entries critical to future actions, enabling reliable task progress with a low memory footprint.

Confidence-driven adaptive budget allocation dynamically adjusts the KV cache budget during inference. We observe a strong correlation between the LLM’s intrinsic confidence and budget sufficiency. Tighter budgets make action-critical KV information incomplete, forcing model to extend reasoning to recover missing context and causing confidence drops (Section 3.2). Accordingly, we design a confidence monitor that combines sliding-window analysis with linear fitting.

to detect confidence degradation caused by budget insufficiency and trigger budget adjustments, adapting to evolving action-critical memory demands.

Page-aware compression management bridges fine-grained KV eviction with block-based memory. We observe that the eviction-based compression can be distilled into a unified workflow of three primitives: attention calculation, entry eviction, and cache compaction, with calculation and compaction as the main system gaps (Section 3.3). Accordingly, we design customized kernels. The recovery-based attention calculation kernel reconstructs attention scores from softmax log-sum-exp (LSE), while the in-place cache compaction kernel performs one-shot in-place copying by conflict-free slot planning. These standardized primitives and customized kernels translate algorithmic gains into tangible memory savings and throughput improvements.

We evaluate ActKV on four agentic LLMs, Qwen3-30B, Qwen3-235B [33], GPT-OSS-20B, and GPT-OSS-120B [20], across HotpotQA [34], WebShop [35], and ALFWorld [25]. Relative to FullKV, ActKV averages 98.53% accuracy with only 25.98% peak KV cache memory on long-trace tasks, compared with at most 74.22% accuracy and about 33.60% memory for StreamingLLM [31], SnapKV [17], and R-KV [2]. End to end, ActKV improves token and task throughput over FullKV by 3.97×3.97\times and 3.58×3.58\times, respectively.

• Action-oriented KV cache eviction. We prioritize action quality during compression to support reliable task progress under aggressive memory constraints.

• Confidence-driven adaptive budget allocation. We use LLM’s intrinsic confidence to adapt the budget to evolving action-critical memory demands.

• Page-aware compression management. We standardize compression into three primitives with customized kernels, realizing practical throughput gains.

• While maintaining or even improving accuracy, ActKV reduces memory footprint and improves throughput, achieving state-of-the-art performance.

References (13)