On the Turing Completeness of Modern Neural Network Architectures

Jorge Pérez, Javier Marinkovic, Pablo Barceló

Introduction

The computational limits of neural networks have been a subject of intense study since the 1990s, when Recurrent Neural Networks (RNNs) were proven to be Turing complete. This property implies that, given arbitrary precision for internal activations, a finite-sized RNN can simulate any algorithm. However, the modern deep learning landscape has shifted toward architectures like the Transformer and the Neural GPU. Unlike RNNs, these models do not rely on direct step-by-step recurrence, leading to questions about their fundamental computational power. This paper addresses whether bounded-size Transformers and Neural GPUs are inherently Turing complete without requiring external, unbounded memory.

Methods

The authors formalize Transformers and Neural GPUs as sequence-to-sequence language recognizers, assuming rational numbers with arbitrary precision for weights and activations. Turing completeness is established through two primary simulation strategies:

  1. Transformer Simulation: A constructive proof demonstrates that a specific Transformer architecture—utilizing "hard" attention and residual connections—can simulate a Turing machine. The network tracks the machine's state, head position, and tape contents within its internal representations.
  2. Neural GPU Simulation: Completeness is proven by showing that a uniform Neural GPU can simulate a sequence-to-sequence RNN, which is already known to be Turing complete.
Schematic of a Transformer simulating a Turing machine step-by-step.

As illustrated in the figure above, the simulation process for the Transformer involves several stages: implementing the transition function, computing the cell index for the next step, and retrieving the last symbol written at that cell using attention mechanisms.

Key Insights

Several architectural features are critical for achieving universal computation:

  • Positional Encodings: Without positional encodings, Transformers are "proportion invariant" and cannot recognize even simple regular languages. Positional encodings are the essential component that enables Turing completeness.
  • Internal Representation as Memory: Standard Transformers and Neural GPUs do not require external memory banks. Their ability to compute and access dense internal representations is sufficient to simulate an infinite Turing tape.
  • Convolution Padding: For Neural GPUs, zero-padding is necessary for Turing completeness. Circular convolutions cause the network to lose the ability to differentiate between periodic sequences of different lengths, thereby breaking completeness.

Results

The theoretical analysis yields three key results:

  1. Transformer networks with positional encodings are Turing complete.
  2. Uniform Neural GPUs using zero-padding are Turing complete.
  3. Transformers without positional encodings and Neural GPUs with circular convolutions are strictly not Turing complete.

Discussion and Limitations

The primary caveat of these proofs is the reliance on arbitrary precision. In practical settings, hardware uses fixed-precision (e.g., float32), which limits the Transformer's ability to store the unbounded state of a Turing machine tape. Under fixed precision, the Transformer loses its theoretical Turing completeness. Furthermore, the Transformer proof utilizes "hard" attention, whereas practical applications typically use "soft" softmax attention.

Future research should investigate the computational power of these architectures under fixed-precision constraints and explore whether specific components like residual connections or gating mechanisms are strictly necessary for these theoretical properties.

Summary updated

BibTeX
@inproceedings{perez2019turing,
  author = {Jorge Pérez and Javier Marinkovic and Pablo Barceló},
  title = {{On the Turing Completeness of Modern Neural Network Architectures}},
  booktitle = {International Conference on Learning Representations},
  year = {2019},
  url = {https://openreview.net/forum?id=kGOKlVnA6VM},
}
Figure