exp: the RP learns the movement rules, and reads the board where it counts
Beats the rule-knowing control on rook (+0.016), queen (+0.006) and king (+0.009) -- the pieces whose moves are cut by occupancy. Still below on pawn, bishop and knight. Absolute position is worth +0.020 and halves the gap to the control, which had been handed the square all along. The rim mechanism proposed for why it pays is recorded as unverified: per type the gain is flat and the knight, 43% of which sit on the rim, gained less than the queen.
This commit is contained in:
1 file changed
+114
@@ -0,0 +1,114 @@
|
|||||||
|
# Teaching the movement rules, on generated positions
|
||||||
|
|
||||||
|
The organism was never taught how the pieces move. Every memory result before this file was
|
||||||
|
measured on top of that gap. This is the base.
|
||||||
|
|
||||||
|
**Where it stands: the RP learns the rules from a generated curriculum and, on the pieces where
|
||||||
|
reading the board matters most, exceeds a control that knows the rules and cannot see.**
|
||||||
|
|
||||||
|
## Why not games
|
||||||
|
|
||||||
|
Two failures of games as a curriculum, both measured rather than argued:
|
||||||
|
|
||||||
|
- **Coverage.** A rook or queen is blocked in 98-100% of real positions (`chess_shape.json`), so
|
||||||
|
the model learned the geometry it saw instead of the rule behind it — it scored *worse* in
|
||||||
|
open positions (rook 0.811) than blocked ones (0.891). Here the piece count is sampled
|
||||||
|
uniformly from 2 to 32, so a near-empty board is as common as a crowded one, and every piece
|
||||||
|
type visits all its legal squares: measured at 3000 positions, a knight lands on each of the
|
||||||
|
64 squares between 65 and 107 times.
|
||||||
|
- **The target left out three rules entirely.** The reachability task asked for
|
||||||
|
`board.attacks`, which for a pawn on e2 returns d3 and f3 while its moves are e3 and e4 —
|
||||||
|
**no overlap at all**. Castling never appeared (a king's attack set is its five adjacent
|
||||||
|
squares; c1 and g1 are not in it) and neither did en passant. The model did not fail to learn
|
||||||
|
these. It was never asked. The target here is `generate_pseudo_legal_moves`.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
300 000 generated positions streamed for training (never stored: dense targets would be 6 GB),
|
||||||
|
4 000 held out from a disjoint seed. Target: every piece's pseudo-legal destinations, as a
|
||||||
|
multi-hot over the 15x15 grid of relative offsets. Metric: precision@k per piece, k the true
|
||||||
|
number of destinations. 4 seeds. No memory anywhere in this file — this is the RP question
|
||||||
|
alone, per the sequencing policy in `AGENTS.md`.
|
||||||
|
|
||||||
|
**`shape` is the control**: it knows each piece's type, its movement rule and its own flags, and
|
||||||
|
reads *nothing else on the board*. It proposes the un-blocked ray. Beating it is what "reads the
|
||||||
|
occupancy" means, and it is the bar this file is measured against — not 1.0.
|
||||||
|
|
||||||
|
Castling rights and the en-passant square are handed over as per-entity attributes. They are
|
||||||
|
**state, not position** — a rook must remember whether it has moved — and without them the same
|
||||||
|
board has two different correct answers. Removing them is the cleanest memory experiment this
|
||||||
|
project has available, with exact ground truth instead of a 0.03 correlation, and it belongs to
|
||||||
|
the parked GRP line.
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
```
|
||||||
|
arm prec@k pawn knight bishop rook queen king
|
||||||
|
constant 0.4075 0.4491 0.0000 0.1730 0.4947 0.5609 0.7781
|
||||||
|
rp_type 0.7793 0.6573 0.8574 0.7856 0.7569 0.7510 0.9124
|
||||||
|
rp 0.8161 0.7835 0.8481 0.7748 0.7837 0.7680 0.9227
|
||||||
|
shape 0.8305 0.8156 0.8624 0.8299 0.7679 0.7618 0.9134
|
||||||
|
|
||||||
|
random ranking scores 0.0233
|
||||||
|
```
|
||||||
|
|
||||||
|
**The RP exceeds the rule-knower on rook (+0.016), queen (+0.006) and king (+0.009)** — the
|
||||||
|
pieces whose moves are cut by occupancy, where ignoring the board costs most. It remains below
|
||||||
|
on pawn (-0.032), bishop (-0.055) and knight (-0.014).
|
||||||
|
|
||||||
|
Absolute position, added as attributes, is worth +0.020 and closes the gap to `shape` from
|
||||||
|
0.034 to 0.014:
|
||||||
|
|
||||||
|
```
|
||||||
|
without position with position
|
||||||
|
rp 0.7962 0.8161
|
||||||
|
rp_type 0.7583 0.7793
|
||||||
|
shape (was always given it) 0.8305 0.8305
|
||||||
|
```
|
||||||
|
|
||||||
|
The CPPN sees only `r_ij`, which makes the representation translation-invariant, and a chess
|
||||||
|
board has edges: a knight has 2.96 destinations on the rim against 6.85 in the middle, and 43%
|
||||||
|
of knights sit on the rim. `shape` was handed the square all along, so the comparison had been
|
||||||
|
biased *against* the organism.
|
||||||
|
|
||||||
|
**A prediction that did not verify.** The improvement was predicted to concentrate on rim
|
||||||
|
pieces. Per type it is roughly flat — pawn +0.008, knight +0.016, bishop +0.028, rook +0.028,
|
||||||
|
queen +0.029, king +0.022 — and the knight, 43% of which sit on the rim, gained *less* than the
|
||||||
|
queen. The per-type cut cannot settle a per-square hypothesis, so this is recorded as
|
||||||
|
unverified rather than as either confirmed or refuted. Position pays; the mechanism proposed
|
||||||
|
for why it pays is not demonstrated.
|
||||||
|
|
||||||
|
## Type in the kernel reverses sign with coverage
|
||||||
|
|
||||||
|
On game data, putting the piece type into `e_ij` was worth +0.10 and took the knight's L from
|
||||||
|
exactly zero to 0.758 (`chess_reach.md`). On the generated curriculum `rp_type` lands *below*
|
||||||
|
`rp`, and the whole deficit is the pawn: 0.6573 against 0.7835, with knight and bishop still
|
||||||
|
slightly ahead. That earlier jump was in part a crutch against scarce data.
|
||||||
|
|
||||||
|
The likely cause is specific and testable: `e_ij` carries the piece **type** and not its
|
||||||
|
**colour**, so a white pawn and a black pawn share one kernel while their moves are mirrored.
|
||||||
|
`own_rank` — rank counted from the piece's own back rank — is present in this run and did not
|
||||||
|
fix it on its own, which points at the colour rather than the orientation.
|
||||||
|
|
||||||
|
**In flight:** `rp_typecol`, twelve kernels (type x colour) instead of six. Seed 0 reads
|
||||||
|
**0.8330**, above `shape`'s 0.8305 and above `rp`'s 0.8161. One seed, not a result yet.
|
||||||
|
|
||||||
|
## Limits
|
||||||
|
|
||||||
|
- One training pass, no schedule, no ordering. A graded curriculum (piece alone, then one
|
||||||
|
blocker, then a full board) has not been tried; the sampler is i.i.d.
|
||||||
|
- The model is still data-limited: 6k positions gave 0.41, 30k gave 0.61, 300k gives 0.82. It
|
||||||
|
had not plateaued at any budget measured.
|
||||||
|
- Legality of the *position* is not modelled: these are sampled placements, valid but not
|
||||||
|
reachable from the opening.
|
||||||
|
- Pins and check are excluded — the target is pseudo-legal. King safety is a global rule and a
|
||||||
|
separate question.
|
||||||
|
- `shape` is a control, not a ceiling: it scores 0.83 because it cannot see the board, and the
|
||||||
|
true ceiling is 1.0.
|
||||||
|
|
||||||
|
Reproduce with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
uv run --with chess python chess_rules.py --positions 300000 --seeds 0,1,2,3
|
||||||
|
uv run --with chess python chess_rules.py --positions 300000 --seeds 0,1,2,3 --arms rp_typecol
|
||||||
|
```
|
||||||
Reference in new issue
Block a user