|
Download README.md from AngeloWolff/snail-chess-data: direct link, hf CLI and curl.
- Browser
- Download file 5.65 kB
-
https://huggingface.co/datasets/AngeloWolff/snail-chess-data/resolve/main/README.md
- Command line
-
hf download hf://datasets/AngeloWolff/snail-chess-data/README.md
-
curl -L -o README.md https://huggingface.co/datasets/AngeloWolff/snail-chess-data/resolve/main/README.md
5.65 kB
| license: cc-by-4.0 | |
| pretty_name: Snail Chess Data | |
| tags: | |
| - chess | |
| - self-play | |
| - evaluation | |
| size_categories: | |
| - 100M<n<1B | |
| viewer: false | |
| # Snail Chess Data | |
| Chess positions from self-play games of [Snail Chess](https://github.com/CodeAdopter/Snail-Chess), the engine behind [Snail Chess GUI](https://github.com/CodeAdopter/Snail-Chess-Gui). Each position has the engine's search score and the game result. This is the data that trained **Shell**, Snail's evaluation network. | |
| | | | | |
| |---|---| | |
| | Positions | 115.4 million | | |
| | Games | 1,373,615 | | |
| | Download | 1.1 GB (3.8 GB unpacked) | | |
| | License | CC BY 4.0 | | |
| ## Quick start | |
| ```sh | |
| pip install -U huggingface_hub numpy | |
| hf download AngeloWolff/snail-chess-data --repo-type dataset --local-dir snail-chess-data | |
| ``` | |
| Add `--include "data/gen6/*" --include "*.py"` to download a single generation. | |
| ```python | |
| import snail_data | |
| records = snail_data.read("snail-chess-data/data/gen6/part00.bin.xz") | |
| print(snail_data.to_fen(records[0])) # r1bqkb1r/ppp1ppp1/2np1n1p/8/3P4/3QPN2/PPP1BPPP/RNB1K2R b - - 0 1 | |
| print(records[0]["score"]) # search score in centipawns, White's view | |
| print(records[0]["result"]) # 0 = black won, 1 = draw, 2 = white won | |
| batch = records[:4096] | |
| x = snail_data.planes(batch) # one-hot piece planes, shape (4096, 768) | |
| y = snail_data.target(batch) # sigmoid(score / 120), the training target | |
| ``` | |
| ## Generations | |
| Snail learned by playing itself. Its old hand-written eval played the first games, a Shell net was trained on them, and each new net played the next generation. | |
| | Generation | Positions | Played by | Nodes per move | | |
| |---|---|---|---| | |
| | gen0 | 10,962,132 | Snail Chess 1.15 (hand-written eval) | 5,000 | | |
| | gen0b | 11,819,836 | Snail Chess 1.15 (hand-written eval) | 5,000 | | |
| | gen1 | 9,154,571 | gen0b net | 5,000 | | |
| | gen2 | 6,978,633 | gen1 net | 8,000 | | |
| | gen3 | 7,500,400 | gen2 net | 8,000 | | |
| | gen4 | 8,082,566 | Snail Chess 1.16 (gen3 net) | 20,000 | | |
| | gen5 | 11,227,776 | gen4 net | 50,000 | | |
| | gen6 | 11,374,723 | gen5 net | 100,000 | | |
| | gen7 | 12,572,074 | Snail Chess 1.17 (gen6 net) | 200,000 | | |
| | gen8 | 25,688,615 | Snail Chess 1.18 (gen7 net, 64 lanes) | 10,000 | | |
| - Games start from Snail's [opening books](#opening-books) plus one or two random moves. Each part's `.fen` file lists its openings. | |
| - gen7 was played on three PCs at once. Each gen7 part joins a few whole runs, so its records are still whole games, and its `.fen` lists the openings in the same order. | |
| - gen8 is the first generation played by a 64-lane net, so the node count starts low again. It started from 320,000 openings, twice the usual number, and none of them is an opening of the gen7 run held out for validation. | |
| - gen0 started from random moves instead. Its positions were too unusual, so later nets didn't use it. | |
| - Only quiet positions were saved: not in check, best move not a capture or promotion, no mate score. | |
| ## Opening books | |
| The four books in `books/` were generated by Snail Chess 1.15: | |
| | Book | Positions | Depth | Snail uses it for | | |
| |---|---|---|---| | |
| | `master.txt` | 24,794 | 20 plies | full strength | | |
| | `neutral.txt` | 17,812 | 16 plies | the Balanced style | | |
| | `gambit.txt` | 18,777 | 16 plies | the Aggressive style, lines that give up material | | |
| | `passive.txt` | 17,678 | 16 plies | the Passive style, quiet lines with few captures | | |
| Each line is a sequence of moves in UCI notation, a colon, then the next moves with their weights. A line starting with `:` gives the moves from the starting position: | |
| ``` | |
| d2d4 : g8f6 100 d7d5 67 e7e6 42 | |
| ``` | |
| `openings.py` makes openings the way the games here started: a short weighted walk through a random book, plus random moves. It needs `pip install chess`. | |
| ```sh | |
| python openings.py openings.txt --count 160000 --random-plies 2 | |
| ``` | |
| ## How Shell was trained | |
| | Net | Trained on | Released in | | |
| |---|---|---| | |
| | gen3 | gen0b–gen3 | Snail Chess 1.16 | | |
| | gen4 | gen0b–gen4 | - | | |
| | gen5 | gen2–gen5 | - | | |
| | gen6 | gen3–gen6 | Snail Chess 1.17 | | |
| | gen7 | gen4–gen7 | - | | |
| | gen7, 64 lanes | gen4–gen7 | Snail Chess 1.18 | | |
| | gen8, 64 lanes | gen4–gen8 | - | | |
| - **Target:** `sigmoid(score / s)`, from search scores only, with `s` fitted to the data (120 from gen6 on). | |
| - **Model:** Shell, a tiny gated network (a split-input clipped ReGLU) added to a small base eval. It had 32 lanes up to gen7 and has 64 since Snail Chess 1.18. | |
| - **Training:** mean squared error, Adam, 60 epochs (120 for gen8). From gen7 on, the last 5 epochs train through the int8 rounding (quantization-aware training), and one gen7 run is held out for validation. | |
| - **Skipped:** positions with flag bit 1 set (about 14%), which the engine scales separately. | |
| ## Record format | |
| Each `data/genN/partNN.bin.xz` decompresses to an array of 32-byte little-endian records: | |
| | Bytes | Field | Type | Meaning | | |
| |---|---|---|---| | |
| | 0–7 | `occupied` | u64 | bit *i* set = square *i* has a piece (a1 = 0, h8 = 63) | | |
| | 8–23 | `pieces` | 32 × 4 bits | piece code of each occupied square, lowest square first, low nibble first | | |
| | 24–25 | `score` | i16 | search score, centipawns, White's view | | |
| | 26–27 | `base` | i16 | base eval, White's view | | |
| | 28–29 | `eval` | i16 | full static eval, White's view | | |
| | 30 | `flags` | u8 | bit 0: black to move; bit 1: endgame scaling | | |
| | 31 | `result` | u8 | 0 = black won, 1 = draw, 2 = white won | | |
| | | Pawn | Knight | Bishop | Rook | Queen | King | | |
| |---|---|---|---|---|---|---| | |
| | White | 2 | 4 | 6 | 8 | 10 | 12 | | |
| | Black | 3 | 5 | 7 | 9 | 11 | 13 | | |
| Castling rights and en passant squares are not stored. | |
| ## License | |
| CC BY 4.0. Snail Chess itself is GPL-3.0. | |