On the Representational Capacity of Recurrent Neural Language Models

Franz Nowak, Anej Svete, Li Du, Ryan Cotterell · OpenReview

Abstract

This work investigates the computational expressivity of language models (LMs) based on recurrent neural networks (RNNs). Siegelmann and Sontag (1992) famously showed that RNNs with rational weights and hidden states and unbounded computation time are Turing complete. However, LMs define weightings over strings in addition to just (unweighted) language membership and the analysis of the computational power of RNN LMs (RLMs) should reflect this. We extend the Turing completeness result to the probabilistic case, showing how a rationally weighted RLM with unbounded computation time can simulate any deterministic probabilistic Turing machine (PTM) with rationally weighted transitions. Since, in practice, RLMs work in real-time, processing a symbol at every time step, we treat the above result as an upper bound on the expressivity of RLMs. We also provide a lower bound by showing that under the restriction to real-time computation, such models can simulate deterministic real-time rational PTMs.

Introduction

The theoretical foundation of Recurrent Neural Networks (RNNs) was significantly advanced in 1992 when Siegelmann and Sontag demonstrated that RNNs are Turing complete. However, that landmark proof treated RNNs primarily as formal language recognizers—systems that either accept or reject a string. In the modern era of Generative AI, this binary classification framework is insufficient. Modern Recurrent Language Models (RLMs) do not merely classify; they assign probabilities to sequences, functioning as probabilistic generators.

This paper addresses the gap between neural network theory and probabilistic modeling. By mapping RLMs onto the hierarchy of probabilistic computation, the authors characterize the "Representational Capacity" of these models, moving beyond simple language recognition to the more complex domain of semimeasures—probability distributions over strings.

Theoretical Framework: RLMs as Semimeasures

A core argument of this work is that treating LMs as standard formal language recognizers is a category error. Because an LM produces a probability distribution, its expressivity must be measured against probabilistic models of computation, such as Probabilistic Turing Machines (PTMs).

To bridge this gap, the authors introduce the **$ε$RLM**. This variant of the RLM is equipped with the ability to output "empty" symbols ($ε$). These $ε$-transitions serve as a theoretical "think step," allowing the RNN to perform multiple internal hidden state updates and computations before emitting the next actual token. This mechanism effectively grants the model unbounded computation time between outputs, a necessary condition for simulating complex computational processes.

Simulation and Turing Completeness

The authors establish the RLM's Turing completeness in the probabilistic context through a constructive proof involving a Probabilistic Two-Stack Pushdown Automaton (2PDA).

The 2-Stack Simulation

Since a 2-stack PDA is computationally equivalent to a Turing Machine, proving that an $ε$RLM can simulate a 2PDA establishes its upper bound of expressivity. The proof relies on Rational Arithmetic: assuming the RNN uses rational-valued weights and infinite precision, the network can "encode" the entire contents of a stack into the digits of a single rational number (the activation of a neuron). By manipulating these digits through linear transformations and non-linearities, the RLM can simulate pushing and popping from the stacks.

Rational Weights Sufficiency

Crucially, the authors show that irrational (real-valued) weights are not required for this level of expressivity. Rational weights are sufficient to simulate any deterministic probabilistic Turing machine with rational transitions, making the result more robust and theoretically grounded in computable numbers.

Real-Time Constraints and Lower Bounds

While the $ε$RLM provides a theoretical upper bound, real-world language models typically operate in "real-time," producing exactly one token per time step without internal $ε$-steps. The paper accounts for this by providing a tighter lower bound: under strict real-time constraints, RLMs can simulate Real-Time Deterministic 2PDAs (RD-2PDA).

This distinction highlights the "Power of the Think Step." The difference between an RLM being a real-time processor and a full Turing machine lies entirely in the ability to take internal computation steps without generating output.

Key Results and Hierarchy

The research establishes a clear hierarchy of expressivity for probabilistic recurrent models:

  1. Upper Bound: Every $ε$RLM has a weakly equivalent 2PDA, and every $Σ$-deterministic 2PDA has a strongly equivalent $ε$RLM. Consequently, $ε$RLMs can represent any enumerable semimeasure.
  2. Lower Bound: Real-time RLMs (without $ε$ symbols) are capable of simulating Real-Time Deterministic 2PDAs.
  3. Equivalence: The authors demonstrate that Probabilistic Turing Machines (PTMs), Rational-valued PTMs (QPTMs), and 2PDAs are all strongly equivalent regarding the probability distributions they can generate.

Discussion and Limitations

While these results provide a rigorous mathematical ceiling for RNN expressivity, several practical limitations remain:

  • Precision: The proofs rely on rational weights with arbitrary precision. In physical hardware, fixed-precision floating-point numbers are used, which theoretically collapses the RNN's capacity to that of a Finite State Automaton.
  • Unbounded Time: The most powerful results require the model to take an arbitrary number of steps between words, which does not align with the standard inference procedures of current RLMs or Transformers.
  • Representability vs. Learnability: A primary open question is the gap between what a model can represent and what it can learn. The existence of a set of weights that simulates a Turing machine does not guarantee that gradient descent can ever discover those weights.

Conclusion

By extending the proof of Turing completeness to the probabilistic domain, this work provides a roadmap for understanding the limits of recurrent architectures. It clarifies that the representational capacity of an RLM is not just a function of its weights, but also of its computational budget per token. Future work remains to apply this rigorous framework to non-recurrent architectures, such as the Transformer, to see if similar hierarchies of probabilistic expressivity apply.

Summary updated

BibTeX
@inproceedings{nowak2023representational,
  author = {Franz Nowak and Anej Svete and Li Du and Ryan Cotterell},
  title = {{On the Representational Capacity of Recurrent Neural Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  url = {https://openreview.net/forum?id=VndpFa27i6D},
}
Figure