Tree of Thoughts: Deliberate Problem Solving with Large Language Models

Shunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran, Thomas L. Griffiths +2 more
5/17/2023
cs.CLcs.AIcs.LG

Official code: princeton-nlp/tree-of-thought-llm (6,044 stars, MIT, last commit 2025-01-16). 1 more implementation below.

Abstract

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.

View on arXivView PDF

Code Implementations(2)

MIT

[NeurIPS 2023] Tree of Thoughts: Deliberate Problem Solving with Large Language Models

6,044624Shell, PythonMay 17, 20231 years agoMIT
large-language-modelsllmpromptingtree-of-thoughtstree-search

Implementing Tree of thought with Self-Consistency and Automatically refine prompts via iterative feedback (OPRO). Papers implementing https://arxiv.org/pdf/2203.11171 , https://arxiv.org/pdf/2305.10601 , https://arxiv.org/pdf/2309.03409

00PythonJun 24, 20251 years ago

Similar Papers

Cite this paper

@article{yao2023tree,
  title  = {Tree of Thoughts: Deliberate Problem Solving with Large Language Models},
  author = {Shunyu Yao and Dian Yu and Jeffrey Zhao and Izhak Shafran and Thomas L. Griffiths and Yuan Cao and Karthik Narasimhan},
  year   = {2023},
  eprint = {2305.10601},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.10601v2},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.10601.svg)](https://codeofpaper.com/paper/2305.10601)

Discussion