为 Lichess 调整 nnue-pytorch 的二进制位置格式

Lichess stores many chess positions and now does it more efficiently (thanks to Stockfish). Games on Lichess are stored as sequences of compressed moves. Previously, FEN or a similar custom format was used. The requirements for a successor format are to store the same information as FEN, support all Lichess variants including illegal positions, be easily reversible, and have similar reading/writing speed as FEN.
Stockfish developers also store lots of positions as training data. The new format is simple and good. The first 64 bits encode occupied squares. Nibbles are used to encode pieces. There are 4 additional special piece types. Small tweaks are needed for some contexts like adding move counters and variant data. If necessary, move counters are encoded using LEB128.
For cloud evaluation storage, the new format saves 56% compared to FEN. The average study chapter has a 63% reduction in position data size. Byte-aligned encoding/decoding makes it easier to create a fast implementation, and reading and writing are roughly 50 times faster than the FEN parser. The next step is to migrate the study chapter collection.

阅读 14
0 条评论