Rational Transductors
Mehryar Mohri
Overview
This talk introduces rational transductors, a novel theoretical and architectural framework for sequence modeling designed to address fundamental limitations in standard transformers. While transformers have established themselves as the de facto standard across natural language processing, code generation, and vision, their reliance on self-attention creates inherent syntactic blind spots. Specifically, standard transformer architectures struggle with tasks requiring precise state tracking, modular counting, and length generalization because they lack an appropriate inductive bias for handling discrete algorithmic operations.

Key moments
- 0:00 Introduction and limitations of transformers
- 2:04 Length generalization issues and the role of syntactic inductive bias
- 4:00 Research questions and talk roadmap
- 6:00 Weighted automata and linear state updates
- 8:38 Architecture combining transformers and weighted automata
- 10:35 Expressivity results and circuit complexity
- 13:30 Optimization and parameterization via Cayley matrices
- 16:00 Generalization guarantees and experimental validation
- 18:44 Audience Q and A: Comparison to state space models
Rational Transductors
Speakers: Mehryar Mohri
Conference: ICML
YouTube: https://slideslive.com/39083636
Overview
This talk introduces rational transductors, a novel theoretical and architectural framework for sequence modeling designed to address fundamental limitations in standard transformers. While transformers have established themselves as the de facto standard across natural language processing, code generation, and vision, their reliance on self-attention creates inherent syntactic blind spots. Specifically, standard transformer architectures struggle with tasks requiring precise state tracking, modular counting, and length generalization because they lack an appropriate inductive bias for handling discrete algorithmic operations.
To resolve this bottleneck, the speaker presents a design that augments standard transformer layers with a syntactic co-processor based on weighted finite automata (WFAs). This hybridization preserves the logarithmic parallel efficiency ($\mathcal{O}(\log T)$) of transformers while strictly expanding expressivity to encompass complex formal languages and syntactic tasks. The framework is supported by a comprehensive theoretical analysis covering circuit complexity, optimization via Cayley matrices, and sequence-length-independent generalization bounds.
The motivation stems from a persistent failure mode in modern deep learning: transformers excel at semantic pattern matching but falter on syntactic operations such as parity checking, carry-bit propagation, and out-of-distribution length extrapolation. By embedding linear state updates derived from weighted automata into transformer layers, rational transductors bridge the gap between connectionist neural networks and classical automata theory. This article details the mathematical foundations, architectural integration, parameterization techniques, and empirical validation of this new sequence modeling paradigm.
Background
▶ Watch: Introduction and limitations of transformers (0:00)
The systems and machine learning literature has extensively documented the theoretical limits of transformer architectures through the lens of circuit complexity. Hard attention mechanisms are bounded within AC0, while soft self-attention models fall within TC0. While TC0 circuits can in principle approximate functions like parity, their gradient-based inductive biases prevent them from learning solutions that generalize to sequence lengths unseen during training. Tasks such as modular counting ($mod \ K$), state tracking, carry-bit propagation, and algorithmic reasoning consistently expose this lack of robust syntactic extrapolation.
Prior attempts to mitigate these shortcomings include state space models (SSMs) and recurrent neural architectures. However, SSMs often introduce layer-wise sequential bottlenecks, resulting in computational complexities scaled by the number of layers multiplied by the log sequence length ($\mathcal{O}(L \cdot \log T)$). Furthermore, alternative sequence models frequently sacrifice the parallel training advantages of transformers or fail to provide rigorous generalization guarantees that hold independently of sequence length ($T$).
The core problem in the machine learning systems space is designing an architecture that unifies the global semantic reasoning of self-attention with the exact state-tracking capabilities of formal automata, without introducing hardware-unfriendly sequential dependencies or forfeiting optimization stability.
Key Findings
▶ Watch: Research questions and talk roadmap (4:00)
Rational transductors resolve the tension between semantic flexibility and syntactic rigidity by introducing a model class whose expressive power strictly contains standard transformer families. Key findings and theoretical results detailed in the talk include:
- Strictly Greater Circuit Complexity: The family of rational transductors ($\mathcal{F}_{RT}$) includes NC1, which strictly contains both TC0 (soft transformers) and AC0 (hard attention), and is bounded within probabilistic NC1.
- Exact Parity and Modular Counting: Unlike fixed-depth transformers which fail to generalize on tasks like modulo 5 counting when tested beyond their training horizon (accuracy dropping to random guess levels), rational transductors maintain 100% accuracy on length generalization tasks for arbitrary sequence lengths $T$.
- Krohn-Rhodes Completeness: A stacked rational transductor can exactly simulate any finite automaton, enabling the uniform recognition of all regular languages, state encodings, and complex syntactic operations.
- Length-Independent Generalization Guarantees: Through Rademacher complexity analysis controlled via the nuclear norm of the Hankel matrix, the framework provides generalization bounds that do not degrade as a function of sequence length $T$.
- Asymptotic Time Efficiency: By leveraging linear recurrence properties, rational transductors achieve a computational complexity of $\mathcal{O}(L + \log T)$, avoiding the layer-wise sequential bottlenecks typical of traditional state space models.
Technical Deep Dive
▶ Watch: Architecture combining transformers and weighted automata (8:38)
The architectural foundation of a rational transductor rests upon augmenting standard transformer layers with a weighted automaton operating as a syntactic co-processor.
Weighted Automata Formulation
A weighted automaton is defined over a finite token alphabet with $D$ states (matching the dimension of the vectors considered). It utilizes an initial state vector $\alpha$ (associated with state $Q_0$) and a set of transition matrices $M_\sigma$ for every token $\sigma$. As an input sequence $X_1, \dots, X_T$ is processed, the linear state update is governed by:
$$H_t = M_{X_t} H_{t-1}$$
where $H_t$ represents the vector of weights reaching the states at time step $t$. Because this recurrence is linear, the system utilizes parallel associative scans to compute these state vectors in logarithmic time ($\mathcal{O}(\log T)$).
Architectural Integration
In a rational transductor, the state vector $H_t$ computed by the weighted automaton at each time step is injected directly into every layer of the transformer. This syntactic vector is combined with the output vector of the corresponding transformer layer via a learned projection matrix. This injection happens seamlessly without introducing inter-layer sequential dependencies.
Parameterization via Cayley Matrices
To guarantee stable optimization without requiring heuristic gradient clipping, the speaker proposes parameterizing the transition matrices using Cayley matrices. A Cayley matrix $M_T$ is formulated as:
$$M_T = g_T \cdot (I + A_T)(I - A_T)^{-1}$$
where $g_T$ is a scalar gate and $A_T$ is a learned skew-symmetric matrix.
- When the scalar $g_T = 1$, the eigenvalues lie strictly on the unit circle, enabling exact counting without numerical drift.
- When $g_T < 1$, the formulation captures gating mechanisms and controlled gradient norm decay.
This parameterization ensures that optimization remains stable across very long sequences without gradient explosion or vanishing norms.
Experimental Setup & Results
▶ Watch: Optimization and parameterization via Cayley matrices (13:30)
The empirical evaluation validates the theoretical properties of rational transductors using synthetic and algorithmic benchmarks designed to test length generalization and state tracking.
- Datasets & Tasks: Experiments focus on algorithmic tasks where standard transformers fail, specifically modulo 5 counting and digit addition.
- Length Generalization Protocol: Models are trained on short sequences (e.g., length $40$) and evaluated on out-of-distribution lengths scaling up to $T = 1000$.
- Baseline Comparison: Standard transformers experience catastrophic failure on modular counting as sequence length increases, with accuracy dropping rapidly to random guessing ($20\%$ for modulo 5). In contrast, rational transductors maintain 100% accuracy across all tested sequence lengths up to $T = 1000$.
- Scaling Behavior: Empirical runtime benchmarks confirm the logarithmic scaling ($\mathcal{O}(\log T)$) of the parallel associative scan used in the automaton recurrence, matching the parallel efficiency of standard self-attention layers while outperforming the layer-wise sequential bottlenecks of standard state space models.
Practical Implications
▶ Watch: Audience Q and A: Comparison to state space models (18:44)
For infrastructure teams, model builders, and deployers, rational transductors offer a pathway to build foundation models that excel at both unstructured semantic tasks and precise symbolic reasoning.
- Algorithmic Reliability: Applications requiring strict logic, such as code generation, mathematical reasoning, symbolic manipulation, and multi-step state tracking, will benefit from the error-free extrapolation provided by weighted automata co-processors.
- Compute Efficiency: Because the syntactic co-processor relies on parallel associative scans ($\mathcal{O}(\log T)$) rather than unrolled sequential loops, deployment on modern GPU/TPU hardware does not incur the throughput penalties associated with traditional recurrent models.
- Tradeoffs: While the architecture provides powerful theoretical guarantees and robust out-of-distribution generalization, integrating projection matrices and Cayley matrix parameterizations adds architectural complexity to standard transformer training pipelines. Practitioners must balance the dimensionality $D$ of the automaton states against memory overhead during backpropagation.
Key Takeaways
- Syntactic Deficit in Transformers: Standard transformers rely on soft self-attention ($\text{TC0}$) which lacks the inductive bias required for length generalization on parity, modular counting, and state-tracking tasks.
- Automata Augmentation: Rational transductors integrate weighted finite automata as syntactic co-processors into standard transformer layers via learned projections.
- Logarithmic Parallelism: The linear state updates of the weighted automaton are computed via parallel associative scans, preserving $\mathcal{O}(\log T)$ efficiency without layer-wise sequential bottlenecks.
- Cayley Matrix Optimization: Parameterizing transition matrices via Cayley matrices ensures stable optimization and exact counting without the need for heuristic gradient clipping.
- Length-Independent Generalization: Theoretical bounds governed by Hankel matrix nuclear norms guarantee that generalization performance does not degrade as sequence length $T$ increases.
About the Speaker(s)
Authors: Mehryar Mohri.
Reviews
- Maya Iyer (Theoretical ML Researcher) — MUST SEE ★★★★★
→ Top-rated talks at International Conference on Machine Learning 2026
All talks from International Conference on Machine Learning 2026