0113. Analyse at 1 million nodes: the protocol EXP-0008 chose
Source:
docs/decisions/0113-analyse-at-1-million-nodes.md. Generated at build time; edit the source file.
Date: 2026-11-24. Status: accepted (lane depth1m, branch feat/analyse-1m-nodes, issue #128). Builds on ADRs 0007, 0104, 0105, 0109 (Amendment 1) and ADR-R2-14. Ships as algo-4.0.0.
Context
Section titled “Context”The main analysis searched every position at 300,000 nodes (ENGINE_NODES, protocol sf19-n300k-v1, ADR 0007). EXP-0008 measured that count against a 30-million-node Stockfish 19 reference on 160 rated rapid Lichess games (lab/experiments/EXP-0008/decision.md). By its registered rule (section 9, rule 1) 300,000 falls short: 1 million nodes disagrees with the reference on 0.0246 of moves fewer, 95% [0.0197, 0.0296], and on 0.0221 fewer [0.0115, 0.0327] against a 100-million-node reference on 40 of the games, both wholly above the tolerance of 0.01. 7.45% of move labels change between the two counts, mostly fewer inaccuracies, and game accuracy falls by 0.42 of a point on average. The engine costs 39.1 CPU-seconds a game of that sample instead of 11.8, 3.3 times as much. The decision asks for the count as a major algorithm version in its own pull request.
Decision
Section titled “Decision”-
ENGINE_NODESis 1,000,000 andANALYSIS_PROTOCOLissf19-n1m-v1(backend/crates/engine/src/types.rs), with one thread, 16 MB of hash anducinewgamebefore every search, as EXP-0008 measured. The TS reference worker (apps/worker/src/engine/protocol.ts) mirrors both, so the parity harness (ADR 0038) compares like with like. -
The hash stays 16 MB. EXP-0008 measured 1 million nodes at 16 MB and its rule chose “1 million, with production’s one thread and 16 MB of hash, as measured”; it has no data on another size. Determinism does not depend on the size: one thread, a fixed node count and
ucinewgamegive the same search every time, which the run’s 72 re-searched positions confirm (12 a setting, every one identical to its cached search). A larger hash could change labels, and only an experiment can say whether for the better. -
The enrichment’s MultiPV probe keeps 300,000 nodes (
enrich::protocol::MULTIPV_NODES, protocolsf19-n300k-mpv3-v1unchanged). It usedENGINE_NODESuntil now, so the bump would have moved it too, under a protocol id that still says 300k. EXP-0008 measured the MultiPV-1 search only, so the probe stays as it was, its cached rows stay valid and no game is re-enriched for this version. The manifest names the count (facts.enrichment.multipv_nodes). Whether the probe should follow is EXP-0027’s to measure, with the top weaknesses.cli lab analyseis unchanged: it serves every search, the enrichment’s included, at the one count its request names (defaultENGINE_NODES), as it always did (ADR 0100), so a lab run at its default searches the probe at 1 million where production does not. -
A major version,
algo-4.0.0. The replay goldens are regenerated and differ fromalgo-3.0.0’s only in the protocol label and the version: the replay searches at 3,000 nodes, so no number moves (backend/fixtures/replay/).bench/baseline.jsonstands: the bench searches at its own 12,000 nodes (bench::memo). -
Stored analyses are not redone. A game analysed at 300,000 nodes keeps its moves, labels, accuracy and
analysis_protocol = 'sf19-n300k-v1'; itsposition_evalsrows stay under that protocol. New games, and any game analysed again (a re-analysis, a requeue for enrichment), are searched at 1 million, because the eval cache is keyed by protocol and has no 1-million row yet. A player’s profile therefore mixes the two counts until their older games age out of the window; the KPI snapshots a build writes are stamped with the current protocol even when some of their games are older, while each history row keeps its game’s own. Whether to re-analyse stored games, at 3.3 CPU-hours per 300, is EXP-0027’s question (do a player’s top weaknesses change between the two counts).Two paths still treat a game as current only under the current protocol, and so skip a 300,000-node game until it is re-analysed. Neither runs because of this version; both bite at the next change that triggers them:
profile::requeue::recompute_game_features(the stale-metrics recompute ofmark_stale_metricsand the Maia difficulty sweep) clears the mark of an older-protocol game without rewriting it, so a laterPLAYER_GAME_METRICS_VERSIONbump or a Maia difficulty result does not reach it.profile::peer_benchmark::compute_opponent_metricsevaluates cache-only under the current protocol, so an older game whoseopponent_game_metricsrow is missing or stale is skipped as uncached. Every game analysed before the upgrade already has its row, which stays.
The change that next bumps either version must read each game under its own protocol (an
EvaluateDepsread protocol, cache-only) or re-analyse; EXP-0027 decides which. -
The web and the chat read a game’s evals under its own protocol. The web already did (
review.ts,weaknesses.ts). The chat did not:DbCoachDataSourcereadposition_evalsunder the current constant, so every game analysed before the upgrade would have lost its engine line in the chat.get_positionnow reads undergames.analysis_protocol, andget_cached_evaltakes the current protocol’s row, else the newest ofengine::EARLIER_ANALYSIS_PROTOCOLS(["sf19-n300k-v1"]), never any other. The coach is not told which count a fallback eval came from. -
The pipeline is re-costed.
scheduler::lag::DEFAULT_CPU_MS_PER_GAME, the fallback when no game finished in the last 24 hours, is 39,000 ms (was 12,000). The ETA (scheduler::eta,cli etaand its web mirrorapps/web/src/server/sync/eta.ts) divides by the measured throughput of the last 10 minutes, so it follows the new cost without a constant;cli queue-lag’s thresholds are times (3 minutes of P0 lag, 15 idle, 600 s a server), and its backlog in core-seconds uses the measured mean, so neither needs a new number. A 90-day import of 300 rapid games is about 3.3 CPU-hours of engine time instead of 1.0: about 49 minutes on 4 engines and 25 on 8 (the pool runsmin(cores − 2, 8)engines unlessWORKER_POOL_SIZEsays otherwise), the engine stage only. The band reference’s own games are analysed under the same protocol, so they cost 3.3 times as much too. -
EXP-0008’s evaluation cache is re-keyed, not re-searched. Its cache files are named by the Stockfish build and the engine crate’s source digest (
exp08-evals/<setting>-<nodes>-<hash>-<tables>-<sf sha256[:12]>-<digest[:12]>.jsonl). This version changes the crate’s digest without changing any search at a stated node count, so each file was copied to the new digest (cf18431a59f9tobb29f3829fa8) in the data directory:for f in *-cf18431a59f9.jsonl; do cp -p "$f" "${f%-cf18431a59f9.jsonl}-bb29f3829fa8.jsonl"; done. The run’s own re-searches (12 a setting, without the cache) then check the copies. Without the copy the arena’s re-run would search everything again, about 19.5 CPU-hours. -
Two comment-only changes are reviewed for EXP-0001.
backend/crates/bench/src/lab.rsandbackend/crates/bench/src/memo.rssit under EXP-0001’sSOURCE_PATHS; only their doc comments changed (they named 300,000 as the production count). Both are listed inlab/source-reviews.jsonwith this ADR. EXP-0001 runs the bench at 12,000 nodes, which no line of this version touches.
Options considered
Section titled “Options considered”- Re-analyse every stored game on upgrade. Rejected for now: 3.3 CPU-hours per 300 games, before anyone knows whether a player’s top weaknesses change (EXP-0027). Mixing counts in one profile is the cost of waiting, and it is written down here.
- Move the MultiPV probe to 1 million too. Rejected: not measured, and it would re-enrich every stored game under a new MultiPV protocol.
- A larger hash with the higher count. Rejected: EXP-0008 measured 16 MB, and a change of hash is a change of protocol that needs its own measurement.
- The cheaper hybrid (100,000 and 300,000 everywhere, 1 million only where they disagree, about 22 CPU-seconds a game). Not choosable: it was found after seeing EXP-0008’s results and is EXP-0028’s challenger on new games.
Consequences
Section titled “Consequences”- The release arena against
algo-3.0.0: see the CHANGELOG entry foralgo-4.0.0andlab/leaderboard.json. - A self-hosted import takes about 3.3 times as long. The README and the getting-started page say so.
- EXP-0009 runs at 1 million nodes, as its catalogue entry says.
- The next protocol change adds
sf19-n1m-v1toEARLIER_ANALYSIS_PROTOCOLS, so the chat keeps reading it.