Softmax Transformers are Turing-Complete

Hongjian Jiang, Michael Hahn, Georg Zetzsche, Anthony Widjaja Lin

For years, a fundamental question has lingered in the theoretical foundations of deep learning: just how computationally powerful are the Transformers that drive modern Large Language Models (LLMs)? While it has been established that Transformers using "hardmax" attention—which strictly selects a single token to attend to—are Turing-complete, the reality of modern AI is built on softmax attention. Softmax does not pick just one token; it computes a weighted average across many.

Until now, it remained an open question whether this "blurry" averaging mechanism could simulate a universal computer. A new paper, "Softmax Transformers are Turing-Complete," finally provides the definitive answer: Yes, they are. Furthermore, the authors prove that these models can achieve this in a way that generalizes to sequences significantly longer than those encountered during training.

Executive Summary

Researchers have proven for the first time that softmax-based Chain-of-Thought (CoT) Transformers are Turing-complete. By demonstrating that these models can simulate Minsky counter machines rather than standard Turing machines, the authors show that softmax Transformers can solve any computable problem. Crucially, they maintain the ability to generalize to longer inputs, provided they utilize Relative Positional Encodings (RPEs) when processing complex, arbitrary languages.

The Problem: Hardmax vs. Softmax and Length Generalization

Theoretical computer science relies on the "Turing-complete" designation as a gold standard for computational universality. If a system is Turing-complete, it can, in principle, compute any computable function.

Previous proofs of Transformer universality relied heavily on hardmax attention. While mathematically convenient for proofs, hardmax is practically unrealistic because its lack of smoothness makes gradient-based training exceedingly difficult. Softmax is the industry standard, but its continuous, averaging nature makes it difficult to pinpoint specific memory locations—a requirement for simulating the discrete read/write head of a standard Turing machine.

Furthermore, theoretical representation does not guarantee practical learnability, especially regarding length generalization. Current LLMs often struggle when asked to solve algorithmic problems on sequences longer than their training data. The authors sought to prove not just that softmax Transformers can represent universal computation, but that they can do so in a length-generalizable manner.

Methodology: Simulating Minsky Counter Machines

The authors took a novel path to prove their point. Instead of forcing a Transformer to mimic a standard Turing Machine moving a head back and forth on a tape, they demonstrated that it could simulate Minsky’s Counter Machines.

State transition diagram illustrating counter machine logic

This simulation relies on three key components:

  1. C-RASP Extension: The researchers utilized C-RASP (Counting RASP), a declarative language known to map directly to the operations of softmax Transformers. They extended this language with Chain-of-Thought (CoT) capabilities, allowing the model to write intermediate "scratchpad" tokens.
  2. Counting as Computation: Softmax attention is naturally adept at counting. By treating the frequency of specific tokens in the CoT history as "counters," the Transformer can perform the core operations of a counter machine: incrementing, decrementing, and zero-testing (as illustrated in the state transition logic above).
  3. Relative Positional Encodings (RPEs): The authors identified a critical limitation: standard softmax CoT is Turing-complete for simple "unary" languages (where numbers are represented by repeating a single character, e.g., 11111 for 5), but fails on arbitrary languages (like binary). To resolve this, they introduced RPEs, which allow the model to "index" into a complex string and convert it into a numerical value that the internal counter machine can process.

Empirical Validation

To move beyond pure theory, the authors empirically validated their findings by training LLaMA-style decoder-only Transformers on several complex arithmetic tasks:

  • Prime: Identifying if a number is prime.
  • Exponential: Calculating $2^i$.
  • Division: Determining if $j$ divides $i$.
  • Greatest Common Divisor (GCD): Finding the GCD of two numbers.
  • Multiplication: Basic non-linear arithmetic.

They tested these tasks using both Unary and Binary representations, training on short sequences (length 1–100) and evaluating on much longer out-of-distribution sequences (up to length 300).

Key Results and Insights

The empirical results strongly supported the theoretical claims:

  • The Power of Counting: The researchers realized that while softmax struggles with precise "pointing," it excels at "summing." Using CoT steps to adjust token counts effectively simulates the registers of a counter machine.
  • Unary Success: On unary tasks, the models achieved nearly 100% accuracy and generalized perfectly to longer sequences without requiring any positional encodings.
  • The Necessity of RPEs for Binary: When using binary representations, models equipped with RPEs maintained 100% accuracy across all test lengths. RPEs act as the vital bridge allowing the model to read a complex input string and load it into its internal counters.
  • The Failure of NoPE: Binary models without positional encodings (NoPE) completely collapsed on longer sequences, often dropping to 0% accuracy on out-of-distribution sets. This confirms that RPEs are essential for generalizable computation in arbitrary languages.

Limitations and Future Work

While this paper definitively proves that length-generalizable softmax Transformers are Turing-complete, it does not primarily focus on computational efficiency. The current proof constructs require a number of CoT steps that might be impractically high for highly complex problems.

Additionally, the proof relies on an "idealized learning procedure." Real-world training with Stochastic Gradient Descent (SGD) on noisy data introduces chaotic dynamics not fully captured by the theory. Future work will likely focus on refining the relationship between the required number of CoT steps and specific computational complexity classes (such as P or PSPACE), bridging the gap between theoretical universality and practical efficiency.

Summary updated

BibTeX
@inproceedings{jiang2026softmax,
  author = {Hongjian Jiang and Michael Hahn and Georg Zetzsche and Anthony Widjaja Lin},
  title = {{Softmax Transformers are Turing-Complete}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=FdkPOHlChS},
}
Figure