Thursday night, Hartwell public library. Dev Raman puts his laptop on the table before anyone has set up a board.
In This Chapter
- 31.1 What Is Actually in the Database
- 31.2 Filters: Every Filter Is an Assumption
- 31.3 Opening Success by Rating Band: Who Plays It Is Part of the Score
- 31.4 Query Positions, Not Names
- 31.5 Sample Weights and Self-Selection
- 31.6 Piece Heat Maps: Where Pieces Stand vs Where They Do Well
- 31.7 Endgame Conversion by Band: The Definition Is the Finding
- 31.8 Time Usage and Results
- 31.9 Replication: How Many of Your Findings Are Real?
- 31.10 Building Your Own Query Tools
- Spaced Review
- Project Checkpoint: database.py
- Chapter Summary
- What's Next
Chapter 31 — Chess Database Analytics: Mining 10 Million Games for Strategic Insights
Thursday night, Hartwell public library. Dev Raman puts his laptop on the table before anyone has set up a board.
Dev: I ran every opening family through ten million games. The Scotch is the best opening in chess. White scores 54.6%. Nothing else in the top twenty-five comes close.
Grace: Ten million?
Dev: Well. Ten million records.
He is half right twice, and the two halves are what this chapter is about.
Start with the count, because a database analyst who cannot say exactly what is in the database has already lost the argument. The book's data snapshot holds 4,000,000 Lichess games (the first four million rated standard games of October 2026), 373,918 over-the-board games relayed through Lichess broadcasts, and 97,833 historical master games from the PGN Mentor collections: 4,471,751 games. Add the 6,193,530 Lichess puzzles and the total reaches 10,665,281 records — so "ten million" is true only if you count puzzle positions, which are not games. Add the 1,959,064 rows of the FIDE rating list and you could claim twelve million of something. The chapter title says ten million games; we mined four and a half million, plus the puzzles, and we will say so every time it matters.
Now the Scotch. Dev's 54.6% is real output: White's score in all 80,403 Scotch Game games in the Lichess sample (bots excluded; bullet, blitz, rapid and classical), with a 95% interval of 54.3–55.0%. It is the highest raw score of the twenty-five most common opening families. But in those games White was, on average, rated 4.5 points higher than Black, so the Elo formula expected them to score 50.4%. Subtract, and the Scotch's rating-adjusted edge is +4.2 points — still the best of the twenty-five, and (as we will see in Section 31.9) among the cells of the opening table that hold up most clearly when you split the data in two and check.
So the Scotch really does score well on Lichess. Why? The database can tell us that too, if we stop asking about names and start asking about positions.

♟️ Position: White Ke1, Qd1, Ra1, Rh1, Bc1, Bf1, Nb1, Nd4, a2, b2, c2, f2, g2, h2, e4; Black Ke8, Qd8, Ra8, Rh8, Bc8, Bf8, Nc6, Ng8, a7, b7, c7, d7, f7, g7, h7 — Black to move. FEN:
r1bqkbnr/pppp1ppp/2n5/8/3NP3/8/PPP2PPP/RNBQKB1R b KQkq - 0 4
In the balanced Lichess games that reached this position, Black's most common move was 4...Nxd4 — 43.0% of the (sample-weighted) replies — and after it White scored 56.9% [54.7–59.2]. After the main alternatives, 4...Bc5 and 4...Nf6, White scored 49.3% and 49.7%. Among the over-the-board games in our broadcast set, 4...Nxd4 was chosen 3.5% of the time; in the masters explorer it is not even among the four most played replies (4...Nf6 9,390 games, 4...Bc5 7,524, 4...Bb4+ 1,176, 4...Qf6 956).
🤖 Engine check: Stockfish 19 rates the position after 4.Nxd4 at +0.08 (depth 20) with 4...Nf6 first. After 4...Nf6 it gives +0.10 (d20) / +0.06 (d24); after 4...Nxd4 5.Qxd4 it gives +0.76 (d20) / +0.62 (d24). The capture swaps Black's only developed piece for a knight that has already moved twice and brings White's queen to d4 with tempo-free centralisation — it cannot be chased by ...c5 without leaving d5 weak, and ...Nc6 is no longer available to hit it. A free half-pawn for White is the engine's way of saying "you developed my queen for me".
That is the whole chapter in miniature. A raw number from a big table (54.6%) became a better number once we asked who played the opening (+4.2 rating-adjusted), and an explanation once we queried positions instead of names: at club level the Scotch scores because its most popular reply is a mistake that strong players avoid. Database analytics is not about how many games you have. It is about the questions, the filters and the checks you put between the data and your conclusion.
📊 Analyst Track: This is your chapter. Read every section; the core skills are the filter cascade (31.2), rating adjustment (31.3), sample weights (31.5), definition sensitivity (31.7) and replication (31.9). The case studies show both a game-level and a population-level audit.
💻 Developer Track: Focus on 31.1, 31.4 and 31.10 and the Project Checkpoint: the streaming prefix index, the transposition-aware position query, and
outpost/database.py. Every script is incode/; outputs are incode/out_*.txt.♟️ Improver Track: Read the hook, 31.3, 31.4 (what the next-move tables say about the openings you play), 31.7 (what "a pawn up in the endgame" really means at your level) and 31.8 (time). Skip the code blocks; the prose carries the argument.
31.1 What Is Actually in the Database
The first question of database analytics is not "what does the data say?" but "what is the data?" Every number later in the chapter inherits the answer.

📊 Figure (described): Horizontal bars for each table in the book's data snapshot. The 4,000,000-game Lichess sample, 373,918 broadcast rows and 97,833 master games add up to 4,471,751 games; the two longest grey bars — 6,193,530 puzzles and 1,959,064 FIDE rating-list players — are records, but not games. Only 864,816 of the Lichess games carry full move text.
| Source | Rows | What it is | What it is not |
|---|---|---|---|
| Lichess sample | 4,000,000 games | Every rated standard game started on Lichess from 1 Oct 2026 00:00 to 2 Oct 10:14 UTC (34.2 hours); Glicko-2 ratings; players are salted hashes | A random sample of a year; a panel that follows players over time; FIDE-rated |
| Lichess move text | 864,816 games | All 416,869 games with server analysis plus a random 1 in 8 of the rest | A random subset — analysed games are over-represented (Section 31.5) |
| Broadcast (OTB) | 373,918 rows; 359,195 human OTB games | Over-the-board games relayed on Lichess, Nov 2025–Oct 2026, FIDE ratings from the headers; 90.3% carry engine evals, 96.5% clocks | Every OTB game played; a sample of club chess (median average FIDE rating 2038) |
| Master games | 97,833 games | PGN Mentor collections of 40 great players, 1749–2026 | A random sample of master chess; speed-tagged (blitz and simuls are mixed in) |
| Puzzles | 6,193,530 | Lichess puzzle database (puzzle ratings) | Games |
| FIDE list | 1,959,064 players | One snapshot of the FIDE rating list (November 2026) | A history of anyone's rating |
Two derived tables sit on top. game_features (1,235,818 rows) replays every game that has move text and stores per-game facts — castling, structures at plies 20/30/40, the first endgame ply and its material, accuracy from stored evals, minimum clocks. positions_sample (199,986 rows) holds one random position per game, stratified by source, rating band and phase. Both were built once, by the toolkit's scripts, so that chapters can ask questions about millions of games in seconds instead of hours.
The pipeline: from PGN text to columns
A chess database starts life as PGN text: tag pairs, then moves, with comments in braces. Lichess's monthly dumps are enormous compressed files of exactly that. You cannot ask a question of a text file quickly, so the toolkit converted everything once into Parquet files — a columnar format that stores each column separately, compressed, in blocks called row groups. Two consequences shape every script in this chapter:
- Read only the columns you need. The Lichess games table is 110 MB on disk, but asking for six columns of it takes a few seconds.
- Stream big text columns. The move text (446 MB compressed) is read one row group at a time (16 groups of roughly 54,000 games), processed and discarded, so memory stays small.
📐 Definition: A database query is three steps: a filter (which games count), a grouping (which comparison — by opening, by rating band, by position), and a summary (score, draw rate, an interval, a sample size). Every statistic in this book is a query, and every query has all three parts, whether or not the author wrote them down.
Here is the loader the chapter's module uses. It reads only the requested columns, applies the book's standard filters and adds the rating columns every comparison needs:
# from project/outpost/database.py (abridged)
def load_lichess(columns=None, speeds=HUMAN_SPEEDS, balanced=True, exclude_bots=True, ...):
base = ["game_id", "speed", "result", "white_elo", "black_elo", "white_title", "black_title"]
cols = list(dict.fromkeys(base + list(columns or [])))
df = pd.read_parquet(PROCESSED / "lichess_games.parquet", columns=cols)
m = df.result.isin(["1-0", "0-1", "1/2-1/2"]).to_numpy()
if exclude_bots:
m &= ~cd.is_bot_game(df) # NA-safe: never a bare != "BOT"
if speeds is not None:
m &= df.speed.isin(list(speeds)).to_numpy()
df = add_rating_cols(df[m].reset_index(drop=True)) # avg_elo, band, exp_white, adj_white
...
A 34-hour sample has a clock of its own
The Lichess sample is the first four million games of a month, which on Lichess is about a day and a half. That is a huge sample of those 34 hours, not of the year — and the hours are not alike.

