arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2604.04722cs.CV
收藏

不要浪费比特!面向轻量级设备LLM的自适应KV缓存量化

Don't Waste Bits! Adaptive KV-Cache Quantization for Lightweight On-Device LLMs

Clemson University(克莱姆森大学)

Sayed Pedram Haeri Boroujeni, Niloufar Mehrabi, Patrick Woods, Gabriel Hillesheim, Abolfazl Razi

AI总结:

本文提出自适应KV缓存量化方法,通过动态调整token重要性分配比特数,减少内存和延迟并提升准确性。

摘要:

大型语言模型(LLMs)在推理、生成和决策任务中取得了显著进展,但将其部署在移动、嵌入式和边缘设备上仍极具挑战性。设备端LLM推理严重受限于键值(KV)缓存的内存和带宽开销,其随上下文长度线性增长且常主导解码成本。现有KV缓存量化方案通常依赖固定精度或手工制定的启发式方法,导致在低影响token上浪费比特同时过度压缩信息性token,引起可避免的精度下降。受霍夫曼编码变量长度分配原理启发,我们提出自适应KV缓存量化,一种学习策略,将比特宽度按token重要性比例分配,最小化预期内存和延迟而不牺牲竞争性准确性。我们的框架提取轻量级token级特征,包括token频率、质量分数、注意力方差和基于熵的不确定性,并将这些特征输入紧凑的数据驱动控制器,动态选择KV精度{2-bit, 4-bit, 8-bit, FP16}。此自适应精度策略在解码过程中减少KV内存足迹和延迟,同时比静态KV量化和规则基基线方法提升准确性,并在标准LLM基准测试中保持接近FP16推理的竞争力。在多个常识推理基准测试中使用SmolLM-135M、SmolLM-360M和SmolLM-1.7B进行广泛实验,证明我们的控制器在准确性-延迟权衡上持续改进。例如,在HellaSwag上使用SmolLM-360M时,我们的方法相比静态KV量化将解码延迟(ms/token)减少17.75%,准确性提高7.60点,并保持在FP16推理仅0.30点以内。

英文摘要:

Large Language Models (LLMs) have achieved remarkable progress across reasoning, generation, and decision-making tasks, yet deploying them on mobile, embedded, and edge devices remains particularly challenging. On-device LLM inference is heavily constrained by the memory and bandwidth overhead of the key-value (KV) cache, which grows linearly with context length and often dominates decoding cost. Existing KV-cache quantization schemes typically rely on fixed precision or hand-crafted heuristics, thereby wasting bits on low-impact tokens while over-compressing informative ones, leading to avoidable accuracy degradation. Inspired by Huffman coding's principle of variable-length allocation, we propose adaptive KV-cache quantization, a learned policy that assigns bit-width proportional to token importance, minimizing expected memory and latency without sacrificing competitive accuracy. Our framework extracts lightweight token-level features, including token frequency, quality score, attention variance, and entropy-based uncertainty, and feeds them into a compact data-driven controller that dynamically selects KV precision from {2-bit, 4-bit, 8-bit, FP16} during decoding. This adaptive precision policy reduces KV memory footprint and latency while improving accuracy compared to static KV quantization and rule-based baselines, and maintaining competitive accuracy close to FP16 inference across standard LLM benchmarks. Extensive experiments across multiple commonsense reasoning benchmarks using SmolLM-135M, SmolLM-360M, and SmolLM-1.7B demonstrate that our controller consistently improves the accuracy-latency trade-off. For instance, with SmolLM-360M on HellaSwag, our method reduces decoding latency (ms/token) by 17.75% relative to static KV quantization, improves accuracy by 7.60 points, and remains within only 0.30 points of FP16 inference.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