Alpha-beta pruning with a transposition table and iterative deepening
Codemia Knowledge Hub ·
In a strong game-tree search engine these three techniques work as one system, not as separate tricks. Alpha-beta cuts branches that cannot affect the result, the transposition table avoids re-searching positions reached by different move orders, and iterative deepening supplies the move ordering that lets alpha-beta prune much more.
Alpha-beta pruning shrinks the minimax tree
Alpha-beta keeps two bounds during minimax search:
alpha: the best score the maximizing side can already guaranteebeta: the best score the minimizing side can already guarantee
When a branch cannot improve the current result, the search prunes it. A simplified version:
Alpha-beta performance depends heavily on move ordering: the better the ordering, the earlier the cutoffs happen.
Transposition tables reuse work across equivalent positions
Game trees often contain transpositions: different move sequences that reach the same board state. A transposition table stores previously searched positions so the engine can reuse the result instead of searching again.
A useful entry typically stores:
- a hash key for the position
- search depth
- score
- bound type such as exact, lower, or upper
- best move if known
The bound type matters because alpha-beta does not always return an exact minimax value. Sometimes it only proves that the score is at least this high, or at most this low. That is still valuable when reused correctly.
Iterative deepening makes move ordering stronger
Iterative deepening searches depth 1, then depth 2, then depth 3, and so on until time runs out. Re-searching shallow depths looks wasteful, but shallow searches reveal a strong move ordering for the deeper ones:
- depth 1 finds a plausible best move
- depth 2 searches that move first
- better ordering causes more alpha-beta cutoffs
So iterative deepening is not just time management; it directly improves search efficiency.
How the three reinforce each other
- iterative deepening discovers good candidate moves
- those moves are stored in the transposition table
- deeper alpha-beta searches consult the table and search promising moves first
- better ordering produces more pruning
An engine with all three usually performs much better than one with raw alpha-beta alone.
A typical search loop
At a high level, engines often do something like:
Inside search_root, the engine:
- probes the transposition table
- orders moves using the stored best move first
- runs alpha-beta search
- stores the resulting score and best move back into the table
This is an anytime algorithm: if time runs out, the best move from the deepest completed iteration is still available.
Correctness depends on storing depth and bound flags
A common mistake is storing only a raw score per position and ignoring the depth searched. A score from a shallow search is not always safe to reuse in a deeper one, and a bound is not an exact value. That is why real tables store the position key, search depth, score and flag type. Without them, reuse becomes unsound or much less effective.
Related reading
- Altering trained images to train neural network
- Alternatively train multi task learning model in pytorch - weight updating
- Amazon Machine Learning for sentiment analysis
- AML Notebook VM auto shutdown policy
- Am I right about the differences between Floyd-Warshall, Dijkstra''s and Bellman-Ford algorithms?
- Amazon S3 What are considered PUT/COPY/POST/LIST request?
- Alpine Dockerfile advantages of --no-cache vs. rm /var/cache/apk/
- Always pass weak reference of self into block in ARC?
System design interview problems on this topic
- Design an E-commerce Recommendation System: solution and walkthrough
- Design an LLM Inference Service: solution and walkthrough
- Design a GPU Cluster Scheduler for ML Training: solution and walkthrough
- Design ChatGPT: solution and walkthrough

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.