FFN架构设计能改变整个模型的计算分布,尤其影响注意力机制。
Sparsity Moves Computation: How FFN Architecture Reshapes Attention in Small Transformers

- 用稀疏专家网络(MoE)重构计算路径,让注意力承担更多任务。
- 随机路由效果接近学习路由,说明稀疏性本身驱动计算重分配。
- 适合关注模型内部机制与架构设计影响的研究者。
Transformer中前馈网络(FFN)的架构选择不仅影响自身,还会重塑模型其他部分所学的计算方式。我们在单层Transformer上研究了数字加法带进位、模运算和直方图统计任务。对比密集型FFN、门控线性单元(GLU)、专家混合(MoE)及MoE-GLU,发现稀疏的MoE路由可将计算从FFN转移到注意力模块,其中带进位加法任务的效应最明显。我们将其分解为每标记的FFN容量降低与专家间的稀疏划分。关键发现是:冻结的随机路由几乎与学习路由效果相当,表明计算重分配主要由架构稀疏性驱动,而非路由器学习到的专门化。其次,GLU式的乘法门控会将任务相关的傅里叶结构从单神经元基底移出,转入分布式子空间,虽削弱了神经元可解释性,但保留了结构化计算。通过随机路由、窄FFN、Top-2 MoE控制实验,以及参数匹配、激活函数和宽度缩放分析,验证了结论。这些结果表明,局部的FFN设计选择会对整个Transformer的计算产生非局部影响。
原文摘要 · Abstract (English)
Architectural choices inside the Transformer feedforward network (FFN) block do not merely affect the block itself; they reshape the computations learned by the rest of the model. We study this effect in one-layer Transformers trained on digit addition with carry, modular arithmetic, and histogram counting. Comparing dense FFNs, gated linear units (GLUs), mixture-of-experts (MoE), and MoE-GLUs, we find that sparse MoE routing can shift computation from FFN to attention, with the strongest ablation-visible effect on carry-based addition. We decompose this redistribution into reduced per-token FFN capacity and sparse partitioning across experts. Critically, frozen random routing nearly matches learned routing, suggesting that redistribution is driven largely by architectural sparsity rather than router-learned specialization. As a secondary finding, GLU-style multiplicative gating rotates task-relevant Fourier structure out of the per-neuron basis and into distributed subspaces, making neuron-level interpretability less informative while preserving structured computation. We validate these conclusions with random-routing, narrow-FFN, and top-2 MoE controls, plus parameter-matching, activation-function, and width-scaling analyses. Together, these results show that local FFN design choices can have nonlocal consequences for Transformer computation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。