---
title: "Tree of Thoughts (ToT) — 思维树"
source: "https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91"
wiki: "systems-analysis.info/int"
article: "Tree_of_Thoughts_(ToT)_—_思维树"
language: "zh"
categories:
  - "Category:Chinese"
  - "Category:Large language models"
  - "Category:Machine learning"
  - "Category:Prompt engineering"
revision_id: 8291
wiki_created_at: 2026-09-07T01:15:09Z
wiki_modified_at: 2026-09-07T01:15:09Z
downloaded_at: 2026-09-07T23:24:35Z
---

# Tree of Thoughts (ToT) — 思维树

**Tree of Thoughts (ToT)**（**思维树**）是一种创新的框架，用于指导大型语言模型（LLM）的推理过程，使其能够通过系统性地探索多个推理路径来有意识地解决问题。该概念由普林斯顿大学和谷歌 DeepMind 的研究人员于 2023 年提出<sup>[\[1\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-yao2023-1)</sup>。

ToT 是对流行的“思维链”（Chain of Thought, CoT）技术的扩展和泛化。与 CoT 中推理是单一线性步骤序列不同，ToT 将思维过程组织成一棵**树**，其中每个节点都是一个中间状态（“想法”），而分支则是推理可能发展的路径。这使得模型能够并行探索多个选项，评估其前景，在遇到死胡同时返回到先前的步骤（*backtracking*），并做出深思熟虑的选择<sup>[\[1\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-yao2023-1)[\[2\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-ibm_tot-2)</sup>。

## 工作原理

ToT 框架将解决问题的过程组织为状态树搜索。其工作基于四个关键组件的循环交互<sup>[\[1\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-yao2023-1)</sup>：

1.  **将问题分解为“想法”**：将原始问题分解为更小的子任务步骤，称为“想法”。与 CoT 中“想法”只是下一个 token 不同，在 ToT 中，“想法”是一个具有语义意义的单元（例如，数学问题中的一个方程式或文本大纲中的一个段落），它能引导模型更接近解决方案。

<!-- -->

1.  **想法生成**：在每一步，模型为当前状态（树节点）生成几个潜在的后续“想法”（分支）。这通常采用两种策略：

- **采样 (sample)**：模型独立生成多个延续方案。这种方法适用于需要广泛创意的创造性任务。
- **提议 (propose)**：模型顺序生成方案，这对于解决方案空间有限的任务更有效。

1.  **状态评估**：生成的“想法”由 LLM 自行评估，以确定其前景。评估可以是数值性的（例如，0 到 1 的分数）或分类的（“确定”、“可能”、“不可能”）。这是一种启发式函数，引导搜索向有希望的分支发展。

<!-- -->

1.  **搜索算法**：为了系统地探索思想树，使用了经典的搜索算法：

- **广度优先搜索 (BFS)**：在进入下一层级之前，探索同一层级的所有节点。它能保证找到最短路径，但需要更多内存。
- **深度优先搜索 (DFS)**：在回溯并尝试其他分支之前，沿着一个分支探索到底。它内存效率更高，适用于搜索空间深但不宽的任务。

该框架模仿了人类解决问题时的思维过程，将（借助 LLM 的）直觉性想法生成与深思熟虑的、系统的规划和选项枚举相结合<sup>[\[2\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-ibm_tot-2)</sup>。

## 与其他推理方法的比较

### ToT vs. Chain of Thought (CoT) - ToT 与思维链（CoT）的比较

ToT 是 CoT 的直接泛化。如果说 CoT 可以被看作是一棵分支宽度为 1 的树，那么 ToT 则允许探索任意宽度的树。这带来了关键优势<sup>[\[3\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-substack_tot_vs_cot-3)</sup>：

- **探索替代方案**：ToT 可以考虑多种解决方案路径，而 CoT 仅限于单一的线性路径。
- **回溯能力**：如果一个推理分支走入死胡同，ToT 允许模型“返回”，这在 CoT 中是不可能的。
- **全局规划**：ToT 允许基于对多个未来步骤的评估做出战略性选择。

### ToT vs. Self-Consistency - ToT 与自洽性的比较

自洽性（Self-Consistency）会生成多个独立的“思维链”，并通过投票选择最常见的答案。该方法提高了 CoT 的可靠性，但与 CoT 一样，它无法探索问题的分支结构。相比之下，ToT 在复杂的规划任务中可以展现出更显著的改进，因为在这些任务中，不仅独立尝试很重要，它们之间的相互关联也很关键<sup>[\[1\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-yao2023-1)</sup>。

## 实验结果

ToT 的作者在三个需要非平凡规划或搜索的任务上展示了其有效性。

- **24点游戏**：一个数学谜题，要求使用四个给定数字通过基本算术运算得到 24。使用 GPT-4 的标准提示成功率为 **7.3%**，Chain of Thought 为 **4%**。而采用广度优先搜索（b=5）的 ToT 达到了 **74%** 的成功率，比 CoT 提高了 18.5 倍<sup>[\[1\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-yao2023-1)[\[4\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-arxiv_plus_5_1-4)</sup>。
- **创意写作**：在生成由四个段落组成的连贯文本（每段的最后一句已给定）的任务中，使用 ToT 生成的文本获得了平均 **7.56** 的连贯性得分（满分 10 分），而 CoT 的得分为 **6.15**。在 100 次比较中，人类在 41 次中更偏爱 ToT 生成的文本，而 CoT 生成的文本只有 21 次<sup>[\[5\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-openreview_plus_3_1-5)</sup>。
- **迷你填字游戏 (5x5)**：ToT 正确填补了 **60%** 的单词，而 CoT 仅为 **1%**<sup>[\[6\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-arxiv_plus_4_1-6)</sup>。

## 局限性与未来方向

尽管取得了令人瞩目的成果，ToT 框架仍存在一些局限性：

- **计算复杂性**：由于需要生成和评估大量的“想法”，ToT 比标准方法需要多得多的计算资源（token 数量多 5 到 100 倍）<sup>[\[1\]](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_note-yao2023-1)</sup>。
- **实现难度**：实施 ToT 需要大量的工程努力来创建和配置所有组件：想法生成器、状态评估器和搜索算法。
- **对评估质量的依赖**：整个框架的效率在很大程度上取决于 LLM 充分评估中间状态的能力，而这一点并非总能得到保证。

未来的研究方向包括提高效率、自动化优化以及将 ToT 与强化学习等其他方法相结合，以创建更智能、更自主的智能体。

## 外部链接

- <a href="https://github.com/princeton-nlp/tree-of-thought-llm" class="external text" rel="nofollow">Tree of Thoughts 官方 GitHub 仓库</a>
- <a href="https://www.promptingguide.ai/techniques/tot" class="external text" rel="nofollow">Tree of Thoughts (ToT)</a> - Prompt Engineering Guide 上的指南。

## 参考文献

- Yao, S. et al. (2023). *Tree of Thoughts: Deliberate Problem Solving with Large Language Models*. <a href="https://arxiv.org/abs/2305.10601" class="external text" rel="nofollow">arXiv:2305.10601</a>.
- Wei, J. et al. (2022). *Chain-of-Thought Prompting Elicits Reasoning in Large Language Models*. <a href="https://arxiv.org/abs/2201.11903" class="external text" rel="nofollow">arXiv:2201.11903</a>.
- Wang, X. et al. (2022). *Self-Consistency Improves Chain of Thought Reasoning in Language Models*. <a href="https://arxiv.org/abs/2203.11171" class="external text" rel="nofollow">arXiv:2203.11171</a>.
- Kojima, T. et al. (2022). *Large Language Models are Zero-Shot Reasoners*. <a href="https://arxiv.org/abs/2205.11916" class="external text" rel="nofollow">arXiv:2205.11916</a>.
- Zhang, Z. et al. (2022). *Automatic Chain of Thought Prompting in Large Language Models*. <a href="https://arxiv.org/abs/2210.03493" class="external text" rel="nofollow">arXiv:2210.03493</a>.
- Lyu, Q. et al. (2023). *Faithful Chain-of-Thought Reasoning*. <a href="https://arxiv.org/abs/2301.13379" class="external text" rel="nofollow">arXiv:2301.13379</a>.
- Ling, Z. et al. (2023). *Deductive Verification of Chain of Thought Reasoning*. <a href="https://arxiv.org/abs/2306.03872" class="external text" rel="nofollow">arXiv:2306.03872</a>.
- Yao, S. et al. (2022). *ReAct: Synergizing Reasoning and Acting in Language Models*. <a href="https://arxiv.org/abs/2210.03629" class="external text" rel="nofollow">arXiv:2210.03629</a>.
- Besta, M. et al. (2023). *Graph of Thoughts: Solving Elaborate Problems with Large Language Models*. <a href="https://arxiv.org/abs/2308.09687" class="external text" rel="nofollow">arXiv:2308.09687</a>.
- Lightman, H. et al. (2023). *Let’s Verify Step by Step*. <a href="https://arxiv.org/abs/2305.20050" class="external text" rel="nofollow">arXiv:2305.20050</a>.
- Lanham, T. et al. (2023). *Measuring Faithfulness in Chain-of-Thought Reasoning*. <a href="https://arxiv.org/abs/2307.13702" class="external text" rel="nofollow">arXiv:2307.13702</a>.
- Yang, B. et al. (2025). *Hallucination Detection in Large Language Models with Metamorphic Relations*. <a href="https://arxiv.org/abs/2502.15844" class="external text" rel="nofollow">arXiv:2502.15844</a>.

## 注释

1.  <span id="cite_note-yao2023-1">↑ <sup>[1.0](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-yao2023_1-0)</sup> <sup>[1.1](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-yao2023_1-1)</sup> <sup>[1.2](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-yao2023_1-2)</sup> <sup>[1.3](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-yao2023_1-3)</sup> <sup>[1.4](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-yao2023_1-4)</sup> <sup>[1.5](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-yao2023_1-5)</sup> Yao, S., Yu, D., Zhao, J., et al. (2023). «Tree of Thoughts: Deliberate Problem Solving with Large Language Models». *arXiv*. <a href="https://arxiv.org/abs/2305.10601" class="external autonumber" rel="nofollow">[1]</a></span>
2.  <span id="cite_note-ibm_tot-2">↑ <sup>[2.0](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-ibm_tot_2-0)</sup> <sup>[2.1](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-ibm_tot_2-1)</sup> «What is Tree of Thoughts Prompting?». *IBM*. <a href="https://www.ibm.com/think/topics/tree-of-thoughts" class="external autonumber" rel="nofollow">[2]</a></span>
3.  <span id="cite_note-substack_tot_vs_cot-3">[↑](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-substack_tot_vs_cot_3-0) «Tree of Thoughts vs Chain of Thought». *Substack*.</span>
4.  <span id="cite_note-arxiv_plus_5_1-4">[↑](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-arxiv_plus_5_1_4-0) «...18.5 times improvement...». *arXiv*.</span>
5.  <span id="cite_note-openreview_plus_3_1-5">[↑](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-openreview_plus_3_1_5-0) «...41 out of 100 comparisons...». *OpenReview*.</span>
6.  <span id="cite_note-arxiv_plus_4_1-6">[↑](https://systems-analysis.info/int/Tree_of_Thoughts_(ToT)_%E2%80%94_%E6%80%9D%E7%BB%B4%E6%A0%91#cite_ref-arxiv_plus_4_1_6-0) «...CoT: 1% success rate...». *arXiv*.</span>
