Gated Recurrent Transformers: Expressive Depth through Recurrent Modulation
Organizations: The German University in Cairo · Technical University of Munich · Cerebras Systems Inc.
Abstract
Scaling transformer language models creates an inherent tension between expressivity and memory efficiency. While unique weights across layers preserve functional specialization---from input-grounding to abstract refinement---they incur a substantial memory footprint. Conversely, standard depth-sharing enforces uniform transformations that collapse representational diversity and degrade modeling quality. We introduce Gated Recurrent Transformer, a recurrent depth transformer where fixed-depth prelude and coda blocks bracket a single shared core iterated R times. Inspired by gated recurrent neural networks, we employ a lightweight projection and an elementwise update gate---conditioned on the hidden state, the fixed prelude output, and noise resampled at every step---to modulate the recurrent update. This allows the model to specialize the input to the same few layers across recurrences, rather than requiring many unique layers to achieve functional diversity. Under an isoFLOPS constraint, a 3-layer Gated Recurrent Transformer matches the accuracy of a 12-layer GPT-2 Small baseline with similar training and inference FLOPs, and leads MoR and heavy-tail depth sampling in all nine scale-by-budget cells; at medium and large scale it approaches dense quality at the standard token budget and overtakes it at medium scale once that budget is doubled. Under an isoPARAMS constraint, deeper recurrence achieves a 2.76 validation loss versus 2.84 for a non-recurrent counterpart at matched parameter and data budget. Our results demonstrate that adaptive depth reuse is a principled strategy for trading parameters for quality: at large scale, 63% fewer parameters and 59% less peak decoding memory for a 10% increase in compiled generation latency.
Figures & tables
| Model | Config | Layers | FLOPs/fwd | Params | Val Loss |
| iso FLOPs regime (matched FLOPs per forward pass) | |||||
| GPT-2 Small | |||||
| Baseline | 12L | 12 | 1.84 G | 124M | 3.15 |
| MoR [ 25 ] | 1+1 10+1 | 3 | 1.84 G | 45M | 3.30 |
| Heavy-tail Poisson [ 9 ] | 1+1 10+1 | 3 | 1.84 G | 34M | 3.23 |
| Ouro [ 10 ] | 1+1 10+1 | 3 | 1.84 G | 35M | 3.19 |
| Task | GRT iso FLOPs | GPT-2 Large | GRT iso Params |
|---|---|---|---|
| 1+5 6+5 | (baseline) | 3+30 6+3 | |
| 288M, 11L ( 63%) | 774M, 36L | 774M, 36L | |
| ARC-Challenge ( ) | 25.43 1.80 | 23.63 | 25.26 1.63 |
| ARC-Easy ( ) | 42.89 0.42 | 43.31 | 45.54 2.23 |
| BoolQ ( ) | 60.18 2.60 | 57.58 | 52.29 5.29 |
| HellaSwag ( ) | 35.62 1.59 | 37.21 | 41.52 4.31 |
| Model | Config | Params | Eager (ms/tok) | Compiled (ms/tok) | Peak mem. |
|---|---|---|---|---|---|
| GPT-2 Medium | 24L | 354M | 2.95 | 2.54 | 747 MB |
| GRT Medium | 2+5 4+2 | 127M | 3.62 | 2.81 | 402 MB |
| GPT-2 Large | 36L | 774M | 4.33 | 3.33 | 1570 MB |
| GRT Large | 1+5 6+5 | 293M | 5.33 | 3.67 | 639 MB |
| Configuration | HellaSwag | Mem. @ | Mem. @ |
|---|---|---|---|
| GPT-2 Medium (24L, 354M) | 34.45 | 0.75 GiB (1.00 ) | 3.66 GiB (1.00 ) |
| GRT iso FLOPs , full KV | 33.65 | 0.41 GiB (0.55 ) | 3.32 GiB (0.91 ) |
| GRT iso FLOPs , averaged KV | 33.90 | 0.35 GiB (0.47 ) | 1.44 GiB (0.39 ) |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Run | Batch tokens | Peak LR | Steps | Hardware | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| GPT-2 Small (baseline) | — | — | — | — | 768 | 12 | 491,520 | 20k | 2 H200 | |
| GRT Small (isoFLOP) | 1 | 1 | 10 | 1 | 768 | 12 | 491,520 | 20k | 2 H200 | |
| GPT-2 Medium (baseline) | — | — | — | — | 1024 | 16 | 491,520 | 20k | 2 H200 | |
| GRT Medium (isoFLOP) | 2 | 5 | 4 | 2 | 1024 | 16 | 491,520 | 20k | 2 H200 | |
| GRT Medium (isoParam) | 2 | 20 | 4 | 2 | 1024 | 16 | 491,520 | 20k | 2 H200 | |
| GPT-2 Large (baseline) | — | — | — | — | 1280 | 20 | 491,520 | 20k | 2 H200 |
| Model | Seed 1337 | Seed 42 | Seed 123 | Mean std |
|---|---|---|---|---|
| Dense baseline (12L) | 3.154 | 3.156 | 3.253 | |
| GRT ( 1+1 10+1 ) | 3.141 | 3.146 | 3.148 |
| Configuration | Val. loss | ||
|---|---|---|---|
| 1 | Dense baseline (non-recurrent) | 3.621 | — |
| 2 | Recurrence | 4.163 | 0.542 |
| 3 | + Prelude / coda ( ) | 4.118 | 0.045 |
| 4 | + State noise ( ) | 4.099 | 0.019 |
| 5 | + Prelude re-injection | 3.901 | 0.198 |
| 6 | + Elementwise gate (full Gated Recurrent Transformer ) | 3.786 | 0.115 |
| Property | Dense | MoR | Poisson | RRT | Ouro | GRT |
| [ 25 ] | [ 9 ] | [ 12 ] | [ 10 ] | (ours) | ||
| Full weight sharing | n/a | Yes | Yes | No (LoRA) | Yes | Yes |
| Variable inference depth | No | Yes | Yes | No | Yes | Yes |
| Input-dependent gating | No | Yes | No | No | Yes | Yes |
| Per-step noise injection | No | No | Init only | No | No | Yes |
| Per-iteration loss | No | No | No | No | Yes | No |
| Anchor type | Val. loss (nats) | vs. trained |
|---|---|---|
| Zeros | 8.08 | +5.40 |
| Input embedding | 3.73 | +1.05 |
| Prev. hidden state | 3.38 | +0.70 |
| Trained model (fixed ) | 2.68 | — |
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