用动态编码压缩大模型,体积减30%却不丢精度,还能提速近50倍。
70% Size, 100% Accuracy: Lossless LLM Compression for Efficient GPU Inference via Dynamic-Length Float (DFloat11)
- 根据权重频率分配长短编码,实现无损压缩
- 在80GB显存单机上运行810GB的Llama 3.1模型
- 相比传统方法提速2.3到46.2倍,生成长度提升14.9倍
大规模AI模型如大语言模型(LLMs)和扩散模型(DMs)迅速增长,给资源受限硬件的高效部署带来挑战。本文提出动态长度浮点数(DFloat11),一种无损压缩框架,可使LLM和DM模型体积减少30%,同时输出与原始模型逐比特相同。该方法源于LLM中BFloat16权重表示的低熵特性,揭示现有存储格式存在显著效率缺陷。通过熵编码,为权重分配动态长度编码,实现接近信息最优的压缩且不损失精度。为支持动态长度编码的高效推理,我们开发了专用GPU内核进行快速在线解压:(i)紧凑分层查找表(LUT)适配GPU SRAM以高效解码;(ii)双阶段内核协调线程读写位置,使用轻量辅助变量;(iii)按变压器块级解压以最小化延迟。在Llama 3.3、Qwen 3、Mistral 3、FLUX.1等模型上的实验验证,DFloat11实现约30%的模型尺寸缩减并保持逐比特相同输出。相较于将部分未压缩模型卸载至CPU以满足内存限制的方案,DFloat11在生成吞吐量上提升2.3–46.2倍。在固定显存预算下,生成长度比未压缩模型延长5.7–14.9倍。特别地,该方法实现了在配备8×80GB GPU的单节点上对810GB的Llama 3.1 405B模型进行无损推理。
原文摘要 · Abstract (English)
Large-scale AI models, such as Large Language Models (LLMs) and Diffusion Models (DMs), have grown rapidly in size, creating significant challenges for efficient deployment on resource-constrained hardware. In this paper, we introduce Dynamic-Length Float (DFloat11), a lossless compression framework that reduces LLM and DM size by 30% while preserving outputs that are bit-for-bit identical to the original model. DFloat11 is motivated by the low entropy in the BFloat16 weight representation of LLMs, which reveals significant inefficiency in the existing storage format. By applying entropy coding, DFloat11 assigns dynamic-length encodings to weights based on frequency, achieving near information-optimal compression without any loss of precision. To facilitate efficient inference with dynamic-length encodings, we develop a custom GPU kernel for fast online decompression. Our design incorporates the following: (i) compact, hierarchical lookup tables (LUTs) that fit within GPU SRAM for efficient decoding, (ii) a two-phase GPU kernel for coordinating thread read/write positions using lightweight auxiliary variables, and (iii) transformer-block-level decompression to minimize latency. Experiments on Llama 3.3, Qwen 3, Mistral 3, FLUX.1, and others validate our hypothesis that DFloat11 achieves around 30% model size reduction while preserving bit-for-bit identical outputs. Compared to a potential alternative of offloading parts of an uncompressed model to the CPU to meet memory constraints, DFloat11 achieves 2.3--46.2x higher throughput in token generation. With a fixed GPU memory budget, DFloat11 enables 5.7--14.9x longer generation lengths than uncompressed models. Notably, our method enables lossless inference of Llama 3.1 405B, an 810GB model, on a single node equipped with 8x80GB GPUs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。