Reasoning Techniques: Chain of Thought, Self-Consistency, and Tree of Thoughts

~14 min read

The book's 3 named prompting techniques for reasoning — CoT (reason step by step), Self-Consistency (vote across multiple reasoning paths), and Tree of Thoughts (search across branching reasoning paths) — each building on the last.

The previous subtopic's caution about trusting a single reasoning trace sets up exactly why these three techniques, covered directly in this course, exist as a PROGRESSION rather than three unrelated tricks — each one addresses a specific limitation of the one before it.

  1. Chain of Thought (CoT), per this course, is the simplest and most widely used technique. Instead of asking the LLM to jump straight to the answer, we nudge it to reason step by step. This often improves accuracy because the model can walk through its logic before committing to a final output — exactly the mechanism covered in this topic's first subtopic. This course's own summary: it's a simple example but this tiny nudge can unlock reasoning capabilities that standard zero-shot prompting could miss.

  2. Self-Consistency (a.k.a. Majority Voting over CoT) addresses CoT's reliability gap directly. Per this course: CoT is useful but not always consistent. If you prompt the same question multiple times, you might get different answers depending on the temperature setting. Self-Consistency embraces this variation: you ask the LLM to generate multiple reasoning paths and then select the most common final answer. It's a simple idea: when in doubt, ask the model several times and trust the majority. This technique often leads to more robust results, especially on ambiguous or complex tasks. This course flags an important limitation directly: it doesn't evaluate HOW the reasoning was done — just whether the final answer is consistent across paths (this is exactly the trust concern from the previous subtopic — Self-Consistency checks answer agreement, not derivation quality).

  3. Tree of Thoughts (ToT) addresses a different limitation than Self-Consistency. Per this course: while Self-Consistency varies the final answer, Tree of Thoughts varies the STEPS of reasoning at each point and then picks the best path overall. At every reasoning step, the model explores multiple possible directions. These branches form a tree, and a separate process evaluates which path seems most promising at a particular timestamp. Think of it like a search algorithm over reasoning paths, where we try to find the most logical and coherent trail to the solution. It's more compute-intensive, but in most cases, it significantly outperforms basic CoT — the natural tradeoff, given it explores far more of the reasoning space than generating one (or several complete, independent) linear chains.

This course notes directly that CoT, Self-Consistency, and ToT all improve how the model reasons through a problem, but they still rely on free-form thinking, which breaks down in long, rule-heavy tasks — this is exactly the gap ARQ (Attentive Reasoning Queries) addresses by replacing free-form reasoning with structured, domain-specific queries. ARQ is covered in full depth in this curriculum's own dedicated prompt-reasoning topic rather than repeated here, to avoid duplicating that material — but it's worth knowing it exists as the natural fourth step in this same progression, for tasks where even ToT's structured search still isn't controlled enough.

💻 Code example

# Implementing all 3 book-named techniques, showing how each builds
# on the limitation of the one before it.
from collections import Counter

def chain_of_thought(question: str) -> dict:
    """1) CoT: one linear sequence of reasoning steps before the answer."""
    steps = ["break the problem down", "work through it step by step"]
    return {"steps": steps, "answer": "42"}

def self_consistency(question: str, num_samples: int = 5) -> dict:
    """2) Self-Consistency: run CoT MULTIPLE times (varying via temperature),
    then take a majority vote over just the final answers."""
    simulated_answers = ["42", "42", "41", "42", "43"]   # different runs, some noise
    vote_counts = Counter(simulated_answers)
    majority_answer, votes = vote_counts.most_common(1)[0]
    return {"all_answers": simulated_answers, "majority_answer": majority_answer,
            "confidence": votes / num_samples}

def tree_of_thoughts(question: str, branch_factor: int = 2, depth: int = 2) -> dict:
    """3) ToT: explore MULTIPLE reasoning directions at EACH step (not just
    the final answer), forming a tree; a separate evaluator scores paths."""
    def evaluate_path(path: list[str]) -> float:
        return len("".join(path)) % 10 / 10   # toy stand-in for a real evaluator

    def expand(path: list[str], remaining_depth: int) -> list[list[str]]:
        if remaining_depth == 0:
            return [path]
        all_paths = []
        for branch in range(branch_factor):
            new_path = path + [f"step_{len(path)}_branch_{branch}"]
            all_paths.extend(expand(new_path, remaining_depth - 1))
        return all_paths

    all_paths = expand([], depth)
    best_path = max(all_paths, key=evaluate_path)
    return {"paths_explored": len(all_paths), "best_path": best_path}

print("1) Chain of Thought:", chain_of_thought("a math problem"))
print("2) Self-Consistency:", self_consistency("a math problem"))
print("3) Tree of Thoughts:", tree_of_thoughts("a math problem"))
# Note the escalating compute cost: 1 path -> 5 independent full paths
# -> an exponentially branching tree of partial paths

💬 Deep Dive with AI

Key points

  • Chain of Thought (CoT): nudge the model to reason step by step instead of jumping to the answer — the simplest, most widely used technique
  • Self-Consistency: since CoT isn't always consistent across runs, generate multiple reasoning paths and take a majority vote on the FINAL ANSWER — but it doesn't evaluate the reasoning quality itself
  • Tree of Thoughts (ToT): unlike Self-Consistency (varies the final answer), ToT varies the STEPS at each point, forming a branching tree evaluated by a separate process — more compute-intensive but stronger
  • The three form a progression: CoT (one path) -> Self-Consistency (many independent full paths, vote) -> ToT (one branching, evaluated search tree)
  • All three still rely on free-form thinking, which breaks down on long, rule-heavy tasks — the gap that ARQ (covered in this curriculum's separate prompt-reasoning topic) addresses with structured queries instead