An Algebraic View of the Expressivity of Recurrent Language Models

Franz Nowak, Ryan Cotterell, Reda Boumasmoud

TL;DR

This paper resolves long-standing conflicts in neural network theory by proving that a model's expressive power is fundamentally dictated by its arithmetic implementation (e.g., floating-point vs. integer). By re-framing Recurrent Neural Networks (RNNs) as algebraic "transformation monoids," the authors provide a unified framework to determine exactly which formal languages a model can recognize based on its hardware-level discretization.

What Problem Does This Paper Address?

In the world of theoretical computer science, there is a "civil war" regarding RNNs. Some researchers claim RNNs are Turing-complete (as powerful as any computer), while others argue they are merely finite automata (only as powerful as simple regex).

The authors identify that this discrepancy stems from a "category error": theorists often assume "Platonic" real-valued math, while practitioners use "Digital" finite-precision arithmetic. This paper addresses the lack of a rigorous, unified language to describe how discretization—rounding errors, overflow, and evaluation order—fundamentally changes the "brain" of a neural network.

Methods

The authors bridge the gap between continuous neural networks and discrete automata theory using Abstract Algebra:

  • Algebraic Cores: They strip RNN layers down to their bare essentials: a state-transition function and a readout function.
  • Transformation Monoids: They treat every input symbol as a function that transforms the network's internal state. The collection of all possible transformations forms a "monoid."
  • Wreath Products: To model deep (multi-layer) networks, they use the "wreath product," an algebraic tool that captures how lower layers control the dynamics of upper layers in a hierarchy.
  • Formal Arithmetic Models: They define "Arithmetic Models" (like IEEE-754 floating-point or modular integers) as parameters. This allows them to prove how losing properties like associativity (which happens in floating-point math) restricts what a model can compute.

Datasets

As a theoretical paper, it does not use standard machine learning datasets like ImageNet or GLUE. Instead, it evaluates models against Formal Languages—mathematical benchmarks for computation:

  • The Parity Language: Recognizing if a string has an even number of 1s (a classic test for "counting" ability).
  • Modular Counters: Languages that require keeping track of counts modulo $k$.
  • Aperiodic Languages: Languages that don't require "cycling" or counting.

Key Insights and Ideas

  • Discretization is not "Noise": The authors argue that quantization isn't just a small error; it fundamentally alters the algebraic structure of the model. For example, floating-point addition is not associative—$(a+b)+c$ does not always equal $a+(b+c)$—which breaks many classical proofs of expressivity.
  • The "Sandwich" Architecture: They formalize an RNN acceptor as a three-part sandwich: an Encoder (mapping text to numbers), a Dynamical Core (the algebraic monoid), and an Accepting Core (the decoder/classifier).
  • Depth-for-Width Tradeoff: They show that certain complex behaviors can be achieved either by a single "wide" layer with complex arithmetic (like integers) or by stacking multiple "thin" layers with simpler arithmetic (like signed floating-point).
  • Evaluation Order Matters: Because computer math isn't associative, the way you write your code (the order of operations) can actually change the formal language the model is capable of recognizing.

Key Results

The paper applies its theory to a case study of Diagonal State Space Models (SSMs), such as the popular Mamba architecture:

  • Floating-Point Limitation: They prove that a non-negative diagonal SSM using floating-point arithmetic cannot recognize the Parity language. It is algebraically "aperiodic" (it cannot cycle).
  • Integer Superiority: Surprisingly, the exact same architecture can recognize Parity if it uses unsigned-integer quantization. The "wraparound" behavior of integers naturally provides the cyclic group structure needed for counting.
  • Unified Divisibility Chain: They establish a "master equation" for expressivity: for a model to recognize a language, the language's "syntactic monoid" must divide the network's "transition monoid."

Limitations and Future Work

  • Learnability vs. Expressivity: The paper proves what a model can do (existence), but not what it will do after being trained with Gradient Descent. A model might be algebraically capable of counting but fail to learn how to do so.
  • Fixed Precision: The current framework assumes precision is fixed. The authors suggest extending this to "growing precision" (where memory increases with input length) to capture non-regular languages.
  • Transformers: While the paper focuses on recurrent models (RNNs, SSMs), the authors note that adapting this algebraic view to Attention-based models is a critical next step, as Transformers currently dominate the field.

Summary updated

BibTeX
@inproceedings{nowak2026algebraic,
  author = {Franz Nowak and Ryan Cotterell and Reda Boumasmoud},
  title = {{An Algebraic View of the Expressivity of Recurrent Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=7pbmZatDuD},
}
Figure