Strassen Attention, Split VC Dimension and Compositionality in Transformers

Alexander Kozachinskiy, Felipe Urrutia, Héctor Rojas, Tomasz Steifer, Germán Pizarro, Matías Fuentes, Francisco Meza, Cristian Buc, Cristóbal Rojas

Abstract

We propose the first method to show theoretical limitations for one-layer softmax transformers with arbitrarily many precision bits (even infinite). We establish those limitations for three tasks that require advanced reasoning: Match 3 (Sanford et al., 2023), function composition (Peng et al., 2024), and binary relations composition. We formally prove the inability of one-layer softmax Transformers to solve any of these tasks. To overcome these limitations, we introduce Strassen attention and prove that, equipped with this mechanism, a one-layer transformer can in principle solve all these tasks. Importantly, we show that it enjoys sub-cubic running-time complexity, making it more scalable than similar previously proposed mechanisms, such as higher-order attention (Sanford et al., 2023). To complement our theoretical findings, we experimentally studied Strassen attention and compared it against standard (Vaswani et al, 2017), higher-order attention (Sanford et al., 2023), and triangular attention (Bergen et al. 2021). Our results help to disentangle all these attention mechanisms, highlighting their strengths and limitations. In particular, Strassen attention outperforms standard attention significantly on all the tasks.

Introduction

While Transformers dominate modern AI, they notoriously struggle with "compositional reasoning"—the ability to combine distinct blocks of knowledge to solve new problems. A core reason is that standard self-attention only computes pairwise interactions between tokens. However, many logical tasks require reasoning about three or more tokens simultaneously. Previous theoretical work proved that standard Transformers fail at these tasks, but those proofs often relied on the assumption of limited numerical precision. This paper definitively proves these limitations even for infinite precision and proposes a computationally feasible alternative.

Overview of attention mechanisms: Standard, Third-Order, Triangular, and the proposed Strassen Attention, along with the one-layer Transformer block architecture.

Theoretical Framework: Split-VC Dimension

To prove their lower bounds, the authors introduce a new mathematical framework called Splitting VC Dimension (split-VC). By splitting a Boolean function's inputs into "parameters" and "inputs," they can measure the function's combinatorial complexity. Using this, they formally prove that a one-layer standard Transformer cannot solve certain compositional tasks without an exponentially massive embedding dimension or number of heads, even with infinite precision. This suggests that the inability to solve compositional tasks is a fundamental architectural blind spot regarding multi-token interactions.

The Strassen Attention Mechanism

To overcome this limitation, the authors design Strassen Attention. Like previous "third-order" attention, it evaluates triplets of tokens. However, instead of computing a full 3D tensor product (which takes $O(n^3)$ time), Strassen attention uses pairwise dot-products of the vectors in the triplet. This clever algebraic formulation allows the attention scores to be decomposed into standard matrix multiplications.

Consequently, it runs in sub-cubic time $O(n^\\omega \\cdot d)$ (where $\\omega < 2.372$ is the matrix multiplication exponent), making it vastly more efficient than naive higher-order implementations. By structuring triplet interactions as pairwise dot products, the mechanism leverages highly optimized matrix multiplication algorithms (like Strassen's algorithm).

Experimental Evaluation

The models were evaluated on four synthetic sequence-to-sequence datasets designed to test specific algorithmic reasoning capabilities:

  • Function Composition: Evaluating $h(g(x))$ given descriptions of functions $g$ and $h$.
  • Match 3: Finding if three tokens in a sequence sum to a specific value modulo $m$.
  • Binary Relation Composition: Checking for transitive relations in a flattened boolean matrix.
  • Quotient Binary Relation Composition: A variant with an added "coloring" constraint, designed to separate Strassen attention from Triangular attention.

Key Results and Insights

  • Theoretical Guarantees: A constant-size, one-layer Strassen Transformer can solve all four benchmark tasks, whereas a standard Transformer fundamentally cannot.
  • High Accuracy: In empirical tests, Strassen attention achieved near-perfect accuracy across all tasks, while standard attention completely failed on tasks requiring triplet reasoning.
  • Superior Efficiency and Stability: Strassen attention trained significantly faster and exhibited much smoother learning curves compared to existing Third-Order attention mechanisms.
  • Structural Priors: While Triangular attention is effective for graph/matrix data, it requires flattening sequences into $n^2$ tokens. Strassen attention works natively on sequences in sub-cubic time.

Conclusion

Strassen Attention provides a scalable path toward improving the reasoning abilities of Transformers. By addressing the fundamental limitation of pairwise attention through an efficient sub-cubic mechanism, this work opens new avenues for models that can handle complex, compositional logic. Future work will involve testing these theoretical advantages on real-world benchmarks such as semantic parsing and protein structure prediction.

Summary updated

Abstract

We propose the first method to show theoretical limitations for one-layer softmax transformers with arbitrarily many precision bits (even infinite). We establish those limitations for three tasks that require advanced reasoning. The first task, Match 3 (Sanford et al., 2023), requires looking at all possible token triplets in an input sequence. The second and third tasks address compositionality-based reasoning: function composition (Peng et al., 2024) and binary relations composition, respectively. We formally prove the inability of one-layer softmax Transformers to solve any of these tasks. To overcome these limitations, we introduce Strassen attention and prove that, equipped with this mechanism, a one-layer transformer can in principle solve all these tasks. Importantly, we show that it enjoys sub-cubic running-time complexity, making it more scalable than similar previously proposed mechanisms, such as higher-order attention (Sanford et al., 2023). To complement our theoretical findings, we experimentally studied Strassen attention and compared it against standard (Vaswani et al, 2017), higher-order attention (Sanford et al., 2023), and triangular attention (Bergen et al. 2021). Our results help to disentangle all these attention mechanisms, highlighting their strengths and limitations. In particular, Strassen attention outperforms standard attention significantly on all the tasks. Altogether, understanding the theoretical limitations can guide research towards scalable attention mechanisms that improve the reasoning abilities of Transformers.
BibTeX
@inproceedings{kozachinskiy2025strassen,
  author = {Alexander Kozachinskiy and Felipe Urrutia and Héctor Rojas and Tomasz Steifer and Germán Pizarro and Matías Fuentes and Francisco Meza and Cristian Buc and Cristóbal Rojas},
  title = {{Strassen Attention, Split VC Dimension and Compositionality in Transformers}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=C9JMOzKD9k},
}
Figure