循环内部:深度受限算法任务上权重绑定Transformer的机制研究
Inside the Loop: A Mechanistic Study of Looped Transformers on Permutation Traversal
AI总结:
本研究探究权重绑定循环Transformer在深度受限算法任务中的机制,发现其通过迭代分配解决有向置换遍历任务,性能优于相同有效深度的未绑定Transformer。
摘要:
解决包含多步顺序的算法任务通常需要增加Transformer的深度或思维链长度,这会分别带来不利的参数和推理计算成本。循环Transformer(Looped Transformers)通过在多次迭代中复用一组层块,有望解决该问题,因为它能在不增加参数或token的情况下扩展有效深度。然而,目前仍不清楚每次迭代实际计算的内容,或者该循环是否仅模拟了更深的未绑定堆叠。在此,我们研究有向置换遍历任务,其中模型从起始节点沿H跳移动并报告到达的节点,因此每个中间跳都有已知的真实值。我们发现,解决该任务需要最小有效深度,超过该深度后,权重绑定的程度成为决定因素。例如,一个包含四层块且迭代八次的循环Transformer在所有随机种子下都能解决该任务,而相同有效深度、相同训练的未绑定Transformer则永远无法解决,仅在使用更低学习率或对其中间层进行监督时才能成功。通过对残差流进行探测和干预,我们发现循环模型会逐步推进中间节点,形成适应其迭代预算的阶梯结构,而未绑定模型在更低速率下仅在其最终层中暴露这些节点。综上,我们的结果将循环Transformer重新定义为迭代程序学习者,它们将迭代次数分配给算法的连续步骤,能够解决相同有效深度、相同训练的未绑定模型无法解决的任务。代码可在该https URL获取。
英文摘要:
Solving algorithmic tasks with many sequential steps typically requires scaling up transformer depth or chain-of-thought length, incurring unfavorable parameter and inference-compute costs, respectively. Looped transformers, which reuse one block of layers across many iterations, are poised to address this, since they scale effective depth without adding parameters or tokens. Yet, it remains unclear what each iteration is actually computing, or whether the loop merely simulates a deeper untied stack. Here, we study directed permutation traversal, in which a model follows H hops from a starting node and reports the node it reaches, so every intermediate hop has a known ground truth. We find that a minimum effective depth is necessary to solve the task, beyond which the degree of weight tying becomes the determining factor. For instance, a looped transformer with a four-layer block iterated eight times solves the task in every seed, while an identically trained untied transformer of the same effective depth never does, succeeding only with a lower learning rate or supervision of its intermediate layers. Probing and intervening on the residual stream, we find that the looped model advances through the intermediate nodes gradually, forming a staircase that adapts to its iteration budget, whereas the untied model, at that lower rate, exposes them only in its final layers. Taken together, our results recast looped transformers as iterative program learners, which allocate their iterations to successive steps of the algorithm and solve tasks that identically trained untied models of the same effective depth do not. Code is available at https://github.com/magnus-sesodia/insidetheloop.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。