arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.31497cs.LGstat.ML
收藏

Assign and Add: 组合算术的机制研究

Assign and Add: A Mechanistic Study of Compositional Arithmetic

Yale University(耶鲁大学);Flatiron Institute(Flatiron研究所)

Brady Exoo, Alberto Bietti, John Sous

AI总结:

通过变量赋值和模加法任务,研究Transformer中组合泛化的机制,发现模型利用同一模加法模块处理直接和间接输入,并揭示了三阶段学习动态。

摘要:

大型语言模型能够组合技能以执行复杂任务,其中许多任务可能在训练期间未曾见过。这种组合发生的具体细节仍然难以捉摸。在本文中,我们通过考虑一个涉及变量赋值和模加法的简单受控设置,研究Transformer中组合泛化的机制。通过将训练数据划分为不相交的集合,我们观察到小型Transformer能够泛化到先前未见过的变量和数字组合。我们的机制分析表明,无论输入是直接给出还是通过单独的变量赋值机制间接给出,都使用相同的“模加法”MLP模块。我们还从经验角度分析了训练动态,揭示了三个学习阶段:首先学习模加法,然后学习变量赋值所需的结构,最后是精炼阶段,模型泛化到训练中未见的一些困难序列。最后,我们提供了一个理论框架来解释组合性如何从训练动态中涌现。这些结果表明,组合泛化可以是Transformer内部机制组合性的自然结果。

英文摘要:

Large language models are able to compose skills in order to perform complex tasks, many of which might not have been seen during training. The details of how exactly this composition occurs remain elusive. In this paper, we study a mechanism for compositional generalization in transformers by considering a simple controlled setting involving variable assignment and modular addition. By partitioning our training data into disjoint sets, we observe that small transformers are able to generalize to previously unseen combinations of variables and numbers. Our mechanistic analysis shows that the same ``modular addition'' MLP module is used whether the inputs are given directly or indirectly through a separate variable assignment mechanism. We also analyze the training dynamics from an empirical lens, which reveals three phases of learning: first, modular addition is learned, then the structure required for variable assignment, and finally a refinement phase where the model generalizes to some hard sequences not seen in training. Finally, we provide a theoretical framework to explain how compositionality emerges from training dynamics. These results suggest that compositional generalization can be a natural consequence of the compositionality of internal mechanisms in~transformers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