Language models are increasingly being deployed for general problem solving across a wide range of tasks, but are still confined to token-level, left-to-right decision-making processes during inference. This means they can fall short in tasks that require exploration, strategic lookahead, or where initial decisions play a pivotal role. To surmount these challenges, we introduce a new framework for language model inference, Tree of Thoughts (ToT), which generalizes over the popular Chain of Thought approach to prompting language models, and enables exploration over coherent units of text (thoughts) that serve as intermediate steps toward problem solving. ToT allows LMs to perform deliberate decision making by considering multiple different reasoning paths and self-evaluating choices to decide the next course of action, as well as looking ahead or backtracking when necessary to make global choices. Our experiments show that ToT significantly enhances language models' problem-solving abilities on three novel tasks requiring non-trivial planning or search: Game of 24, Creative Writing, and Mini Crosswords. For instance, in Game of 24, while GPT-4 with chain-of-thought prompting only solved 4% of tasks, our method achieved a success rate of 74%. Code repo with all prompts: https://github.com/princeton-nlp/tree-of-thought-llm.
核心贡献 · Key contributions
提出思维树(ToT)框架,一种新的语言模型推理框架,通过探索多条推理路径泛化了思维链。 Proposes Tree of Thoughts (ToT), a new framework for language model inference that generalizes Chain of Thought by exploring multiple reasoning paths.
通过自我评估、前瞻和回溯,在连贯的思维单元上实现审慎决策。 Enables deliberate decision-making via self-evaluation, lookahead, and backtracking over coherent thought units.
在三个挑战性任务上展示了显著改进:24 点游戏(74%对比 4%)、创意写作和小型填字游戏。 Demonstrates significant improvements on three challenging tasks: Game of 24 (74% vs 4%), Creative Writing, and Mini Crosswords.
引入模块化组件:思维分解、生成、评估和搜索算法,可根据问题特性调整。 Introduces modular components: thought decomposition, generation, evaluation, and search algorithms adaptable to problem properties.
表明语言模型自我评估可作为灵活的搜索启发式,替代编程或学习的启发式。 Shows that LM self-evaluation can serve as a flexible heuristic for search, replacing programmed or learned heuristics.
提供统一视角,其中 IO、CoT、CoT-SC 是深度和广度受限的 ToT 特例。 Provides a unified view where IO, CoT, CoT-SC are special cases of ToT with limited depth and breadth.
局限 · Limitations
ToT 比标准采样方法需要更多计算资源(如 API 成本)。 ToT requires more computational resources (e.g., API cost) than standard sampling methods.
对于 GPT-4 已经擅长的任务,审慎搜索可能不必要。 Deliberate search may be unnecessary for tasks where GPT-4 already excels.
状态评估启发式不完美,可能剪枝正确解,如在填字游戏中所示。 State evaluation heuristics are imperfect and can prune correct solutions, as seen in crosswords.
仅探索了三个相对简单的任务;未测试扩展到更复杂的现实任务。 Explored only three relatively simple tasks; scalability to more complex real-world tasks is untested.
若应用于交互环境而无防护措施,可能被用于有害目的。 Potential for harmful uses if applied to interactive environments without safeguards.
论文章节 · Sections(共 12)
摘要Abstract
1 引言1 Introduction
2 背景2 Background
3 思维树:使用语言模型进行深思熟虑的问题求解3 Tree of Thoughts: Deliberate Problem Solving with LM