📊 Figure (described): Bars show games started per UTC hour (from about 67,000 in the small hours, 02:00–03:00 UTC, to 184,685 at 18:00 UTC on 1 October); the line shows the mean average rating of those games. The player mix shifts during the day: the mean average rating ranges from 1624 (12:00 UTC) to 1662 (18:00 UTC), and the bullet share from 32.8% to 38.7%.
A 38-point swing in mean rating by hour is modest, but it is a warning. Anything that varies with time of day — who is online, which countries are awake, how tired people are — is baked into the sample in proportions set by one Thursday and Friday. If you ever compare "Monday games" with "Saturday games" from this data, you cannot: there are none. Say "in our Lichess sample (4 million rated games, October 2026)", and mean it.
🔄 Check your understanding 1. Dev says "I mined ten million games." What is the exact games count, and what makes up the rest of the ten million? 2. Why does the toolkit store games as Parquet columns rather than as PGN? 3. Name one question the Lichess sample cannot answer because of how it was drawn.
Answer
- 4,471,751 games (4,000,000 Lichess + 373,918 broadcast rows + 97,833 master games). The 6,193,530 puzzles bring the record count to 10,665,281 — but puzzles are positions, not games.
- Columnar storage lets a query read only the columns it needs (seconds instead of minutes) and stream large text columns one row group at a time.
- Anything about change over time for a player (improvement, rating trajectories), weekday or seasonal effects, or long-term trends — the sample is 34.2 hours of one Thursday and Friday.
31.2 Filters: Every Filter Is an Assumption
Before you group anything, you decide which games count. Each filter is a claim about what "a chess game" means for your question. Watch what each one does to two headline numbers — White's score and the draw rate.
Lichess funnel games White score draws mean avg rating
all 4M rows 4,000,000 51.63% 3.83% 1641.9
+ completed (drop '*') 3,999,600 51.63% 3.83% 1641.8
+ no BOT on either side 3,978,653 51.63% 3.73% 1639.7
+ bullet/blitz/rapid/classical only 3,938,632 51.64% 3.75% 1638.9
+ balanced (|rating diff| <= 100) 3,377,552 51.67% 3.74% 1632.8
OTB broadcast funnel
all broadcast rows 373,918
+ Standard chess 371,007
+ completed 366,653 53.51% 23.88% 2045.9
+ no engine events (TCEC etc.) 362,773 53.34% 23.60% 2028.0
+ no online events, no BOT (human OTB) 359,195 53.33% 23.78% 2033.5
+ both FIDE ratings present 310,067 53.49% 25.66% 2033.5
+ balanced 92,747 53.76% 34.64% 2059.3

📊 Figure (described): Two panels trace White's score (blue) and the draw rate (orange) as each standard filter is applied, with the number of games left above each point. On Lichess the headline numbers barely move. On the OTB side the draw rate jumps from 25.7% to 34.6% when only balanced pairings are kept — the filter changes which events you are looking at.
On Lichess the standard filters barely move the headline numbers, because the excluded groups are small. That is not a reason to skip them — it is a reason to look at what they excluded:
- Bot games are 20,947 of the completed games. When a human played a bot, the human scored 39.0% as White (2,575 games) and 36.5% as Black (1,887); 16,485 games were bot against bot. Any question about human decisions must drop them, and the drop must be NA-safe (the title column is empty for untitled players; a bare
!= "BOT"comparison silently discards every one of them). - Unbalanced games are where ratings decide everything. When White was rated more than 100 points higher, White scored 68.5% (281,961 games); when Black was, White scored 34.2% (279,119 games). Mixing them into an opening comparison adds a huge source of variation that has nothing to do with the opening. That is why the book's opening statistics use balanced games unless stated.
On the OTB side the filters matter more:
- Engine events (TCEC and other engine tournaments relayed on the same platform) are 3,880 games with a 50.0% draw rate and a 70.0% White score. Leave them in and every "OTB" draw rate and colour advantage is contaminated by computer chess.
- Online events relayed through broadcasts (3,578 games) had a 6.4% draw rate — online behaviour, not OTB.
- Balancing OTB games changes the population: open tournaments with large rating gaps drop out, closed and late-round pairings remain, the mean average rating rises from 2033.5 to 2059.3, and the draw rate rises from 25.7% to 34.6%. Both numbers are "right"; they answer different questions.
⚠️ Common pitfall: Filtering bots with
df.white_title != "BOT". In pandas the title column is a nullable string; for an untitled player the comparison returns missing, and a boolean filter drops the row. You lose almost every human game without an error message. Usechessdata.is_bot_game(df)or fill missing values first — and always print the row count after each filter so a silent collapse is visible.📋 Try it — Database research: Using
outpost.database.load_otb(columns=["opening"]), compute White's score and the draw rate for human OTB games with both ratings present, then for the balanced subset, separately for the classical, rapid and blitz classes. Which speed's draw rate is most sensitive to the balancing filter?
Worked answer
From
code/out_01_inventory.txt(section 3b):
text classical all n=210,354 White 53.83% draws 29.76% | balanced n=67,648 White 54.06% draws 38.60% rapid all n= 53,073 White 53.05% draws 18.12% | balanced n=12,793 White 53.06% draws 25.37% blitz all n= 40,723 White 52.21% draws 14.09% | balanced n=10,521 White 52.59% draws 20.08%Balancing raises the draw rate at every speed by six to nine points (classical +8.8, rapid +7.3, blitz +6.0), while White's score hardly moves. In absolute points classical is the most sensitive; relative to its starting level, blitz rises most (by about 43%). The filter removes open-tournament pairings with big rating gaps, which are decisive far more often — so a draw rate means nothing until you say which pairings it counts.
31.3 Opening Success by Rating Band: Who Plays It Is Part of the Score
Dev's 54.6% for the Scotch was a raw score. To see why raw scores mislead, line up all twenty-five common families in the unbalanced Lichess games (any rating gap) and add one column: the score the Elo formula expected from the ratings of the players who actually played them.
📐 Definition: The rating-adjusted score ("adj") of a group of games is the actual score minus the mean Elo-expected score, in percentage points: adj = 100 × (score − mean E), with E = 1/(1+10^((R_opp − R_own)/400)) computed from each game's own two ratings. A positive adj means the side did better than its ratings predicted. White's first-move edge is part of adj, so compare openings with each other, not with zero.
family n score lo hi expected adj mean_diff
Scotch Game 80403 54.6 54.3 55.0 50.4 4.2 4.5
Queen's Gambit Declined 105764 53.9 53.6 54.2 50.8 3.1 7.7
Ruy Lopez 66866 53.2 52.9 53.6 50.5 2.7 5.1
English Opening 118141 52.9 52.6 53.2 50.5 2.3 5.5
Queen's Pawn Game 368808 52.8 52.6 52.9 50.1 2.6 1.2
Italian Game 163406 51.8 51.6 52.1 50.2 1.6 2.4
Indian Defense 75024 51.2 50.8 51.6 49.3 1.9 -7.2
Englund Gambit 53224 50.9 50.4 51.3 50.5 0.4 4.6
Sicilian Defense 377348 50.2 50.0 50.4 49.3 0.9 -7.3
Caro-Kann Defense 227274 50.2 49.9 50.4 49.6 0.6 -4.4
Van't Kruijs Opening 66561 49.9 49.6 50.3 49.7 0.2 -1.8
spread of raw scores: 49.9-54.6 spread of rating-adjusted: +0.2 to +4.2
correlation across families between raw score and Elo-expected score: r = 0.74
(Selected rows; the full table is in code/out_03_openings_by_band.txt. mean_diff is the average White-minus-Black rating gap.)

