From 1ca3309dad9d412870b2b793f33af7a7ccabd514 Mon Sep 17 00:00:00 2001 From: tslil Date: Thu, 3 Sep 2026 20:17:22 +0100 Subject: TD-leaf and another negamax bug TD-lambda and TD-leaf are separated by the observation that minimax with a parameterised leaf heuristic is differentiable* in the parameters. "All" that had to be done was to extract the "principal variation": which one position survived all of the pruning to become the reported value. This was a bit fiddly and uncovered a subtle bug (again) in negamax.c: we were not being complete in our overriding of the TT entry and by omitting key it was possible that later searches would find incorrect values. The more interesting question to me was: how do we introduce enough variety while not corrupting the PV chain? I settled on having selfplay have one of the players be epsilon-random but the other greedy (minimax) and simply report only the greedy portion PV chain. This appears to work well enough in practice and doesn't introduce nonsense training data for the net (we don't force its actions to be nonsensical). I also deciced, perhaps in a departure from tradition, that we had good supervised labels for PVs that happened to be winning states, so the training overrides the targets in that case. Finally rolled back some of the ambition in nn_train.py default arguments. *almost always --- include/actions.c | 1 + 1 file changed, 1 insertion(+) (limited to 'include/actions.c') diff --git a/include/actions.c b/include/actions.c index 9b2ae0d..541b388 100644 --- a/include/actions.c +++ b/include/actions.c @@ -337,6 +337,7 @@ void action_undo(tak_state_p state, const action_t action) { if (A_GET_TYPE(action) == A_PLACE) { const uint8_t black = (state->current_colour == C_BLACK); state->celldat[loc] = 0; + state->colours[loc] = 0; if (A_GET_DATA0(action) == STONE_CAPSTONE) { if (black) state->black_count |= 0x80; -- cgit v1.3.1