arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2512.16902cs.CLcs.LG
收藏

上下文中的代数

In-Context Algebra

Northeastern University(东北大学);TU Clausthal(图鲁姆大学)

Eric Todd, Jannik Brinkmann, Rohit Gandikota, David Bau

AI总结:

本研究探讨了transformer在上下文代数任务中学习的机制,发现模型能通过动态变量分配实现符号推理。

摘要:

我们研究了当变压器被训练以在序列上解决算术问题时,出现的机制。在这些序列中,标记是变量,其意义仅通过它们在上下文中的相互作用来确定。尽管先前的工作研究了在token嵌入中包含固定参数或几何信息的transformer设置,我们设计了一个新的上下文推理任务,其中标记到特定代数元素的分配会因序列而异。尽管这种具有挑战性的设置,transformers在该任务上实现了接近完美的准确性,甚至能够泛化到未见过的群组。我们开发了有针对性的数据分布,以创建因果测试一组假设机制,我们一致地隔离了三种机制模型:交换复制,其中专门的头部复制答案;身份元素识别,能够区分包含身份的事实;以及基于闭包的抵消,跟踪群组成员身份以约束有效答案。我们的发现表明,transformer所学习的推理策略取决于任务结构,并且当模型被训练在上下文中推理关于其意义不固定的变量时,可以发展出符号推理机制。

英文摘要:

We investigate the mechanisms that arise when transformers are trained to solve arithmetic on sequences where tokens are variables whose meaning is determined only through their interactions in-context. While prior work has studied transformers in settings where the answer relies on fixed parametric or geometric information encoded in token embeddings, we devise a new in-context reasoning task where the assignment of tokens to specific algebraic elements varies from one sequence to another. Despite this challenging setup, transformers achieve near-perfect accuracy on the task and even generalize to unseen groups. We develop targeted data distributions to create causal tests of a set of hypothesized mechanisms, and we isolate three mechanisms models consistently learn: commutative copying where a dedicated head copies answers, identity element recognition that distinguishes identity-containing facts, and closure-based cancellation that tracks group membership to constrain valid answers. Our findings show that the kinds of reasoning strategies learned by transformers are dependent on the task structure and that models can develop symbolic reasoning mechanisms when trained to reason in-context about variables whose meanings are not fixed.

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

↑