📊 Figure (described): For each of the 25 most common Lichess families (all rating gaps), the red dot is White's raw score, the grey tick the score the players' ratings predicted, and the blue diamond 50 plus the rating-adjusted score. Raw scores and expected scores move together (r = 0.74 across families): a good part of an opening's raw score is simply who chose it.
The correlation of 0.74 between raw score and expected score across families is the confounding made visible. Players choose openings, and the choice correlates with strength. The Sicilian looks like White's worst 1.e4 opening (50.2%) partly because White was on average 7.3 points lower-rated in those games — Sicilian players tend to be stronger than their opponents. The Queen's Gambit Declined looks strong (53.9%) partly because White was on average 7.7 points higher. On Lichess, with its millions of fairly matched games, the effect is small because rating gaps are small. Over the board it is not small:
OTB (human broadcast set, both ratings, all speeds)
family n score lo hi expected adj mean_diff
Slav Defense 4911 59.4 58.0 60.8 55.1 4.3 47.2
Queen's Gambit Declined 16544 57.5 56.8 58.3 53.6 3.9 33.1
Ruy Lopez 12414 56.4 55.6 57.3 52.6 3.8 24.2
Sicilian Defense 68116 50.7 50.3 51.0 48.0 2.7 -18.4
Nimzo-Indian Defense 6599 50.3 49.1 51.5 47.1 3.1 -26.6
Indian Defense 8961 48.9 47.8 49.9 46.2 2.7 -35.6
Raw OTB White scores for these fifteen families range from 48.9% to 59.4%. Rating-adjusted, the whole range is +2.0 to +4.3. In the Slav Defense games White was on average 47 rating points stronger; in the "Indian Defense" family (the 1.d4 Nf6 sidelines) White was 36 points weaker. Open tournaments pair strong players with weak ones in the early rounds, and the weaker player's opening choices differ. Without the adjustment you would conclude that the Slav is a terrible defence and that 1.d4 Nf6 sidelines are a weapon for Black. Both conclusions are artefacts of who sat on which side of the board.
🔍 Why this works: The Elo expected score is a summary of everything the two ratings know about the players. Subtracting it removes the part of an opening's score that is explained by who played it — at least to the extent that ratings capture strength. What it cannot remove: style (sharp players choose sharp openings and also blunder differently), preparation (a prepared line scores better than its rating gap predicts), time control (a blitz-only weapon may look great in a pooled table) and the fact that ratings are themselves noisy estimates (Chapter 30 measured how well the formula's expected score matches reality). Adjustment shrinks confounding; it does not abolish it.
By band: what changes with level
With balanced games and the adjustment in place, the band-by-band table finally says something about levels. Here is the heat map; the full numbers are in code/ch31_family_band.csv.

📊 Figure (described): Rows are the 25 families sorted by overall rating-adjusted White score, columns the eight Lichess bands (balanced games, cells with at least 300 games). Red cells are good for White, blue good for Black. The Scotch and the Bishop's Opening are red almost everywhere; the main 1.e4 defences (Sicilian, Caro-Kann, French) start near zero for White below 1600 and turn red above 2000.
Three patterns are worth reading out — remembering that White's average adj in balanced games is itself +1.4 to +2.5 depending on band (it is +1.7 below 1200 and +2.5 at 2400+):
- The serious defences get worse for Black as the level rises. White's adj against the Sicilian goes from −0.4 (<1200) to +2.2 (2200–2399) and +2.1 (2400+); against the Caro-Kann from +0.3 to +3.5; against the French from +0.2 to +2.5. At club level these defences hold White below the average opening; at expert level White's first move starts to count. This is the same pattern the reference tables show for Black's Sicilian score (50.4% below 1200, 48.1% at 2400+; Sicilian higher than 1...e5 for Black in every band below 2000 — see Chapter 22).
- The Italian fades with level. White's adj with the Italian is +2.2 below 1200 but +1.0 at 1800–1999 and +0.9 at 2000–2399. The opening that wins quickly against beginners meets prepared defenders higher up.
- The Scotch stays strong in every band, from +4.7 (<1200) to +2.8 (2400+) — and the hook told you why: the next-move table.
A claim you will meet in chess writing is that the Sicilian scores about 55% in grandmaster games but only 48% at the 1200 level. The data says the opposite in both places: for Black, the Sicilian scores 47.2% in the masters explorer (627,286 games) and about 50% at club level on Lichess. An opening's success depends on the level — but not in the direction folklore expects, and you only see the real direction with the right filter and the right adjustment.
⚠️ Common pitfall: Reading a family's score as the opening's objective value. A difference of one or two points between families is within what selection alone can produce (who chooses it, at which time control, after how much preparation). Use the database to find where to look, then use positions and the engine to find why.
🔄 Check your understanding 1. In the OTB table the Slav Defense shows White at 59.4%. Why is that not evidence that the Slav is a poor defence? 2. White's rating-adjusted score against the Caro-Kann is +0.3 below 1200 and +3.5 at 2400+. State the finding in one sentence a club player could use. 3. What does the rating adjustment not correct for?
Answer
- In those games White was on average 47 rating points stronger, so the Elo formula already expected 55.1%; the rating-adjusted figure (+4.3) is within the +2.0 to +4.3 range of all fifteen OTB families.
- "Below 1200 the Caro-Kann holds White to roughly the score of an even game; at expert level White's first-move advantage comes through against it as it does against the other main defences."
- Style, preparation, time-control mix, and the noise in the ratings themselves — anything that makes the players of one opening different from the players of another in ways their ratings do not capture.
31.4 Query Positions, Not Names
The Opening header in a Lichess or broadcast game is a label produced by a classifier. It is useful for grouping, but it answers "what is this game called?", not "did this game reach the position I care about?". A player preparing a line needs the second question — and needs it to count transpositions, games that reach the same position by a different move order.
The module's query engine does it in two passes:
- Index once. Stream the move text, strip comments and move numbers, and keep the first 16 moves (plies) of every game as one string. For the 864,816 Lichess games this takes about 77 seconds; for the human OTB set about 14 seconds.
- Query fast. For a line of k plies, an exact move-order match is a string-prefix test over the whole index. For transpositions, a cheap pre-filter keeps only games whose first k plies contain the same moves for each side in any order ("the same bag of moves"); those candidates are replayed with python-chess, and only games whose position (pieces, side to move, castling and en-passant rights) is identical to the target are kept.
# simplified from project/outpost/database.py (helper names shortened)
def query_line(index, moves, transpositions=True):
toks = line_tokens(moves) # validated with python-chess
k, prefix = len(toks), " ".join(toks)
target = position_key(board_after(toks)) # board.epd(): no move counters
exact = index.line.str.startswith(prefix + " ") | (index.line == prefix)
res = [frame(index[exact], "exact")]
if transpositions:
sub = index[~exact & (index.n >= k)]
bag = _bag(toks) # sorted White moves | sorted Black moves
cand = sub[sub.line.str.split(" ").str[:k].map(_bag) == bag]
ok = [gid for gid, line in zip(cand.game_id, cand.line)
if position_key(replay(line, k)) == target]
res.append(frame(cand[cand.game_id.isin(ok)], "transposition"))
...
The bag pre-filter misses transpositions that use different moves (a knight reaching f3 via d2 instead of g1, say), so the module includes transposition_recall, which replays the first k plies of a random sample of 20,000 games and counts every true match, whatever the moves. For all five queries below, recall was 100% on those samples — but the true-match counts were small (19 to 819 games per sample), so read that as "no misses found", not as a proof.
📐 Definition: A transposition is a game that reaches a given position at the same ply by a different move order. The transposition share of a query is transpositions ÷ all matching games. A position query counts both; a move-order query counts only exact sequences.
Validation first
A new query engine is guilty until proven innocent. The book's reference opening tables (computed independently by the toolkit's opening-statistics script) give the Italian position after 1.e4 e5 2.Nf3 Nc6 3.Bc4 as 30,375 Lichess games (balanced, no bots, bullet to classical; Kish effective n 18,428), White 51.6%, and 3,823 balanced OTB games, White 54.3%. Our engine:
QUERY 01-italian: Italian Game [e4 e5 Nf3 Nc6 Bc4]
Lichess games 30,375 (exact 28,226, transposition 2,149 = 7.1%) weighted n 131,903 Kish n 18,428
White 51.6% [50.9-52.3] draws 3.6% adj +1.5
OTB games 3,823 (exact 3,774, transposition 49 = 1.3%) White 54.3% [52.7-55.9] draws 32.2% adj +4.2
Both pools match exactly. Only then do we trust it with new questions.
Five queries

