2025-05-09 · 进阶 · 自然语言处理

Chain-of-Thought Tokens are Computer Program Variables

本文实证研究了大型语言模型中思维链 (CoT) 的标记如何像计算机程序变量一样存储中间结果,并验证了其在多位数乘法和动态规划任务中的有效性,同时探讨了CoT的压缩和可变性。

更新于 2025-05-14。作者:Fangwei Zhu、Peiyi Wang、Zhifang Sui。

中文摘要

链式思维 (CoT) 要求大型语言模型 (LLM) 在得出最终答案之前生成中间步骤,已被证明可以有效帮助 LLM 解决复杂的推理任务。然而,CoT 的内部机制仍然很大程度上不清楚。在本文中,我们通过实证研究了 CoT 标记在 LLM 上的两种组合任务中的作用:多位数乘法和动态规划。虽然 CoT 对于解决这些问题至关重要,但我们发现仅保留存储中间结果的标记即可实现相当的性能。此外,我们观察到以另一种潜在形式存储中间结果不会影响模型性能。我们还随机干预了 CoT 中的一些值,并注意到随后的 CoT 标记和最终答案会相应地发生变化。这些发现表明,CoT 标记可能像计算机程序中的变量一样发挥作用,但同时也存在潜在的缺点,例如意外的捷径和标记之间的计算复杂性限制。代码和数据可在 https://github.com/solitaryzero/CoTs_are_Variables 获取。

英文摘要

Chain-of-thoughts (CoT) requires large language models (LLMs) to generate intermediate steps before reaching the final answer, and has been proven effective to help LLMs solve complex reasoning tasks. However, the inner mechanism of CoT still remains largely unclear. In this paper, we empirically study the role of CoT tokens in LLMs on two compositional tasks: multi-digit multiplication and dynamic programming. While CoT is essential for solving these problems, we find that preserving only tokens that store intermediate results would achieve comparable performance. Furthermore, we observe that storing intermediate results in an alternative latent form will not affect model performance. We also randomly intervene some values in CoT, and notice that subsequent CoT tokens and the final answer would change correspondingly. These findings suggest that CoT tokens may function like variables in computer programs but with potential drawbacks like unintended shortcuts and computational complexity limits between tokens. The code and data are available at https://github.com/solitaryzero/CoTs_are_Variables.

解读

一句话总结

本文实证研究了大型语言模型中思维链 (CoT) 的标记如何像计算机程序变量一样存储中间结果,并验证了其在多位数乘法和动态规划任务中的有效性,同时探讨了CoT的压缩和可变性。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt