|
|
Tree of Thought Prompting
Author: Venkata Sudhakar
Tree of Thought (ToT) prompting extends Chain of Thought by asking the model to explore multiple reasoning paths simultaneously before committing to a final answer. Instead of following a single linear reasoning chain, the model generates several candidate "thoughts" at each step, evaluates them, and continues down the most promising branches. This dramatically improves performance on complex planning and decision-making tasks. ToT is especially valuable for strategic business decisions - such as inventory planning, pricing strategy, or launch sequencing - where a single chain of reasoning may miss important alternatives. You can implement ToT with a single LLM by explicitly instructing it to generate multiple options at each step and evaluate them before proceeding. The below example uses the Gemini API to apply Tree of Thought prompting for a ShopMax India inventory decision problem, exploring three different restocking strategies before recommending the best one.
It gives the following output,
Step 1 - Restocking Strategies:
Strategy A: Allocate equally - Rs 166667 per category
Strategy B: Focus on high-margin smartphones (Rs 300000),
remainder split between laptops and headphones
Strategy C: Prioritise by velocity - allocate based on
historical Diwali sales ratios (50% smartphones,
30% laptops, 20% headphones)
Step 2 - Evaluation:
Strategy A: Low risk but ignores demand patterns
Strategy B: Higher margin but risks laptop stockout
Strategy C: Data-driven, aligns with customer demand
Step 3 - Best Strategy: C
Reason: Matches historical demand, maximises revenue
Step 4 - Action Plan:
Order smartphones: Rs 250000 (500 units)
Order laptops: Rs 150000 (30 units)
Order headphones: Rs 100000 (200 units)
Place orders today for delivery by Day 7.
Tree of Thought forces the model to consider alternatives it would skip in a standard prompt. The structured format - generate, evaluate, select - is key to getting useful multi-path reasoning. Use this pattern for any ShopMax decision that has multiple viable options and where choosing the wrong path has significant business cost.
|
|