Tree-of-Thought prompt builder
For genuinely hard problems, a model’s first answer is often not its best. Tree-of-Thought prompting tells the model to behave like a deliberate problem solver: generate several candidate approaches, score each against explicit criteria, prune the weak ones, expand the strong ones, and only then commit to a final answer. This builder turns your problem and a few parameters into that structured prompt.
How it works
You state the problem and set a branching factor and a depth. The generated prompt instructs the model to produce that many distinct approaches, evaluate each against your criteria with a 1–10 score and justification, prune the weakest, then expand the survivors through repeated cycles to the chosen depth. It closes by following the single best root-to-leaf path and reporting a final answer with a one-line rationale for why that path won.
Tips and notes
- Reserve ToT for branchy problems. Planning, design trade-offs, and puzzles benefit most; straightforward questions do not justify the token cost.
- Keep the tree modest. A branching factor of 3 and depth of 2 already explores nine paths — go wider only when the problem clearly demands it.
- Make criteria concrete. “Feasibility, cost, and maintainability” gives the model sharper grounds for scoring than “quality.”
- Combine with self-consistency for the hardest cases. Run the ToT prompt a few times and compare final paths when the stakes justify it.