Transformer借助思维链可证明高效解决奇偶校验问题
Transformers Provably Solve Parity Efficiently with Chain of Thought
AI总结:
本文首次从理论上证明单层Transformer通过思维链训练可高效解决k-奇偶校验问题,并揭示任务分解、逐步推理与自一致性检查在优化过程中自然涌现。
摘要:
本工作首次从理论上分析了如何训练Transformer通过递归生成中间状态来解决复杂问题,这一过程类似于针对思维链(CoT)推理的微调。我们考虑训练一个单层Transformer来解决基本的k-奇偶校验问题,并扩展了Wies等人(2023)关于RNN的研究。我们建立了三个关键结果:(1)任何有限精度、基于梯度的算法,在没有中间监督的情况下,需要大量迭代才能在有限样本上解决奇偶校验问题。(2)相比之下,当将中间奇偶校验结果纳入损失函数时,在教师强制(teacher forcing)的辅助下,即在每个生成步骤提供推理链的真实标签,我们的模型可以在一次梯度更新中学会奇偶校验。(3)即使没有教师强制,即模型必须端到端地生成CoT链,如果使用增强数据来内部验证中间步骤的正确性,奇偶校验也可以被高效地学习。我们的发现得到了数值实验的支持,表明任务分解和逐步推理自然地从使用CoT优化Transformer中产生;此外,自一致性检查可以提升多步推理能力,这与关于CoT的实证研究一致。
英文摘要:
This work provides the first theoretical analysis of training transformers to solve complex problems by recursively generating intermediate states, analogous to fine-tuning for chain-of-thought (CoT) reasoning. We consider training a one-layer transformer to solve the fundamental $k$-parity problem, extending the work on RNNs by Wies et al. (2023). We establish three key results: (1) any finite-precision gradient-based algorithm, without intermediate supervision, requires substantial iterations to solve parity with finite samples. (2) In contrast, when intermediate parities are incorporated into the loss function, our model can learn parity in one gradient update when aided by \emph{teacher forcing}, where ground-truth labels of the reasoning chain are provided at each generation step. (3) Even without teacher forcing, where the model must generate CoT chains end-to-end, parity can be learned efficiently if augmented data is employed to internally verify the soundness of intermediate steps. Our findings, supported by numerical experiments, show that task decomposition and stepwise reasoning naturally arise from optimizing transformers with CoT; moreover, self-consistency checking can improve multi-step reasoning ability, aligning with empirical studies of CoT.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。