思维之树:利用大型语言模型进行有意识的问题解决
Tree of Thoughts: Deliberate Problem Solving with Large Language Models
May 17, 2023
作者: Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Thomas L. Griffiths, Yuan Cao, Karthik Narasimhan
cs.AI
摘要
语言模型越来越多地被部署用于解决各种问题,但在推理过程中仍然局限于基于标记的、从左到右的决策过程。这意味着它们在需要探索、战略前瞻或初始决策起关键作用的任务中可能表现不佳。为了克服这些挑战,我们引入了一种新的语言模型推理框架,即“思维树”(Tree of Thoughts,ToT),它泛化了流行的“思维链”方法,促使语言模型在解决问题时可以对文本单元(思维)进行探索,这些思维作为中间步骤。ToT允许语言模型通过考虑多条不同的推理路径和自我评估选择来进行有意识的决策,以决定下一步的行动,同时在必要时进行前瞻或回溯,以做出全局性选择。我们的实验表明,ToT显著增强了语言模型在需要复杂规划或搜索的三项新任务中的解决问题能力:24点游戏、创意写作和迷你填字游戏。例如,在24点游戏中,虽然只有使用思维链提示的GPT-4解决了4%的任务,但我们的方法成功率达到了74%。所有提示的代码库:https://github.com/ysymyth/tree-of-thought-llm。
English
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/ysymyth/tree-of-thought-llm.