diff options
| author | Scott Gasch <[email protected]> | 2026-10-23 13:19:17 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-10-23 13:19:17 -0700 |
| commit | 69525eb2f42ea9cca8255f6cc3b85e6b1312fd05 (patch) | |
| tree | d78420b6c45d584a3f09b4dcbaf4f1edb36e8d5d /src/typhoon_nnue | |
| parent | 6b883e83935f5e8110788565cfcb77cd6fbf8950 (diff) | |
NNUE search integration: FH% tables, NODE_TYPE refinement, TREEDUMP rewrite
- data.c/chess.h: widen the joint FH% table's late axis 16->17, dedicating
the new bucket 0 to a whole-node ("will something here fail high at
all") sample rather than sharing it with the first-leftover-move curve.
Add an NNUE-eval counterpart table (g_uJointFHThousandths_NNUE) and an
NNUE counterpart of the beta-side table, selected at runtime based on
whether NNUE eval is active.
- search.c/searchsup.c: add _RefineNodeTypeGuess, which uses the FH%
tables (via g_NodeTypeGuessTable) to refine a node's NODE_TYPE guess
instead of the old heuristic; thread uParentMoveFHEstimate through
PLY_INFO so a node can see its parent's prediction for the move that
led to it.
- generate.c: initialize sKillers[2]/[3].uBonus unconditionally (an
uninitialized-stack read caught by valgrind under LTO; harmless today
but a real bug).
- dumptree.c/chess.h/GNUmakefile: replace the long-dead DUMP_TREE XML
tree dump (written for a GUI this project no longer has) with TREEDUMP,
a flat, path-keyed move/result trace meant to diff against an
identically-instrumented Stockfish build -- see docs/TREEDUMP_FORMAT.md.
- docs/DEEPER_PRUNING.md: notes on closing the search-efficiency gap vs
Stockfish.
- crafty_egtb/stockfish_xboard/typhoon_nnue: wrapper scripts so
match_play.py's Engine class can drive Crafty, Stockfish (via
PolyGlot), and an NNUE-enabled typhoon the same way it drives HCE
typhoon.
- tests/lop: rename lop.txt -> lop.ep_; update compare_lop.cpp.
- annotate_pgns: add aggregate_marginsafety.py, dedup_pgn.py,
fit_lazy_probe.py; update annotate.py/run_nnue_pipeline.py for the NNUE
training pipeline.
- .gitignore: ignore compile_commands.json (clangd build DB) and
eval.nnue (a symlink into the untracked head_reference/ comparison
baseline), neither of which belongs in the repo.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/typhoon_nnue')
| -rwxr-xr-x | src/typhoon_nnue | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/typhoon_nnue b/src/typhoon_nnue new file mode 100755 index 0000000..7996299 --- /dev/null +++ b/src/typhoon_nnue @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# +# typhoon_nnue -- thin wrapper that execs ./typhoon with NNUE eval enabled. +# +# Mirrors the NNUE_WEIGHTS/NNUE_PROBE_WEIGHTS/NNUE_LAZY_MARGIN/ +# NNUE_SUPERLAZY_MARGIN env-var convention used by eval_tune/test_vs_head.sh +# (see that file's header comment and docs/NNUE.md) so the same weights file +# works whether you're driving a head-to-head match or just want to play +# with the NNUE engine interactively/in --batch mode. +# +# Env vars (all optional): +# NNUE_WEIGHTS Path to the main net weights file. Defaults to +# eval.nnue, a symlink (next to this script) into +# head_reference/nnue/current/weights.nnue -- the +# "current best" NNUE generation, promoted only +# via head_reference/nnue/promote.sh after a real +# self-play match (see that script and +# docs/NNUE.md's "Iterating on a net" section). +# Override to run an older/other checkpoint, e.g. +# one of head_reference/nnue/archive/*.nnue or a +# not-yet-promoted candidate straight out of +# annotate_pgns/runs/<rundir>/nnue_ckpt/. +# NNUE_PROBE_WEIGHTS Path to the probe weights file ("NPRB" format). +# Enables the lazy-eval accumulator probe gate. +# No default as of 2026-10-17 -- the old default +# (annotate_pgns/nnue_probe.bin) was fit against +# the PREVIOUS net's accumulator representation; +# since nnue_ckpt_matprobe is a from-scratch +# retrain, that probe is stale/mismatched for it. +# Set this explicitly only once a probe has been +# refit against the current NNUE_WEIGHTS net. +# NNUE_LAZY_MARGIN Flat cp override for every material bucket's +# lazy-probe margin (requires NNUE_PROBE_WEIGHTS). +# NNUE_SUPERLAZY_MARGIN Flat cp margin for the even-cheaper material-only +# pre-filter (off by default). +# +# The binary path defaults to ./typhoon next to this script; override by +# setting TYPHOON_BIN. +# +# Usage: +# NNUE_WEIGHTS=/path/to/net.nnue ./typhoon_nnue [engine args...] + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +BIN="${TYPHOON_BIN:-${SCRIPT_DIR}/typhoon}" + +NNUE_WEIGHTS="${NNUE_WEIGHTS:-${SCRIPT_DIR}/eval.nnue}" +#NNUE_WEIGHTS="/home/scott/typhoon/annotate_pgns/runs/sf_20261020_recal/nnue_weights.nnue" + +if [ ! -f "$NNUE_WEIGHTS" ]; then + echo "typhoon_nnue: NNUE_WEIGHTS file not found: $NNUE_WEIGHTS" >&2 + exit 1 +fi + +if [ ! -x "$BIN" ]; then + echo "typhoon_nnue: engine binary not found or not executable: $BIN" >&2 + echo " (build it first, or set TYPHOON_BIN to an existing binary)" >&2 + exit 1 +fi + +NNUE_PROBE_WEIGHTS="${NNUE_PROBE_WEIGHTS-}" + +ARGS=(--nnueweights "$NNUE_WEIGHTS") + +if [ -n "$NNUE_PROBE_WEIGHTS" ] && [ -f "$NNUE_PROBE_WEIGHTS" ]; then + ARGS+=(--nnueprobeweights "$NNUE_PROBE_WEIGHTS") + if [ -n "${NNUE_LAZY_MARGIN:-}" ]; then + ARGS+=(--nnuelazymargin "$NNUE_LAZY_MARGIN") + fi +fi + +if [ -n "${NNUE_SUPERLAZY_MARGIN:-}" ]; then + ARGS+=(--nnuesuperlazymargin "$NNUE_SUPERLAZY_MARGIN") +fi + +exec "$BIN" "${ARGS[@]}" "$@" |
