paper-with-me

홈 › Papers

KVQuant: Towards 10 Million Context Length LLM Inference with KV Cache Quantization

2024-01-31 · Coleman Hooper, Sehoon Kim, Hiva Mohammadzadeh, Michael W. Mahoney, Yakun Sophia Shao, Kurt Keutzer, Amir Gholami

LLMs are seeing growing use for applications which require large context windows, and with these large context windows KV cache activations surface as the dominant contributor to memory consumption during inference. Quantization is a promising approach for compressing KV cache activations; however, existing solutions fail to represent activations accurately in sub-4-bit precision. Our work, KVQuant, facilitates low precision KV cache quantization by incorporating several novel methods: (i) Per-Channel Key Quantization, where we adjust the dimension along which we quantize the Key activations to better match the distribution; (ii) Pre-RoPE Key Quantization, where we quantize Key activations before the rotary positional embedding to mitigate its impact on quantization; (iii) Non-Uniform KV Cache Quantization, where we derive per-layer sensitivity-weighted non-uniform datatypes that better represent the distributions; and (iv) Per-Vector Dense-and-Sparse Quantization, where we isolate outliers separately for each vector to minimize skews in quantization ranges. By applying our method to the LLaMA, Llama-2, Llama-3, and Mistral models, we achieve < 0.1 perplexity degradation with 3-bit quantization on both Wikitext-2 and C4, outperforming existing approaches. Our method enables serving LLaMA-7B with a context length of up to 1 million on a single A100-80GB GPU and up to 10 million on an 8-GPU system. We develop custom CUDA kernels for KVQuant, showing that we can achieve up to ~1.7x speedups, compared to baseline fp16 matrix-vector multiplications, for the LLaMA-7B model.

📄 PDF Abstract BibTeX arXiv:2401.18079

Code (2)

squeezeailab/kvquant 공식 구현 jax
ruikangliu/IntactKV pytorch

Tasks

GPUQuantization

Similar Papers 제목 키워드 기반

WKVQuant: Quantizing Weight and Key/Value Cache for Large Language Models Gains More

2024-02-19 · Yuxuan Yue, Zhihang Yuan, Haojie Duanmu, Sifan Zhou 외

Large Language Models (LLMs) face significant deployment challenges due to their substantial memory requirements and the computational demands of auto-regressive text generation process. This paper addresses these challe…

QuantizationText Generation

HeadInfer: Memory-Efficient LLM Inference by Head-wise Offloading

2025-02-18 · Cheng Luo, Zefan Cai, Hanshi Sun, Jinqi Xiao 외

Transformer-based large language models (LLMs) demonstrate impressive performance in long context generation. Extending the context length has disproportionately shifted the memory footprint of LLMs during inference to t…

Computational EfficiencyCPUGPU

Medha: Efficiently Serving Multi-Million Context Length LLM Inference Requests Without Approximations

2024-09-25 · Amey Agrawal, Haoran Qiu, Junda Chen, Íñigo Goiri 외

As large language models (LLMs) handle increasingly longer contexts, serving long inference requests of millions of tokens presents unique challenges. We show that existing work for long context inference is largely base…

BlockingChunkingScheduling

KV Cache Optimization Strategies for Scalable and Efficient LLM Inference

2026-03-20 · Yichun Xu, Navjot K. Khaira, Tejinder Singh arxiv

The key-value (KV) cache is a foundational optimization in Transformer-based large language models (LLMs), eliminating redundant recomputation of past token representations during autoregressive generation. However, its …

KV-Compress: Paged KV-Cache Compression with Variable Compression Rates per Attention Head

2024-09-30 · Isaac Rehg

Context lengths of Large Language Models (LLMs) have exploded in recent years, with 128k-token context becoming a standard and million-token context becoming a reality. Efficiently supporting long-context inference remai…