Command Palette
Search for a command to run...
Mixture-of-Loops Transformer
Mixture-of-Loops Transformer
Lianghui Zhu Shijie Wang Xinggang Wang Jinze Bai Bo Wang Xiang Bai
Zusammenfassung
Geschleifte Transformer steigern die Ausdruckskraft, indem sie gemeinsame Schichten über Schleifen hinweg wiederverwenden, jedoch auf Kosten der Effizienz. Um ihre Ausdruckskraft-Effizienz-Grenze zu verschieben, muss der Kernmechanismus, der benachbarte Schleifen verbindet, neu gedacht werden: Was sollte als Transformer-Schleife weitergegeben werden? Wir stellen den Mixture-of-Loops Transformer (MoLT) vor, dessen Mixture-of-Loops Attention (MoLA) Schlüssel und Werte (KV) als Gedächtnis für die selektive Wiederverwendung über Tiefen und Schleifen hinweg nutzt. Unter Schleifen-Residuum behält MoLT-R den Residuenstrom bei und liest lokale KV über Schleifen hinweg für Ausdruckskraft. Unter Schleifen-KV startet MoLT-KV stattdessen neu aus Einbettungen und liest lokale KV der aktuellen Schleife mit Gedächtnis-KV vorangehender Schleifen an früheren Positionen für Effizienz. MoLT-KV eliminiert die positionsgleiche schleifenübergreifende Abhängigkeit und ermöglicht, gepaart mit Schleifen-Forcing für paralleles Training, eine Mixture-of-Loops (MoL)-Dekodierung in einem einzigen Durchlauf über den Trainingsschleifenhorizont hinaus. Um Effizienz und Qualität auszubalancieren, führen wir den U-förmigen MoLT (U-MoLT) ein, der die Gedächtniskonstruktion vom Vorhersage-Auslesen trennt und ungenutzte Dekodierdurchläufe überspringt, ohne die Vorhersagen zu verändern. Im 400-Milliarden-Token-Vortraining übertrifft U-MoLT OLMo3 bei dichten 700M/1,5Bund 3B-MoE-Modellen und erreicht eine 1,7-fache Token-Effizienz bei der Validierungs-Kreuzentropie (CE) bei 700M, während die 10-Domänen-Perplexität des 3B-MoE um 0,75 und die 10-Aufgaben-Genauigkeit um 2,1 Prozentpunkte verbessert werden. Im 100-Milliarden-Token-Fortsetzungstraining von Qwen3.5-0.8B-Base senkt unsere U-MoLT-Adaption die CE in allen 11 Domänen gegenüber der angepassten Baseline mit einer 1,4-fachen mittleren Token-Effizienz. Bei der Inferenz erreicht U-MoLT mit MoL-Hybrid-2 die Latenz des nicht geschleiften OLMo3 mit 996,6 gegenüber 1.000,6 ms bei Modellen der Größe S (ca. 113M).
One-sentence Summary
Researchers from Huazhong University of Science & Technology, ByteDance Seed, and University of Toronto propose Mixture-of-Loops Transformer (MoLT), whose Mixture-of-Loops Attention uses keys and values as memory for selective reuse across depths and loops, and U-shaped MoLT (U-MoLT) separates memory construction from prediction readout while skipping unused decoder traversals without changing predictions; in 400B-token pretraining, U-MoLT outperforms OLMo3 across 700M/1.5B dense and 3B MoE models, achieving 1.7× validation cross-entropy token efficiency at 700M and improving 3B MoE 10-domain perplexity by 0.75 and 10-task accuracy by 2.1 percentage points.
Key Contributions
- Mixture-of-Loops Transformer (MoLT) with Mixture-of-Loops Attention (MoLA) uses keys and values as reusable memory across depths and loops. MoLT-R retains the residual stream and reads local KV across loops for expressivity, while MoLT-KV restarts from embeddings and reads current-loop local KV with preceding-loop memory KV at earlier positions to remove same-position cross-loop dependence.
- U-shaped MoLT (U-MoLT) separates memory construction from prediction readout and skips unused decoder traversals without changing predictions. With loop forcing and strict-prefix memory KV, it enables single-traversal Mixture-of-Loops (MoL) decoding beyond the training loop horizon and MoL-Hybrid decoding with parallel prefill.
- In 400B-token pretraining with the OLMo3 recipe, U-MoLT outperforms OLMo3 across 700M/1.5B dense and 3B MoE models, achieving 1.7× validation cross-entropy token efficiency at 700M and improving 3B MoE 10-domain perplexity by 0.75 and 10-task accuracy by 2.1 percentage points. In 100B-token continued pretraining of Qwen3.5-0.8B-Base, it lowers cross-entropy on all 11 domains with 1.4× mean token efficiency, and U-MoLT with MoL-Hybrid-2 matches non-looped OLMo3 latency at 996.6 vs. 1,000.6 ms on S-size (~113M) models.
Introduction
Foundation model architecture design must balance expressivity and efficiency. Looped Transformers improve expressivity by reusing parameters across repeated loops, but prior designs mainly pass information through a residual stream across loops. This repeated compression can dilute information, and same-position cross-loop dependence forces sequential loop execution at inference. The authors propose Mixture-of-Loops Transformer (MoLT), which treats computed keys and values as reusable memory across depths and loops. Its Mixture-of-Loops Attention lets each layer attend to KV from different depths and loops, while MoLT-KV and U-MoLT remove same-position loop dependence so a plain stack can decode in a single traversal beyond the training loop horizon.
Method
The authors introduce the Mixture-of-Loops Transformer (MoLT), a framework that leverages Key-Value (KV) pairs as memory for selective reuse across depths and loops. At the core of this architecture is the Mixture-of-Loops Attention (MoLA) module, which allows each layer to jointly attend to sequence context and same-position depth sources within a single attention distribution. Unlike standard looped Transformers that rely solely on a recurrent residual stream, MoLT provides flexible feedback interfaces to carry computation forward.
The framework defines two primary feedback forms. The first, MoLT-R, utilizes loop residual feedback. It carries the preceding loop's final state into the next loop while retaining local KV to make intermediate representations directly readable. This approach prioritizes expressivity by allowing MoLA to selectively read current-loop and preceding-loop local KV at the same token position, mitigating information dilution. The second form, MoLT-KV, prioritizes decoding efficiency. In this paradigm, each loop restarts afresh from token embeddings. It reads memory KV projected from the preceding loop's normalized output strictly at earlier positions, combined with current-loop local KV. This strict-prefix masking and embedding restart remove same-position cross-loop dependencies, enabling single-traversal decoding.
To balance efficiency and quality, the authors propose U-shaped MoLT (U-MoLT), which separates memory construction from prediction readout. U-MoLT employs a looped MoLT Encoder to build feedback memory across loops using the loop KV paradigm. A separate, causal, cross-only MoLT Decoder then reads the normalized encoder output to predict the next token. This architectural split isolates the responsibilities of preserving high-fidelity historical context and collapsing hidden states toward the next-token distribution, preventing the representational degradation often seen in deep autoregressive layers.
Training the MoLT family relies on a multi-loop objective combined with loop forcing. The authors supervise next-token predictions at successive loops of the shared network. For a given loop count N, the total loss is a weighted sum of the per-loop cross-entropy losses. In MoLT-KV and U-MoLT, applying this objective with positive weights on every loop constitutes loop forcing. Analogous to teacher forcing, each feedback loop trains in parallel across token positions from the preceding loop's strict-prefix memory KV rather than from sequentially decoded prefixes. This reduces the training complexity from sequential steps to parallel passes and allows gradients to refine earlier computations that produce the feedback sources.
During inference, the authors introduce Mixture-of-Loops (MoL) decoding to exploit the efficiency of the loop KV paradigm. Because embedding restart and strict-prefix memory reads eliminate same-position cross-loop dependencies, each feedback loop reduces to a strictly triangular recurrence across token positions. MoL decoding processes the prompt and generates tokens using a single traversal of the shared stack per token. It jointly reads completed prefix memory KV and current-loop local KV, appending new memory KV to the cache for subsequent tokens. To further optimize, MoL-Hybrid decoding combines fixed-loop parallel prefill with the MoL decoding update, initializing prompt memory KV from the final prefill loop and preserving the cross-token recursion over continuation positions while matching the inference costs of non-looped Transformers.
Experiment
The experiments evaluate MoLT variants through S-size component ablations, scaling runs for dense and MoE models, inference schedules, and continued pretraining adaptation of Qwen3.5-0.8B-Base. Ablations show that residual looping, direct depth access, and independent decoder KV projections improve prediction quality, while scaling confirms U-MoLT and MoLT-R gains at larger sizes and faster convergence. MoL-Hybrid decoding reduces latency with only small perplexity changes, and the Qwen adaptation improves all validation domains with modest parameter overhead and faster token-matched convergence.
The comparison separates non-looped memory reuse methods, which typically decode in a single traversal, from looped methods that require multiple traversals per generated token. Non-looped approaches vary in prefix memory source, including layer-mixture memory, shared top-layer KV, and layer-output KV, while MoDA uniquely adds same-token depth KV. Looped designs such as LPT, PLT, and Universal YOCO rely on residual or shifted residual loop input and pay multiple encoder or decoder traversals. Non-looped methods including Feedback Transformer, LCKV, and Recurrent Transformer all complete a single traversal per token but differ in whether sequence KV comes from layer mixtures, shared top layers, or layer outputs. MoDA is the only compared method that combines current sequence KV with same-token depth KV in one pass, while looped methods use residual or shifted residual loop inputs and require multiple traversals per token.
Ablations on S-size models show that moving from one loop to two loops improves validation loss at the same parameter count, and expanding depth access within and across loops yields further gains. The depth-source benefits persist with sparse placement, though two-loop training adds logical FLOPs and update time. Residual looping improves validation CE without changing the parameter count. Direct depth access strengthens feedback: current-loop cross-layer sources add a small gain, and preceding-loop sources add a larger gain. Adding depth KV lowers the best MoLT-R validation CE without adding parameters, and the preceding-loop gain also holds with sparse placement. The two-loop recipe doubles logical training FLOPs and increases update time relative to the single-loop baseline.
Across the tested loop-loss weight ratios, the second loop consistently achieves lower validation cross-entropy than the first loop. Shifting loss weight toward the second loop improves its validation CE while slightly worsening the first-loop validation CE. This indicates a trade-off where emphasizing the final loop yields better final-loop predictions at some cost to the earlier loop. The second loop's validation CE decreases as its relative loss weight increases. The first loop's validation CE worsens as loss weighting shifts toward the second loop.
Final-checkpoint downstream accuracy shows consistent gains for MoLT variants over OLMo3 baselines across 700M dense, 1.5B dense, and 3B MoE scales. At 700M, MoLT-R and U-MoLT both raise mean accuracy to about 59 percent, with MoLT-R leading aggregate and U-MoLT leading on OpenBookQA, COPA, and MMLU. U-MoLT also improves broad task performance at larger scales, including all ten tasks on the 3B MoE model. U-MoLT improves mean downstream accuracy over OLMo3 at every evaluated scale. At 700M dense, MoLT-R achieves the highest aggregate accuracy in its block, while U-MoLT nearly matches it and leads on OpenBookQA, COPA, and MMLU. At 1.5B dense, U-MoLT improves nine tasks and ties ARC-E, raising average accuracy above the OLMo3 baseline. On the 3B MoE model, U-MoLT improves all ten downstream tasks.
Across the ten text domains, MoLT variants lower validation perplexity relative to the OLMo3 baseline, with improvements in every domain at each reported model scale. The gains are broad rather than concentrated in a few domains, and the best perplexity in each model block belongs to a MoLT variant. The trend also holds for the reported MoE configuration, where average perplexity declines. In the 700M dense block, MoLT-R and U-MoLT both improve perplexity across all ten domains, with the lowest domain perplexities split between the two MoLT variants. At the reported MoE scale, U-MoLT improves perplexity in every domain and lowers average perplexity from 13.99 to 13.24.
The experiments compare non-looped and looped memory reuse designs, with MoDA as the only compared method that combines current sequence KV with same-token depth KV in one pass, while looped methods require multiple traversals per token. Ablations show that two loops, residual looping, direct depth access, and depth KV improve validation loss at fixed parameters, though two-loop training increases logical FLOPs and update time, and shifting loop-loss weight toward the second loop improves final-loop cross-entropy at a small cost to the first loop. Downstream and perplexity evaluations show MoLT variants, particularly U-MoLT, consistently improve over OLMo3 baselines across 700M dense, 1.5B dense, and 3B MoE scales, with lower validation perplexity in every text domain at each reported scale.