Constant Bit-size Transformers Are Turing Complete

Qian Li, Yuyi Wang

Introduction

In the quest to understand the reasoning capabilities of Large Language Models (LLMs), a fundamental question persists: "Is a Transformer Turing complete?" While previous theoretical work suggested that Transformers could simulate Turing machines, these proofs often came with significant caveats. Specifically, they required either increasing numerical precision (more bits per number) or growing the embedding dimension (more parameters) as the input length or complexity increased. This implied a fundamental scaling barrier—that models must physically grow to solve increasingly difficult problems.

This research addresses a critical theoretical gap: Is it necessary to scale the bit-size of a Transformer to handle longer inputs? The authors prove that a single Transformer model with a fixed number of parameters and constant numerical precision can simulate any Turing machine, provided its context window is sufficiently large. This shifts the theoretical bottleneck of AI reasoning from "model size" to "memory length."

Methodology: Simulating Post Machines

The authors bridge the gap between neural networks and classical computation by utilizing the Post machine as an intermediary. A Post machine is a Turing-complete model of computation that uses a queue instead of a moving tape. The researchers observed that a Transformer’s context window—where oldest tokens slide out as new ones are appended during generation—behaves remarkably like a queue.

Key technical components of their construction include:

  • Hardmax Abstraction: The model uses "hardmax" (zero-temperature softmax) to attend to specific, discrete tokens.
  • Relative Positional Encoding: A specialized encoding scheme allows the model to "look back" exactly $s(n)$ positions to retrieve the necessary state from the context window.
  • Post Machine Simulation: They demonstrate how a single-layer, single-head Transformer can implement the transition logic of a Post machine, effectively treating the context window as its working memory.

Key Insights and Theoretical Results

The paper establishes a formal equivalence between Transformer memory and computational complexity classes. The main theorem states that the complexity class $WINDOW[s(n)]$ (what a constant bit-size Transformer can achieve with window $s(n)$) is exactly equal to $SPACE[s(n)]$ (what a Turing machine can do with $s(n)$ space).

Comparison of this work with previous literature on Transformer expressiveness.

Space vs. Time

Previous proofs suggested the context window must scale with the time complexity of a task. This paper proves it only needs to scale with the space complexity. This is a massive distinction; many hard problems (like game-tree searches) require exponential time but only polynomial space. Consequently, a Transformer with a polynomial-length context window can solve any problem in PSPACE, including complex tasks like theorem proving and optimal planning.

The Context Window as a Data Structure

Instead of viewing attention as a statistical aggregator, the authors treat it as a discrete computational operation over a queue. By applying their result to a Universal Turing Machine, they show that a single, fixed-size Transformer can theoretically compute any computable function, provided the instructions (the TM description) are provided in the prompt.

Discussion and Future Work

While this work provides a formal theoretical justification for the industry trend of lengthening context windows (e.g., Gemini's 2M tokens), several hurdles remain:

  • Simulation Efficiency: The current proof requires $O(t(n) \cdot s(n))$ steps to simulate a process. This "slowdown" might be inefficient for practical use, prompting further investigation into faster simulations.
  • Nonstandard Encodings: The proof relies on a specific relative positional encoding. It remains to be seen if standard encodings like RoPE offer the same theoretical guarantees.
  • Expressiveness vs. Learnability: A major open question is the gap between representation and optimization; just because a Transformer can represent these computations does not guarantee that standard training processes like Gradient Descent can find those specific weights.

Summary updated

BibTeX
@inproceedings{li2025constant,
  author = {Qian Li and Yuyi Wang},
  title = {{Constant Bit-size Transformers Are Turing Complete}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=RBWnyDEBKf},
}
Figure