RoPE vs. learned square matrices
Hypothesis. Learned square matrices could represent chessboard geometry better than fixed rotary position encoding (RoPE), improving move rankings at the same parameter budget.
Methodology. I trained both designs for one BF16 epoch on 963,319 engine games. RoPE uses fixed rotations, so I used the freed parameter budget to widen its feed-forward layers. I scored the legal top three on 76,544 held-out positions.
Results
- RoPE led at all four sizes by 2.79–4.61 percentage points.
- 100M RoPE scored highest at 70.07% legal top-3 coverage.
- RoPE had lower policy and value losses at each size. It took longer to train.
- Learned P
- RoPE
- 10M
- 50M
- 75M
- 100M
| Size | Policy loss | Value MSE | Time (min) |
|---|---|---|---|
| 10M | 2.247 / 2.073 | 0.1600 / 0.1510 | 32 / 49 |
| 50M | 2.058 / 1.921 | 0.1484 / 0.1413 | 77 / 162 |
| 75M | 2.004 / 1.885 | 0.1463 / 0.1404 | 93 / 152 |
| 100M | 1.930 / 1.798 | 0.1439 / 0.1379 | 179 / 267 |
Inside the chess transformer
Board input20 feature planes × 8 × 8, oriented to the side to move
Square embedding64 tokens · linear projection from 20 to 640 features
Transformer block × 15
Layer norm → attention + residual → layer norm → GELU feed-forward + residual
Learned P64 square matrices shared across blocksFeed-forward width 2,560
Axial RoPEFixed file and rank rotations on queries and keysFeed-forward width 3,924 or 3,925
Final layer normalization
Policy head73 move types per square4,672 flattened move logits
Value head16 features per square, then flattenMLP with tanh outcome score
Attention and loss
- Learned P
- qs = WQPsxs ks = WKPsxs vs = WVPsxs
- Axial RoPE
- qs = RsWQxs ks = RsWKxs vs = WVxs
- Per-head attention
- softmax(QKT / √64)V
- Training loss
- CE(move logits, played move) + MSE(value, result)
100M training curves
- Learned P
- RoPE
- Training
- Validation
Data, optimizer, and benchmark details
- Both engines had ratings of at least 3400 on their source’s scale. Games started with at least 15 minutes per side or qualified under an official hardware-adjusted tournament class.
- I split the dataset by game and sampled up to eight positions per game, for 7,629,987 training positions.
- Each pair matches within 16 parameters. Both 10M models used AdamW with batch size 256. Larger pairs used Muon and AdamW with batch size 1,024 on an NVIDIA GB10.
- Policy loss uses the full action vocabulary. Top-3 scores use legal moves only, with ties broken by ascending move-encoding index.
- Training time includes validation and checkpoint writing. The learned-P 50M, 75M, and 100M short benchmarks measured 1,726, 1,375, and 712 positions/s, with peak allocations of 11.4, 14.1, and 26.3 GB.