Intuition The one core idea
One reasoning attempt from a language model is like one noisy measurement — it might be wrong by luck. If we take many attempts and let them agree (vote) or search (branch and prune), the truth survives while random mistakes cancel out.
Everything on the parent page is just two ways of doing that: counting votes (self-consistency) or exploring a tree (tree-of-thought).
This page builds every symbol, word, and picture the parent note leans on — starting from a reader who has never seen probability, sampling, or search. Read it top to bottom; each block earns the next.
Before any formula, meet the two nouns the whole topic revolves around.
Definition Prompt, reasoning, answer
Prompt = the question you type to the model (e.g. "What is 17 × 4? Think step by step").
Reasoning (also "chain" or "thought path") = the step-by-step working the model writes out.
Answer = the single final result at the end of that working (e.g. "68").
The picture: a question flows into a path of steps , which ends in one boxed answer .
We now name these with letters, because the parent page does.
a and r
a = the answer (a single value, like "68" or "24").
r = the reasoning path (the full chain of steps that produced a ).
"prompt" = the fixed question we condition on.
Picture: in the figure above, r is the whole orange path; a is only the green box at the end.
Intuition Why the topic needs two separate letters
Many different r can lead to the same a . Three friends can solve 17×4 by three different methods and all write "68". The topic's central trick — voting — only makes sense once we separate the path (r , which we don't care about) from the answer (a , which we do).
We call r a nuisance variable : something we must acknowledge exists but want to get rid of. The tool that removes it is the next block.
The parent writes p ( a ∣ prompt ) and a big ∑ r . Two new symbols — let's earn both.
p ( X ) — probability
p ( X ) is a number between 0 and 1 measuring how likely event X is. 0 = never, 1 = certain, 0.5 = fifty-fifty.
Picture: a bar whose height is the chance. A tall bar = very likely.
p ( A ∣ B ) — conditional probability
The vertical bar ∣ reads "given ". p ( A ∣ B ) = "probability of A , given that B already happened."
So p ( a ∣ prompt ) = "chance of answer a , given this particular question."
∑ — the summation sign
r ∑ f ( r ) means "add up f ( r ) over every possible r ." The big Greek S ("sigma") is just a compact way to write f ( r 1 ) + f ( r 2 ) + f ( r 3 ) + …
Picture: stacking many bars into one total-height bar.
Intuition Why the topic sums over
r
To find how likely the answer a is no matter which path was taken , you add up the chance of every path that ends in a . That is exactly:
p ( a ∣ prompt ) = ∑ r p ( a , r ∣ prompt ) .
The joint p ( a , r ) means "a and r both happen." Summing it over all r erases the nuisance r and leaves only p ( a ) . This move is called marginalization (see Monte Carlo Estimation for the estimation counterpart below).
The multiplication rule p ( a , r ) = p ( a ∣ r ) p ( r ) (read: "chance of the path, times chance the path gives that answer") is what turns the sum into the parent's form ∑ r p ( a ∣ r ) p ( r ∣ prompt ) .
To sample means to draw a random outcome according to its probabilities — like rolling weighted dice. Sampling r ∼ p ( r ∣ prompt ) means "let the model randomly produce one reasoning path, with more-likely paths appearing more often."
Temperature is a knob (a number ≥ 0 ) controlling how random the model's word choices are.
Temperature = 0 → always picks the single most-likely next word → identical output every time (no randomness).
Temperature > 0 → injects randomness → different path each run .
Picture: a probability bar chart that is sharp (one tall spike) at temp 0 and flattened (spread out) at high temp.
Intuition Why the topic needs temperature
> 0
Self-consistency wants many different reasoning paths so it has something to vote across. At temperature 0 all N runs are twins — the vote is meaningless. This is the exact reason the parent page insists on temperature ≈ 0.5 –0.7 . Full detail in Temperature and Sampling in LLMs .
The parent uses 1 [ a ( i ) = a ] . Two pieces: the superscript and the box.
a ( i ) — the i -th sample's answer
The superscript ( i ) is just a label / index : a ( 1 ) is the answer from the 1st chain, a ( 2 ) from the 2nd, and so on up to a ( N ) . N = total number of chains we ran.
1 [ condition ] — the indicator function
A tiny switch: it equals 1 if the condition inside is true , and 0 if false .
So 1 [ a ( i ) = a ] = "1 if chain i 's answer equals a , else 0."
Picture: a light bulb — ON (1) when the answers match, OFF (0) when they don't.
Intuition Why this is exactly "counting votes"
Adding these switches, ∑ i = 1 N 1 [ a ( i ) = a ] , simply counts how many chains voted for answer a . Divide by N and you get the fraction — a Monte-Carlo estimate p ^ ( a ) of the true marginal.
arg max — "the winner"
arg max a f ( a ) returns the a that makes f biggest (not the size of f , but which a wins).
So a ^ = arg max a ∑ i 1 [ a ( i ) = a ] = "the answer with the most votes" = majority vote . This is the shared logic of Ensemble Methods and Majority Voting .
The parent's "Condorcet" formula uses ( k N ) and p k ( 1 − p ) N − k .
p (single-chain accuracy)
Here p is reused to mean the probability one chain gets the right answer. The topic assumes p > 2 1 (better than a coin flip).
( k N ) — "N choose k"
The number of different ways to pick which k of the N chains are the correct ones. Read "N choose k".
Example: ( 3 5 ) = 10 — there are 10 ways to choose which 3 of 5 chains are right.
Picture: highlighting 3 bulbs out of 5, counted over all arrangements.
⌈( N + 1 ) /2 ⌉
"Majority correct" means more than half the chains agree on the right answer. The ceiling ⌈( N + 1 ) /2 ⌉ is the smallest k that counts as a majority (for N = 5 that's k = 3 ). We add up the chances of every winning split — this is the same "sum the good cases" idea from §2, now for votes. As N → ∞ this total marches toward 1 .
s , generator G ( s ) , evaluator V ( s )
State s = prompt plus the partial reasoning so far (a half-finished path).
Generator G ( s ) = the model proposes k candidate next thoughts from state s .
Evaluator V ( s ) = a score of how promising s looks ("sure / maybe / impossible", or a number).
Picture: a branching tree. Each node is a state s ; each node sprouts k children via G ; each child gets a colored score from V ; low scores get pruned (crossed out).
k , b , d — the tree's shape
k = branching factor : children generated per node.
b = beam width : how many best states we keep at each level.
d = depth : how many reasoning steps deep the tree goes.
These give the parent's cost ≈ d ⋅ b ⋅ k generate + evaluate calls. The keep-the-best-b idea is beam search .
Intuition Why a tree needs these and a chain does not
A single chain (plain Chain-of-Thought Prompting ) has k = 1 , b = 1 : no choice, no scoring, no undo. The moment you let the model branch (k > 1 ), keep some (b ), and abandon dead ends (prune via V ), you have a searchable tree with backtracking — the one power CoT and self-consistency lack.
Probability p and given bar
Indicator and argmax vote
State generator evaluator
Beam width depth branching
Each foundation on the left feeds exactly the part of the parent it unlocks. Trace any arrow back and you can see why that symbol had to be built first.
Cover the right side and answer each aloud — if any stalls, reread that section.
What does the vertical bar in p ( a ∣ prompt ) mean? "given" — the probability of a given the prompt already fixed.
What does ∑ r do to the reasoning path r ? Adds over every path, erasing the nuisance r and leaving the answer marginal p ( a ) (marginalization).
Why must temperature be > 0 for self-consistency? At temperature 0 all chains are identical, so there is nothing to vote across.
What does 1 [ a ( i ) = a ] evaluate to? 1 if chain i 's answer equals a , else 0 — a vote-counting switch.
What does arg max a return? The answer a that gets the most votes (the winner), not the vote count itself.
What does ( k N ) count? The number of ways to choose which k of the N chains are correct.
What is a "state" s in Tree-of-Thought? The prompt plus the partial reasoning built so far.
What do G ( s ) and V ( s ) do? G generates candidate next thoughts; V scores how promising a state is.
What do k , b , d stand for in ToT cost? Branching factor, beam width kept per level, and tree depth.
Which single capability does ToT have that CoT and SC do not? Backtracking — abandoning a dead-end branch and trying another.