MMOOZZGG.com

Glossary

What is tree of thoughts prompting?

In short

Tree of thoughts prompting is a way to solve a problem with a language model in which the model tries several options for each step, scores them and develops the promising ones, going back from dead ends.

Prompts · tree of thoughts

MMOOZZGG.com editorsChecked: 1 min read

For a child

Imagine you are solving a maze on paper. At a fork you follow one path with your pencil, hit a wall and go back. Then you try another one. The paths you draw split like the branches of a tree. Some smart programs solve hard puzzles in a similar way: they try different options and drop the ones that lead to a dead end.

In plain words

Usually a model solves a task in one line: step by step, with no going back. If it makes a mistake at the start, all the later work is wasted. In this method, at each step the model creates several ways to continue, judges for itself which of them look like a path to the solution and develops only those. If a branch hits a dead end, it can return to the fork and try another. This is how puzzles that need planning ahead are solved. It is like a chess player who goes through several moves in their head and drops the ones that lose a piece.

For business

The approach is useful where search and planning are needed: building a shift schedule with many constraints, choosing a delivery route, finding contract terms that suit both sides. One line of reasoning often hits a dead end in such tasks, while searching through options finds a solution. The price is high: the model makes many calls instead of one, so the answer costs more and takes longer. For everyday emails and lookups this is wasted spending. Reasoning models are trained to think at length before they answer, so first check whether they are enough, and only then build your own branching system. Where such a search pays off becomes clear after a review of the company’s processes.

For a specialist

The Tree of Thoughts (ToT) method was described by Yao et al. in 2023 (NeurIPS 2023) as a generalization of chain-of-thought. The intermediate unit is a “thought”: a coherent piece of text that moves the solution forward. The model generates several candidates at each step, evaluates the states itself (self-evaluation) and chooses which branch to develop, with the option to look ahead (lookahead) and to step back (backtracking). The tree is traversed with classic breadth-first (BFS) or depth-first (DFS) search. The authors build on the idea of Newell, Shaw and Simon from the 1950s of problem solving as search in a combinatorial space. In the arithmetic puzzle Game of 24, GPT-4 with chain-of-thought solved 4% of the tasks, and with the tree 74%; the method was also tested on creative writing and mini crosswords. The price of accuracy: one task takes many model calls. A related technique is self-consistency, where paths do not branch but only vote with their final answers.

Example

A logistics company asks a model to build a weekly schedule of trips. The system builds several options for the first days, drops those where a driver goes over the limit of hours, and continues only with the valid ones until it has a full schedule.

Related terms

Questions and answers

How is tree of thoughts different from chain of thought? Chain of thought goes in one line from the question to the answer. Here the model looks at several options at each step, scores them and can go back.
When should you use this method? When the task needs search and planning: schedules, routes, puzzles. For ordinary questions it is too costly and slow.

Sources

Not sure whether your company needs this?

AI solutions map
Contact us