All models

fla_mesanet

A MesaNet sequence model whose layers solve an in-context optimization problem at every step.

Language · 938 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

This diagram has 938 operations (1.0 MB) and is drawn when you ask.

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
16.9M
Operations
938
Framework
PyTorch
Recurrent
No
Published
ICLR 2026
Cited by
0 (as of 22 October 2026)
Authors
Johannes von Oswald, Nino Scherrer, Seijin Kobayashi and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m4980
Graph hash
1163362ec5b0881b445ca5bf1ea4284444a6b8035f5114033eb5541b72dc5a84
Skeleton hash
be80ddfadf4603d8ad64a5db22aefc9bb5fbbf692cc6fc94c83626ef33892ec3
Architecture hash
f361fa3aa77f8366cb4a423b8fa946111cbef0e96a4381b8718a75c3513ac46a
Diagram SHA-256
1c9629b70d73efaea08cc2da8e7c04cba8a56b9954f86435f11552127522f224
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

This model is a single Mesa layer applied to hidden states, the layer that generates a prediction by solving an optimization problem.

MesaNet is a sequence model made of many Mesa layers interleaved with MLPs. A Mesa layer generates its prediction by solving an optimization problem, which yields the linear model that best fits a given sequence. The paper places it among recurrent models such as DeltaNet, Mamba and xLSTM, whose layer dynamics can all be derived from an in-context regression objective that is approximately optimized through an online learning rule.

The Mesa layer instead minimizes its in-context loss to optimality at every time point, using a fast conjugate gradient solver. The earlier Mesa layer could only run sequentially in time and was not scalable, and this paper introduces a numerically stable version that can be parallelized over chunks. Because the number of solver iterations needed to reach a stopping criterion differs across sequences, the layer adapts its computational cost at test time to the sequence at hand.

The authors train MesaNets with 140M, 440M and 1B parameters on the SlimPajama dataset. At all of these scales the paper reports lower validation perplexity than models such as Mamba2, xLSTM, DeltaNet, Gated DeltaNet and Transformers with the same base architecture. The paper states that this gain comes at the cost of additional flops spent at inference time.

Key idea. MesaNet makes the Mesa layer numerically stable and chunkwise parallelizable, so each layer can minimize an in-context loss to optimality with a conjugate gradient solver at scale.

  • MesaNet
  • Mesa layer
  • fla_mesa_net
  • test-time training
  • in-context regression
  • conjugate gradient
  • recurrent language model
  • linear attention
  • language modeling

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{vonoswald2026mesanetsequencemodelinglocally,
      title={MesaNet: Sequence Modeling by Locally Optimal Test-Time Training}, 
      author={Johannes von Oswald and Nino Scherrer and Seijin Kobayashi and Luca Versari and Songlin Yang and Sarthak Mittal and Maximilian Schlegel and Kaitlin Maile and Yanick Schimpf and Oliver Sieberling and Alexander Meulemans and Rif A. Saurous and Guillaume Lajoie and Charlotte Frenkel and Razvan Pascanu and Blaise Agüera y Arcas and João Sacramento},
      year={2026},
      eprint={2506.05233},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2506.05233}, 
}