Rational Transductors
Organizations: Google Research
Abstract
Standard Transformers excel at semantic modeling but struggle with rigid sequential logic and state tracking. Theoretical work establishes that self-attention is limited to (under hard attention) or (under soft attention), complexity classes that often fail to support robust length generalization on sequential problems without intermediate chain-of-thought \citep{hahn2020theoretical, hao2022formal, merrill2022saturated}. In this work, we introduce Rational Transductors, a dual-stream architecture that augments the Transformer with a matrix-valued recurrence derived from Weighted Finite Automata (WFA). By injecting rational state information into the attention mechanism via a Deep Rational Injection scheme, our framework strictly generalizes the expressive power of Transformers to capture all Regular Languages, -complete languages (such as the word problem of ), and fundamental separations like Parity and Modular Counting, while preserving parallel training efficiency. We ground the architecture in a rigorous learning theory: we prove that Random Rational Features act as a universal basis for sequential dependencies, justifying our initialization strategy, while establishing that the Differentiable Rational Feature regime is necessary to close the representational compactness gap. Theoretical analysis and empirical results demonstrate that Rational Transductors solve the ``Regular Gap,'' enabling robust length generalization on algorithmic tasks where standard Transformers fail, without the sequential computational bottlenecks of traditional RNNs.
Figures & tables
| Task / Property | Transformer | Transductor | Theoretical Reason |
|---|---|---|---|
| Parity ( ) | ✗ † | ✓ | Limited to / |
| Modular Counting | ✗ | ✓ | Lack of cyclic state vs. WFA exactness |
| All Regular Languages | ✗ | ✓ | Star-free limitation vs. Rational completeness |
| Length Generalization | ✗ | ✓ | Positional drift vs. Time-invariant recurrence |
| All Context-Free Languages | ✗ | ✗ | Lack of unbounded memory stack |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| Config / Task | Modulo Counting | Length Gen. | Long Addition | Base-2 Eval |
|---|---|---|---|---|
| (Sec. 7.1) | (Sec. 7.2) | (Sec. 7.4) | (Sec. 7.5) | |
| Model Architecture | ||||
| Hidden Dim ( ) | 32 | 32 | 32 | 12 (Rational Transductor) / 32 (Transformer) |
| Rational State Dim ( ) | 8 | 8 | 4 | 12 |
| Layers | 2 | 2 | 2 | 1 (Rational Transductor) / 3 (Transformer) |
| Heads | 4 | 4 | 4 | 4 |
Recurrent Transformers
Recurrent Transformers reuse layers or state across steps to extend context, reasoning depth, and sequence modeling with less parameter growth.
See all 179 papers