arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.25300cs.LGcs.AIcs.CL
收藏

Transformer规划中的弃权时机学习:一项机制研究

Learning When to Abort in Transformer Planning: A Mechanistic Study

Harvard University(哈佛大学);Shenzhen University(深圳大学);Microsoft Research Asia(微软亚洲研究院);University of Southern California(南加州大学)

Shi Feng, Qimin Zhong, Siwei Wang, Yifei Shen, Shang-Hua Teng, Hao Liao, Wei Chen

AI总结:

本文研究Transformer规划中的错误识别机制,训练模型检测无效转移并生成弃权标记,结合重试提升模型在图、倒计时和迷宫任务上的规划可靠性。

摘要:

规划本身并不意味着识别错误的能力,但识别错误可以提升规划能力。本文研究Transformer规划中的这一现象。为分析内在机制,我们遵循Wang等人(2024)的方法,将规划抽象为图中的路径查找。在此设置下,我们训练模型检测无效转移的错误,即当模型生成与当前节点不相邻的下一个节点后,应生成特殊的弃权(不执行)标记x。为保证表达能力,我们为任意固定节点集为V的图构造前馈宽度为O(|V|)的Transformer,它可检测所有可能的无效转移,且当前缀有效时选择有效的下一个节点。我们随后提出前馈宽度的最坏情况下界,使检测器的线性宽度在对数因子内接近最优。在训练后的模型中,我们证明无效转移检测会增加对前序节点的注意力,且大部分有效-无效分离位于前馈网络的输出中,这与我们的理论见解一致。最后,我们利用该错误检测提升模型性能:推理时,生成弃权(不执行)标记x会直接触发外部过程放弃尝试并从原始提示重新开始。实验表明,错误检测结合重试可提升模型在图、倒计时和迷宫任务上的规划可靠性。

英文摘要:

Planning does not by itself imply the ability to recognise errors, but recognising errors can improve planning capacity. In this paper, we study this phenomenon in Transformer planning. To analyze the inner mechanism, we follow the approach of Wang et al. (2024) and abstract planning as path-finding in graphs. In this setting, we train the model to detect the error of invalid transitions, i.e., after the model generates a next node that is not adjacent with the current node, the model should then generate a special abort token x. For expressiveness, we construct a Transformer with feed-forward width $O(|V|)$ for any fixed graph with node set $V$. It can detect all possible invalid transitions, and select a valid next node if the prefix is valid. We then propose a worst-case lower bound on feed-forward width, which makes the detector's linear width near-optimal up to logarithmic factors. In trained models, we demonstrate that invalid-transition detection increases previous-node attention, and most of the valid--invalid separation locates in the feed-forward network's output. This accords with our theoretical insights. Finally, we use this error detection to improve the model's performance: at inference, generating the abort token x will directly cause an external procedure to discard the attempt and restart from the original prompt. Experiments show that error detection combined with retry improves model's planning reliability on graphs, Countdown, and mazes.

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

↑