LLM Prompting Strategy — X of Thought Reasoning
This article explains the Chain of Thoughts (CoT), Tree of Thoughts (ToT) and Graph of Thoughts (GoT) techniques in prompt engineering
Srinivas Jayanthi (JV)
1/20/20255 min read


In prompt engineering there are a few techniques used to guide or structure the reasoning of language models as they generate a response. In this article, I would like to cover the following with simple examples.
Chain of Thoughts (CoT)
Tree of Thoughts (ToT)
Graph of Thoughts (GoT)
Chain Of Thoughts (CoT)
This technique involves breaking down a complex task into a step-by-step reasoning process, where the model is encouraged to “think out loud” and provide intermediate steps that lead to the final solution. This will not only help us understand the model’s reasoning, but also help the model itself to better handle tasks that require multi-step reasoning, such as math problems, logical reasoning, or decision-making processes.
Example
Consider the following prompt.
Betty has 5 apples. She buys 7 more apples. She has 1 apple for breakfast and then gives 3 apples to her friend. How many apples does Betty have now?
Response (Chain of Thought):
Let’s break down the situation step by step and track Betty’s apples:
Initial number of apples: Betty starts with 5 apples.
Total apples at the start: 5.
She buys 7 more apples: Adding 7 to her original 5 apples gives:
5+7=12
Total apples after buying: 12.
She eats 1 apple for breakfast: Subtracting 1 apple from her total:
12−1=11
Total apples after eating: 11.
She gives 3 apples to her friend: Subtracting 3 apples:
11−3=8
Total apples after giving to her friend: 8.
Thus, Betty has 8 apples now.
Tree Of Thoughts (ToT)
This technique expands on CoT by branching out different possible reasoning paths at each step, exploring alternative approaches to solve a problem. Each “branch” represents a possible line of reasoning, and the tree structure allows exploration of multiple solutions.
Example
Consider the following prompt.
I am planning to go out for dinner. I am interested in either Italian or Indian. What would you recommend to me?
Response (Tree of Thoughts)
Here’s a breakdown of the decision-making process (the tree of thought) to help recommend between Italian and Indian cuisine:
Branch 1: Indian Food
Pros:
Flavors and Spices: Indian food offers rich and complex flavors with a wide variety of spices. It’s perfect if you’re in the mood for something bold and flavorful.
Variety: There’s a huge range of dishes like curries, tandoori, biryani, and naan. It also offers great vegetarian and vegan options.
Hearty Meal: Indian food tends to be filling and satisfying, making it ideal if you’re very hungry or craving something substantial.
Health Benefits: Ingredients like turmeric, ginger, and cumin can offer health benefits, including anti-inflammatory properties.
Cons:
Spice Level: If you’re sensitive to spices or not in the mood for spicy food, some Indian dishes might be a bit too much, though you can ask for mild versions.
Heaviness: Indian meals, especially curries, can be rich and heavy, which might leave you feeling very full or bloated if you’re not used to it.
Branch 2: Italian Food
Pros:
Comfort Food: Italian cuisine offers comfort dishes like pizza, pasta, and risotto, which are universally loved. It’s a great choice if you want something familiar and indulgent.
Quick and Light Options: If you’re looking for something lighter, you can choose from salads, grilled vegetables, or simple pasta with olive oil and herbs.
Customizable: Italian dishes are highly customizable, so you can add or remove ingredients to suit your preferences (e.g., extra cheese, gluten-free pasta).
Less Spice: If you’re not in the mood for spicy food, Italian cuisine tends to be more on the mild side, perfect for a calm, relaxing meal.
Cons:
Carb-Heavy: Many Italian dishes are heavy on carbohydrates, which might not be ideal if you’re trying to avoid a carb-rich meal.
Repetitive: If you’ve had Italian food recently or eat it often, it may not feel as exciting compared to the rich variety of Indian food.
Evaluation:
If you’re craving bold, spicy, and flavorful dishes, Indian food is the way to go. It’s a great option for a filling and flavorful meal, especially if you enjoy trying different spice combinations and hearty dishes.
If you want something comforting and lighter, Italian food might suit you better. It offers a wide range of simple yet delicious dishes, from pizza to fresh pasta, and can be tailored to your preferences.
Conclusion:
If you’re in the mood for rich, bold flavors and a filling, hearty meal, I recommend going with Indian. However, if you prefer something familiar, comforting, and potentially lighter, I’d suggest Italian.
Graph Of Thoughts (GoT)
This technique extends ToT by allowing even more complex relationships between reasoning steps, where multiple thoughts or ideas can interconnect and influence each other, forming a network (graph) of reasoning paths. This is useful for complex tasks where different parts of the problem are interrelated as it allows for the exploration of how different ideas or solutions might affect each other.
Example
Consider the following Prompt
I need to get groceries. Should I drive or walk to the store?
Response (Graph Of Thoughts)
Distance to the Store:
Short Distance: If the store is close (e.g., a 10-minute walk), walking might be a good option.
Long Distance: If the store is far, driving might be more practical, especially if you’re carrying groceries.
Weather Conditions:
Good Weather: If it’s sunny and pleasant, walking can be enjoyable and give you some exercise.
Bad Weather: If it’s raining or very hot, driving would be more comfortable.
Amount of Groceries:
Few Items: If you only need a few light items, walking is easier.
Heavy Load: If you’re planning to buy a lot of groceries, driving will help with transportation.
Time Available:
Plenty of Time: If you’re not in a rush, walking can be a relaxing and healthy choice.
Limited Time: If you’re in a hurry, driving is faster and will save time.
Environmental Impact:
Walking: Environmentally friendly — no gas or emissions.
Driving: Increases your carbon footprint, but more convenient for carrying large amounts.
Interconnections (Graph of Thought):
Distance ↔ Amount of Groceries: If the store is close and you’re only buying a few items, walking makes sense. However, if you’re buying a lot, even a short distance might be hard to manage, and driving would help.
Weather ↔ Walking: Good weather encourages walking, but bad weather would push you toward driving, even for short distances.
Time ↔ Driving: If you’re short on time, even a short walk could be impractical, making driving the better option.
Environmental Impact ↔ Driving: Driving has a higher environmental impact, but it may be necessary if you’re carrying heavy groceries or in a hurry.
Time ↔ Amount of Groceries: If you have a lot of groceries to carry and little time, driving is the most efficient choice.
Conclusion
If the store is close, the weather is good, and you’re only buying a few items, walking is a great choice: it’s healthy, environmentally friendly, and enjoyable.
If you’re buying a lot of groceries, it’s far, or you’re in a hurry, driving would be more practical: it’s faster and more convenient for carrying heavier items.
Dataflix
© 2025. All rights reserved.