模型通过上下文推理解代数题,学会符号推理机制。
In-Context Algebra
- 用动态变量上下文设计新推理任务,突破固定嵌入限制。
- 模型准确率接近完美,且能泛化到未见的代数群。
- 发现三种符号推理机制:交换复制、单位元识别、封闭性消去。
我们研究了当Transformer被训练在序列上解决代数问题时所涌现的机制,其中标记(tokens)是变量,其含义仅通过上下文交互确定。与以往依赖固定参数或几何信息嵌入的工作不同,我们设计了一种新的上下文推理任务,其中标记对具体代数元素的分配在不同序列间变化。尽管设定极具挑战性,模型仍实现了接近完美的准确率,并能泛化至未见过的群结构。我们构建针对性数据分布,进行因果测试,识别出模型始终学习到的三种机制:交换复制(专用头复制答案)、单位元识别(区分含单位元的事实)、基于封闭性的消去(追踪群成员身份以约束有效答案)。结果表明,Transformer所学的推理策略取决于任务结构,当训练其在上下文中对非固定意义的变量进行推理时,模型可发展出符号推理能力。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。