Strassen Attention, Split VC Dimension and Compositionality in Transformers

Alexander Kozachinskiy, Felipe Urrutia, Hector Jimenez, Tomasz Steifer, Germán Pizarro, Matías Fuentes, Francisco Meza, Cristian B. Calderon, Cristóbal Rojas

This paper, recently presented by researchers from CENIA and the University of Chile, tackles a fundamental question in deep learning: Why do Transformers struggle with complex reasoning, and how can we fix it without making them prohibitively slow?

The authors provide a two-part answer: a new mathematical framework for proving what one-layer Transformers cannot do, and a novel "Strassen Attention" mechanism that solves these problems with sub-cubic efficiency.

TL;DR

The authors introduce Split VC Dimension to prove that one-layer softmax Transformers have inherent reasoning limitations regardless of numerical precision. To overcome this, they propose Strassen Attention, a new mechanism that captures complex triple-wise token interactions in sub-cubic time ($O(n^{2.37})$), significantly outperforming standard attention on compositional reasoning tasks.

What Problem Does This Paper Address?

Standard Transformers rely on self-attention, which essentially computes interactions between pairs of tokens. However, many reasoning tasks—like function composition or finding specific triplets in a sequence—require looking at three or more tokens simultaneously.

While researchers have proposed "higher-order" attention to handle these interactions, they usually come with a massive computational cost, typically $O(n^3)$ time complexity. Furthermore, previous theoretical proofs of Transformer limitations often assumed the models used a limited number of precision bits. This left a lingering question: Could a Transformer with "infinite precision" (perfect arithmetic) bypass these reasoning hurdles?

This paper proves the answer is no, and offers a scalable way to move beyond pairwise interactions.

Methods

1. Split VC Dimension

The authors introduce a new theoretical tool called Split VC Dimension. By splitting the arguments of a Boolean function into "inputs" and "parameters," they can measure the combinatorial complexity of that function.

  • The Main Theorem: They prove that for a one-layer standard Transformer to compute a function, its size (embedding dimension, number of heads, etc.) must grow polynomially with the function's Split VC dimension.
  • The Impact: This allows them to prove that one-layer Transformers are mathematically incapable of solving tasks like "Match3" or "Binary Relation Composition" unless they are impractically large, even if they have infinite numerical precision.

2. Strassen Attention

To solve these tasks efficiently, the authors introduce Strassen Attention. Inspired by Strassen’s algorithm for fast matrix multiplication, this mechanism allows the model to consider interactions between triplets of tokens $(i, j, k)$.

Figure 1: Comparison of Transformer attention mechanisms: Standard [23], Third-Order [20], Tri- angular [2], and Strassen (proposed). The diagram shows operations and the one-layer Transformer architecture, highlighting the flow through each attention and output MLP (without layer normal- ization and dropout in the attention mechanism). Notation: input length n, embedding dimension d, number of nodes m, with n = m2 when n refers to the shape of flatten matrices.

Unlike previous "Third-Order" attention mechanisms that require $O(n^3)$ time, Strassen Attention leverages matrix multiplication properties to achieve a complexity of $O(n^\omega \cdot d)$, where $\omega < 3$ (currently $\approx 2.37$). This makes it much more scalable for long sequences.

Datasets

The authors evaluated their theories and the new mechanism on four synthetic reasoning benchmarks:

  1. Function Composition: Given functions $g$ and $h$, compute $h(g(x))$.
  2. Match3: Identify if any three integers in a sequence sum to zero (modulo $m$).
  3. Binary Relation Composition: Determine if a transitive relation exists between elements in a matrix.
  4. Quotient Binary Relation Composition: A new, more difficult version of the relation task designed to distinguish the capabilities of Strassen attention from "Triangular" attention.

Key Insights and Ideas

  • Precision isn't a silver bullet: The failure of one-layer Transformers on compositional tasks isn't about "rounding errors" or bit-depth; it's a fundamental architectural limitation of pairwise softmax attention.
  • The "Strassen Trick": By decomposing the attention score into pairwise dot products $(f_i g_j + g_j h_k + h_k f_i)$, the model can simulate a triple-wise interaction without the full cost of a 3D tensor.
  • Separation of Powers: The authors show that while "Triangular Attention" (another efficient variant) works well when data is already structured as a matrix, Strassen Attention is more general and can solve reasoning tasks directly from raw sequences.

Key Results

The experimental results (summarized in Figure 3 of the paper) show a clear hierarchy of performance:

  • Accuracy: Strassen and Third-Order attention were the only mechanisms to achieve near-perfect accuracy across all four reasoning tasks. Standard attention failed significantly on all of them.
  • Training Speed: Strassen Attention consistently outperformed Third-Order attention in terms of "accuracy per minute." In tasks like Function Composition, Strassen was nearly as fast to train as Standard attention while being far more accurate.
  • Scalability: Computational benchmarks on NVIDIA A100 GPUs confirmed that Strassen Attention is significantly more memory-efficient and faster than Third-Order attention as sequence length increases.

Limitations and Future Work

The primary limitation acknowledged is that these results are currently confined to one-layer models and synthetic "toy" tasks. While these tasks are essential for proving theoretical bounds, the real-world impact on large-scale language modeling (LLMs) remains to be seen.

Future work includes:

  • Testing Strassen Attention in multi-layer architectures.
  • Applying the mechanism to natural language tasks like semantic parsing.
  • Investigating if Strassen Attention leads to a "smoother loss landscape," as the authors observed more stable training dynamics compared to other higher-order methods.

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 Hector Jimenez and Tomasz Steifer and Germán Pizarro and Matías Fuentes and Francisco Meza and Cristian B. Calderon 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