Lesson 06.04 · Phase 06 · Planning & Reasoning
Tree of Thoughts search
Don't commit to the first idea. Propose several next steps, score how promising each one is, and search: keep the best few, or go deep and back up when a path dies. Every score you ask for is a model call, so the search strategy is also your budget.
Learning objectives
- Frame a problem as search over "thoughts": states, a proposer of next steps, an evaluator of states, and a goal test.
- Implement greedy search, beam search and depth-first search with pruning and backtracking.
- Count evaluator calls as the cost, and compare success against cost across strategies.
- Explain why a weak evaluator makes greedy search fail and backtracking succeed, and when this kind of search is worth its price.
Some problems can't be solved left to right. In the Game of 24 (combine 4, 9, 10 and 13 with + − × ÷ to make 24), the first step that looks good often leads nowhere, and you only find out two steps later. A model generating an answer token by token is doing greedy search: it commits to each step and can't take it back.
Loading the full lesson…