Rate-Distortion Optimization for Transformer Inference
Anderson de Andrade, Alon Harell, Ivan V. Bajić
TL;DR
This work proposes a principled rate-distortion framework for compressing intermediate transformer representations to enable multi-device inference. It introduces a transformer-based auto-regressive entropy model with a hyper-prior and defines the $\mathcal{V}$-entropy gap to quantify rate-entropy mismatch under modeling constraints, along with PAC-style generalization bounds. The approach is validated on language-model benchmarks and vision tasks, where it achieves substantial rate-distortion gains over Fourier-basis and direct-access baselines, and demonstrates practical speedups under constrained links. The analysis links rate to target representation statistics via covariance and Rademacher complexity, offering theoretical insight and practical guidance for designing learnable codecs for machines.
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.
