arXiv:2510.05529cs.CLcs.LG2025-10

H1B-KV用1比特压缩键、4比特量化值,让大模型长文本推理内存减少70倍。

H1B-KV: Hybrid One-Bit Caches for Memory-Efficient Large Language Model Inference

  • 键用1比特二值化,值用4比特量化,实现全栈压缩
  • 70亿参数模型处理8千词上下文仅需不到60MB内存
  • 轻微微调后在数学推理等任务上媲美全精度模型

自回归解码时,大型语言模型(LLM)需缓存不断增长的过去键值(KV)对,导致长上下文推理成为内存瓶颈。现有方法或量化缓存、或剔除令牌、或对键使用二进制草图(如Loki),但常因保留未压缩的某一部分(如值)或丢失上下文信息而效果不全。本文提出混合1比特键值缓存(H1B-KV),通过将每个键向量表示为1比特二值草图,实现硬件友好的按位注意力,并进一步以4比特量化压缩值向量。该整体性混合方案使70亿参数的LLM在处理8000词上下文时,缓存内存低于60MB,相较原模型降低70倍。经轻量微调后,H1B-KV不仅在困惑度基准上达到全精度性能,还在数学推理(GSM8K)、多任务理解(MMLU)和代码生成(HumanEval)等复杂下游任务中表现相当。实验表明,其单位字节质量显著优于主流量化(KIVI)、令牌剔除(SparseLLM)与仅键草图化(Loki)方法,是内存受限场景下部署LLM的可靠方案。

原文摘要 · Abstract (English)

Autoregressive decoding in large language models (LLMs) requires caching a growing list of past key-value (KV) pairs, making long-context inference a memory-bound problem. While recent methods have explored quantizing the cache, evicting tokens, or using binary sketches for keys (e.g., Loki), these approaches often provide an incomplete solution by leaving one component (like values) uncompressed or by discarding context information. This paper introduces the Hybrid One-Bit KV Cache (H1B-KV), a comprehensive compression scheme that radically reduces memory usage without sacrificing context. H1B-KV represents each key vector using a 1-bit binary sketch, enabling hardware-friendly bitwise attention, and further compresses value vectors using 4-bit quantization. This holistic, hybrid approach allows a 7-billion parameter LLM to handle an 8k-token context with under 60 MB of cache memory - a 70x reduction. We demonstrate that after a lightweight finetuning, H1B-KV matches full-precision performance not only on perplexity benchmarks but also on complex downstream tasks like mathematical reasoning (GSM8K), multi-task understanding (MMLU), and code generation (HumanEval). Our results show H1B-KV significantly outperforms leading quantization (KIVI), token eviction (SparseLLM), and key-only sketching (Loki) methods in quality-per-byte, establishing it as a robust solution for deploying LLMs in memory-constrained environments.

内存优化大模型推理量化压缩

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。