♟️ Position: White Ke1, Qd1, Ra1, Rh1, Bc1, Bc4, Nb1, Nf3, a2, b2, c2, d2, f2, g2, h2, e4; Black Ke8, Qd8, Ra8, Rh8, Bc8, Bf8, Nc6, Ng8, e5, a7, b7, c7, d7, f7, g7, h7 — Black to move. FEN:
r1bqkbnr/pppp1ppp/2n5/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R b KQkq - 3 3
The next-move table is where a query becomes chess. In the Italian position, Lichess players chose 3...Nf6 (34.5%), 3...Bc5 (30.5%) and 3...h6 (13.3%); over the board, 3...Bc5 (47.0%) and 3...Nf6 (45.9%) and almost nothing else; in the masters explorer 3...Bc5 (26,897 games) and 3...Nf6 (22,421). The 13% of club players who spend a tempo on 3...h6 are the same story as 4...Nxd4 in the Scotch: a move that strong players almost never choose, sitting in the middle of the amateur tree. (White scored 51.9% after it in our Lichess games — no catastrophe, just a tempo given away.)
| Query (position after) | Lichess games (transpositions) | Lichess White % [95% CI], Kish n | OTB games (transpositions) | OTB White % [95% CI] | SF19 d20 |
|---|---|---|---|---|---|
| Italian 3.Bc4 | 30,375 (7.1%) | 51.6 [50.9–52.3], 18,428 | 3,823 (1.3%) | 54.3 [52.7–55.9] | +0.16 (3...Bc5) |
| Scotch 4.Nxd4 | 6,974 (5.5%) | 53.5 [52.0–55.0], 4,298 | 886 (0.9%) | 55.8 [52.5–59.0] | +0.08 (4...Nf6) |
| Najdorf 6.Be3 | 363 (12.4%) | 52.4 [45.6–59.2], 203 | 471 (2.5%) | 48.2 [43.7–52.7] | +0.25 (6...e5) |
| QGD Exchange 4...exd5 | 1,320 (70.6%) | 50.9 [47.4–54.5], 767 | 1,267 (44.1%) | 57.9 [55.2–60.6] | +0.26 (5.Bg5) |
| London 3.Bf4 (vs ...d5/...Nf6) | 3,013 (63.6%) | 54.0 [51.7–56.3], 1,780 | 667 (50.8%) | 54.6 [50.8–58.3] | +0.15 (3...c5) |
(Lichess and OTB pools are balanced games; Lichess figures are sample-weighted with Kish effective n — see Section 31.5. Engine evaluations are Stockfish 19 at depth 20 of the query position, White's point of view, with the engine's first choice in brackets.)
🧩 Productive struggle: Before you look at the table again: if you searched a database for the QGD Exchange by typing the moves 1.d4 d5 2.c4 e6 3.Nc3 Nf6 4.cxd5 exd5 into a move-tree explorer that does not merge transpositions, what fraction of the Lichess games reaching that position would you miss? Make a guess, then think about how 1.d4 players actually reach it.
Answer
70.6% (932 of 1,320 Lichess games) arrived by another order — for example 1.d4 Nf6 2.c4 e6 3.Nc3 d5, the Nimzo/QGD move order, or 1.c4 or 1.Nf3 move orders. A move-order query would show you less than a third of the games and a misleading score. Over the board the share is 44.1%. The London position is similar (63.6% on Lichess): 1.d4 d5 2.Nf3 Nf6 3.Bf4 can be reached through 1.d4 Nf6 2.Nf3 d5 3.Bf4, 1.Nf3 d5 2.d4 Nf6 3.Bf4, 1.d4 d5 2.Bf4 Nf6 3.Nf3 and others. Systems that are played "by set-up" transpose constantly; sharp main lines (Italian, Scotch, Najdorf) mostly do not.

♟️ Position: White Ke1, Qd1, Ra1, Rh1, Bc1, Bf1, Ng1, Nc3, a2, b2, e2, f2, g2, h2, d4; Black Ke8, Qd8, Ra8, Rh8, Bc8, Bf8, Nf6, Nb8, d5, a7, b7, c7, f7, g7, h7 — White to move. FEN:
rnbqkb1r/ppp2ppp/5n2/3p4/3P4/2N5/PP2PPPP/R1BQKBNR w KQkq - 0 5
This position is the doorway to Anchor A, the Carlsbad structure: White's d4 pawn against Black's d5 and c-pawn, the half-open c-file for White and e-file for Black. Once Black plays ...c6, the classifier calls it Carlsbad:white — the skeleton you met in Chapter 2, as it appeared in Smyslov–Keres, World Championship 1948.

♟️ Position: White Ke1, Qd1, Ra1, Rh1, Bf1, Bg5, Ng1, Nc3, a2, b2, f2, g2, h2, e3, d4; Black Ke8, Qd8, Ra8, Rh8, Bc8, Bf8, Nf6, Nd7, d5, c6, a7, b7, f7, g7, h7 — White to move. FEN:
r1bqkb1r/pp1n1ppp/2p2n2/3p2B1/3P4/2N1P3/PP3PPP/R2QKBNR w KQkq - 0 7
The database view of the plan belongs here, because it is a structure query rather than a move query: of 11,934 OTB games that carried the White-owned Carlsbad label at ply 20, 30 or 40, the minority attack (b4–b5 while the structure holds) was played in 9.1% [8.6–9.7]; the owner scored 57.2% with it (rating-adjusted +4.9) and 56.1% without (+3.7). On Lichess (balanced) the share is 7.2% of 7,877 games. And the over-the-board next-move table above shows how settled the position is: 5.Bg5 in 94.6% of OTB games, with White scoring 58.1%; Stockfish 19 also puts 5.Bg5 first (+0.26 at depth 20).
🤖 Engine check: All five query positions are within about a quarter of a pawn of equality by Stockfish 19 at depth 20 — Italian +0.16, Scotch +0.08, Najdorf 6.Be3 +0.25, QGD Exchange +0.26, London +0.15. The scores in the table range from 48.2% to 57.9%. That gap between a near-zero evaluation and a practical edge of up to eight points is exactly what a database adds: the engine tells you the position is balanced; the database tells you how people actually continue from it, and which side's typical choices cost points. In the QGD Exchange, OTB White scores 57.9% although Stockfish sees only +0.26: Black's position is objectively sound but it is the side that must defend against a slow plan, which is hard to do accurately for forty moves — the same lesson the Carlsbad chapters drew from Smyslov's minority attack, where the engine called the position roughly equal while the plan kept the pressure on.
Thin data: the Najdorf English Attack (Anchor C)

♟️ Position: White Ke1, Qd1, Ra1, Rh1, Bf1, Be3, Nc3, Nd4, a2, b2, c2, f2, g2, h2, e4; Black Ke8, Qd8, Ra8, Rh8, Bc8, Bf8, Nf6, Nb8, a6, d6, b7, e7, f7, g7, h7 — Black to move. FEN:
rnbqkb1r/1p2pppp/p2p1n2/8/3NP3/2N1B3/PPP2PPP/R2QKB1R b KQkq - 1 6🎭 Composite data: Dev's games are real Lichess games played by anonymous players at his rating, assembled into one "player" so we can demonstrate the method on your own games.
Dev's opening worry in Chapter 20 was this position: his 50 English Attack games as White scored 36.0% [24.1–49.9], below his band's 44.3% — a gap the interval could not distinguish from noise. The full Lichess move-text subset contains only 363 balanced games that reached it (45 by transposition) — an effective sample of 203 once weights are applied — and no single rating band has an effective sample of even 100. Over the board there are 471 balanced games, and only the 2400+ band reaches 100 (126 games, White 52.4%). After 6...e5, the most common reply in both pools (50.6% of Lichess replies, 72.6% OTB), White scored 46.2% on Lichess and 46.6% OTB. Stockfish 19 gives the position +0.25 at depth 20, with 6...e5 first.

📊 Figure (described): White's score with 95% intervals, by rating band, for the five query positions (balanced games; only cells with an effective sample of at least 100 are drawn). The Italian and the Scotch have full curves; the Najdorf English Attack has no Lichess cell at all and a single OTB cell — the honest picture of how little the database knows about a sharp line at any one level.
The lesson from Anchor C stands and gets sharper: confidence intervals before conclusions, and look at the width of the database's own interval, not only at the player's. A four-million-game sample can still be a 203-game sample for the question you actually asked.
The same query on the historical record
Indexing the 97,833 master games the same way shows when the English Attack arrived among these 40 players' games. Of games reaching the Najdorf position after 5...a6, the share continuing 6.Be3 was 0.7% in the 1960s, 5.6% in the 1970s, 11.1% in the 1980s, 35.2% in the 1990s and 47.0% in the 2000s, before falling back to 25.5% (2010s) and 16.3% (2020s). The earliest 6.Be3 game in the record is Rossolimo–Fischer, U.S. Championship 1966 (0-1). The QGD Exchange (4.cxd5 exd5 after 3...Nf6) went from almost never before 1950 to 33–40% from the 1980s on, and 72.7% of these collections' 2020s games. Remember the filter, though: these are the PGN Mentor collections of particular players, so a decade's share describes their choices, not master chess at large. The line is alive in today's broadcasts at every level and in every section: among the OTB games, for example, Bibisara Assaubayeva won with Black against the English Attack at the 2026 Tata Steel Challengers.
🔄 Check your understanding 1. A query engine finds 1,320 games in the QGD Exchange position, 932 of them by transposition. What would a move-order search have reported, and why does it matter for the score? 2. Why validate a new query engine against a known table before using it? 3. The Najdorf English Attack has 363 Lichess games in the position. Why is the useful sample size smaller still?
Answer
- Only the 388 exact-order games — under a third — and their score would describe the players who use that particular move order, not everyone who reaches the position.
- Because a silent bug (a missed transposition, a wrong filter, a mis-parsed move) produces plausible-looking numbers. Reproducing the reference Italian row exactly (30,375 games, Kish n 18,428, 51.6%; OTB 3,823, 54.3%) shows the filters, weights and matching agree.
- The games carry sample weights of 1 and 8, so their Kish effective size is 203 — and split by band, no cell reaches 100.
31.5 Sample Weights and Self-Selection
Every Lichess number in the query table was weighted. Here is why, and a test you rarely get to run: a test against the truth.
The move-text subset is not a simple random sample. It contains every game that someone asked Lichess's server to analyse (412,421 human games in our filtered population) plus a random one-in-eight of all other games (440,882). Analysed games are therefore over-represented about eight to one. The fix is a sample weight: 1 for each analysed game, 8 for each un-analysed one. The weights sum to 3,939,477 — almost exactly the 3,938,632 games in the population.
For most quantities you cannot check whether weighting worked, because you do not have the full population's move text. But for a handful — game length, result, termination, speed, rating — the full 4M-row table is the truth. So we can grade the estimators:
truth (4M) subset unweighted subset weighted analysed only
mean plies 65.99 66.09 65.99 66.23
games >= 80 plies % 28.65 27.39 28.60 25.73
draw rate % 3.75 3.58 3.76 3.34
White score % 51.64 51.56 51.64 51.45
time forfeit % 31.93 28.38 32.00 23.43
bullet share % 35.90 29.47 35.88 20.72
rapid share % 16.96 23.15 16.97 31.58
mean average rating 1638.88 1623.38 1638.74 1602.41
rating >= 2000 % 18.05 17.97 18.03 17.89

