Alpha-Beta Pruning
Minimax's answer without reading every leaf — prune branches that provably can't matter. Asked in every exam paper
The Simplest Explanation
Minimax wastes effort on branches that could never influence the final decision. Alpha-beta's insight:
"While backing up values, keep track of the best already-guaranteed options for both sides. If a branch turns out worse than something already guaranteed — stop looking. Cut it off."
Two values travel down the tree:
- α (alpha): the best value MAX is already assured of somewhere else (lower bound). Starts at .
- β (beta): the best value MIN is already assured of (upper bound). Starts at .
The cutoff rule: whenever , stop expanding the current node and return. Nothing below can change the outcome.
Alpha-beta returns the EXACT same root value as minimax — it just skips work that cannot matter. α is "how good MAX's fallback is", β is "how good MIN's fallback is". When they cross (α ≥ β), the current branch is dead.
The Rules (memorize these four lines)
- At a MAX node: update
- At a MIN node: update
- Children inherit the current window
- If at any point : prune remaining children of this node and back up immediately
- If cut off at a MAX node → called a β-cutoff
- If cut off at a MIN node → called an α-cutoff
Interactive Demo
Same idea as minimax — but watch two leaves escape evaluation entirely:
Root A is a MAX node with three MIN children B, C, D. Start with the widest window: α = −∞, β = +∞. Descend left-to-right, depth-first.
What Just Happened
- After B backs up 3, the root knows: whatever else happens, MAX gets ≥ 3 ().
- Inside C, the first child returns 2. C is a MIN node, so C ≤ 2 < 3. MAX would never pick C.
- Therefore C's remaining children (4, 6) are irrelevant — pruned without being read.
Result: minimax value 3, optimal move A→B, only 7 of 9 leaves examined.
Worked Exam-Style Trace (by hand)
Tree: Root MAX with three MIN children; leaves left-to-right: B(3, 12, 8), C(2, 4, 6), D(14, 5, 2).
| Step | Where | Action | α at root | Notes |
|---|---|---|---|---|
| 1 | B | min(3,12,8) = 3 backed up | α = 3 | full min computed |
| 2 | C | first leaf 2 → β_C = 2 ≤ α = 3 | α = 3 | α-cutoff: skip C's other leaves |
| 3 | D | leaves 14, then 5 (>3 keep going), then 2 | α = 3 | 2 ≤ 3 fires but no siblings remain |
Root value: . Leaves evaluated: 7 of 9.
How to Count Cuts in Exams
A cut fires the moment a node's provisional value becomes ≤ α (at MIN nodes) or ≥ β (at MAX nodes), using the inherited window. Count every sibling after the firing child as pruned — even if the firing child was last, some papers still ask "was there a cutoff?" (answer: the condition held).
Inverse Design Problems (2026 trend!)
Recent exams flip the question: "Assign evaluation values to maximize the number of cuts."
Strategy:
- To force an early α-cutoff at a MIN node under window : make its first leaf ≤ α (e.g., very negative)
- To force an early β-cutoff at a MAX node: make its first leaf ≥ β (e.g., very large)
- Left-to-right order matters: cuts only fire on children examined after the window tightened, so put extreme values early in promising subtrees and let later siblings be cut
Effectiveness
| Scenario | Leaves evaluated |
|---|---|
| Worst ordering (best moves last) | — no savings, equals plain minimax |
| Random ordering | |
| Best ordering (best moves first) | ≈ doubles searchable depth! |
With perfect move ordering alpha-beta searches roughly twice as deep as minimax in the same time — why it powers every chess engine.
Inspected vs Pruned — Two Sides of One Trace
Papers flip between asking which leaves were pruned (skipped) and which were inspected (evaluated). They're complements:
| Question phrasing | What to output |
|---|---|
| "List the horizon nodes pruned by Alpha-Beta" | skipped leaves, sorted |
| "First five horizon nodes pruned" | skipped leaves in chronological cut order, not alphabetical! |
| "Leaf nodes inspected by Alpha-Beta" (25T2) | evaluated leaves — everything not pruned |
| "Leaves not affecting the game value" (24T3) | leaves whose value cannot change the root under optimal play — typically deep pruned branches |
The chronological variant matters when several cuts fire: order them by when the cutoff occurred during the left-to-right traversal, then sort alphabetically only within simultaneous cuts.
Cutoff Taxonomy
When a forced eval triggers a stop, name it correctly:
| Where the window closes | Node type | Cut name |
|---|---|---|
| value ≤ α reached | MIN node | α-cutoff |
| value ≥ β reached | MAX node | β-cutoff |
25T3 papers ask this directly: give a leaf eval that induces a cutoff at a named node, then classify it. Recipe: check whether the node is MIN or MAX; that fixes α-cut vs β-cut; solve the inequality for the leaf's smallest/largest feasible value.