如何循环MoE:展平专家,解开注意力
研究论文 · 2026/10/06
循环Transformer通过多次复用同一层块,以额外计算推动固定规模模型,从而更充分地利用参数;而稀疏专家混合(MoE)模型对每个token仅激活众多专家中的少数。循环MoE融合了这两种设计理念,为MoE模型提升专家利用率带来新潜力,但也引出一个问题:如何循环MoE?我们以Foil回答。在专家参数和每token专家计算量固定的前提下,Foil(1)展平专家,将专家层数减半,每层专家数加倍,并加倍传递次数,使每次路由决策从更大池中选择;(2)解绑注意力,为每次传递赋予独立的注意力参数,而专家和路由器保持共享。实验表明,Foil明显优于未展平的循环基线:在20B token时,每个Foil模型的预训练损失都低于基线;在100B token时,损失随展平程度单调改善,最展平的Foil在等参数和等计算量下最终比基线低0.012 nat,下游准确率相当或更好;在相同形状下,解绑注意力还带来更平衡、更自信的路由。我们的消融分析了Foil有效的原因,并将发现转化为循环MoE的设计指导:循环与加宽专家层的收益相互放大,路由置信度比负载均衡更能反映健康的专家使用,因此稀疏循环MoE应每层使用更多专家和更多传递次数。代码和配置见https://github.com/SR-A-W/how-to-loop-moe。
该研究解决了循环MoE的关键设计问题,提出的Foil方法在等参数和等计算量下显著提升性能,并为循环MoE设计提供了实用指导,具有较高的理论和应用价值。
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.