截断与否?截断反向传播的循环Transformer的缩放研究
研究论文 · 2026/10/28
循环Transformer通过重用共享层块来增加计算深度而不增加可训练参数,通常使用时间反向传播(BPTT)训练。为节省计算,BPTT常被截断到最后几次循环,但截断会产生有偏梯度,可能削弱循环的益处。本研究系统探究了截断在循环Transformer训练中的价值:联合变化模型大小、训练token数以及前向和反向循环次数,进行了近600次训练运行,并拟合了一个统一缩放定律,通过有效参数捕捉循环和截断的影响。尽管截断节省训练计算,但拟合定律表明,当前向和反向循环次数联合优化时,全BPTT更优。在匹配计算量的运行中,通过较少循环的全BPTT始终优于相同计算量的截断设置。该定律进一步表明,在固定模型大小时,计算最优的循环次数和训练token预算均随计算量增长。当模型大小也可变时,定律确定两个完全训练的循环为最佳循环设置。实验上,该设置比计算最优的非循环模型验证损失更低,非嵌入参数减少约27%,训练计算仅增加8%。
该研究通过大规模实验和缩放定律分析,挑战了循环Transformer训练中常用的截断BPTT做法,表明全BPTT在计算最优配置下更有效,并给出了具体的循环次数和参数效率优势,对高效训练循环Transformer具有重要指导意义。
Looped transformers reuse a shared block of layers to increase computational depth without increasing the number of trainable parameters. They are trained with backpropagation through time (BPTT). To save training compute, BPTT is often truncated to the last few loops, but truncation yields biased gradients that may weaken the benefit of looping. In this work, we study the value of truncation in looped transformer training in a systematic way: we jointly vary model size, training tokens, and forward and backward loop counts across nearly 600 training runs and fit a unified scaling law that captures the effects of looping and truncation through effective parameters. Despite the training-compute savings of truncation, our fitted law favors full BPTT when forward and backward loop counts are jointly optimized. In matched-compute runs, full BPTT through fewer loops consistently outperforms truncated settings of the same compute. The law further shows that at fixed model size, the compute-optimal loop count and training-token budget both grow with compute. When model size is also free, the law identifies two fully trained loops as the best looped setting. Experimentally, this setting achieves lower validation loss than the compute-optimal non-looped model with about 27% fewer non-embedding parameters and only 8% more training compute.