MeSH: Memory-as-State-Highways for Recursive Transformers

Chengting Yu, Xiaobo Shu, Yadao Wang, Yizhen Zhang, Haoyi Wu, Jiaang Li, Rujiao Long, Ziheng Chen, Yuchi Xu, Wenbo Su, Bo Zheng

TL;DR

MeSH introduces an explicit memory buffer and learnable routers to recursive transformers, solving the "information overload" that typically plagues weight-shared models. By decoupling transient computation from persistent state, MeSH-enhanced models outperform standard Transformers while using 33% fewer parameters, offering a more sustainable path for scaling large language models.

What Problem Does This Paper Address?

Recursive transformers are a parameter-efficient alternative to standard Large Language Models (LLMs). Instead of deploying 24 unique layers, a recursive model might loop a single "core" block 24 times. While this saves massive amounts of memory by decoupling compute depth from parameter depth, these models historically underperform compared to their non-recursive counterparts when given the same amount of compute.

By probing the hidden states of these models, the authors diagnose two primary "pathologies" causing this performance gap:

  1. Undifferentiated Computation: Because the core block is shared, it tends to perform the same type of processing in every iteration, failing to specialize. For instance, the first loop should ideally perform different feature extraction than the final loop, but standard recursive models show diminishing returns in later iterations.
  2. Information Overload: A single hidden state is forced to act as both "Working Memory" (intermediate calculations) and "Long-term Memory" (preserving input context). This conflict leads to representational collapse, where the model's internal states lose complexity and "stagnate" as they move through the loop.
Pathologies of Recursive Transformers

Methods: Memory-as-State-Highways (MeSH)

To address these bottlenecks, the authors propose Memory-as-State-Highways (MeSH). Instead of passing a single, overloaded hidden state through a loop, MeSH maintains an external State Buffer with multiple slots.

MeSH Architecture vs. Heuristic Recurrence

Key components of the MeSH architecture include:

  • The State Buffer ($M$): A dedicated multi-slot "highway" for long-lived information, externalizing state management from the core computation.
  • Dynamic Routers: Lightweight, step-wise "Read" and "Write" routers. At each iteration $t$, the model uses a router to decide which information to pull from the buffer and where to store its new outputs.
  • Functional Specialization: Unlike previous "rigid" methods (like simple residual connections), MeSH routers have unique parameters for each iteration. This allows the model to learn a specific "policy"—for example, using Slot 1 for initial features and Slot 4 for late-stage refinement.

This architecture effectively converts the implicit challenge of state management into a clear, learnable routing problem.

Key Insights and Ideas

  • Breaking Stagnation: Through Centered Kernel Alignment (CKA) visualizations, the authors show that standard recursive models get "trapped" in a fixed point where the state stops evolving. MeSH breaks this trap, allowing the representation to progressively refine across the entire loop.
  • The "Processor" vs. "Preserver" Role: By offloading memory to the buffer, the core transformer block is "liberated" to focus entirely on computation (the "Processor" role) rather than just trying not to forget the input (the "Preserver" role).
  • Emergent Routing Policies: Visualizations of the routers show they naturally learn to organize information. In early iterations, they might target specific "anchor" slots, while later iterations synthesize complex summaries from multiple past states.

Key Results

The models were pretrained from scratch using The Pile and evaluated on language modeling capabilities (Wikitext, Lambada) and a suite of 9 downstream tasks (including PIQA, HellaSwag, WinoGrande, ARC, SciQ, and MMLU-Continuation).

  • Efficiency Gains: At the 1.4B parameter scale, a MeSH-enhanced recursive model outperformed the standard non-recursive Vanilla Transformer while using 33% fewer non-embedding parameters.
  • Accuracy Boost: MeSH improved average downstream accuracy by +1.06% over the Vanilla baseline and significantly outperformed "naive" recursive baselines.
  • Scalability: The benefits of MeSH were consistent across the entire Pythia suite, from 160M up to 6.9B parameters, proving it is a scalable and principled architecture.
  • Low Overhead: The routers are extremely lightweight, adding only about 0.005% more parameters and 0.014% more FLOPs compared to a base recursive model.

Limitations and Future Work

While MeSH shows great promise, the authors note a few areas for further exploration:

  • Scale Limits: While tested up to 6.9B, it remains to be seen if these parameter-efficiency gains persist at the 70B+ or 400B+ scale.
  • Non-Recursive Application: Preliminary tests suggest MeSH could even benefit standard, non-recursive Transformers by improving information flow between unique layers, but a full investigation was outside the scope of this paper.
  • Training Regimes: The models were trained for one epoch on 250B tokens; testing on much larger data volumes (trillions of tokens) would further establish its robustness.

Summary updated

BibTeX
@inproceedings{yu2026mesh,
  author = {Chengting Yu and Xiaobo Shu and Yadao Wang and Yizhen Zhang and Haoyi Wu and Jiaang Li and Rujiao Long and Ziheng Chen and Yuchi Xu and Wenbo Su and Bo Zheng},
  title = {{MeSH: Memory-as-State-Highways for Recursive Transformers}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=IhTrFvY7p3},
}
Figure