Autoregressive Large Language Models are Computationally Universal

Dale Schuurmans, Hanjun Dai, Francesco ZaniniarXiv 2024

Abstract

We show that autoregressive decoding of a transformer-based language model can realize universal computation, without external intervention or modification of the model's weights. Establishing this result requires understanding how a language model can process arbitrarily long inputs using a bounded context. For this purpose, we consider a generalization of autoregressive decoding where, given a long input, emitted tokens are appended to the end of the sequence as the context window advances. We first show that the resulting system corresponds to a classical model of computation, a Lag system, that has long been known to be computationally universal. By leveraging a new proof, we show that a universal Turing machine can be simulated by a Lag system with 2027 production rules. We then investigate whether an existing large language model can simulate the behaviour of such a universal Lag system. We give an affirmative answer by showing that a single system-prompt can be developed for gemini-1.5-pro-001 that drives the model, under deterministic (greedy) decoding, to correctly apply each of the 2027 production rules. We conclude that, by the Church-Turing thesis, prompted gemini-1.5-pro-001 with extended autoregressive (greedy) decoding is a general purpose computer.

Introduction

The fundamental computational limits of Large Language Models (LLMs) have been a subject of intense debate. While LLMs demonstrate remarkable capabilities in pattern recognition and reasoning, the question of whether they are "computationally universal"—capable of performing any computation a classical computer can—remains central. Previous proofs of universality often relied on external tools or memory management systems. This work addresses the challenge of the bounded context window in Transformers, proving that an unaided LLM using standard autoregressive decoding can indeed function as a Universal Turing Machine (UTM).

Theoretical Foundation: Lag Systems and Sliding Windows

The core theoretical contribution is mapping the autoregressive decoding process to a Lag system, a string-rewriting model of computation. In a standard Transformer, the context window is fixed. To process sequences of arbitrary length, the authors define a generalized autoregressive decoding process where the context window "slides" forward as new tokens are generated.

Standard sliding-window autoregressive decoding mechanism.

In this framework, the model reads a prefix of the current sequence and appends a new token to the end. This behavior mirrors a Lag system, which operates like a circular queue: it reads symbols from the front and appends new symbols to the back based on production rules. The authors show that by "rotating" the string through the context window multiple times, they can simulate moving a tape head both left and right. They prove that a Lag system with a context length of just 2 tokens is sufficient to simulate any Turing machine.

Generalized autoregressive decoding mapping to a Lag system.

Empirical Proof: Simulating a UTM with Gemini

To demonstrate this empirically, the authors utilized the $U_{15,2}$ Universal Turing Machine (15 states, 2 symbols). This UTM was reduced to a Lag system comprising 2,027 production rules.

The researchers then tested whether gemini-1.5-pro-001 could execute these rules. They constructed a massive system prompt containing all 2,027 rules and used deterministic (greedy) decoding. The model achieved 100% accuracy in mapping every possible input bigram to the correct output bigram as defined by the UTM logic. This confirms that the LLM can perfectly simulate the state transitions of a universal computer.

Discussion: Efficiency and the "Universality by Default" Conjecture

While the proof establishes theoretical universality, the practical efficiency is low. Simulating a tape head movement requires multiple rotations of the string through the context window. Specifically, moving the tape head one position left takes $O(n)$ iterations, while moving it right takes $O(n^3)$ iterations. Furthermore, the proof relies on "extended" decoding where the model can emit multiple tokens per step; without this, the model might be limited to a Linear Bounded Automaton.

A significant implication of this work is the "Universality by Default" conjecture. The authors suggest that LLMs may not be "taught" to reason solely through training on human text. Instead, the Transformer architecture itself, combined with next-token prediction, might inherently possess universal computational properties. Training simply provides the linguistic "interface" for humans to interact with this underlying computational power.

Conclusion

By demonstrating that a prompted LLM can simulate a UTM through extended autoregressive decoding, this research confirms that frontier models like Gemini 1.5 Pro are general-purpose computers. This result places LLMs within the same class of computational power as classical Turing machines, provided they are allowed to operate over an advancing context window.

Summary updated

BibTeX
@misc{schuurmans2024autoregressive,
  author = {Dale Schuurmans and Hanjun Dai and Francesco Zanini},
  title = {{Autoregressive Large Language Models are Computationally Universal}},
  year = {2024},
  eprint = {2410.03170},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.03170},
}
Figure