<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ctak/include/nn.h, branch hybrid_rootstrap</title>
<subtitle>An implementation of Tak and a computer opponent in C</subtitle>
<id>https://git.l-3.space/ctak/atom/include/nn.h?h=hybrid_rootstrap</id>
<link rel='self' href='https://git.l-3.space/ctak/atom/include/nn.h?h=hybrid_rootstrap'/>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/'/>
<updated>2026-09-16T20:02:53Z</updated>
<entry>
<title>fix tt issue for non-self-play</title>
<updated>2026-09-16T20:02:53Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-16T19:10:33Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=1898add0142b70b3fef5af78a6f3d7399a3f2cd5'/>
<id>urn:sha1:1898add0142b70b3fef5af78a6f3d7399a3f2cd5</id>
<content type='text'>
A little subtle, but in non-self-play games sharing tt entries is incorrect. We must therefore key additionally on the evaulation function itself.
</content>
</entry>
<entry>
<title>credit Mitchell Riley: we can drop 65 parameters for about the same strength; also train for longer</title>
<updated>2026-09-10T20:04:40Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-10T13:12:41Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=220a4b79e4b6d742a9ca7c278a1962b870500fbc'/>
<id>urn:sha1:220a4b79e4b6d742a9ca7c278a1962b870500fbc</id>
<content type='text'>
The idea is that the current model is M_theta(board, ply) = "score for player 0", but we can instead create a different model M'_theta(board) = "score for player 0 assuming that it's player 0's move" and for a certain pair of functions sigma, normalise, recover M_theta(board, ply) = sigma(ply) M'_theta(normalise(board, ply)).

This pair of functions is sigma(ply) = +/- 1 (parity), and normalise being a conditional interchange of pieces on the board depending on the parity of the ply. The only things stopping this from being completely straightforward is that nn_train.py evaluates M'_theta itself so we need to pass sigma(ply) to the training loop.

6x6 is still untrained.
</content>
</entry>
<entry>
<title>~25% speedup in selfplay due to: incremental zobrist hashing, smarter road checking, re-using the input computed for the NN</title>
<updated>2026-09-09T20:45:17Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-08T10:55:28Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=1c9e266ae25f7f6067806d139e5971ce8513d2f6'/>
<id>urn:sha1:1c9e266ae25f7f6067806d139e5971ce8513d2f6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>TD-leaf and another negamax bug</title>
<updated>2026-09-04T20:03:59Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-09-03T19:17:22Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=1ca3309dad9d412870b2b793f33af7a7ccabd514'/>
<id>urn:sha1:1ca3309dad9d412870b2b793f33af7a7ccabd514</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>TD(lambda), and a big rework</title>
<updated>2026-09-02T11:13:01Z</updated>
<author>
<name>tslil</name>
<email>tslil@posteo.de</email>
</author>
<published>2026-08-30T18:46:07Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=241156da6f35cb888253e6b8814e7b61a76b4fc7'/>
<id>urn:sha1:241156da6f35cb888253e6b8814e7b61a76b4fc7</id>
<content type='text'>
NOTE: 6x6 weights are as-yet untrained

On the performance side:
* switch from linked-list chaining hash table to direct mapping
* cache check_win by hash
* persist transposition tables across plies (this was a big deal and difficult to puzzle out)
* add align directives to the network floats
* prepare_nn_input gained a small LUT to avoid branching (i suppose you might call this 1D embedding)
* apply mtune=native for the native builds

On the correctness side:
* Zobrist has now includes the ply parity
* the network now predicts something in [-1, 1] using tanh (approximated by polynomials)
* the training object is now MSE because we're learning a value estimate
* use .clangd instead of compile_commands.json

On the training side:
* completely forgo human-derived data set
* implement td(lambda), self-play, tournaments
</content>
</entry>
<entry>
<title>might as well enable size 6</title>
<updated>2023-01-21T21:00:57Z</updated>
<author>
<name>tslil clingman</name>
<email>tslil@posteo.de</email>
</author>
<published>2023-01-21T18:30:45Z</published>
<link rel='alternate' type='text/html' href='https://git.l-3.space/ctak/commit/?id=72c5056c5aa614d9a86f8b760955cfcf96c44be4'/>
<id>urn:sha1:72c5056c5aa614d9a86f8b760955cfcf96c44be4</id>
<content type='text'>
Same network architecture, same training principle. Predictably this is
too slow.

Also statically allocate state in driver programmes.
</content>
</entry>
</feed>
