Ouroboros: Dynamic Weight Generation for Recursive Transformers via Input-Conditioned LoRA Modulation
Organizations: RightNow AI
Abstract
Recursive transformers reuse a shared weight block across multiple depth steps, trading parameters for compute. A core limitation: every step applies the same transformation, preventing the model from composing distinct operations across depth. We present Ouroboros, a system that attaches a compact Controller hypernetwork to a recursive transformer block. The Controller observes the current hidden state, produces a per-step diagonal modulation vector, and applies it to frozen SVD-initialized LoRA bases, making each recurrence step input-dependent. We combine this with gated recurrence (bias-initialized to 88% retention) and per-step LayerNorm for stable deep iteration. On Qwen2.5-3B split into a Prelude/Recurrent/Coda architecture (17 of 36 layers retained), Ouroboros reduces training loss by 43.4% over the unmodified 17-layer baseline, recovering 51.3% of the performance gap caused by layer removal. The full system adds only 9.2M trainable parameters (Controller, gate, and per-step norms) yet outperforms equivalently-sized static per-step LoRA by 1.44 loss points at depth 1 and remains ahead across all tested depths (1, 4, 8, 16) and ranks (8, 32, 64). We also find that gated recurrence is essential: without it, recursive layer application makes the model strictly worse. These gains are measured on the training distribution; on held-out text, the Controller does not yet improve over the baseline, a limitation we attribute to frozen downstream layers and discuss in detail. Code: https://github.com/RightNow-AI/ouroboros
Figures & tables
| System | Year | Per-Step | Input- | Gated | SVD | Trainable |
|---|---|---|---|---|---|---|
| Adapters | Cond. | Recur. | Init | Params | ||
| Universal Transformer | 2019 | ✗ | ✗ | ✗ | ✗ | Full |
| Relaxed Recursive | 2024 | ✓ | ✗ | ✗ | ✓ | LoRA |
| RingFormer | 2025 | ✓ | ✗ | ✗ | ✗ | Signals |
| Huginn | 2025 | ✗ | ✗ | ✗ | ✗ | Full |
| Retrofitted Recurrence | 2025 | ✗ | ✗ | ✗ | ✗ | Full |
| Component | Parameters | Status |
|---|---|---|
| Prelude (8 layers) | 544M | Frozen |
| Recurrent Layer | 86M | Frozen |
| Coda (8 layers) | 544M | Frozen |
| Embeddings + LM Head | 622M | Frozen |
| CompactController | 0.7M | Trained |
| Recurrence Gate | 8.4M | Trained |
| Configuration | Controller | Static LoRA | (Controller wins by) |
|---|---|---|---|
| Depth = 1 | 5.082 | 6.519 | 1.437 |
| Depth = 4 | 5.075 | 5.246 | 0.171 |
| Depth = 8 | 5.080 | 5.119 | 0.039 |
| Depth = 16 | 5.078 | — | — |
| lr = 1e-3 (depth 8) | 5.073 | 5.106 | 0.033 |
| Rank = 8 (depth 8) | 5.078 | 5.091 | 0.013 |
| Variant | Final Loss | Improvement | vs. Baseline (8.975) |
|---|---|---|---|
| Depth = 1 | 5.082 | 43.4% | 3.893 |
| Depth = 2 | 5.081 | 43.4% | 3.894 |
| Depth = 4 | 5.075 | 43.5% | 3.900 |
| Depth = 8 | 5.080 | 43.4% | 3.895 |
| Depth = 16 | 5.078 | 43.4% | 3.897 |
| Rank = 8 | 5.078 | 43.4% | 3.898 |
| Model | Avg Loss | Beats 17-layer | Beats Full 3B |
|---|---|---|---|
| Full Qwen 3B (36 layers) | 1.683 | — | — |
| 17-layer baseline | 5.690 | — | 0/12 |
| Ouroboros V2 | 5.961 | 3/12 | 0/12 |
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