Abstract
Transformers achieve superior performance on many tasks, but impose heavy compute and memory requirements during inference. This inference can be made more efficient by partitioning the process across multiple devices, which, in turn, requires compressing its intermediate representations. In this work, we introduce a principled rate-distortion-based framework for lossy compression that learns compact encodings that explicitly trade off bitrate against accuracy. Experiments on language benchmarks show that the proposed codec achieves substantial savings with improved accuracy in some cases, outperforming more complex baseline methods. We characterize and analyze the rate-distortion performance of transformers, offering a unified lens for understanding performance in representation coding. This formulation extends information-theoretic concepts to define the gap between rate and entropy, and derive some of its bounds. We further develop probably approximately correct (PAC)-style bounds for estimating this gap. For different architectures and tasks, we empirically demonstrate that their rates are driven by these bounds, adding to the explainability of the formulation.
Introduction
Transformer models have revolutionized AI but remain computationally expensive for edge deployment. Split inference offers a path forward by distributing layers between a local device and a cloud server. However, the intermediate tensors transmitted between these devices often exceed the size of the original input, creating a communication bottleneck. This work addresses the challenge through Rate-Distortion (RD) optimization, seeking an optimal balance between transmission bitrate (rate) and the resulting model accuracy (distortion).
Methods: Task-Aware Compression
The proposed framework utilizes a lossy compression codec designed specifically for transformer intermediate states. The system splits the transformer into two modules, where the first module's output is quantized and compressed using a novel auto-regressive entropy model.
Unlike traditional methods that rely on "direct access" to previously coded elements—which can be computationally intensive—this approach employs a transformer-based hyper-prior model. This model generates a compact secondary representation to predict the distribution of target data, streamlining the decoding process.
The theoretical foundation rests on $\mathcal{V}$-entropy (usable information). While Shannon entropy assumes an ideal observer, $\mathcal{V}$-entropy accounts for the specific computational constraints of the entropy model. By deriving bounds based on Rademacher complexity and Lipschitz constants, the authors explain why deeper transformer layers are inherently harder to compress.
Key Results and Analysis
The framework was evaluated using GPT-2 and Pythia models on the OpenWebText and LAMBADA datasets, as well as ViT and ResNet models on ImageNet-1k.
Performance Gains
The proposed method achieved a 10.7% improvement in BD-rate over complex baselines like Fourier-basis models. When compared to standard lossless tools like Deflate (ZIP), the codec operated at just 21.84% of the bitrate for equivalent task performance. Furthermore, the method demonstrated a 48.21% speed increase over Deflate during token processing.
The "Transformer Trait"
A significant finding is that in Transformers, the required bitrate actually increases with depth. This contradicts the behavior of many other neural networks where entropy typically decreases in deeper layers. The analysis shows that deeper layers produce representations with higher complexity (higher Rademacher complexity), making them more difficult for entropy models to predict. As shown in Figure 6 (right), moving the split point in GPT-2 from layer 3 to layer 9 increases the required bitrate from ~148 BPT to ~492 BPT to maintain accuracy.
Conclusion
By applying a rate-distortion lens to transformer inference, this work provides both a practical compression tool and a theoretical explanation for the complexity of transformer representations. The results suggest that simplicity in entropy modeling can lead to better generalization and efficiency, paving the way for more effective edge-cloud collaborative AI.
Summary updated