How to Loop MoE: Flatten the Experts, Untie the Attention
Abstract
Looped Transformers reuse one block of layers several times: by spending extra computation they push a model of fixed size further, and so use its parameters more fully; while sparse mixture-of-experts (MoE) models activate only a few of many experts for each token. Looped MoE bridges these two design philosophies and gives MoE models new potential for better expert usage, but it raises a question: how to loop a MoE? We answer it with Foil. With the expert parameters and the expert compute per token held fixed, Foil (1) flattens the experts, halving the expert layers, doubling the experts per layer and doubling the passes, so that every routing decision chooses from a larger pool, and (2) unties the attention, giving each pass its own attention parameters while the experts and routers stay shared. Experiments show that Foil clearly outperforms the unflattened looped baseline: at 20B tokens every Foil model has lower pretraining loss than the baseline; at 100B tokens the loss improves monotonically with the degree of flattening, the most flattened Foil ending 0.012 nat below the baseline at equal parameters and compute, with downstream accuracy on par or better; untying the attention also yields more balanced and more confident routing at equal shape. Our ablations analyse why Foil works and turn the findings into design guidance for looped MoE: the returns of looping and of widening the expert layers amplify each other, routing confidence tracks healthy expert use better than load balance, and a sparse looped MoE should therefore use more experts per layer and more passes. Code and configurations are available at https://github.com/SR-A-W/how-to-loop-moe.
Community
Looped Transformers reuse the same block across multiple passes, while sparse Mixture-of-Experts models store many experts but activate only a few for each token. These two ideas are naturally complementary: every new pass gives a token another routing decision, allowing it to reach different experts and expert combinations without adding expert parameters. But this raises an open design question: under a fixed parameter and compute budget, how should experts be distributed across layers and passes; and which components should be shared across passes?
Our new preprint, โHow to Loop MoE: Flatten the Experts, Untie the Attention,โ answers this question with Foil.
๐ข๐๐ฟ ๐ถ๐ฑ๐ฒ๐ฎ: Flatten the experts. Loop more. Untie the attention.
At each flattening step, Foil uses:
โ half as many expert layers
โ twice as many experts per layer
โ twice as many recurrent passes
โ separate attention parameters for each pass
while keeping total parameters, expert compute per token, and effective depth fixed.
We go from:
8 experts ร 8 layers ร 2 passes to:
64 experts ร 1 layer ร 16 passes
๐ฅ๐ฒ๐๐๐น๐๐:
โ Every Foil configuration achieves lower pretraining loss than the baseline at 20B tokens.
โ ๐๐ ๐ญ๐ฌ๐ฌ๐ ๐๐ผ๐ธ๐ฒ๐ป๐, ๐น๐ผ๐๐ ๐ถ๐บ๐ฝ๐ฟ๐ผ๐๐ฒ๐ ๐บ๐ผ๐ป๐ผ๐๐ผ๐ป๐ถ๐ฐ๐ฎ๐น๐น๐ ๐๐ถ๐๐ต ๐๐ต๐ฒ ๐ฑ๐ฒ๐ด๐ฟ๐ฒ๐ฒ ๐ผ๐ณ ๐ณ๐น๐ฎ๐๐๐ฒ๐ป๐ถ๐ป๐ด ๐ฎ๐ ๐บ๐ฎ๐๐ฐ๐ต๐ฒ๐ฑ ๐ฝ๐ฎ๐ฟ๐ฎ๐บ๐ฒ๐๐ฒ๐ฟ๐ ๐ฎ๐ป๐ฑ ๐ฐ๐ผ๐บ๐ฝ๐๐๐ฒ. The fully flattened Foil ends 0.012 nat below the baseline, with downstream accuracy on par or better.
โ Untying attention becomes increasingly valuable as the model gets flatter. At the fully flattened shape, it lowers loss by 0.049 nat and improves mean accuracy on three representative downstream tasks by 3.3 points over tied attention at the same shape, with no additional compute.
โ More experts per layer make additional loops more useful; and more loops make additional experts more useful. The two amplify each other.
โ Load balance alone is not enough; it should be read together with routing confidence. In our experiments, routing confidence moves with looping gain, and its per-pass peak may signal diminishing returns from further looping or flattening.
Get this paper in your agent:
hf papers read 2609.35751 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 1
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper