When chain-of-thought needs a back button
Official implementation that replaces linear chain-of-thought with branching tree search for harder LLM reasoning tasks.

What it does Tree of Thoughts (ToT) frames LLM reasoning as a tree search over intermediate steps. The repo provides the official NeurIPS 2023 implementation, including prompts, model outputs, and experiment logs for tasks like Game of 24, creative writing, and crosswords. It explores candidate reasoning paths using BFS or DFS, backtracking from dead ends instead of locking into a single unbroken sequence.
The interesting bit The framework makes the LLM act as both generator and evaluator of its own partial thoughts, using either independent value scoring or majority voting to decide which branches survive. It is essentially a classical search algorithm that uses an LLM to score and expand nodes.
Key highlights
- Includes complete paper trajectories and acknowledges reproducibility variance: a reproduced Game of 24 run scored 69% versus the original 74% due to GPT decoding randomness.
- Supports two search strategies (BFS and DFS) and two evaluation modes (
valuefor per-state scoring,votefor collective ranking). - Extensible to new tasks by adding a class in
tot/tasks/and prompts intot/prompts/. - Bundles naive baselines (standard sampling and chain-of-thought) alongside the full ToT algorithm for comparison.
Caveats
- Documentation centers on OpenAI’s API and GPT-4; other backends are not mentioned.
- The authors explicitly warn that output is non-deterministic and can still be wrong.
- Exact paper reproduction is sensitive to sampling variance, as shown by the diverging Game of 24 scores.
Verdict Worth a look if you are experimenting with structured reasoning or reproducing prompting research. Look elsewhere if you need a model-agnostic, battle-tested reasoning framework—this is academic code scoped to OpenAI-driven experiments.
Frequently asked
- What is princeton-nlp/tree-of-thought-llm?
- Official implementation that replaces linear chain-of-thought with branching tree search for harder LLM reasoning tasks.
- Is tree-of-thought-llm open source?
- Yes — princeton-nlp/tree-of-thought-llm is open source, released under the MIT license.
- What language is tree-of-thought-llm written in?
- princeton-nlp/tree-of-thought-llm is primarily written in Python.
- How popular is tree-of-thought-llm?
- princeton-nlp/tree-of-thought-llm has 6k stars on GitHub.
- Where can I find tree-of-thought-llm?
- princeton-nlp/tree-of-thought-llm is on GitHub at https://github.com/princeton-nlp/tree-of-thought-llm.