📊 Figure (described): For seven quantities, the relative error of three estimates against the full-population truth. The unweighted move-text subset is off by up to 18% (bullet share) and 36% (rapid share); the same rows with sample weights are within 0.3% everywhere; analysed games alone are off by 42% on the bullet share and 86% on the rapid share.
The weighted estimates are essentially perfect. The unweighted ones are not, and "analysed games only" is badly biased, because the people who request analysis are not a random slice of the population:
share of games analysed — by speed: classical 33.4%, rapid 19.5%, blitz 10.3%, bullet 6.0%
by band: <1200 13.4%, 1200-1399 11.2%, 1400-1599 10.5%, 1600-1799 9.4%, 1800-1999 8.8%,
2000-2199 9.3%, 2200-2399 11.4%, 2400+ 13.3%
games ending 'Normal' (mate, resignation, agreed draw) 11.8% vs 'Time forfeit' 7.7%
Slower games get analysed far more often than bullet; the lowest and highest bands more than the middle; games decided at the board more than games lost on the clock. Weighting fixes the design (the one-in-eight sampling that the toolkit chose). Nothing fixes the self-selection in "analysed only" except a population that does not depend on it — which is why every eval-based Lichess statistic in this book says "analysed games" and why the eval-based parts of Sections 31.7 and 31.8 carry that caveat.
📐 Definition: The Kish effective sample size of weights w is n_eff = (Σw)² / Σw². It says how many equally weighted observations the weighted sample is worth for computing an interval. The 853,303-row weighted subset has n_eff = 542,092; the Italian query's 30,375 games have n_eff = 18,428. Use n_eff, not the row count, inside a Wilson interval.
⚠️ Common pitfall: Computing a Lichess population statistic from
game_featuresorlichess_moveswithout weights. The unweighted subset says 29.5% of games are bullet; the truth is 35.9%. Any statistic that differs between bullet and slower games (accuracy, blunder rates, endgame frequency, time-forfeit share) inherits that error. Inoutpost.database.summarise, passweight="sample_weight"(or"w"), and the interval uses Kish's n automatically.🔄 Check your understanding 1. Why do the sample weights sum to almost exactly the population size? 2. A friend computes the average accuracy of Lichess blitz players from server-analysed games and calls it "the average Lichess blitz accuracy". What should you say? 3. Why can a weighted estimate be unbiased and still have a wider interval than its row count suggests?
Answer
- Each un-analysed game kept with probability 1/8 stands for 8 games, and each analysed game (all kept) stands for itself; summing 8s and 1s rebuilds the population count.
- That it is the average among analysed games, a self-selected group that over-represents slower games and the lowest and highest bands; weights cannot fix this because un-analysed games have no evals at all.
- Unequal weights reduce the information per row: 30,375 rows with weights of 1 and 8 carry the information of 18,428 equal-weight rows (Kish n).
31.6 Piece Heat Maps: Where Pieces Stand vs Where They Do Well
Heat maps are usually sold with a promise: they show where pieces are most effective, and they confirm that knights belong on central outposts and bishops on long diagonals. Heat maps are the most seductive picture in chess analytics, so let us build them carefully and then read them sceptically.
The book's reference tables record, for every OTB human game and every (weighted) Lichess human game that reached ply 30 — after Black's fifteenth move — which squares each side's knights and bishops stood on, in the owner's orientation (Black's pieces are mirrored, so "d5" always means the owner's fifth rank). For each square there are two very different numbers: how often a piece stands there (frequency) and how its owner scored compared with the Elo expectation (owner_adj).

📊 Figure (described): Four boards. Left: where knights stand at ply 30 (share of side-games, %), OTB above and Lichess below — f3 (33.4% OTB) and c3 (25.9%) dominate, simply because those are the developing squares of the most common openings. Right: the owner's score minus the Elo expectation for each square with at least 500 cases (enemy back rank blanked). Own back-rank and second-rank squares are orange (below expectation); squares on the owner's fifth to seventh ranks in the centre are blue (above).
Read the right-hand boards first. In OTB games, a knight on the owner's sixth rank goes with an above-expectation score — e6 +5.7 points (1,236 cases), d6 +5.6 (2,152), c6 +2.6 — while knights still on the back two ranks go with below-expectation scores (b2 −6.2, a2 −6.1, c1 −5.5, d1 −4.8). Grouping squares (OTB, weighted by occurrences):
[otb] rim (a/h files) occurrences 47,943 mean adj -1.86
[otb] own back rank (rank 1) occurrences 50,984 mean adj -3.17
[otb] centre box c3-f6 occurrences 502,632 mean adj +0.73
[otb] enemy half ranks 5-6 (c-f) occurrences 51,028 mean adj +2.66
[lichess] enemy half ranks 5-6 (c-f) occurrences 140,574 mean adj +3.65
So the folklore survives: knights in the enemy half of the centre go with better results than knights on the rim or at home. But now read the left-hand boards against the right-hand ones.

