diff options
| author | Scott Gasch <[email protected]> | 2026-09-14 11:54:30 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-09-14 11:54:30 -0700 |
| commit | ca73728f7dbf01c4b39c7496729f81b1fbffa00b (patch) | |
| tree | fa0b28d21da015dbd7e1abb36054a979c20d5c8c /src | |
| parent | 4ff9170fd96e3da049c747bf5215e908a94ff145 (diff) | |
Fix KING_QUEEN_PROXIMITY_DANGER's missing material scaling and settle
on -14/count after isolated self-play testing.
The 2026-09-14 commit's -32/count rescale (and a -21/count trim of it)
both tested net negative in isolated self-play against a file-storm-
only baseline (2780 games score 0.490 llr -1.91; 520 games score 0.480
llr -0.63) despite the underlying regression signal looking directionally
real. Root cause wasn't the raw magnitude -- this term applied at full
strength regardless of attacker material, unlike the main counter-based
king-safety score just above it, which tapers via
REDUCED_MATERIAL_DOWN_SCALER/8. Adding that same scaling here was the
bigger fix (770 games score 0.494 llr -0.34, nearly flat); trimming the
now-scaled magnitude a further ~33% to -14/count tipped it positive
(690 games score 0.522 llr +0.60, trending toward H1).
KING_BACK_FLIGHT_BONUS (still +1/square, unchanged since 4ff9170) rode
along in all of these isolated matches without being implicated -- no
evidence yet that it's a problem on its own.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9EDZVcqu6E2bNRm4zDrTf
Diffstat (limited to 'src')
| -rw-r--r-- | src/eval.c | 41 |
1 files changed, 34 insertions, 7 deletions
@@ -627,7 +627,7 @@ static SCORE QUEEN_KING_TROPISM[8] = // King eval terms // --------------------------------------------------------------------------- // -static ULONG KING_INITIAL_COUNTER_BY_LOCATION[2][128] = +static ULONG KING_INITIAL_COUNTER_BY_LOCATION[2][128] = { { 1, 0, 0, 0, 1, 0, 0, 1, 0,0,0,0,0,0,0,0, @@ -653,7 +653,7 @@ static ULONG KING_INITIAL_COUNTER_BY_LOCATION[2][128] = } }; -static SCORE KING_TO_CENTER[128] = +static SCORE KING_TO_CENTER[128] = { +0, +0, +0, +0, +0, +0, +0, +0, 0,0,0,0,0,0,0,0, +1, +3, +5, +7, +7, +5, +3, +1, 0,0,0,0,0,0,0,0, @@ -726,11 +726,25 @@ static SCORE KING_SAFETY_BY_COUNTER[42] = // tables below which feed the separate uCounter/KING_SAFETY_BY_COUNTER // lookup and need their own, different calibration) -- see // (misscastleshort_live / misscastleshort_raw_coef) = k, then -// k * queenproximity_raw_coef =~ -32/count. Validate via the usual -// sd10 + self-play gate before trusting this magnitude. +// k * queenproximity_raw_coef =~ -32/count. +// +// -32/count self-play-tested net negative (2780 games, score 0.490, +// llr -1.91 trending to H0) alongside the back-flight bonus below -- +// consistent with this term's own weaker calibration confidence flagged +// up front (anchored against misscastleshort's never-independently- +// validated historical value, a bigger single-step jump than the +// file-storm retune's already-large ~1.75-2x). Direction still looks +// right (a real, non-collinear predictor), so trimmed 33% to -21/count +// rather than reverted outright. Re-validate via sd10 + self-play +// before trusting this magnitude either. +// -21/count + material scaling (see above) pulled self-play from +// clearly negative (score 0.490, llr -1.91 unscaled) to nearly flat +// (770 games, score 0.494, llr -0.34, drifting slowly) -- scaling was +// the bigger fix, but still trending slightly negative. Trimmed +// another ~33% to -14/count. static SCORE KING_QUEEN_PROXIMITY_DANGER[7] = -{// 0 1 2 3 4 5 6 - +0, -32, -64, -96, -128, -160, -192 +{// 0 1 2 3 4 5 6 + +0, -14, -28, -42, -56, -70, -84 }; static SCORE KING_MISSING_ONE_CASTLE_OPTION = -23; @@ -4570,12 +4584,25 @@ Return value: i, "king safety"); + // 2026-09-15: this term used to apply at full, unscaled magnitude + // regardless of how much material the attacker had left -- unlike + // the main counter-based king-safety score just above, which is + // multiplied by REDUCED_MATERIAL_DOWN_SCALER/8 (a step function at + // DO_KING_SAFETY_THRESHOLD, full strength only once the attacker + // has roughly queen+2R+2m). Self-play at both -32/count and -21/ + // count came back net negative (2780 games score 0.490 llr -1.91; + // 520 games score 0.480 llr -0.63) even after trimming magnitude + // 33% -- the scaling gap, not just the raw weight, looks like the + // real defect: a position barely past DO_KING_SAFETY_THRESHOLD was + // getting the same full penalty as a position with a full army. + // Matching the main term's scaling here instead of trimming further. ASSERT(uQueenNearKing <= 10); EVAL_TERM(uColor, KING, c, iKingScore, - KING_QUEEN_PROXIMITY_DANGER[MINU(uQueenNearKing, 6)], + (SCORE)((KING_QUEEN_PROXIMITY_DANGER[MINU(uQueenNearKing, 6)] * + (SCORE)REDUCED_MATERIAL_DOWN_SCALER[pos->uArmyScaler[xColor]]) / 8), "queen proximity danger"); ASSERT(uBackFlightSquares <= 3); |
