Publish medium-v4-greedy
Browse files- README.md +26 -32
- config.json +3 -3
- model.safetensors +1 -1
- onnx/model-fp16.onnx +1 -1
- onnx/model-int8.onnx +1 -1
- onnx/model.onnx +1 -1
- onnx/parity.json +5 -5
README.md
CHANGED
|
@@ -17,12 +17,12 @@ tags:
|
|
| 17 |
# chorcat/rukh-medium
|
| 18 |
|
| 19 |
A GPT decoder written from scratch that plays chess by predicting the next move of a game
|
| 20 |
-
written in UCI. This is the `medium-greedy` stage of [Rukh](https://github.com/borja-glez/rukh), a course
|
| 21 |
that builds a chess language model end to end: 115,120,128 parameters, a
|
| 22 |
vocabulary of 2030 fixed tokens and a context of
|
| 23 |
200 moves.
|
| 24 |
|
| 25 |
-
|
| 26 |
[https://lab.rukh.borjaglez.com](https://lab.rukh.borjaglez.com)
|
| 27 |
|
| 28 |
## Results
|
|
@@ -31,20 +31,20 @@ Measured with `rukh eval --suite full` on 2026-09-19.
|
|
| 31 |
|
| 32 |
| Metric | Value |
|
| 33 |
|---|---|
|
| 34 |
-
| Legality without the mask, argmax | 99.
|
| 35 |
-
| Legality without the mask, sampled (T=0.05, top-k 1) | 99.
|
| 36 |
-
| Top-1 next move |
|
| 37 |
-
| Top-3 next move |
|
| 38 |
-
| Puzzles solved |
|
| 39 |
-
| Estimated Elo |
|
| 40 |
|
| 41 |
Puzzles by difficulty band:
|
| 42 |
|
| 43 |
| Band | Solved |
|
| 44 |
|---|---|
|
| 45 |
-
| 1000-1500 |
|
| 46 |
-
| 1500-2000 |
|
| 47 |
-
| 2000+ |
|
| 48 |
|
| 49 |
Legality is measured **without** the legality mask, twice, because the two numbers answer
|
| 50 |
different questions:
|
|
@@ -65,20 +65,14 @@ flattering or not.
|
|
| 65 |
|
| 66 |
| Bar | Target | Measured | Verdict |
|
| 67 |
|---|---|---|---|
|
| 68 |
-
| Legality without the mask, argmax | at least 99 % | 99.
|
| 69 |
-
| Estimated Elo | at least 1200 |
|
| 70 |
-
|
| 71 |
-
**The Elo bar is not met**, and the reason is the corpus rather than the recipe: this model was
|
| 72 |
-
trained on 5.9 M games, against the 16 M of the reference work it is measured against, and the
|
| 73 |
-
`medium` stage with three times the parameters and the same data bought only 84 more Elo, with
|
| 74 |
-
overlapping intervals. The constraint is data, not capacity, so the honest fix is more months of
|
| 75 |
-
Lichess and not more layers.
|
| 76 |
|
| 77 |
How to read these numbers:
|
| 78 |
|
| 79 |
- legality_argmax is the share of validation positions where the single most likely token is a legal move (no temperature, no top-k, no mask): this is the >= 99 % bar of GOAL.md. legality_sampled draws the token the way the demo does (temperature 0.05, top-k 1) and is always the lower of the two.
|
| 80 |
- the Elo interval covers sampling noise only: the four ``skill-*`` rungs are nominal ``Skill Level`` anchors rather than measured ratings, and Stockfish plays at 0.1 s per move, far below any setting ``UCI_Elo`` is calibrated for
|
| 81 |
-
-
|
| 82 |
|
| 83 |
|
| 84 |
## Input and output
|
|
@@ -121,14 +115,14 @@ repository is that measurement, as the exporter wrote it.
|
|
| 121 |
|
| 122 |
| File | Same move as PyTorch | Worst logit drift |
|
| 123 |
|---|---|---|
|
| 124 |
-
| `model.onnx` (fp32) | 100.0 % | 1.
|
| 125 |
-
| `model-fp16.onnx` (fp16) |
|
| 126 |
-
| `model-int8.onnx` (int8) |
|
| 127 |
|
| 128 |
The bar the project set itself is 99.9 %.
|
| 129 |
|
| 130 |
-
`model-int8.onnx` does not reach it: it picks a different move in
|
| 131 |
-
positions, roughly one in
|
| 132 |
int8 build is playing a measurably different model from the one in the results table above: the
|
| 133 |
weights are the same, the arithmetic is not.
|
| 134 |
|
|
@@ -150,23 +144,23 @@ weights are the same, the arithmetic is not.
|
|
| 150 |
| `grad_clip` | `1.0` |
|
| 151 |
| `log_every` | `10` |
|
| 152 |
| `lr` | `0.00045` |
|
| 153 |
-
| `max_steps` | `
|
| 154 |
| `min_lr_ratio` | `0.1` |
|
| 155 |
| `model` | `None` |
|
| 156 |
| `num_params` | `114966528` |
|
| 157 |
| `out_dir` | `checkpoints` |
|
| 158 |
| `precision` | `bf16` |
|
| 159 |
| `preset` | `medium` |
|
| 160 |
-
| `run_name` | `medium` |
|
| 161 |
| `seed` | `42` |
|
| 162 |
-
| `tokens_dir` | `data/tokens/uci` |
|
| 163 |
| `unique_run_name` | `True` |
|
| 164 |
| `vocab_hash` | `527c5dda224cab570cb84da8f7dcda0f43fe53edaf86822f899568f5dd824b46` |
|
| 165 |
| `warmup` | `1000` |
|
| 166 |
| `weight_decay` | `0.1` |
|
| 167 |
| `workers` | `4` |
|
| 168 |
|
| 169 |
-
MLflow run: `
|
| 170 |
|
| 171 |
```json
|
| 172 |
{
|
|
@@ -176,13 +170,13 @@ MLflow run: `beb0cea9dd5043bf8518cfb782d8c1d1`.
|
|
| 176 |
"model_type": "rukh-move-decoder",
|
| 177 |
"library_name": "rukh",
|
| 178 |
"rukh_version": "0.0.1",
|
| 179 |
-
"stage": "medium-greedy",
|
| 180 |
-
"step":
|
| 181 |
"params": 115120128,
|
| 182 |
"tokenizer": "uci",
|
| 183 |
"vocab_hash": "527c5dda224cab570cb84da8f7dcda0f43fe53edaf86822f899568f5dd824b46",
|
| 184 |
"data_manifest_sha": "2274906c04342b8fc1632d3e1c3bff82e33f535936af742c7a7f9e4b052afa31",
|
| 185 |
-
"git_sha": "
|
| 186 |
"vocab_size": 2030,
|
| 187 |
"n_layer": 16,
|
| 188 |
"n_head": 12,
|
|
|
|
| 17 |
# chorcat/rukh-medium
|
| 18 |
|
| 19 |
A GPT decoder written from scratch that plays chess by predicting the next move of a game
|
| 20 |
+
written in UCI. This is the `medium-v4-greedy` stage of [Rukh](https://github.com/borja-glez/rukh), a course
|
| 21 |
that builds a chess language model end to end: 115,120,128 parameters, a
|
| 22 |
vocabulary of 2030 fixed tokens and a context of
|
| 23 |
200 moves.
|
| 24 |
|
| 25 |
+
The demo at [https://rukh.borjaglez.com](https://rukh.borjaglez.com) serves the `tiny` and `small` stages, not this one; this repository is for running the weights yourself · read how it was built:
|
| 26 |
[https://lab.rukh.borjaglez.com](https://lab.rukh.borjaglez.com)
|
| 27 |
|
| 28 |
## Results
|
|
|
|
| 31 |
|
| 32 |
| Metric | Value |
|
| 33 |
|---|---|
|
| 34 |
+
| Legality without the mask, argmax | 99.8 % |
|
| 35 |
+
| Legality without the mask, sampled (T=0.05, top-k 1) | 99.8 % |
|
| 36 |
+
| Top-1 next move | 54.4 % |
|
| 37 |
+
| Top-3 next move | 82.2 % |
|
| 38 |
+
| Puzzles solved | 37.5 % |
|
| 39 |
+
| Estimated Elo | 1504 (95 % CI 1446-1558) |
|
| 40 |
|
| 41 |
Puzzles by difficulty band:
|
| 42 |
|
| 43 |
| Band | Solved |
|
| 44 |
|---|---|
|
| 45 |
+
| 1000-1500 | 57.9 % |
|
| 46 |
+
| 1500-2000 | 38.0 % |
|
| 47 |
+
| 2000+ | 16.6 % |
|
| 48 |
|
| 49 |
Legality is measured **without** the legality mask, twice, because the two numbers answer
|
| 50 |
different questions:
|
|
|
|
| 65 |
|
| 66 |
| Bar | Target | Measured | Verdict |
|
| 67 |
|---|---|---|---|
|
| 68 |
+
| Legality without the mask, argmax | at least 99 % | 99.8 % | met |
|
| 69 |
+
| Estimated Elo | at least 1200 | 1504 (95 % CI 1446-1558) | met |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
How to read these numbers:
|
| 72 |
|
| 73 |
- legality_argmax is the share of validation positions where the single most likely token is a legal move (no temperature, no top-k, no mask): this is the >= 99 % bar of GOAL.md. legality_sampled draws the token the way the demo does (temperature 0.05, top-k 1) and is always the lower of the two.
|
| 74 |
- the Elo interval covers sampling noise only: the four ``skill-*`` rungs are nominal ``Skill Level`` anchors rather than measured ratings, and Stockfish plays at 0.1 s per move, far below any setting ``UCI_Elo`` is calibrated for
|
| 75 |
+
- 2 of 160 games hit the context limit and were adjudicated (2 of them) instead of being scored as draws
|
| 76 |
|
| 77 |
|
| 78 |
## Input and output
|
|
|
|
| 115 |
|
| 116 |
| File | Same move as PyTorch | Worst logit drift |
|
| 117 |
|---|---|---|
|
| 118 |
+
| `model.onnx` (fp32) | 100.0 % | 1.91e-05 |
|
| 119 |
+
| `model-fp16.onnx` (fp16) | 99.9 % | 0.0196 |
|
| 120 |
+
| `model-int8.onnx` (int8) | 95.1 % | 2.77 |
|
| 121 |
|
| 122 |
The bar the project set itself is 99.9 %.
|
| 123 |
|
| 124 |
+
`model-int8.onnx` does not reach it: it picks a different move in 4.9 % of
|
| 125 |
+
positions, roughly one in 20. That is the file the WASM fallback loads, so a phone on the
|
| 126 |
int8 build is playing a measurably different model from the one in the results table above: the
|
| 127 |
weights are the same, the arithmetic is not.
|
| 128 |
|
|
|
|
| 144 |
| `grad_clip` | `1.0` |
|
| 145 |
| `log_every` | `10` |
|
| 146 |
| `lr` | `0.00045` |
|
| 147 |
+
| `max_steps` | `48000` |
|
| 148 |
| `min_lr_ratio` | `0.1` |
|
| 149 |
| `model` | `None` |
|
| 150 |
| `num_params` | `114966528` |
|
| 151 |
| `out_dir` | `checkpoints` |
|
| 152 |
| `precision` | `bf16` |
|
| 153 |
| `preset` | `medium` |
|
| 154 |
+
| `run_name` | `medium-v4` |
|
| 155 |
| `seed` | `42` |
|
| 156 |
+
| `tokens_dir` | `data/tokens-v4/uci` |
|
| 157 |
| `unique_run_name` | `True` |
|
| 158 |
| `vocab_hash` | `527c5dda224cab570cb84da8f7dcda0f43fe53edaf86822f899568f5dd824b46` |
|
| 159 |
| `warmup` | `1000` |
|
| 160 |
| `weight_decay` | `0.1` |
|
| 161 |
| `workers` | `4` |
|
| 162 |
|
| 163 |
+
MLflow run: `3aba23bb1cf04deb89afc6994c17e1e1`.
|
| 164 |
|
| 165 |
```json
|
| 166 |
{
|
|
|
|
| 170 |
"model_type": "rukh-move-decoder",
|
| 171 |
"library_name": "rukh",
|
| 172 |
"rukh_version": "0.0.1",
|
| 173 |
+
"stage": "medium-v4-greedy",
|
| 174 |
+
"step": 48000,
|
| 175 |
"params": 115120128,
|
| 176 |
"tokenizer": "uci",
|
| 177 |
"vocab_hash": "527c5dda224cab570cb84da8f7dcda0f43fe53edaf86822f899568f5dd824b46",
|
| 178 |
"data_manifest_sha": "2274906c04342b8fc1632d3e1c3bff82e33f535936af742c7a7f9e4b052afa31",
|
| 179 |
+
"git_sha": "386e45f0378bf97456c4faaaf712ea91b57f0dce",
|
| 180 |
"vocab_size": 2030,
|
| 181 |
"n_layer": 16,
|
| 182 |
"n_head": 12,
|
config.json
CHANGED
|
@@ -5,13 +5,13 @@
|
|
| 5 |
"model_type": "rukh-move-decoder",
|
| 6 |
"library_name": "rukh",
|
| 7 |
"rukh_version": "0.0.1",
|
| 8 |
-
"stage": "medium-greedy",
|
| 9 |
-
"step":
|
| 10 |
"params": 115120128,
|
| 11 |
"tokenizer": "uci",
|
| 12 |
"vocab_hash": "527c5dda224cab570cb84da8f7dcda0f43fe53edaf86822f899568f5dd824b46",
|
| 13 |
"data_manifest_sha": "2274906c04342b8fc1632d3e1c3bff82e33f535936af742c7a7f9e4b052afa31",
|
| 14 |
-
"git_sha": "
|
| 15 |
"vocab_size": 2030,
|
| 16 |
"n_layer": 16,
|
| 17 |
"n_head": 12,
|
|
|
|
| 5 |
"model_type": "rukh-move-decoder",
|
| 6 |
"library_name": "rukh",
|
| 7 |
"rukh_version": "0.0.1",
|
| 8 |
+
"stage": "medium-v4-greedy",
|
| 9 |
+
"step": 48000,
|
| 10 |
"params": 115120128,
|
| 11 |
"tokenizer": "uci",
|
| 12 |
"vocab_hash": "527c5dda224cab570cb84da8f7dcda0f43fe53edaf86822f899568f5dd824b46",
|
| 13 |
"data_manifest_sha": "2274906c04342b8fc1632d3e1c3bff82e33f535936af742c7a7f9e4b052afa31",
|
| 14 |
+
"git_sha": "386e45f0378bf97456c4faaaf712ea91b57f0dce",
|
| 15 |
"vocab_size": 2030,
|
| 16 |
"n_layer": 16,
|
| 17 |
"n_head": 12,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 460498656
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8dc287617cb7d228ecd30aba39898f435faeff8f0b36664be1d8a823c7a35035
|
| 3 |
size 460498656
|
onnx/model-fp16.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 231386235
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d5fccc452e76199bd1ae0cb077e836b15d12a737ae9c566f3a61403a3d334177
|
| 3 |
size 231386235
|
onnx/model-int8.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 121832210
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a604683385acc890ccb7924ca6713009dc11cc02415ab240da2d999359e9155
|
| 3 |
size 121832210
|
onnx/model.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 461621570
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:57af638e6eca911f75b8085b8b413ef574e3154081fdf8e92f238464fd30747c
|
| 3 |
size 461621570
|
onnx/parity.json
CHANGED
|
@@ -11,17 +11,17 @@
|
|
| 11 |
"fp32": {
|
| 12 |
"file": "model.onnx",
|
| 13 |
"agreement": 1.0,
|
| 14 |
-
"max_abs_logit_delta": 1.
|
| 15 |
},
|
| 16 |
"fp16": {
|
| 17 |
"file": "model-fp16.onnx",
|
| 18 |
-
"agreement":
|
| 19 |
-
"max_abs_logit_delta": 0.
|
| 20 |
},
|
| 21 |
"int8": {
|
| 22 |
"file": "model-int8.onnx",
|
| 23 |
-
"agreement": 0.
|
| 24 |
-
"max_abs_logit_delta":
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|
|
|
|
| 11 |
"fp32": {
|
| 12 |
"file": "model.onnx",
|
| 13 |
"agreement": 1.0,
|
| 14 |
+
"max_abs_logit_delta": 1.9073486328125e-05
|
| 15 |
},
|
| 16 |
"fp16": {
|
| 17 |
"file": "model-fp16.onnx",
|
| 18 |
+
"agreement": 0.999,
|
| 19 |
+
"max_abs_logit_delta": 0.01959085464477539
|
| 20 |
},
|
| 21 |
"int8": {
|
| 22 |
"file": "model-int8.onnx",
|
| 23 |
+
"agreement": 0.951,
|
| 24 |
+
"max_abs_logit_delta": 2.7724474668502808
|
| 25 |
}
|
| 26 |
}
|
| 27 |
}
|