📊 Figure (described): Each dot is a square (at least 500 knights), plotted by how often a knight stands there (log scale) against the owner's rating-adjusted score. There is no positive relationship: across OTB squares the rank correlation is −0.12, across Lichess squares −0.33. The most popular squares (f3, c3) sit at about zero; the best-scoring squares are rare. Red triangles mark the enemy back rank.
There is no positive relationship between how often a square is used and how well its owner does (Spearman −0.12 OTB, −0.33 Lichess). Frequency is driven by openings: f3 is the natural developing square in most openings, so it is common and neutral (+0.1 OTB). The effective squares are rare: a knight on d6 at move 15 appears in 0.36% of OTB side-games.
🔍 Why this works: A knight on the enemy sixth rank is strong for geometric reasons — from d6 it attacks b7, c8, e8, f7, f5, e4, c4 and b5, half of them squares inside the opponent's camp, and a pawn-protected knight there can only be removed by a minor piece. But the heat map's +5.6 points is not that geometry measured. It is an association, and two other things travel with a knight on d6: the owner was often already better (you only get a knight there if the opponent's position allowed it — the reference tables show that owners of outpost knights at ply 30 already stood about +0.50 on average in OTB games), and sometimes the knight has just captured something there. The Lichess maps show this second effect clearly: the top squares are f7 (+12.0), e7 (+9.1) and c7 (+8.5) — squares a knight reaches by taking a pawn or forking — and on the enemy back rank d8 (+14.6), a8 and h8 (+13.3 each), where a knight has typically just captured a rook or a queen. That is why the maps blank the enemy back rank and why the reference tables warn against reading frequency or back-rank squares as "good squares".

📊 Figure (described): Bishops at ply 30 in OTB games. Frequency is dominated by home and fianchetto squares (g2 20.1%, c1 19.3%, e2 17.8%). The rating-adjusted map is quieter than the knights': bishops still on the back rank go with below-expectation scores (d1 −6.3, h1 −5.6), and the best squares are deep in the enemy camp (h6 +4.7 with 3,689 cases, c7 and h7 +5.0 with fewer than 900 each).
For bishops the "long diagonal" claim is not something these maps can confirm or deny: g2 (the fianchetto square) is the most common bishop square in OTB games, and its owners score at expectation (−0.2). What the maps do show is that undeveloped bishops go with poor results and that bishops which have penetrated (h6, c7, h7, d6) go with good ones — the activity story from Chapter 3, where the same idea was tested with mobility counts and the knight on an outpost (a stricter, pawn-protected definition: 56.8% for its owner OTB, rating-adjusted +3.8).
How it plays at different levels: Chapter 3's band split found the centre-knight effect grows with strength (mean win/loss ratio of c5/d5/e5/f5/d6 knights: Lichess below 1400 1.14, Lichess 2000+ 1.34, OTB 2000+ 1.62). One plausible reading — a hypothesis, not something the maps prove — is that a centralised knight is worth more to a player who knows how to support it with pawns and use it as a base for an attack.
⚠️ Common pitfall: Treating a heat map of frequency as a heat map of quality. "A third of OTB games have a knight on f3 at move 15" is a fact about opening choice. "Knights on f3 score well" is not even true (owner_adj +0.1 OTB). Always plot the outcome measure, mask squares with few cases (we used 500), and remove squares whose meaning is "something was just captured".
🔄 Check your understanding 1. Knights stand on f3 in 33.4% of OTB side-games at ply 30, with owner_adj +0.1. Knights on d6 appear in 0.36% with +5.6. Which number answers "is d6 a good square?" and what does it still not prove? 2. Why are the enemy back-rank squares blanked on the maps?
Answer
- The rating-adjusted score (+5.6), not the frequency. It still does not prove that putting a knight on d6 causes a better result: owners of d6 knights were often already better, and some knights got there by capturing.
- A knight or bishop on the enemy back rank at move 15 has usually just captured a rook or queen there, so its score measures material won, not the square's value (Lichess d8 +14.6, a8 and h8 +13.3).
31.7 Endgame Conversion by Band: The Definition Is the Finding
How often does a one-pawn advantage in the endgame convert to a win? A popular answer is "about 75% at grandmaster level, about 45% at 1200". The book's reference endgame tables show that this is wrong in direction (see also the endgame chapters, Chapter 16 and Chapter 18): exactly one pawn up with equal pieces at the start of the endgame, the side ahead wins 46.1% of OTB classical games at FIDE 2400+ (draws 45.2%) but 53.5% of Lichess 1200–1399 blitz games. Here we ask the analyst's question: how much of that answer depends on how "the start of the endgame" is defined, and what does "one pawn up" mean on the board?
Three definitions, same games (game_features; book endgame = combined non-pawn material ≤ 26):
- E — entry: the first ply at which the position is an endgame, even if a recapture is pending.
- S — settled: the same, but only games whose next move is not a capture.
- L — reference: the reference tables' first stable endgame position, found by replaying every game.
OTB classical: side exactly one pawn up (equal pieces) WINS %
band E entry S settled L reference n (E) n (S)
1400-1599 58.6 60.2 60.0 1,365 1,024
1600-1799 59.5 62.8 62.2 3,655 2,756
1800-1999 56.6 60.3 60.0 4,945 3,670
2000-2199 54.5 58.9 59.2 5,199 3,782
2200-2399 51.7 55.6 56.1 4,943 3,572
2400+ 41.6 46.0 46.1 2,543 1,812

📊 Figure (described): The side one pawn up, share of wins by band, under the three definitions; shaded bands are 95% intervals. In OTB classical games the "entry" definition sits three to five points below the other two at every band, because 26.7% of entry positions are mid-exchange and the pawn count is about to change; the "settled" definition reproduces the reference table to within a point. In Lichess blitz all three are close.
Twenty-seven per cent of the OTB "entry" positions are mid-exchange (the next move is a capture), and the pawn count is about to change. Drop them and a crude one-line filter ("x" not in next_move) reproduces the expensive replay-based reference numbers to within a point. Keep them and every band's conversion rate drops by three to five points. Neither number is "the" conversion rate; each is the answer to a precisely stated question. State it.
Then ask what the engine thinks of these "one pawn up" positions. The move text stores an evaluation after every move in most OTB broadcasts (relay engines of varying depth — treat them as indicative) and in analysed Lichess games:
OTB classical, settled one-pawn-up positions with an eval (side-ahead view, centipawns)
band count 25% median 75% share <= +0.50 share >= +1.50
1400-1599 938 47 180 288 25.4 57.9
1800-1999 3363 16 166 325 32.5 52.5
2200-2399 3375 0 97 275 42.2 42.6
2400+ 1750 0 40 221 52.2 33.4
conversion by eval bucket: side ahead WINS % (n)
band <= +0.50 +0.51..+1.49 >= +1.50
1400-1599 34.0 (238) 56.5 (161) 72.5 (539)
1800-1999 29.2 (1,093) 56.2 (512) 80.7 (1,758)
2200-2399 25.2 (1,423) 60.0 (518) 84.2 (1,434)
2400+ 18.5 (913) 57.4 (256) 84.7 (581)

📊 Figure (described): Histograms of the stored engine evaluation, from the side ahead, for settled one-pawn-up endgame starts. OTB classical (left) has a tall spike at 0.00 (3,000+ positions in the 0.00–0.25 bin) and a median of +1.34 over all bands; Lichess blitz (right) has a smaller spike and a higher median, +1.73. Both have a pile at the +5 clip — positions where the 'one pawn' is the least of the winning side's assets.
Now the "contradicted direction" makes sense. At 1400–1599, the median OTB one-pawn-up position is worth +1.80 to the engine; at 2400+ it is worth +0.40, and more than half of the 2400+ positions are evaluated at +0.50 or less. Strong players reach "pawn-up" endgames that are objectively nearly level. A reading consistent with these numbers (the data show the what, not the why): strong players give up a pawn mainly when they get activity or a known drawing structure in return, so their opponents' extra pawns are less often real. Within each evaluation bucket, conversion rises with strength: with a real edge (≥ +1.50), the side ahead wins 72.5% at 1400–1599 and 84.7% at 2400+. The raw band trend (60% falling to 46%) is a composition effect: the mix of positions changes with level.
Two real games from the query make it concrete.

♟️ Position: White Kg2, Rc1, Rd5, a2, f2, h2, b3, g3; Black Kg7, Re4, Rf6, h5, g6, a7, f7 — Black to move. FEN:
8/p4pk1/5rp1/3R3p/4r3/1P4P1/P4PKP/2R5 b - - 0 30
Vladimir Fedoseev (2693) against Pentala Harikrishna (2655), Rubinstein Memorial, Polanica-Zdrój 2026. After 29.Qxd5 Qxd5 30.Rxd5 the endgame has started, White has five pawns to four, and the next move is not a capture — a settled one-pawn-up endgame for every one of our definitions. But Black's rook on e4 is one move from the second rank: 30...Re2 31.Rf1 Rxa2, and the pawns are level again. The game was drawn in 54 moves.

♟️ Position: White Kg2, Qd3, Nd2, h2, c3, g3, b4, e4; Black Kg8, Qf8, Bb6, g4, e6, c7, h7 — White to move. FEN:
5qk1/2p4p/1b2p3/8/1P2P1p1/2PQ2P1/3N2KP/8 w - - 0 33
Magnus Carlsen (2840) against Alireza Firouzja (2759), Norway Chess 2026, round 11. After 32.Rxf8+ Qxf8 the queens and minor pieces stay on, White is a pawn up with a healthier structure, and Firouzja has 4.0 minutes to Carlsen's 36.8. Carlsen won at move 55.
🤖 Engine check: Stockfish 19 rates Fedoseev–Harikrishna after 30.Rxd5 at +0.00 (depth 18) and −0.06 (depth 24), with 30...Re2 31.Rf1 Rxa2 as the main line at both depths; after 31...Rxa2 it is +0.05 (d24). The pawn was never really extra — the a2 pawn was loose and the active black rook was always going to collect it. Carlsen–Firouzja after 32...Qxf8 is +1.68 (d18) and +1.82 (d24), with 33.Qe2 (the move Carlsen played) first: White's extra pawn is a passed-pawn candidate on the queenside, Black's king is exposed, and the g4 pawn is weak. One row is a draw in disguise, the other a genuine advantage; the database's "one pawn up" label is identical for both.
What this means at the board: at club level, if you are a clean pawn up in an endgame, you are usually really better (median +1.80 at 1400–1599) and your job is technique — convert it more often than the 60% your peers manage. At master level, "a pawn up" is often a structural detail the opponent has already priced in; the 46% win rate does not mean masters convert worse.
31.8 Time Usage and Results
The fourth classic database question is about time: do players who spend more time on critical positions perform better? The usual answer is "yes, significantly". Chapter 13 measured time at critical moments directly. Here we ask a database question that is easier to state precisely and harder to fool yourself with: does spending more of your clock in the opening go with better or worse results?
The query: balanced Lichess human games at three increment-free controls (3+0, 5+0, 10+0), a seeded sample of 50,000 games each from the move-text subset, weighted. For each player, used15 = the share of the base time spent by the player's own fifteenth move (games of at least 30 plies). Players are split into quintiles within each control.
tc q n median used score adj se
180+0 Q1 fastest 20000 10.0% 53.12 +3.00 0.41
180+0 Q3 20000 19.4% 51.90 +1.81 0.41
180+0 Q5 slowest 20000 37.2% 42.11 -7.71 0.42
300+0 Q1 fastest 20000 10.0% 52.82 +2.73 0.40
300+0 Q5 slowest 20000 35.7% 43.03 -6.87 0.44
600+0 Q1 fastest 20000 7.2% 51.85 +1.81 0.46
600+0 Q5 slowest 20000 30.3% 45.90 -4.01 0.50

📊 Figure (described): Left: rating-adjusted score by quintile of base time used by move 15, for 3+0, 5+0 and 10+0. The slowest fifth score 4 to 8 points below expectation; the fastest fifth 2 to 3 points above. Right: among analysed games, the difference between slow (Q4–Q5) and fast (Q1–Q2) players who had the same engine evaluation after move 15. In 3+0 slow players still score worse (by 2 to 7 points); in 5+0 and 10+0 the differences are mostly within their intervals.
In every control, the players who spent the most clock by move 15 scored worst, and the gap shrinks as the control gets slower: −7.7 points in 3+0, −6.9 in 5+0, −4.0 in 10+0. Is that the clock's fault? Two other explanations are waiting:
- Position quality. A player who is already in trouble at move 15 thinks longer and scores worse. To control for it, we compared slow and fast players with the same server evaluation after ply 30 (analysed games only, so self-selected and unweighted). At 3+0 the slow players still scored worse in every bucket — by 4.45 points in level positions (−0.50 to +0.50; standard error 1.08). At 5+0 the level-position gap shrank to −1.38 (SE 1.21) and at 10+0 it was +1.66 (SE 0.97) — neither distinguishable from zero.
- Reverse causality. The most tempting clock statistic is the worst one:
tc lowest clock < 10% of base n share score adj
180+0 False 74,330 73.65% 55.86 +5.80
180+0 True 25,670 26.35% 33.63 -16.20
600+0 True 8,766 8.33% 32.37 -17.51
Players whose clock fell below 10% of base scored 16 to 18 points below expectation. But a clock falls low because of the game — long, hard, losing positions consume time, and players who lose on time are counted as both low-clocked and losing. The outcome contaminates the predictor. A pre-outcome measure (time used by move 15) is better; a measure controlled for the position is better still; neither proves causation.
What the database supports, then: in 3+0 blitz, spending a third of your clock on the first fifteen moves goes with worse results even from equal positions; at 10+0 the same habit costs little or nothing measurable. That is consistent with Chapter 13's finding that time trouble itself is expensive, and with common sense: at 3+0 there is no clock left to recover with. It does not say that thinking is bad. It says, at the fastest controls, budget the opening.
⚠️ Common pitfall: Using any end-of-game clock statistic (lowest clock, time left at the end, "lost on time") as a cause of the result. These are partly effects of the result. Choose predictors that are fixed before the outcome is known, and control for what the position already says.
🔄 Check your understanding 1. Why does the OTB "entry" definition give lower conversion rates than the "settled" one? 2. The side a pawn up wins 46% of OTB 2400+ endgames and 60% at 1400–1599. Give the data-backed reason this does not mean masters convert worse. 3. Why is "players whose clock fell below 10% scored 17 points below expectation" not evidence that low clocks cause losses?
Answer
- 26.7% of entry positions are mid-exchange; the pawn count is about to change, so some "pawn-up" games are not pawn-up a move later.
- Strong players' pawn-up endgames are objectively closer to level (median engine eval +0.40 at 2400+ vs +1.80 at 1400–1599); within the same eval bucket, conversion rises with rating (≥ +1.50: 72.5% → 84.7%).
- The low clock is partly a consequence of the game going badly (hard positions take time; losses on time are counted as both) — reverse causality.
31.9 Replication: How Many of Your Findings Are Real?
Section 31.3's heat map has 195 cells (25 families × 8 bands, at least 300 games each). In 140 of them White's score interval excludes 50% — but that is uninteresting, because White's first-move edge alone puts most cells above 50%. The miner's real question is sharper: does this opening, at this level, do better or worse than the typical opening at this level? Subtract each band's average rating-adjusted score (White's edge) from every game's adj, and test each cell against zero.
With 183 testable cells, about nine would look "significant" at the 5% level even if no opening differed from any other. So how do you know which of your findings are real? The cleanest answer a big database allows: split it in two and check.
📐 Definition: Split-half replication. Assign each game at random (a seeded hash of its id) to half A or half B. Compute every cell in both halves. A cell replicates if it is significant (|z| ≥ 1.96) in A and significant with the same sign in B. Report the number of cells significant in A, the number that replicate, and the correlation of cell values between halves. To ask whether a finding generalises to other players, split by player instead of by game.
random games : cells 183, significant in A 63, replicate in B 42 (67%), r(A,B) = 0.55, sign agreement 73%
by White player: cells 183, significant in A 57, replicate in B 40 (70%), r(A,B) = 0.70, sign agreement 75%
top-5 cells in A: mean +3.09 in A -> +2.77 in B (all four Scotch cells below 1800, Vienna 1600-1799)
bottom-5 cells in A: mean -3.34 in A -> -1.45 in B (Englund Gambit 2200-2399: -5.41 -> +0.78)
2% subsample (52,331 games): cells 133, significant in A 10, replicate in B 0, r(A,B) = 0.02

