Skip to main content
QUICK REVIEW

[Paper Review] Quad Length Codes for Lossless Compression of e4m3

Aditya Agrawal, Albert Magyar|arXiv (Cornell University)|Feb 19, 2026
Algorithms and Data CompressionComputer Science0 citations
TL;DR

Introduces Quad Length Codes, a 4-length hybrid coding scheme using 3-bit area prefixes and a 256-entry LUT to compress e4m3 data efficiently with faster, simpler decoding than Huffman codes.

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.

Motivation & Objective

  • Motivate reducing network traffic in LLM training/serving by lossless data compression.
  • Exploit symbol frequency distributions while enabling non-bit-sequential decoding.
  • Provide a hardware-friendly coding scheme with a small LUT-based encoder/decoder.

Proposed method

  • Analyze symbol distributions for e4m3 tensors (FFN1/FFN2 activations, weights, gradients).
  • Design Quad Length Codes by partitioning 256 symbols into 8 areas using 3 prefix bits, yielding 4 possible code lengths (6, 7, 8, 11 bits).
  • Implement a 256-entry encoder LUT that maps input symbols by decreasing probability to short codes.
  • Implement a 256-entry decoder LUT using area codes to select code lengths and offsets.
  • Compare compressibility and hardware complexity against Huffman coding on Gemma/Gemma-like data distributions.
Figure 1: Sorted Probability Mass Function (PMF) of FFN1 activation.
Figure 1: Sorted Probability Mass Function (PMF) of FFN1 activation.

Experimental results

Research questions

  • RQ1Can a fixed four-length (quad) code scheme approach Huffman-like compression while enabling simpler hardware and non-bit-sequential decoding?
  • RQ2How does adapting area sizes affect compression for different e4m3 distributions (activations, gradients, etc.)?
  • RQ3What is the trade-off between compression rate and decoding speed/complexity for the proposed scheme?
  • RQ4Is the quad-length approach portable across tensor types (activations, weights, gradients) and data distributions?

Key findings

  • For FFN1 activation, Huffman yields 15.9% compressibility; Quad Length Codes achieve 13.9% (2.0% lower).
  • The Quad Length scheme uses 4 code lengths (6, 7, 8, 11 bits) across 8 areas, enabling a 256-entry LUT encoder/decoder.
  • Adaptation on FFN2 activation distribution (with a different symbol frequency) yields 19.0% compressibility using an adjusted 4-length scheme (better than the 16.7% from the original 8-area Table 1 design).
  • The initial quad scheme reduces hardware/decode complexity relative to deep Huffman trees, at some loss in compression efficiency (~2 percentage points in the primary case).
  • The encoder builds a 256-entry LUT sorted by probability; decoding uses the 3-bit area prefix to determine the code length and offset, with a 256-entry LUT for symbol recovery.
Figure 2: Huffman code lengths for each symbol.
Figure 2: Huffman code lengths for each symbol.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.