KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache

Zirui Liu, Jiayi Yuan, Hongye Jin, Shaochen Zhong, Zhaozhuo Xu, Vladimir Braverman, Beidi Chen, Xia Hu

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

kv-cache llm-inference quantization llama memory-optimization tuning-free asymmetric-quantization batching

Abstract

Efficiently serving large language models (LLMs) requires batching of many requests to reduce the cost per request. Yet, with larger batch sizes and longer context lengths, the key-value (KV) cache, which stores attention keys and values to avoid re-computations, significantly increases memory demands and becomes the new bottleneck in speed and memory usage. Additionally, the loading of the KV cache causes the computational core to be idle, which limits the inference speed. A straightforward and effective solution to reduce KV cache size is quantization, which decreases the total bytes taken by KV cache. However, there is a lack of in-depth studies that explore the element distribution of KV cache to understand the hardness and limitation of KV cache quantization. To fill the gap, we conducted a comprehensive study on the element distribution in KV cache of popular LLMs. Our findings indicate that the key cache should be quantized per-channel, i.e., group elements along the channel dimension and quantize them together. In contrast, the value cache should be quantized per-token. From this analysis, we developed a tuning-free 2bit KV cache quantization algorithm named KIVI. With hardware-friendly implementation, KIVI can enable Llama, Falcon, and Mistral models to maintain almost the same quality while using $\mathbf{2.6\times}$ less peak memory (including model weight). This reduction in memory usage enables up to $\mathbf{4\times}$ larger batch size, bringing $\mathbf{2.35\times \sim 3.47\times}$ throughput on real LLM inference workload. The source code is available at https://github.com/jy-yuan/KIVI.

한국어 요약

한 줄 요약

KIVI는 튜닝 없이 키-벨류 캐시를 2비트로 양자화하여 LLM 추론 메모리 사용량을 2.6배 감소시키는 알고리즘이다.

핵심 기여도

핵심 아이디어

기존 KV 캐시 양자화 연구는 키와 벨류 캐시의 분포 차이를 고려하지 않았다. KIVI는 키 캐시가 채널 단위로 큰 아웃라이어를 가지며, 벨류 캐시는 토큰 단위로 분산된다는 점을 분석하여 각각 다른 양자화 전략을 적용한다. 키 캐시는 채널 단위로 그룹화하여 양자화함으로써 오류가 다른 채널에 영향을 주지 않도록 설계되었다. 벨류 캐시는 토큰 단위로 양자화하여, 어텐션 스코어의 희소성에 기반한 오류 제한을 달성한다. 이는 어텐션 출력이 중요한 토큰의 값에만 의존하기 때문이다.

기술적 접근법

주요 결과

의의 및 한계

KIVI는 KV 캐시 양자화의 기초적인 분포 분석을 통해, 기존 연구에서 간과되었던 키-벨류 캐시의 차이를 명확히 규명하고, 이를 기반으로 실용적인 2비트 양자화 알고리즘을 제안한 점에서 학술적 의의가 있다. 또한, 튜닝 없이 적용 가능한 plug-and-play 방식으로, 실제 서비스 환경에서 즉시 활용 가능하다는 실용적 가치를 가진다. 다만, 그룹 크기와 잔여 길이에 따라 성능이 변동하며, 특정 조건에서 최적의 결과를 얻기 위해 추가 실험 필요. 또한, 더 큰 모델(예: 540B 파름)에서의 성능 검증이 미흡하다는 한계가 있다.

실용적 활용

KIVI는 대규모 언어 모델의 배치 추론 성능을 향상시키는 데 유용하며, 특히 GPU 메모리 제한이 있는 클라우드 인프라, 실시간 대화형 서비스, 멀티유저 지원 시스템 등에서 활용 가능하다. 추론 속도 향상과 메모리 절감을 통해 비용 효율적인 모델 배포를 가능하게 한다.