KVzip: Query-Agnostic KV Cache Compression with Context Reconstruction

Jang-Hyun Kim, Jinuk Kim, Sangwoo Kwon, Jae W. Lee, Sangdoo Yun, Hyun Oh Song

arXiv:2505.23416 · 2026-07-27 공개 · arXiv · PDF

llm transformer kv-cache llama compression flashattention cache-eviction attention-latency

Abstract

Transformer-based large language models (LLMs) cache context as key-value (KV) pairs during inference. As context length grows, KV cache sizes expand, leading to substantial memory overhead and increased attention latency. This paper introduces KVzip, a query-agnostic KV cache eviction method enabling effective reuse of compressed KV caches across diverse queries. KVzip quantifies the importance of a KV pair using the underlying LLM to reconstruct original contexts from cached KV pairs, subsequently evicting pairs with lower importance. Extensive empirical evaluations demonstrate that KVzip reduces KV cache size by $3$-$4\times$ and FlashAttention decoding latency by approximately $2\times$, with negligible performance loss in question-answering, retrieval, reasoning, and code comprehension tasks. Evaluations include various models such as LLaMA3.1, Qwen2.5, and Gemma3, with context lengths reaching up to 170K tokens. KVzip significantly outperforms existing query-aware KV eviction methods, which suffer from performance degradation even at a 90% cache budget ratio under multi-query scenarios.

한국어 요약

한 줄 요약

KVzip은 쿼리와 무관하게 KV 캐시를 압축해 메모리와 추론 속도를 동시에 개선하는 새로운 알고리즘이다.

핵심 기여도

핵심 아이디어

KVzip은 기존 query-aware 방법과 달리, 향후 쿼리와 무관하게 KV 캐시를 압축하는 query-agnostic 전략을 채택한다. 이는 KV 캐시 내 각 KV 쌍의 중요도를 LLM 자체를 이용해 재구성된 컨텍스트 기반으로 평가함으로써 달성된다. KV 캐시는 Transformer의 인코더-디코더 구조와 유사하게 작동하며, 이 구조를 활용해 중요한 KV 쌍을 선별적으로 보존한다. 이는 self-supervised learning의 재구성 기반 학습과 유사한 원리로, 다양한 다운스트림 작업에서 일반화 성능을 유지한다. KVzip은 특히 오프라인 압축이 필요한 시나리오, 예를 들어 사용자 프로필이나 대화 기록을 유지하는 개인화된 챗봇에서 유용하다.

기술적 접근법

주요 결과

의의 및 한계

KVzip은 기존 query-aware 방법의 다중 쿼리 환경에서의 성능 저하 문제를 해결하며, 압축된 캐시의 재사용성을 확보한다. 특히, 컨텍스트 재구성을 기반으로 KV 캐시를 압축하는 방식은 Transformer의 구조적 특성을 잘 활용한 점에서 학술적 의의가 크다. 그러나 KV 캐시 압축 과정에서 일부 컨텍스트 정보가 손실될 수 있으며, 압축률이 높아질수록 성능 저하가 발생할 수 있다. 또한, 압축 알고리즘은 모델 종류와 컨텍스트 구조에 따라 최적화가 필요할 수 있다.

실용적 활용

KVzip은 대규모 컨텍스트를 유지해야 하는 개인화된 챗봇, 기업 문서 검색 시스템, 코드 이해 및 추론 작업 등에 적용 가능하다. 특히, KV 캐시 압축을 오프라인으로 수행해 여러 쿼리에 재사용할 수 있어, 실시간 추론 성능과 메모리 효율을 동시에 개선하는 데 유용하다.