# 9. Reasoning strategies

Techniques that make models reason better at inference time. Chain of thought, self-consistency, decomposition, tree and graph of thoughts, Monte Carlo tree search, backtracking, self-refine, Reflexion, debate, mixture of agents, step-back and program of thought.

Source: https://glamorous-boar.cloudvent.net/learn/reasoning-strategies/

---

**Inference-time** (or test-time) **reasoning strategies** spend more computation at question time to get better answers: more tokens, more samples, or a search over possible reasoning paths. They trade cost and latency for accuracy. They are the explicit, controllable cousins of what reasoning models now do internally.

## Linear strategies

### Chain of thought (CoT)
Ask the model to reason step by step before answering (Wei et al., 2022). Intermediate steps give the model room to compute and make errors visible. With reasoning models, much of this happens internally already.

### Self-consistency
Sample several independent chains of thought at a non-zero temperature and take the **majority** answer (Wang et al., 2022). Errors are random; correct reasoning converges. Cost scales with the number of samples. Works best when answers are short and comparable (numbers, labels).

### Decomposition (least-to-most)
Break a hard question into simpler sub-questions, answer them in order, each answer feeding the next, then answer the original (Zhou et al., 2022). Good for multi-hop questions.

### Step-back prompting
First ask for the **underlying principle or concept** (*what physics law applies here?*), then solve the specific question using it (Zheng et al., 2023). Helps on science and principle-based questions.

### Program of thought (PoT / PAL)
Have the model write a **program or expression** and let an interpreter compute the answer (Chen et al., 2022; Gao et al., 2022, PAL). Models are bad at arithmetic and good at writing it down; the interpreter is exact. AgenticMind's version evaluates arithmetic expressions with a safe evaluator; general code goes through the Code Interpreter tool.

## Search strategies

These treat reasoning as **search over a tree of partial solutions**. A *state* is the reasoning so far; *expanding* a state proposes next steps; *evaluating* scores how promising a state is (usually by asking the model).

### Tree of thoughts (ToT)
At each level, propose several next steps (**branching**), score them, keep the best few (**beam width**), continue to a maximum **depth** (Yao et al., 2023). It can recover from a bad first step that a single chain would commit to. Classic use: puzzles and planning.

### Graph of thoughts (GoT)
Generalises the tree to a **graph**: thoughts can be **aggregated** (merge the best parts of several solutions into one node with multiple parents) and **refined** in loops (Besta et al., 2023). Useful when partial solutions can be combined.

### Monte Carlo tree search (MCTS)
The algorithm behind AlphaGo, adapted to reasoning. Repeat for N iterations:

1. **Select** a path down the tree using **UCT** (upper confidence bound for trees; Kocsis and Szepesvári, 2006), which balances **exploitation** (high average value) and **exploration** (rarely visited nodes).
2. **Expand** a leaf by proposing new steps.
3. **Simulate**: estimate the value of the new state (in LLM reasoning, often the model's own value estimate instead of a full rollout).
4. **Back-propagate** the value up the path.

The answer follows the path with the best **mean** value. Strong for problems with many plausible but wrong paths; expensive.

### Backtracking
Depth-first search with a **validity check** at each step: if a step is judged invalid, try the next alternative; at a dead end, back up. Natural for constraint problems.

## Iterative improvement

### Self-refine
Draft → critique (list issues, decide whether it is good enough) → revise, until the critique finds nothing or a round limit is hit (Madaan et al., 2023). No training, no extra model: the same model wears both hats.

### Reflexion
Attempt → self-evaluate (correct? score? feedback) → write a one-line **lesson** → retry with all lessons in context (Shinn et al., 2023). The memory of lessons makes later attempts better. Return the first attempt judged correct, else the best-scored.

## Ensembles

### Multi-agent debate
Several "debaters" answer independently, read each other's answers and revise over rounds; a majority or a judge decides (Du et al., 2023). Using different models increases diversity.

### Mixture of agents (MoA)
Proposers answer in layers, each layer seeing the previous layer's answers; an aggregator synthesises the final answer (Wang et al., 2024).

## Choosing and budgeting

| Strategy | Typical calls | Good for |
|---|---|---|
| Chain of thought | 1 | Default; most tasks |
| Self-consistency (n samples) | n | Short, checkable answers |
| Decomposition | 2–6 | Multi-hop questions |
| Step-back | 2 | Principle-based questions |
| Program of thought | 1–3 | Arithmetic and quantitative questions |
| Self-refine | 2–7 | Writing to a quality bar |
| Reflexion | 3–10 | Tasks with verifiable correctness |
| Tree of thoughts | 10–40 | Puzzles, planning, dead ends |
| Graph of thoughts | 10–40 | Combinable partial solutions |
| MCTS | 20–60+ | Many plausible wrong paths |
| Backtracking | 5–30 | Constraint satisfaction |
| Debate / MoA | agents × rounds | Contested or judgement questions |

Always cap search with a **call budget** and a **token budget**, and answer from the best path found when the budget runs out. With modern reasoning models, simple strategies often match elaborate searches at a fraction of the cost: measure on your own questions.

## Try it in AgenticMind

The **Reasoning** node implements all twelve methods with `max_llm_calls` and `token_budget`, and outputs the answer, the chosen reasoning path and the **whole explored tree** (ids, parents, text, scores, visits). Template *Think it through*. See [Reasoning strategies](/reasoning/).

<Alert variant="tip" title="Key takeaways" text="Reasoning strategies buy accuracy with extra computation at question time. Chain of thought and self-consistency are cheap and strong. Tree of thoughts, graph of thoughts, MCTS and backtracking search over reasoning paths. Self-refine and Reflexion improve answers iteratively. Debate and mixture of agents ensemble several answers. Always budget, and measure against simpler baselines."/>
