An In-depth Investigation of Sparse Rate Reduction in Transformer-like Models

Yunzhe Hu, Difan Zou, Dong Xu

Modern Transformers are notoriously "black boxes"—we know they achieve state-of-the-art performance, but we don't fully understand why or how information is transformed across their layers. To unveil the inner workings of these architectures, researchers previously proposed CRATE (Coding Rate Reduction Transformer). CRATE is a "white-box" model derived by unrolling a mathematical optimization process intended to compress data into low-dimensional subspaces while keeping it sparse, an objective known as Sparse Rate Reduction (SRR).

However, two critical questions remained unanswered: Does the forward pass of a CRATE model actually minimize the SRR objective in practice? And is there a causal link between this mathematical objective and the model's ability to generalize to unseen data? This paper takes a magnifying glass to CRATE, discovering implementation flaws, proposing architectural fixes, and demonstrating that SRR is a surprisingly powerful predictor of model generalization.

The "Uphill" Mistake: A Mathematical Audit

The authors began by investigating whether CRATE actually works as intended. Through a rigorous mathematical audit of the Taylor expansion used to derive the Multi-head Subspace Self-Attention (MSSA) operator, they found a significant pitfall. By dropping certain terms for mathematical simplicity, the original CRATE implementation (referred to as CRATE-C) actually performs gradient ascent on the compression term.

Layer-wise coding rate showing decompression instead of compression.

Counterintuitively, this means the model decompresses representations rather than compressing them. Despite this mathematical contradiction to its stated goal, the model still functions well, suggesting that other architectural components (like ReLU non-linearities) compensate for the decompression.

To fix this theoretical misalignment, the authors introduced two variants:

  • CRATE-N: Flips a sign in the attention mechanism to ensure proper gradient descent (compression).
  • CRATE-T: Uses a transposed matrix to better align the implementation with the underlying theory.

SRR as a Generalization Compass

Beyond architectural fixes, the authors evaluated SRR as a "complexity measure" to see if it correlates with the "generalization gap" (the difference between training and testing performance). They trained 64 different model versions across standard image classification benchmarks (CIFAR-10 and CIFAR-100) to conduct extensive hyperparameter sweeps.

The results were striking: SRR is an excellent predictor of generalization. It achieved a Kendall’s rank correlation ($\tau$) of 0.445, significantly outperforming nearly 20 other baseline measures, including traditional "path-norm" or "sharpness-based" metrics. This robust correlation suggests that the "coding rate" of a model's internal representations is a fundamental signal of its quality.

Initialization vs. Training Dynamics

By tracking the SRR objective throughout the training process, the authors uncovered fascinating layer-wise behaviors. At initialization (with random weights), CRATE models naturally tend to minimize SRR in the early layers.

Evolution of the Sparse Rate Reduction measure across layers and training epochs for CRATE variants.

However, as training progresses, the SRR actually increases across the network. The authors hypothesize that while the model initially compresses data, it learns to slightly "un-compress" representations later in training to preserve the fine-grained, task-specific details necessary for accurate classification.

Improving Performance with SRR Regularization

If SRR is a good measure of generalization, can we force the model to optimize it? The authors added the SRR objective directly into the Cross-Entropy loss function as a regularizer. This mathematical constraint consistently improved Top-1 accuracy. For instance, on CIFAR-10, the basic CRATE-C model improved from 76.87% to 77.61%. Furthermore, they demonstrated that regularizing every layer isn't necessary; applying the SRR constraint to just the final layer or a few early layers yields performance gains without massive computational overhead.

Limitations and Future Directions

While promising, these findings are currently limited to the CRATE family of models. Standard Transformers (like ViT or GPT) use independent Query, Key, and Value matrices, making the direct calculation of a Sparse Rate Reduction objective non-trivial.

Interestingly, while CRATE-N is more mathematically "correct" regarding the compression objective, the transposed version (CRATE-T) often performs better empirically. This highlights a lingering gap between pure information theory and the practical requirements of high-accuracy deep learning. Future work will need to explore how these SRR principles scale to deeper models, different domains like Natural Language Processing, and how they relate to emerging training paradigms.

Summary updated

BibTeX
@inproceedings{hu2024depth,
  author = {Yunzhe Hu and Difan Zou and Dong Xu},
  title = {{An In-depth Investigation of Sparse Rate Reduction in Transformer-like Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=CAC74VuMWX},
}
Figure