NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Hard Attention Transformers and BSS-Machines

Lena EhrmuthNeurIPS 2026

TL;DR

Most theoretical studies of transformer expressivity compare them to discrete Turing machines, ignoring the continuous math happening under the hood. This paper proves that when transformers operate on continuous vectors without rounding to discrete tokens at each step, they are computationally equivalent to Blum-Shub-Smale (BSS) machines—an algebraic cousin of the Turing machine that computes directly over real numbers. This means idealized transformers over the reals aren't just Turing-complete; they can theoretically compute functions that standard Turing machines cannot touch.

What Problem Does This Paper Address?

When computer scientists ask, "What can a transformer actually compute?", they usually measure it against classical yardsticks like Boolean circuits or Turing machines. Those models live in a discrete universe of finite alphabets and 1s and 0s.

Yet internally, transformers are continuous beasts—multiplying matrices and adding vectors of real numbers. Forcing them to map outputs back to a discrete vocabulary at every step throws away the algebraic richness of their internal state.

To understand what transformers can do in their native algebraic habitat, the author compares them to Blum-Shub-Smale (BSS) machines. Introduced in 1989, a BSS-machine is essentially a Turing machine whose infinite tape holds exact elements from an ordered ring (like integers $\mathbb{Z}$, rationals $\mathbb{Q}$, or reals $\mathbb{R}$) instead of discrete symbols. In a single step, it can evaluate polynomials on tape cells and branch based on inequalities ($\ge 0$). Over $\mathbb{Q}$, BSS-machines are Turing-complete; over $\mathbb{R}$, exact real arithmetic makes them strictly more powerful than Turing machines. The paper asks: how do transformers stack up against BSS-machines?

Methods

To bridge transformers and BSS-machines, the author introduces recursive transformers using leftmost hard attention (where each vector attends strictly to the first vector achieving the highest attention score, allowing exact value copying without softmax blurring).

Instead of outputting discrete tokens, a recursive transformer takes a sequence of vectors and outputs a new sequence of vectors, growing the sequence by one vector per iteration until a designated "halt" coordinate becomes non-zero. The author studies two recursion flavors:

  • Full-sequence recursion ($\mathbf{R}$): The entire updated sequence is fed back into the next pass.
  • Chain-of-Thought recursion ($\mathbf{S}$): Standard autoregressive generation, where only the final vector is appended to the existing history, leaving past vectors immutable.

To simulate a BSS-machine, each vector represents a single tape cell—storing its value, position, and the machine's current state. Because transformers vary in how they process vectors after attention, the author tests two activation setups:

  1. Arithmetic Circuits: Activation layers made of addition and multiplication gates, capable of computing arbitrary polynomials.
  2. Standard Feedforward Networks (FFNs): Standard linear layers with $\text{ReLU}$ activations, which cannot natively multiply two arbitrary variables together.

Datasets

Not discussed in the paper. (This is a purely theoretical computer science paper proving mathematical equivalences between computational models.)

Key Insights and Ideas

  • Discontinuity for free: Simulating a BSS-machine's conditional branching requires evaluating a discontinuous $\text{sign}$ function. Even if a transformer's internal circuits only have smooth addition and multiplication, hard attention itself introduces discontinuity. By cleverly routing attention between reference vectors holding $0$ and $1$, the attention mechanism acts as a built-in comparator.
  • Faking multiplication with ReLU: Standard ReLU networks can't multiply arbitrary variables to do conditional logic ("if state A, output $x$, else $0$"). The author bypasses this by proving all intermediate FFN values are bounded by a dynamically trackable maximum $G$. Using attention to fetch either $G$ or $0$ and passing it through $\text{ReLU}(a + y_{\text{sign}} - G)$ cleanly zeroes out unwanted branches without needing multiplication gates!
  • Irrationals drive super-Turing power: Because the exact same transformer architecture simulates BSS-machines over both $\mathbb{Q}$ and $\mathbb{R}$, the leap beyond Turing-computability over $\mathbb{R}$ doesn't come from architectural tricks—it emerges purely from allowing exact representation and arithmetic over irrational numbers.
  • Autoregressive immutability doesn't hurt: Even when restricted to Chain-of-Thought ($\mathbf{S}$) recursion—where old tape cells cannot be overwritten—transformers lose zero expressivity. They simply treat the sequence as an append-only log, using positional embeddings to attend to the most recent update of a tape cell.

Key Results

Over any $\mathbb{Z}$-ordered ring $R$ (including $\mathbb{Z}, \mathbb{Q},$ and $\mathbb{R}$), the paper establishes two tight computational equivalences (holding for both $\mathbf{R}$ and $\mathbf{S}$ recursion):

  1. Circuit Transformers = Standard BSS-Machines: Recursive hard-attention transformers with arithmetic circuit activations compute the exact same class of functions as division-free $\text{BSS}_R$-machines.
  2. ReLU Transformers = Linear BSS-Machines: Standard recursive transformers using ReLU FFNs and dot-product attention are computationally equivalent to linear $\text{BSS}_R$-machines (degree $\le 1$ updates) with degree-2 polynomial branching (thanks to the quadratic nature of dot-products).
  3. Polynomial-Time Equivalence: The simulations are efficient. A transformer simulates a $t(n)$-step BSS-machine in $t(n) + \mathcal{O}(n)$ iterations, while a BSS-machine simulates one transformer iteration in quadratic time. Thus, the complexity classes of functions computable in polynomial time are identical across both models.

Limitations and Future Work

  • Real-world hardware: Any model relying on exact real numbers ($\mathbb{R}$) is a mathematical idealization that cannot be physically realized on finite-precision digital computers (though all results still hold cleanly over $\mathbb{Q}$).
  • Average hard attention & division: When ties in maximal attention scores are averaged, transformers can still simulate BSS-machines. However, simulating average attention on a BSS-machine requires division, breaking the clean two-way equivalence for general function computation (though they remain equivalent for yes/no decision problems).
  • Soft attention: Extending this to standard softmax attention remains an open problem. Softmax requires real exponentials, smears values across vectors, and makes the entire transformer continuous—preventing the neat attention trick used to compute $\text{sign}$. The author suspects reintroducing $\text{sign}$ into the activation functions might allow soft-attention transformers to approximate certain BSS-machines.

Summary updated

BibTeX
@inproceedings{ehrmuth2026hard,
  author = {Lena Ehrmuth},
  title = {{Hard Attention Transformers and BSS-Machines}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=uF9Zr3T0p8},
}
Figure