Imagine you’re solving a math problem. You don’t spit out the answer right away—you go step by step: determine what’s known, what needs to be found, do intermediate calculations. This approach is called Chain of Thought.
And if you explore possible courses of action, branch off, backtrack, and choose the best path—that’s Tree of Thought.
And in tasks where you need not only to reason but also to act (for example, query an API or run a function), ReAct is used: Reason + Act.
These approaches make LLMs more logical, predictable, and effective.
📘 What You’ll Learn
- The essence of Chain of Thought, Tree of Thought, and ReAct
- How these methods improve results
- Where they are applied: use cases, games, technical analysis
- How to write prompts that enable reasoning
🧩 Key Terms
- Chain of Thought — The model reasons step by step out loud before answering
- Tree of Thought — The model explores alternative moves and options
- ReAct — The model alternates between reasoning and actions
- Reasoning — The ability to derive a result logically
- Intermediate steps — Intermediate thoughts, conclusions, or calculations
- Tool Use — The model’s ability to run external commands (e.g., APIs)
🧠 Why It Matters
Plain generation is a quick answer without explanations. Sometimes that’s enough, but in more complex tasks this approach leads to errors and misunderstandings. Let’s unpack why step-by-step reasoning matters and how it helps.
❌ The “Black Box” Problem
When you get just an answer without intermediate steps, you don’t know:
- How reliable it is
- How it was reached
- What to clarify if it’s wrong
📎 Analogy: Imagine you gave an intern a task: “Prepare a reply to the client.” They silently bring back an email. There’s an answer—but how did they arrive at it? Are the arguments sound? It remains a mystery.
🪜 Thinking “Out Loud” = Control
Approaches like Chain of Thought and Tree of Thought let the model “think step by step”—that is, articulate the solution path, verify intermediate results, and draw conclusions based on logic rather than guesswork.
📎 Analogy: It’s like the intern starts explaining: “I compared our prices to competitors, checked logistics costs, then added inflation—so that’s how I got this.” Now you can intervene at any step: clarify, correct, teach.
🔄 Feedback and Debugging
When an LLM articulates its steps, you can easily see where it went wrong. This is especially important:
- for debugging,
- in technical and legal tasks,
- when building pipelines in products.
📎 Analogy: If the answer is wrong but the reasoning is detailed—you can find exactly where the process “went off the rails,” instead of guessing what went wrong.
🧩 More Than Just an Answer
Chain of Thought isn’t about being “slower,” it’s about being more deliberate. This approach brings LLMs closer to explainable AI: the model doesn’t just output an answer; it leads a dialogue—first thinks, then proposes a solution.
📎 This makes it not just an assistant, but a full-fledged partner in reasoning—especially when a task is complex, ambiguous, or sensitive to context.
🔗 Chain of Thought: Think Before You Answer
Large language models can not only give quick answers, but also reason step by step, as humans do. The Chain of Thought approach allows the model to verbalize the solution process—making answers more reliable, more explainable, and easier to verify.
🧠 What It Means
Plain generation answers immediately: “450.” Chain of Thought asks: “Think step by step before giving the answer.”
The model literally verbalizes the reasoning—calculations, logical transitions, intermediate steps. This not only improves accuracy, but also makes the entire process “transparent” to a human.
📌 Example
Problem: How many minutes are in 7 hours and 30 minutes?
-
Answer without Chain of Thought: → 450 (but where did that number come from?)
-
Answer with Chain of Thought:
7 hours = 7 × 60 = 420 minutes 30 minutes = 30 Total: 420 + 30 = 450 minutes
Now it’s clear where the numbers came from and how the model reached the result.
📎 Analogy
It’s like solving a math problem at school. If you just write the answer—the teacher will ask: how did you get it? But if you write out each step—even if there’s a mistake, it’s clear where it happened, and it’s easier to discuss.
🧪 When to Use Chain of Thought
Chain of Thought is especially useful:
- 📏 In calculation tasks: financial models, percentages, units of measure
- 🧩 In logical and analytical cases: condition checking, decision-making
- 📋 In instructions and step-by-step actions: planning, algorithms, how-tos
💡 Why It Works
A model may err not because it “doesn’t know,” but because it rushed. Chain of Thought adds a reasoning phase, reducing random, illogical, or uninterpretable answers.
📎 Essentially, you instruct it: “Think first—then speak.”
🌳 Tree of Thought: Explore Options and Choose the Best
When a task doesn’t have a single correct answer, it’s better to explore possible strategies and choose the most justified one rather than guess. The Tree of Thought approach does exactly that: instead of one linear chain of reasoning, the model generates multiple solution branches, compares them, and makes a deliberate choice.
🧠 What It Means
Instead of immediately saying what to do, the model offers several possible courses of action. Each path is one “branch” of the tree. It then evaluates pros and cons of each, and picks the best.
📌 Example
Task: Which strategy to choose in a game?
Model’s answer with Tree of Thought:
- 🗡️ Attack immediately → quick advantage, but high risk of defeat
- ⏳ Wait and gather resources → safe, but you lose initiative and map control
- 🧠 Feint (fake attack) → requires coordination, but creates surprise
➡️ Conclusion: The third strategy provides the best balance of risk and reward.
📎 Analogy
Tree of Thought works like a brainstorm:
- First you jot down different options.
- Then you discuss and compare by criteria.
- Finally—you choose the one that fits best.
It’s also like branching in chess: you think 2–3 moves ahead, considering the opponent’s possible responses.
🧪 When to Use Tree of Thought
Tree of Thought is especially useful when:
- 🎯 There are multiple solutions, and you must pick the best
- 💡 You need creativity filtered by realism
- 📊 Argumentation matters, not just generation
Example tasks:
- 🛠 Product decisions — feature selection, prioritization
- 🎮 Game strategy — bot or player behavior
- 💬 Idea generation — marketing creativity, scenarios
- 🧭 Launch strategies — when there are many variables and risks
💡 How to Improve the Prompt
Add a clarification like:
“Propose 3 different paths and justify which one fits best.”
You can also ask for a metric or criterion used for the choice—then the reasoning will be even more structured.
🤖 ReAct: Reason + Act
When an answer alone isn’t enough—you need an assistant who thinks first, then acts. That’s exactly how ReAct works: the model analyzes the task, chooses an action, executes it, and then reasons again. It’s a powerful way to make LLMs more accurate and meaningful, especially when linked to external data sources and tools.
🧠 What Is ReAct
Instead of a single generation wave, ReAct builds a chain of thought + actions. The model:
- formulates what needs to be learned or done (Reason),
- performs an action (Act) — makes an API call, queries a database, invokes a function,
- analyzes the result,
- continues reasoning based on what it got.
📎 Analogy: It’s like an assistant who doesn’t “improvise” an answer but goes, checks, and comes back with results. They might say: “I need to clarify,” open the right site, collect data, think, and only then present a conclusion.
💡 A Simple Example
Suppose you ask the model:
What’s the weather in London right now?
Without ReAct: the model “makes up” a temperature.
With ReAct:
- Reason: I need current weather data for London.
- Act:
weather_api("London") → { "temp": 18 } - Reason: Temperature 18°C — that’s cool.
- Answer: It’s cool in London right now, 18°C.
This answer is logical, explainable, and based on external information.
🔧 Where It’s Especially Useful
ReAct is used where you need interactive behavior and fact-checked accuracy:
- 🤖 Smart assistants: from customer support to internal bots.
- 🔎 Search and data analysis: extraction, filtering, summarization.
- 📚 Learning and testing: demonstrating chains of thought + dynamic code execution.
- 🧠 Tasks requiring external knowledge: references, databases, documentation.
📈 Why It’s a Game Changer
Plain prompts are like telling an intern: “Answer the question.” ReAct is like an experienced employee saying: “I’ll check first, then report.”
📎 Analogy: Imagine a doctor who doesn’t immediately diagnose, but first analyzes symptoms, orders tests, reviews results—and only then explains everything to the patient. That makes the process more reliable and clearer.
🛠 Integration and Implementation
To implement ReAct you can use:
- built-in function calling in the ChatGPT API,
- frameworks like LangChain,
- tools for visually designing stepwise prompts (Prompt Engineering UIs),
- connections to external data (databases, APIs, plugins).
🔧 How to Prompt Correctly
| Approach | What to add to the prompt |
|---|---|
| Chain of Thought | “Think step by step…” |
| Tree of Thought | “Propose several options… Explain pros and cons…” |
| ReAct | “First explain, then execute the command…” |
📎 Add clear task framing (instruction clarity) and describe what matters in the output: accuracy, logic, completeness.
🧠 Common Mistakes
-
No request for reasoning
The model gives the final answer immediately, without step-by-step thought. Add “Think step by step.”
-
Prompt too generic
The model doesn’t understand what’s wanted: no structure, format, goal.
-
Mixing strategies
Reasoning, actions, and conclusions all in one prompt—the model gets confused.
-
One big prompt instead of stages
Better to split into steps: first analysis, then action, then conclusion.
-
No examples
Without few-shot examples the model may miss the format and depth of reasoning.
❓ FAQs
-
Can I enable CoT in any prompt?
Yes—just add “think step by step,” or start the prompt with analysis.
-
Can the model “overdo it”?
Sometimes. If the task is simple, the model may reason too long. Limit the number of steps.
-
Does ReAct require hooking up external functions?
For full ReAct—yes, but you can simulate calls (e.g., “imagine you queried…”).
✅ Takeaways
In the end, Chain of Thought, Tree of Thought, and ReAct make working with LLMs more transparent, flexible, and productive. They let you not only get a result, but also understand the logic behind it, evaluate alternatives, and connect external sources of information. This is especially valuable for complex tasks where explainability, accuracy, and debuggability matter. By using these methods, you turn the model from a “black box” into a reliable thinking partner.
👉 Next section — how to use few-shot examples and connect external tools to reasoning-based approaches.