Saved in:
Bibliographic Details
Main Authors: Dong, Shichen, Cheng, Wen, Qin, Jiayu, Wang, Wei
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2403.04643
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910407663288320
author Dong, Shichen
Cheng, Wen
Qin, Jiayu
Wang, Wei
author_facet Dong, Shichen
Cheng, Wen
Qin, Jiayu
Wang, Wei
contents The emergence of LLMs has ignited a fresh surge of breakthroughs in NLP applications, particularly in domains such as question-answering systems and text generation. As the need for longer context grows, a significant bottleneck in model deployment emerges due to the linear expansion of the Key-Value (KV) cache with the context length. Existing methods primarily rely on various hypotheses, such as sorting the KV cache based on attention scores for replacement or eviction, to compress the KV cache and improve model throughput. However, heuristics used by these strategies may wrongly evict essential KV cache, which can significantly degrade model performance. In this paper, we propose QAQ, a Quality Adaptive Quantization scheme for the KV cache. We theoretically demonstrate that key cache and value cache exhibit distinct sensitivities to quantization, leading to the formulation of separate quantization strategies for their non-uniform quantization. Through the integration of dedicated outlier handling, as well as an improved attention-aware approach, QAQ achieves up to 10x the compression ratio of the KV cache size with a neglectable impact on model performance. QAQ significantly reduces the practical hurdles of deploying LLMs, opening up new possibilities for longer-context applications. The code is available at github.com/ClubieDong/KVCacheQuantization.
format Preprint
id arxiv_https___arxiv_org_abs_2403_04643
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle QAQ: Quality Adaptive Quantization for LLM KV Cache
Dong, Shichen
Cheng, Wen
Qin, Jiayu
Wang, Wei
Computation and Language
The emergence of LLMs has ignited a fresh surge of breakthroughs in NLP applications, particularly in domains such as question-answering systems and text generation. As the need for longer context grows, a significant bottleneck in model deployment emerges due to the linear expansion of the Key-Value (KV) cache with the context length. Existing methods primarily rely on various hypotheses, such as sorting the KV cache based on attention scores for replacement or eviction, to compress the KV cache and improve model throughput. However, heuristics used by these strategies may wrongly evict essential KV cache, which can significantly degrade model performance. In this paper, we propose QAQ, a Quality Adaptive Quantization scheme for the KV cache. We theoretically demonstrate that key cache and value cache exhibit distinct sensitivities to quantization, leading to the formulation of separate quantization strategies for their non-uniform quantization. Through the integration of dedicated outlier handling, as well as an improved attention-aware approach, QAQ achieves up to 10x the compression ratio of the KV cache size with a neglectable impact on model performance. QAQ significantly reduces the practical hurdles of deploying LLMs, opening up new possibilities for longer-context applications. The code is available at github.com/ClubieDong/KVCacheQuantization.
title QAQ: Quality Adaptive Quantization for LLM KV Cache
topic Computation and Language
url https://arxiv.org/abs/2403.04643