TRACE: A Fast Transformer-based General-Purpose Lossless Compressor

Yu Mao, Yufei Cui, Tei-Wei Kuo, Chun Jason Xue

Abstract

As global data volumes continue to expand, the demand for efficient lossless compression has never been higher. While deep-learning-based compressors offer superior compression ratios compared to traditional algorithms like Gzip, they are often hindered by the slow, sequential nature of Recurrent Neural Networks (RNNs). This paper introduces TRACE, a novel framework that utilizes a highly optimized, single-layer Transformer. By implementing architectural innovations such as byte-grouping, shared feed-forward networks, and a dynamic backpropagation controller, TRACE achieves a 3x speedup over state-of-the-art deep learning compressors like Dzip while maintaining superior compression performance across text, audio, and image data.

Introduction

The explosion of digital data has made the cost of storage and transmission a critical concern for modern infrastructure. Standard compressors (e.g., Gzip, 7z) are computationally efficient but often fail to capture the complex patterns found in "multi-modal" data streams containing mixed text, binaries, and media.

Deep learning models have emerged as a powerful alternative, providing significantly higher compression ratios. However, their real-world adoption is limited by inference speed. Current state-of-the-art models like Dzip rely on RNNs, which process data sequentially and fail to leverage the parallel processing power of modern GPUs. Other Transformer-based models like NNCP are often too computationally heavy for general-purpose use. TRACE addresses these challenges by providing a "Transformer-parallel" and "mobile-light" architecture designed for high-throughput, general-purpose compression.

Methodology

TRACE is built around a streamlined, single-layer Transformer architecture. To achieve high efficiency without sacrificing compression quality, the authors introduced several key innovations:

  1. Byte-Grouping: Standard Transformers typically map every individual byte to a high-dimensional vector. TRACE instead groups adjacent bytes together before they enter the model. This allows the Transformer to process a much longer historical context without increasing the total computational load.
  2. Shared-FFN (Feed-Forward Network): To increase the model's reasoning depth without adding extra parameters, TRACE passes data through the same FFN multiple times. This "recurrent" use of the layer enhances capacity while keeping the model lightweight.
  3. Back-Prop (BP) Controller: Online adaptation (training during compression) is a major bottleneck. TRACE utilizes a FIFO cache to monitor recent cross-entropy loss. If the model is already predicting data accurately, the controller skips the expensive backpropagation step for that batch, resulting in a significant speed boost.
  4. LCR Metric: The authors propose the Latency-to-Compression Ratio (LCR), a design metric that quantifies the trade-off between computational latency and improvements in compression ratio, guiding the selection of optimal model dimensions.
The TRACE architecture overview, illustrating the flow from raw byte streams to byte groups, the 1-layer Transformer with Shared FFN, and the selective backpropagation mechanism managed by the Backward controller.

Evaluation and Key Results

The researchers evaluated TRACE against a diverse set of benchmarks, including text (Enwik8/9), images (ImageNet), audio (ESC), and mixed files (Silesia).

Performance and Throughput

TRACE demonstrates a clear advantage in hardware utilization. While RNN-based models like Dzip leave GPUs largely idle due to sequential processing, TRACE's Transformer architecture scales effectively with batch size. The system reached a maximum inference throughput of 81,594 bytes/s, significantly outperforming its predecessors.

Comparison of Peak GPU Memory Usage and Inference Throughput. TRACE (red) shows significantly better memory efficiency and higher throughput at larger batch sizes compared to DZIP and NNCP.

Compression Efficiency

On the Enwik9 text dataset, TRACE achieved a 5.29:1 compression ratio, which is 94% higher than 7z and 82% higher than Dzip. Furthermore, TRACE proved to be exceptionally memory-efficient, using only about 1/3 of the GPU memory required by Dzip, despite having a larger total parameter count (2.4M vs 1M).

Conclusion

TRACE proves that a single-layer Transformer, when properly optimized with techniques like byte-grouping and selective backpropagation, can overcome the speed bottlenecks of deep-learning-based compression. While it faces some challenges in convergence speed on very small, highly varied files (such as those in the Silesia benchmark), its performance on large-scale general data marks a significant step toward making neural compression practical for real-world systems. Future work will focus on further optimizing attention mechanisms to bridge the speed gap with traditional non-neural compressors.

Summary updated

BibTeX
@inproceedings{mao2022trace,
  author = {Yu Mao and Yufei Cui and Tei-Wei Kuo and Chun Jason Xue},
  title = {{TRACE: A Fast Transformer-based General-Purpose Lossless Compressor}},
  booktitle = {The Web Conference},
  year = {2022},
  doi = {10.1145/3485447.3511987},
}
Figure