Skip to main content
QUICK REVIEW

[论文解读] Quad Length Codes for Lossless Compression of e4m3

Aditya Agrawal, Albert Magyar|arXiv (Cornell University)|Feb 19, 2026
Algorithms and Data CompressionComputer Science被引用 0
一句话总结

引入四长度编码(Quad Length Codes),是一种使用 3 位区域前缀和 256 条目 LUT 的4长度混合编码方案,能够在更快、更简单的解码下高效压缩 e4m3 数据,相较于霍夫曼编码。

ABSTRACT

Training and serving Large Language Models (LLMs) relies heavily on parallelization and collective operations, which are frequently bottlenecked by network bandwidth. Lossless compression using e.g., Huffman codes can alleviate the issue, however, Huffman codes suffer from slow, bit-sequential decoding and high hardware complexity due to deep tree traversals. Universal codes e.g., Exponential-Golomb codes are faster to decode but do not exploit the symbol frequency distributions. To address these limitations, this paper introduces Quad Length Codes, a hybrid approach designed to balance compression efficiency with decoding speed. The coding scheme uses 3 prefix bits to divide the 256 symbols into 8 areas. Each area has a different code length and encodes a different number of symbols. The scheme uses a Look Up Table with 256 entries, significantly simplifying the hardware implementation compared to Huffman trees. The coding scheme can be adapted for different distributions. For the e4m3 data type, the scheme achieves a compressibility of 13.9% in comparison to 15.9% achieved by Huffman codes, but it significantly speeds up the decoding and simplifies the hardware complexity.

研究动机与目标

  • 通过无损数据压缩来推动在大规模语言模型训练/推理中的网络流量减少。
  • 在兼容非逐比特解码的同时,挖掘符号频率分布特征。
  • 提供一个硬件友好的编码方案,具备基于小型 LUT 的编码器/解码器。

提出的方法

  • 分析 e4m3 张量的符号分布(FFN1/FFN2 激活、权重、梯度)。
  • 通过将 256 个符号分成 8 个区域、使用 3 位前缀位,设计 Quad Length Codes,得到 4 种可能的码长(6、7、8、11 位)。
  • 实现一个 256 条目编码 LUT,根据概率从高到低映射输入符号到较短的码长。
  • 实现一个 256 条目解码 LUT,利用区域码选择码长和偏移。
  • 与 Gemma/类 Gemma 的数据分布下的霍夫曼编码在可压缩性和硬件复杂性方面进行对比。
Figure 1: Sorted Probability Mass Function (PMF) of FFN1 activation.
Figure 1: Sorted Probability Mass Function (PMF) of FFN1 activation.

实验结果

研究问题

  • RQ1固定四长度(quad)码方案是否能接近霍夫曼式压缩,同时实现更简单的硬件和非比特串行解码?
  • RQ2将区域大小进行自适应对不同 e4m3 分布(激活、梯度等)的压缩效果有何影响?
  • RQ3所提方案的压缩率与解码速度/复杂度之间的权衡如何?
  • RQ4四长度方法是否可在张量类型(激活、权重、梯度)和数据分布之间实现可移植性?

主要发现

  • 对于 FFN1 激活,霍夫曼提供 15.9% 的可压缩性;Quad Length Codes 实现 13.9%(低 2.0%)。
  • Quad Length 方案在 8 个区域中使用 4 种码长(6、7、8、11 位),实现 256 条目编码/解码 LUT。
  • 对 FFN2 激活分布进行自适应(符号频率不同)时,采用调整后的 4 长度方案实现 19.0% 的可压缩性(优于原 8 区表 1 设计的 16.7%)。
  • 初始四长度方案在降低硬件/解码复杂性的同时,相较深度霍夫曼树在压缩效率上有一定损失(主案例约下降 2 个百分点)。
  • 编码端构建按概率排序的 256 条目 LUT;解码端使用 3 位区域前缀来确定码长和偏移,并有 256 条目 LUT 进行符号恢复。
Figure 2: Huffman code lengths for each symbol.
Figure 2: Huffman code lengths for each symbol.

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。