arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2502.01432cs.CLcs.LG
收藏

使用Transformer建模计数器语言时涌现的栈表示

Emergent Stack Representations in Modeling Counter Languages Using Transformers

Birla Institute of Technology and Science, Pilani(比拉理工学院皮拉尼分校);Saarland University(萨尔大学)

Utkarsh Tiwari, Aviral Gupta, Michael Hahn

AI总结:

本文在4种计数器语言上训练Transformer模型,并用栈等价表示这些语言,通过探测内部表示发现模型作为下一token预测器学习到了类似栈的表示,为理解Transformer学习语言的算法机制和电路发现提供了新见解。

摘要:

Transformer架构是大多数现代语言模型的骨干,但理解这些模型的内部工作机制在很大程度上仍然是一个未解决的问题。过去的研究通过在这些架构上训练它们学习已被充分理解的形式语言类别,来隔离这些架构的学习能力。我们通过分析在计数器语言上训练的模型来扩展这一文献,计数器语言可以使用计数器变量进行建模。我们在4种计数器语言上训练Transformer模型,并等价地使用栈来表述这些语言,栈的深度可以理解为计数器值。然后,我们在每个输入token处探测它们的内部表示以获取栈深度,从而表明这些模型在作为下一个token预测器训练时学习到了类似栈的表示。这使我们更接近于理解Transformer如何学习语言的算法细节,并有助于电路发现。

英文摘要:

Transformer architectures are the backbone of most modern language models, but understanding the inner workings of these models still largely remains an open problem. One way that research in the past has tackled this problem is by isolating the learning capabilities of these architectures by training them over well-understood classes of formal languages. We extend this literature by analyzing models trained over counter languages, which can be modeled using counter variables. We train transformer models on 4 counter languages, and equivalently formulate these languages using stacks, whose depths can be understood as the counter values. We then probe their internal representations for stack depths at each input token to show that these models when trained as next token predictors learn stack-like representations. This brings us closer to understanding the algorithmic details of how transformers learn languages and helps in circuit discovery.

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

↑