Token Statistics Transformer: Linear-Time Attention via Variational Rate Reduction

Ziyang Wu, Tianjiao Ding, Yifu Lu, Druv Pai, Jingyuan Zhang, Weida Wang, Yaodong Yu, Yi Ma, Benjamin David Haeffele

The Token Statistics Transformer (ToST) introduces a paradigm shift in efficient architecture design by replacing the standard quadratic-time self-attention mechanism with a novel Token Statistics Self-Attention (TSSA). Derived from "white-box" optimization principles rather than empirical heuristics, ToST achieves competitive performance on vision and language tasks while scaling linearly with the number of tokens, making it significantly faster and more memory-efficient than traditional Transformers.

The Quadratic Bottleneck of Attention

The "Attention is All You Need" era brought state-of-the-art performance across domains, but it came with a heavy computational price tag: quadratic complexity. In standard self-attention, every token must be compared to every other token to compute a similarity matrix ($Q \times K^T$). Consequently, if you double the sequence length, the computational and memory requirements quadruple.

While many "efficient" or "linear" attention mechanisms exist, they are often empirical hacks or approximations of the original softmax attention. This paper tackles the bottleneck from a first-principles perspective: Can we derive a linear-time attention operator by designing a network that explicitly optimizes a well-defined mathematical objective?

Deriving Linear Attention from First Principles

The authors leverage "white-box" architecture design via algorithmic unrolling. Instead of stacking black-box layers, they design each layer to perform one step of gradient descent to optimize the Maximal Coding Rate Reduction ($MCR^2$) objective.

The $MCR^2$ principle seeks to map data into a representation where tokens from the same group are compressed into low-dimensional subspaces, while tokens from different groups are expanded and spread out as much as possible.

Architecture of the Token Statistics Transformer (ToST) block, highlighting the linear-time TSSA module.

The key innovation is a novel variational form of the $MCR^2$ objective. By using a variational upper bound, the authors derive an update rule that fundamentally changes the attention operation:

  1. Estimates Group Membership: Computes a "soft clustering" of tokens ($\Pi$) based on their alignment with learned subspaces.
  2. Projects Tokens: Instead of pairwise dot products, it computes a data-dependent low-rank projection based on the second-moment statistics of the tokens.
  3. Achieves Linear Scaling: Because it avoids the $N \times N$ similarity matrix entirely, the computational and memory complexity drops to $O(N)$, where $N$ is the number of tokens.

Key Insights and Interpretability

  • Pairwise Similarity is Optional: The most striking takeaway is that the success of Transformers might not actually depend on computing similarities between every pair of tokens. Global statistics and subspace projections can achieve highly competitive results.
  • Attention as Denoising: The TSSA operator can be interpreted as a form of "non-local denoising" or "subspace projection." It suppresses directions in the feature space that lack "power" (low second-moment statistics) and preserves those that represent the underlying structure of the data.
  • Inherent Interpretability: Because the model is derived from clustering principles, the resulting "attention maps" (the membership matrix $\Pi$) are naturally interpretable. They show how the model groups image patches (e.g., foreground vs. background) without needing extra supervision.

Empirical Results

The authors validated ToST across several domains, including computer vision (ImageNet-1k, CIFAR), language modeling (OpenWebText), and long-sequence tasks (Long-Range Arena).

Inference time and peak memory scaling comparison demonstrating ToST's linear efficiency versus ViT's quadratic cost.
  • Massive Efficiency Gains: As sequence lengths grow, the benefits of ToST become undeniable. For a sequence of 10,000 tokens, ToST is nearly 10x faster for inference and uses roughly 100x less GPU memory than a standard Vision Transformer (ViT).
  • Competitive Accuracy: On ImageNet-1k, ToST-S (Small) achieves 77.9% top-1 accuracy, which is remarkably close to ViT-S (79.8%) despite the radical change in the attention mechanism and significantly lower complexity.
  • Long-Range Performance: On the Long-Range Arena (LRA) benchmark, ToST achieved an average score of 59.90, outperforming popular efficient variants like Reformer, LinFormer, and Performer.
  • Graceful Scaling: The performance gap between ToST and standard Transformers narrows as the model size increases, suggesting that the "token statistics" approach scales effectively.

Limitations and Future Directions

While ToST presents a compelling white-box alternative to standard attention, the authors note that they only tested up to "medium" sized models (68M-110M parameters). It remains to be seen if ToST maintains its competitive edge at the multi-billion parameter scale of modern LLMs.

Furthermore, while the attention block is now mathematically interpretable and linear, the standard MLP (Feed-Forward) block remains a "black-box." Future work could replace the MLP with a white-box component (such as an ISTA block) to make the entire Transformer fully interpretable end-to-end. Finally, more research is needed to evaluate how TSSA handles complex generative tasks or high-resolution dense prediction compared to specialized attention kernels.

Summary updated

BibTeX
@inproceedings{wu2025token,
  author = {Ziyang Wu and Tianjiao Ding and Yifu Lu and Druv Pai and Jingyuan Zhang and Weida Wang and Yaodong Yu and Yi Ma and Benjamin David Haeffele},
  title = {{Token Statistics Transformer: Linear-Time Attention via Variational Rate Reduction}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=lXRDQsiP2v},
}
Figure