arXiv:2609.07966cs.LGSep 2026

Manuscript Offprint

arXiv:2609.07966

MetaKV: Adaptive KV Cache Compression for Constrained LLM Inference

Michael Wang, Keith Li, Roozbeh Bostandoost

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Key-value (KV) cache compression is an effective way to reduce the memory overhead of large language model (LLM) inference, particularly for long-context workloads. However, existing compression methods make different trade-offs among accuracy, inference latency, and peak KV cache memory utilization, making a single fixed configuration unsuitable across different prompts and resource constraints. We introduce METAKV, an adaptive framework that selects a KV cache compression configuration for each input prompt based on user-specified latency and peak memory budgets. METAKV uses lightweight prediction models to estimate the end-to-end latency, peak memory, and probability of a correct response for each candidate configuration, and selects the configuration that best satisfies the latency-memory constraints while preserving accuracy. We evaluate METAKV across ten configurations from three representative KV cache compression methods, KVQuant, H₂O, and RocketKV, together with an uncompressed FP16 configuration, on four datasets covering mathematics, science, commonsense reasoning, and reading comprehension. Across a wide range of latency and peak memory constraints, METAKV consistently outperforms the best static configuration, improving constrained success rate (CSR), the fraction of prompts answered correctly while satisfying both constraints, by approximately 0.07 on average and up to 0.135. These results demonstrate the benefit of adapting KV cache compression to individual prompts and latency-memory constraints. Code is available at https://github.com/MichaelWang0505/MetaKV.git.

1 Introduction

Large Language Models (LLMs) have become widely used for applications such as conversational assistants and code generation [19, 5]. Their growing adoption has increased the demand for GPU memory and efficient LLM inference [12, 13, 1]. This challenge is especially important for long-context inference, where the KV cache, which stores the key and value vectors of previously processed tokens, can consume up to 80% of GPU memory [9]. To reduce this memory overhead and serve more requests on limited GPU resources, prior work has proposed KV cache compression methods. These methods can be broadly categorized as lossless or lossy. Lossless methods reduce memory usage while preserving the original KV cache values and, therefore, model accuracy. Lossy methods reduce precision or discard parts of the KV cache, achieving larger memory savings at the cost of some accuracy loss. Since long-context inference often requires substantial memory reduction and lossless compression provides limited savings, we focus on lossy KV cache compression in this work.

State-of-the-art lossy KV cache compression methods use different approaches. These include (i) quantization, reducing the bits used to store KV values [9, 20, 8]; (ii) token eviction, permanently

*These authors contributed equally.

†Corresponding author: rbostandoost@umass.edu.

Preprint.

removing less important tokens from the KV cache [18]; and (iii) sparse attention, attending to only a subset of cached tokens during computation [2, 11]. Each approach makes different trade-offs among peak KV cache memory utilization (peak memory), end-to-end latency, and accuracy.

Quantization can substantially reduce peak memory by representing values with only a few bits instead of full 16-bit floating-point precision (FP16). But the additional quantization and dequantization operations can increase inference latency. In contrast, token eviction and sparse attention reduce computation by removing or skipping tokens, often resulting in lower latency. However, the retained KV values typically remain at higher precision, leading to larger peak memory usage than aggressive quantization. So, no single compression approach is consistently superior across all efficiency and accuracy objectives.

Different LLM deployment environments also impose different requirements on accuracy, end-to-end latency, and peak memory. For example, LLMs are increasingly deployed on edge devices such as smartphones, where limited memory makes peak memory usage a major constraint [16]. In contrast, interactive applications such as customer-service chatbots require fast responses, making inference latency a key constraint [6]. These scenarios can favor different KV cache compression methods. Quantization may be more suitable for memory-constrained environments, while token eviction may better suit latency-constrained settings. Sparse attention can also be effective because it has the least latency on shorter-context prompts [2]. Compression methods can also perform differently across datasets because the datasets emphasize different capabilities. Since different compression methods preserve or remove information from the KV cache in different ways, their relative performance can vary across these task types. For example, token eviction can achieve higher accuracy than quantization on math prompts, while quantization can perform better on scientific-reasoning prompts. This difference can occur because token eviction removes entire token representations, while quantization retains all tokens at reduced precision, causing the two approaches to preserve task-relevant information differently. Per-dataset results can be viewed in Appendix A.

Since the relative performance of compression methods can vary across prompt types and deployment constraints, we propose METAKV, an adaptive framework that selects the most suitable KV cache compression configuration for each input prompt. Given end-to-end latency and peak memory constraints from the user, METAKV predicts the accuracy, end-to-end latency, and peak KV cache memory of each candidate configuration and selects the one that best satisfies the constraints while preserving accuracy. This allows METAKV to adapt its compression strategy to both the input prompt and the deployment environment.

In summary, this paper makes three main contributions. First, we show that existing KV cache compression methods exhibit different trade-offs across accuracy, end-to-end latency, and peak memory utilization, motivating the need for adaptive selection. Second, we introduce METAKV, a framework that predicts the accuracy, latency, and peak KV cache memory of candidate compression configurations and selects the most suitable one under given constraints. Third, we evaluate METAKV across multiple KV cache compression methods and datasets, showing that it consistently outperforms the best static configuration across all tested latency and peak memory constraint pairs, improving constrained success rate, the fraction of prompts answered correctly while satisfying both constraints, by approximately 0.07 on average and up to 0.135.