feat: value network trained on Lc0 data

The static evaluation behind the quiescence search is now a
(768 -> 128)x2 -> 1 SCReLU network instead of the hand-written
evaluation. It was trained with bullet on linrock's Lc0-derived test80
2024-02 binpack, 40 superbatches (10 min on an RTX 3070), final loss
0.0220. The quiescence search itself is unchanged.

The network is embedded with incbin (EVALFILE, default
networks/rigby-value-v1.bin). Q is tanh(cp / 800), the same scale the
network was trained on (sigmoid(cp / 400) = expected score).

Checked: bullet's float evaluation of fixed positions (trainer --check)
and the engine's quantised inference (evalfens) agree within 6 cp; an
integer re-implementation in Python matches the engine exactly. Perft
passes, bench is deterministic.

Bench: 545914

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rektdieandclaude committed 2026-11-15 04:12:52 +01:00
1 parent 530c4d67ed
commit 30b0c36cd5
14 files changed
+700 -68

No files matched your search

+7 -5
View File
@@ -5,7 +5,8 @@ SRC_DIR := src
OBJ_DIR := obj
EXE ?= Rigby
EVALFILE ?=
# The value network embedded into the binary
EVALFILE ?= networks/rigby-value-v1.bin
CXX ?= clang++
ifeq ($(origin CXX),default)
CXX := clang++
@@ -25,7 +26,7 @@ else
endif
endif
CXXFLAGS := -std=c++20 -O3 -flto -Wall -Wextra -DNDEBUG
CXXFLAGS := -std=c++20 -O3 -flto -Wall -Wextra -DNDEBUG -Iexternal
LDFLAGS := -O3 -flto
ifeq ($(PLATFORM),windows)
@@ -55,9 +56,7 @@ else
LDFLAGS += -pthread -static
endif
ifneq ($(EVALFILE),)
CXXFLAGS += -DEVALFILE=\"$(EVALFILE)\"
endif
CXXFLAGS += -DEVALFILE=\"$(EVALFILE)\"
CXXFLAGS += $(ARCH_FLAGS)
LDFLAGS += $(ARCH_FLAGS)
@@ -77,6 +76,9 @@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(OBJ_DIR):
mkdir $(OBJ_DIR)
# Rebuild the network's translation unit when the network changes
$(OBJ_DIR)/nnue.o: $(EVALFILE)
-include $(DEPS)
.PHONY: clean