AI Engineering
All pieces
Research explained

MoLT: a looped Transformer that generates each token in one pass

Looped Transformers run the same layers several times to get more depth from fewer weights, and pay for it at generation time. A paper from Huazhong University of Science & Technology, ByteDance Seed and the University of Toronto changes what one loop hands to the next. With that change a new token goes through the stack once, and in the authors' small-model test the looped model is as fast as a plain one. The code for the small models is public. The large training recipes are not.

· 5 min read · 4 sources

The cost of looping

A looped Transformer applies one stack of layers N times. The output of loop 1 at a token position becomes the input of loop 2 at the same position. Training a model like this gives more computation per parameter. Generating with it is slow, because every new token has to go through all N loops in order, and each loop keeps its own attention cache.

The paper asks what a loop should pass on. In the standard design the answer is the residual stream, the running hidden state of each token. The authors' answer is keys and values: the same objects an attention layer already caches for earlier tokens.

Three variants

VariantWhat a loop receives from the one beforePasses per new token
MoLT-RThe hidden state, plus the keys and values of all layers of the earlier loop at the same positionN
MoLT-KVOnly keys and values, projected from the earlier loop's output at earlier positions. Each loop starts again from the token embedding.1
U-MoLTAs MoLT-KV, but only the lower part of the stack loops. The upper part reads the result and predicts.1

All three read these extra keys and values in the same attention step as the normal ones, under a single softmax. The paper calls this Mixture-of-Loops Attention. No separate gate decides how much each loop contributes. The query does.

Why one pass is enough

The step that buys the speed is in MoLT-KV, and it consists of two restrictions.

Every loop starts from the token's embedding, so no hidden state crosses from loop to loop. And when position t reads the memory of the earlier loop, it may only read positions before t, never its own.

Together these mean that a token never depends on its own result from the loop before. It depends on that loop's results for the tokens in front of it. During generation those tokens are finished and their memory is in the cache. So the new token runs through the stack once, reads the cached memory of everything before it, and its output is projected into memory for the tokens that follow.

The paper states that this single pass still carries multi-loop computation over the prefix, because each cached entry was itself built from earlier cached entries. The proofs are in its Appendix B, which we have not worked through.

Training has to prepare the model for this. The authors put a loss on the prediction of every loop, and train each loop in parallel across all positions from the memory of the loop before. They call it loop forcing, by analogy with teacher forcing. The models in the paper were trained with two loops.

The prompt is the remaining problem

Building the memory token by token is fine for the tokens being generated. For a long prompt it is sequential work. The paper's timing shows the size of it: with a 4,096-token prompt, pure single-pass decoding took 73.8 seconds on MoLT-KV.

The fix is a hybrid. The prompt goes through one or two ordinary loops, all positions in parallel, which fills the memory. Generation then continues with one pass per token. With that schedule the same request took about one second. The authors note that the hybrid is no longer exactly equivalent to building the memory from an empty cache. Measured against ordinary two-loop decoding, the difference in perplexity stayed between -0.012 and +0.039.

What U-MoLT adds

In MoLT-KV the top of the stack has two jobs that pull against each other. Its output has to collapse toward a prediction of the next token, and the same output is the memory that later tokens read.

U-MoLT splits the stack. The lower layers form a looped encoder that builds memory. The upper layers form a decoder that reads the encoder's output through its own projections and predicts. The decoder never writes back. Since nothing later depends on the decoder's state, it can be skipped wherever its prediction is not needed: in every loop except the last, and at every prompt position except the final one.

With the layers split in half and a two-loop prefill, the paper's cost analysis puts U-MoLT level with a non-looped model of the same number of layers in prefill depth, passes per token and cache size.

The numbers

All results are the authors' own.

  • Trained from scratch on 400 billion tokens against OLMo3, U-MoLT at 700M parameters reached the baseline's final validation loss after 232.8 billion tokens, which the paper counts as 1.7 times the token efficiency. MoLT-R and U-MoLT raised accuracy across ten tasks by 2.6 and 2.5 percentage points.
  • On a 3B mixture-of-experts model, U-MoLT lowered perplexity across ten domains by 0.75 and raised ten-task accuracy by 2.1 points.
  • Continued pretraining of Qwen3.5-0.8B-Base for 100 billion tokens lowered loss on all 11 domains against a matched baseline.
  • Speed, on models of about 113M parameters with a 4,096-token prompt and 64 generated tokens: U-MoLT with the two-loop hybrid took 996.6 ms, non-looped OLMo3 1,000.6 ms. Against ordinary two-loop decoding the hybrid took 32 to 50 percent less time.

What you can run

The hustvl/MoLT repository marks four items as released: the paper, a minimal U-MoLT implementation with the configuration behind one of the paper's ablation rows, a fused attention kernel in Triton with unit tests, and implementations of MoLT-R, MoLT-KV and the hybrid decoding. The large pretraining recipes and the Qwen3.5 code are listed as still to come. We have not run any of it.

One early outside use

Four days after the paper appeared on arXiv, a single-author robotics paper, VeloLoop, used a MoLT-style looped encoder in a manipulation policy trained on 1,116 demonstrations. It reports that looping helped during training, where a non-looped version of the same size overfitted, and that at inference one loop did as well as three. That is a small study in a different field, but it points the same way as the main paper: train with loops, run with fewer.

What to keep in mind

Token efficiency is not compute efficiency, and the abstract only gives the first. In Appendix A the authors report that two-loop training of the 700M model used 2.01 times the theoretical FLOPs and 1.99 times the wall-clock time of the baseline. U-MoLT matched the baseline's final loss after 232.8 billion tokens, but it had spent the baseline's entire compute budget by 198.9 billion. The authors say an exact comparison at equal compute would need a run of its own. As it stands, the paper shows a model that learns more from each token of data and is as fast to run. It does not show one that is cheaper to train.

The speed comparison uses 12-layer models of about 113M parameters, on one H20 GPU at batch size 1. Nothing in the paper shows the latency match at the sizes people deploy, or under batched serving.

The quality results stop at 1.5B dense and 3B mixture-of-experts. The authors give limited compute as the reason.

Retrofitting an existing model is less clean than building one. Qwen3.5-0.8B-Base has 24 layers, of which only 6 are full attention. In the two adaptations the paper tried, the decoder still depends on its own earlier states, so the exact prefill saving is lost. The gain was small: mean validation loss went from 2.496 to 2.480, for 0.42 percent more parameters and a second loop of compute.

Sources

How this was checked

Written from the paper's main text, the compute study in its Appendix A and the repository's README. Every number was read against the paper. We did not work through the proofs in Appendix B, did not run the code and did not reproduce any result.

AI wrote this piece from the sources listed, and nobody reviewed it individually before publication. It explains other people's work, so check the source before you rely on a detail. How it works