Hierarchical vs. Flat Iteration in Shared-Weight Transformers
Organizations: Korea University of Technology and Education · Biomonster Co.
Abstract
We present an empirical study of whether hierarchically structured, shared-weight recurrence can match the representational quality of independent-layer stacking in a Transformer-based language model. HRM-LM replaces L independent Transformer layers with a two-speed recurrent pair: a Fast module operating at every step for local refinement, and a Slow module operating every T steps for global compression. This recurrent hierarchy is unrolled for M = N x T steps with shared parameters. The central and most robust finding, supported by a parameter-matched Universal Transformer ablation (UniTF, 1.2B) across five independent runs, is a sharp empirical gap between the two approaches.
Figures & tables
| Property | Transformer | HRM-LM | Valid |
|---|---|---|---|
| Stored params | |||
| Inference KV cache | ( ) | ||
| Parameter sets | (indep.) | (shared) | |
| Step parallelism | Pipeline-opt. | Serial | — |
| Depth scaling | params | Free ( ) | |
| Gradient flow | layers | -step window | — |
| Symbol | Meaning | Transformer | HRM-LM |
|---|---|---|---|
| model dim. | shared | shared | |
| layers | param sets | — | |
| Slow-module cycles | — | hyperpar. | |
| L-steps/cycle | — | hyperpar. | |
| supervision passes | — | hyperpar. | |
| gradient window | — | hyperpar. |
| Update type | KV cache | Inter-token | Expressiveness |
|---|---|---|---|
| interaction | |||
| Full causal attn (ours) | ✓ | High | |
| RNN position-wise | Lower | ||
| Hybrid ( attn steps) | , | Partial | Medium |
| Dimension | Transformer | HRM-LM |
|---|---|---|
| Stored params | ||
| Train activations | ||
| Train FLOPs | ||
| Inference KV cache |
| Exp | Fixed | Measured | |
|---|---|---|---|
| Rep. | 1 (equal params) | Stored params 1.23B | val CE |
| 2 (equal FLOPs) | FLOPs/iter | val CE (T-L12 partial) | |
| Rep. | 3 (long train) | FLOPs/iter, 20k steps | val CE |
| A (LR search) | Best LR for T-L12 | val CE (60k, converged) | |
| Rep. | 4 (inference) | Architecture | latency, peak memory |
| Rep. | 5 (ablation) | , base config | val CE vs |
| Model | Params | val CE | vs T-L4 |
|---|---|---|---|
| HRM (N=2,T=4) | 1229M | 4.239 | 0.323 |
| HRM (N=4,T=3) | 1229M | 4.284 | 0.278 |
| HRM (N=2,T=2) | 1229M | 4.450 | 0.112 |
| Transformer L=2 | 743M | 4.509 | 0.053 |
| Transformer L=4 | 1280M | 4.562 | — |
| Model | Params | val CE | vs T-L12 |
|---|---|---|---|
| HRM , | 1857M | 4.165 | 1.231 |
| HRM , | 1229M | 4.233 | 1.163 |
| HRM , | 359M | 4.364 | 1.032 |
| Transformer L=12 | 3427M | 5.396 ‡ | — |
| Model | Params | val CE (10k) | val CE (20k) | val CE (60k) | (10k→20k) |
|---|---|---|---|---|---|
| HRM , | 1229M | 4.233 | 3.901 | — | 0.332 |
| Transformer L=12, | 3427M | 5.396 ‡ | 4.929 ‡ | 4.251 ‡ | 0.467 |
| HRM , | 359M | (4.364 ∗ ) | 6.113 † | — | 1.749 |
| Universal TF , | 474M | 6.673 | 6.614 ⋆ | — | 0.059 |
| ∗ EqualFLOPs result; LongTrain run uses different config (warmup=2000). | |||||
| T-L12 at 60k (4.250) trails HRM NT=12 at 10k (4.177) by 0.073 nats; confirmed converged ( CE 0.001 nats over final 3,500 steps). | |||||
| Config | Steps | val CE | Status |
| T-L12, lr (EqualFLOPs) | 10k | 5.396 | [email protected] |
| T-L12, lr (LongTrain) | 20k | 4.929 | slow descent |
| T-L12, lr (TF-Baseline) | 60k | 4.250 | converged |
| HRM NT=12 (1229M, EqualFLOPs LR) | 10k | 4.233 | converged |
| HRM NT=12 (1229M, LongTrain) | 20k | 3.901 | converging |
| Model | Params | Lat. | Peak | T-L4 |
| T L=2 | 743M | 6.6 ms | 1670 MB | |
| T L=4 | 1280M | 10.5 ms | 2698 MB | |
| T L=12 | 3427M | 25.4 ms | 6810 MB | |
| HRM | 1229M | 20.5 ms | 2656 MB | |
| HRM | 1229M | 31.1 ms | 2656 MB | |
| HRM | 1229M | 46.8 ms | 2656 MB |
| Config | val CE | Notes | |
|---|---|---|---|
| K ablation (N=4, T=3, S=1) | |||
| (K/M ) | 4.238 | 0.012 | |
| (base, 17%) | 4.226 | — | |
| (33%) | 4.098 | 0.128 | |
| (67%) | 4.052 | 0.174 | best overall |
| S ablation (N=4, T=3, K=2) | |||
| Model | Params | val CE @ 10k | Note |
|---|---|---|---|
| HRM , | 1229M | 4.177 | UniTF (10k complete) |
| T-L4, | 1280M | 4.562 | EqualParam |
| UniTF , | 474M | 6.403 | |
| UniTF , | 820M | 7.624 | 3 runs; see App. B |
| UniTF , | 1218M | 7.578 | 10k complete; plateau throughout |
| HRM NT=12 (1229M) | T-L4 (1280M) | ||||
|---|---|---|---|---|---|
| lr | warmup | val CE | lr | warmup | val CE |
| 1000 | 4.308 | 1000 | 4.543 | ||
| 500 | 4.485 | 500 | 4.545 | ||
| 500 | 4.367 † | 1000 | 4.687 | ||
| 1000 | 4.381 | 500 | 4.706 | ||
| 1000 | 4.920 | 1000 | 4.997 | ||
| Aggregation | HRM NT=12 | T-L4 | HRM advantage |
|---|---|---|---|
| Best (top-1) | 4.308 | 4.543 | |
| Top-2 mean | 4.338 | 4.544 | |
| Median (of 8) | 4.703 | 4.852 | |
| Worst (of 8) | 5.727 | 5.799 |
| Model | seed=42 | seed=1337 | seed=2024 | mean | std |
|---|---|---|---|---|---|
| T-L4 (1280M) | 4.702 | 4.698 | 4.692 | 4.697 | 0.004 |
| HRM NT=12 (1229M) | 4.909 | 4.892 | 4.889 | 4.896 | 0.009 |
| Model | tok/sec | ms/tok | Peak GPU | vs T-L4 |
| T-L2 (743M) | 542.7 | 1.84 ms | 1483 MB | |
| T-L4 (1280M) | 318.6 | 3.14 ms | 2511 MB | |
| T-L12 (3427M) | 120.2 | 8.32 ms | 6623 MB | |
| HRM (1229M) | 144.3 | 6.93 ms | 2428 MB | |
| HRM (1229M) | 61.3 | 16.33 ms | 2429 MB | |
| HRM ( , 359M) | 55.7 | 17.96 ms | 744 MB |
| Model | CE (normal) | CE (H frozen) | CE |
|---|---|---|---|
| HRM NT=4 (N=2,T=2) | 4.375 | 5.281 | +0.906 |
| HRM NT=8 (N=2,T=4) | 4.375 | 5.938 | +1.563 |
| HRM NT=12 (N=4,T=3) | 4.313 | 8.313 | +4.000 |
| Step | H? | gate | ||||
|---|---|---|---|---|---|---|
| 0 | 0.281 | 16.36 | 56.57 | 56.57 | 0.048 | |
| 1 | 0.268 | 10.32 | 56.57 | 56.57 | 0.040 | |
| 2 | 0.281 | 8.73 | 56.57 | 10.21 | 0.084 | |
| 3 | 0.281 | 7.94 | 10.21 | 10.21 | 0.085 | |
| 4 | 0.288 | 7.76 | 10.21 | 10.21 | 0.080 | |
| 5 | 0.292 | 7.68 | 10.21 | 6.85 | 0.134 |
| Model | Blocks | Params | Mem | Steps † | Saving |
|---|---|---|---|---|---|
| TF L=4 | 4 indep. | 1.07B | 2.1 GB | 4 | — |
| TF L=12 | 12 indep. | 3.22B | 6.4 GB | 12 | — |
| HRM | 3 shared | 0.81B | 1.6 GB |
| Metric | TF L=4 | HRM | HRM |
|---|---|---|---|
| Stored params | 1280M | 1229M | 1229M |
| KV cache (theory) | |||
| Latency (seq=1024) | 10.5 ms | 31.1 ms | 46.8 ms |
| Latency ratio | |||
| Peak GPU (seq=1024) | 2698 MB | 2656 MB | 2656 MB |
| val CE (10k) | 4.562 | 4.239 | 4.233 |
| Property | HRM-LM | TurboQuant |
|---|---|---|
| Target | Stored model weights | KV cache activations |
| Stored param. mem. | , -fold | Unchanged |
| KV cache memory | reduction ( only) | |
| Quality cost | None (CE improved) | Quality-neutral at 3.5 bits |
| Requires retraining | Yes | No |
| Latency overhead | slower | Negligible |
| Model | M | K/M | 3k | 5k | 7k | 10k | grad 10k |
|---|---|---|---|---|---|---|---|
| HRM | 48 | 33% | 5.054 | 4.443 | 4.255 | 4.172 | 1.281 |
| HRM | 48 | 25% | 4.819 | 4.741 | 4.509 | 4.519 | 1.570 |
| UniTF flat † | 48 | 33% | 5.735 | 6.461 | 6.823 | 6.101 | 0.812 |
| HRM (M=12) | 12 | 67% | — | — | — | 4.177 | — |
| UniTF (M=12) | 12 | 17% | — | — | — | 7.578 | — |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Run | lr / warmup | iter 0 CE | val CE plateau |
|---|---|---|---|
| v2 | / 2000 | 11.98 (normal) | 7.624 @ 10k |
| v2b | / 500 | 91.7 (bad seed) | 7.613 @ 2k |
| v2c | / 500, v3-init | 109.9 (bad seed) | 7.646 @ 4.5k |
| iter | val CE |
|---|---|
| 0 | 139.04 |
| 500 | 7.909 |
| 1000 | 7.651 |
| 1500 | 7.627 |
| 2000 | 7.612 |
| 2500 | 7.553 |
Transformer
Transformers are neural architectures that use attention to model relationships among sequence elements in language, vision, and scientific data.
See all 528 papers