📊 Figure (described): Each dot is an opening-family × band cell (family minus band average, rating-adjusted points), half A on the x-axis and half B on the y-axis. Blue dots are significant in both halves with the same sign; red dots are significant only in A. With 2.6 million games the cloud lines up along the diagonal (r = 0.55 by random game, 0.70 by White player); most of the red dots sit near the centre, and the extreme cells shrink toward zero in the other half.
Three lessons, in increasing order of importance:
- With millions of games, many findings are real. Two-thirds of the cells significant in half A replicate in half B, far beyond the nine expected by chance. The Scotch's edge (+3.38 → +3.14 at 1200–1399) is one of them; so is the French at 1600–1799 being slightly worse than average for White.
- The extremes shrink. The five best cells in half A averaged +3.09 and fell to +2.77 in half B; the five worst averaged −3.34 and fell to −1.45. The single most negative cell, the Englund Gambit at 2200–2399 (−5.41), came out positive (+0.78) in the other half. If you sort a table and read off the top and bottom rows, you are reading the noisiest cells. This is regression to the mean, and it is why "the best opening at your level" lists are always less impressive the second time.
- With a club-sized database, almost nothing replicates. Take a random 2% of the games — 52,331, still more than most players will ever look at — and repeat. Ten cells come out significant in half A, about what chance alone predicts; none replicates; the correlation between halves is 0.02. Case study 2 follows this curve across database sizes.
🔍 Why this works: A split half is a second, independent sample from the same population, so a real effect should appear in both and noise should not. It is a direct, assumption-light test of the question "would I see this again?". It is not a test of causation — confounding replicates perfectly well (if Scotch players are systematically different, both halves contain those players). Splitting by player rather than by game is a stronger test: it asks whether the effect belongs to the opening or to a few heavy users of it. Here the by-player correlation (0.70) was higher, not lower, than the by-game one, which suggests the opening effects are not driven by a handful of prolific accounts.
For a single player — Dev, Grace, you — the implication is uncomfortable but useful. Your 500 games split into 25 openings are a 2%-subsample problem, not a 2.6-million-game problem. Treat a striking per-opening number as a hypothesis, compute its interval, and check it against the population (Anchor C's lesson), before you change what you play.
🔄 Check your understanding 1. In half A the Englund Gambit at 2200–2399 was the worst cell (−5.41); in half B it was +0.78. What is the general name for this, and when should you expect it? 2. Why can a confounded finding replicate perfectly in a split-half test?
Answer
- Regression to the mean: when you select the most extreme cells from a noisy table, part of their extremeness is noise, which does not repeat in new data. Expect it whenever you sort and read the top or bottom of a table — especially with small cells.
- Because both halves come from the same population; if a group of players is systematically different, both halves contain them. Replication tests "is it noise?", not "is it causal?".
31.10 Building Your Own Query Tools
Everything above runs on the book's prepared tables, but the same method works on your own games, on a PGN download from any site, or on a monthly Lichess dump. The workflow, in the order you should build it:
- Ingest once, query many times. Stream the PGN with
chessdata.iter_pgn_text(or python-chess'schess.pgn.read_headersfor headers only), write one row per game — headers, ratings, result, plies and the raw move text — to a Parquet file, and never parse the PGN again. For your own few thousand games this takes seconds; for a month of Lichess it is an overnight job worth doing exactly once. - Normalise the awkward columns at load time. Results as numbers, ratings as floats with missing values as missing (not zero), titles as strings with missing filled, time controls parsed into base and increment, speeds by a stated rule. The toolkit's caveats are a good checklist: string-typed "True"/"False" flags must be mapped, never cast with
.astype(bool); bot titles must be tested NA-safely. - Index the opening once. A prefix index of the first 16 plies (as in Section 31.4) answers almost every opening question; a full position index (a key per position per game) is only needed for middlegame or endgame position searches, and is much larger.
- Put the summary in one function. One
summarisethat always returns n, effective n, score, interval, draw rate, Elo-expected and rating-adjusted score means you can never "forget" the interval or the sample size. - Visualise with the uncertainty on the picture. Error bars or shaded intervals on every score; heat maps with low-count cells masked (we used 300 games for family × band cells and 500 cases for squares); the number of games in every title or caption. A beautiful heat map with three-game cells is a random-number generator.
📋 Try it — Database research: Pick an opening you play. Using
outpost.database, (a) query its main position in the Lichess index and the OTB index; (b) print the next-move table for the side to move, with the score and interval after each reply; (c) find the most common reply whose score is worst for the side that chose it, and ask Stockfish 19 at depth 20 whether it is a real mistake (as 4...Nxd4 was in the Scotch) or just a less popular move. Write two sentences: what the database says, and what the engine says about why.
Worked answer (Italian Game, 3.Bc4, Black to move)
From
code/out_04_position_queries.txt: Lichess replies 3...Nf6 34.5% (White 52.3% [51.1–53.5]), 3...Bc5 30.5% (51.1% [49.8–52.4]), 3...h6 13.3% (51.9% [49.9–53.9]), 3...d6 7.5% (51.6% [48.9–54.3]); OTB 3...Bc5 47.0% and 3...Nf6 45.9%. All the intervals overlap — no reply is a clear mistake at club level. Stockfish 19 (MultiPV 3, depth 20,code/out_08_exercise_positions.txt) ranks 3...Bc5 and 3...Nf6 equal at +0.23 and 3...Be7 third at +0.44; 3...h6 is not in the top three. What the database says: club players' fourth-most-popular move (3...h6) costs them little in practice. What the engine says: it is a tempo the main moves do not waste — the difference shows up at higher levels, where 3...h6 has almost disappeared (0.8% of OTB replies).
Spaced Review
Three earlier ideas, revisited through this chapter's lens. Try each before reading the reminder.
- Chapter 2 — pawn structure tells you the plan. In Section 31.4 the QGD Exchange query found that 44% of OTB games reached the position by transposition. Why does that make a structure label (Carlsbad) a better unit of analysis than an opening name? Reminder: the structure is what both players actually face, however they got there; Chapter 2's minority attack (b4–b5, 9.1% of 11,934 OTB Carlsbad games) is a plan for a skeleton, not a move order.
- Chapter 13 — the clock is a resource. What did Chapter 13 find about level positions at move 25 and later time trouble, and how does Section 31.8 extend it? Reminder: from level positions, OTB players who later fell below five minutes scored 44.0% against 54.3% for those who did not; here, at 3+0, players who spent the most clock by move 15 scored worse even from equal engine evaluations, while at 10+0 the effect disappeared.
- Chapter 20 — confidence intervals before conclusions. What was Dev's Najdorf number, and what did this chapter add? Reminder: 36.0% [24.1–49.9] over 50 games against a band census of 44.3% — the interval overlapped the expectation. This chapter showed that the database's side of the comparison was thin too: 203 effective Lichess games in the position at all levels, none in any single band.
Project Checkpoint: database.py
Dev's module for this chapter is the one every later chapter quietly depends on: a query engine. project/outpost/database.py packages the chapter's habits as functions:
| Function | What it does |
|---|---|
load_lichess(columns, speeds, balanced, exclude_bots, min_avg, max_avg) |
column-pruned Lichess loader with the book's filters and rating columns |
load_otb(columns, speeds, balanced, require_ratings) |
the human OTB set (Standard, completed, no engine/online events, no bots) |
load_features(source, columns) |
game_features with string flags mapped to real booleans and sample_weight kept |
add_rating_cols(df), band_of(avg), expected(ra, rb), family(opening) |
avg rating, band (<1200 merged), Elo expectation, rating-adjusted score, opening family |
summarise(df, by, weight=None, min_n=0) |
n, Kish n, score, Wilson interval, draw %, expected %, adj |
wilson(points, n), kish_n(w), split_half(df, by, key, value, min_n) |
intervals, effective sample size, replication |
san_prefix, build_prefix_index, load_movetext |
streaming move-text tools |
line_tokens, board_after, query_line(index, moves), transposition_recall(...) |
validated position queries, exact and by transposition |
heatmap(piece, source, value, min_n, exclude_back_rank), piece_list(board) |
heat-map dicts for boards.draw_board, the position line |
The demo (code/project_checkpoint.py) turns Dev's question into position queries: his own White games against the Lichess database at his level (blitz, White rated 1550–1750, no bots), both sides with intervals:
for name, line in (("Italian, 3.Bc4", "e4 e5 Nf3 Nc6 Bc4"),
("Najdorf English Attack, 6.Be3", "e4 c5 Nf3 d6 d4 cxd4 Nxd4 Nf6 Nc3 a6 Be3")):
mine = db.query_line(dev_idx, line).merge(dev_idx[["game_id", "persona_score", "elo_expected"]], on="game_id")
ref = db.query_line(idx, line).merge(idx[["game_id", "w", "score_white", "exp_white"]], on="game_id")
m = db.summarise(mine.assign(k=name), "k", score="persona_score", exp="elo_expected").iloc[0]
r = db.summarise(ref.assign(k=name), "k", weight="w").iloc[0]
overlap = not (m.lo > r.hi or m.hi < r.lo)
Italian, 3.Bc4:
Dev n= 70 score 67.9% [56.2-77.6] Elo-expected 51.1%
database n=3078 (Kish 2077) score 52.7% [50.5-54.8] Elo-expected 50.3% transpositions 265
verdict: intervals separate - a real difference
Najdorf English Attack, 6.Be3:
Dev n= 19 score 26.3% [11.8-48.8] Elo-expected 44.1%
database n= 8 (Kish 4) score 47.7% [13.0-84.8] Elo-expected 41.8% transpositions 3
verdict: intervals overlap - no evidence of a difference
The position query finds 70 of Dev's White games at the exact 3.Bc4 position, against the 80 games that carry the "Italian Game" name in his record — the name and the position are not the same set — and on the position he still clears the database comfortably. His Najdorf comparison collapses further than in Chapter 20: only 19 of his English Attack games have move text, and the database has just 8 games with move text in that position for White players rated 1550–1750 at blitz. The honest verdict is "no evidence either way" — and the honest next step is to study the line because it is sharp and he meets it, not because a number looked bad.
The demo also runs a split-half check on the Italian family by band (all Lichess blitz, balanced): only two of seven bands replicate, so even the database's own band pattern for one opening is mostly noise below the level of a few points. Later modules can build on it: load_features and summarise fit accuracy-by-band tables (Chapter 32), query_line fits an opening dashboard (Chapter 35), and a query command is a natural addition to the command-line tool assembled in Chapter 40.
Chapter Summary
| Principle | What the data showed | What to do |
|---|---|---|
| Know exactly what you mined | 4,471,751 games (+6,193,530 puzzles = 10,665,281 records); a 34.2-hour Lichess window with a time-of-day mix | State sources, windows and counts with every number |
| Every filter is an assumption | Bots: humans scored 36.5–39.0% against them; unbalanced games: 68.5% / 34.2%; OTB engine events 50.0% draws; balancing OTB raises draws 25.7% → 34.6% | Apply the standard filters NA-safely; print the count after each |
| Who plays it is part of the score | r = 0.74 between families' raw and expected scores; OTB raw 48.9–59.4% vs adjusted +2.0 to +4.3 | Compare openings by rating-adjusted score in balanced games |
| Query positions, not names | Transposition share: Italian 7.1%, QGD Exchange 70.6%, London 63.6% (Lichess) | Index once; query exact + transposition; validate against a known table |
| Weight designed samples | Unweighted move-text subset: bullet share 29.5% vs true 35.9%; weighted 35.88%; analysed-only 20.7% | Use sample_weight and Kish n; label eval-based Lichess numbers "analysed games" |
| Frequency is not quality | Knight squares: frequency vs adj Spearman −0.12 OTB; f3 33.4% of games, adj +0.1 | Plot outcomes, mask low counts, drop capture-artefact squares |
| The definition is the finding | One pawn up OTB 2400+: 41.6% (entry) vs 46.0% (settled) vs 46.1% (stable); median eval +0.40 at 2400+ vs +1.80 at 1400–1599 | Define "start", check with the engine, condition on eval |
| Beware reverse causality | Low-clock players −16 to −18 pts; slow early play costs at 3+0 even from equal evals, not at 10+0 | Use pre-outcome predictors and control for the position |
| Replicate before you believe | Full data: 42 of 63 findings replicate; 2% subsample: 0 of 10 | Split-half every mined table; distrust the extremes |
Decision checklist for any database claim: (1) Which games — source, window, filters, n? (2) Which comparison — balanced? rating-adjusted? weighted? (3) Which definition — of the opening (name or position), the phase, the advantage? (4) How wide is the interval, on both sides of the comparison? (5) Does it replicate in the other half? (6) What does the engine say about why?
What's Next
Chapter 32 turns from counting results to measuring moves: average centipawn loss, accuracy and blunder rates computed at scale, how Lichess's stored evaluations compare with our own Stockfish 19 runs on the same games, and why an accuracy number depends on the position as much as on the player. Every lesson from this chapter — filters, weights, self-selection, definitions — comes with it.