diff --git a/results/chess_reach.md b/results/chess_reach.md new file mode 100644 index 0000000..cdb572a --- /dev/null +++ b/results/chess_reach.md @@ -0,0 +1,115 @@ +# Does the organism learn how a piece moves? + +Every memory result in this project so far assumed the model understood its domain. On chess +that assumption had never been measured. This file measures it, and the answer changes what +the earlier chess nulls mean. + +**Answer: only when the piece's type enters the CPPN.** With the type reaching the kernel +through the spec's edge-type channel, the knight's L is recovered at 0.758. Without it, on +every seed, the knight scores **exactly zero** — the model learns one average movement shape +and applies it to all six types. + +## Setup + +Target: `board.attacks(square)` for every live piece, as a multi-hot over the 15x15 grid of +**relative** offsets. Relative, not absolute, and that is not a convenience: the CPPN sees only +`r_ij`, so an entity's representation is translation-invariant and cannot know which absolute +square it stands on. A 64-square target is unanswerable by construction. In offset space the +question is the one worth asking — a knight's L is eight cells, a bishop's is four rays. + +Loss is BCE over all live entities, not just one mover. Metric is precision@k per entity, with +k the true number of reachable offsets: of the k offsets it ranks highest, how many are real. + +Three controls, and the first is the one the question needs: + +- **`constant`** — every piece moves like the average piece: offsets ranked by their marginal + frequency, blind to type and to position. Beating it is what "tells a pawn from a bishop" + means. It is not a weak floor; it scores 0.4065 where random ranking scores 0.0191. +- **`rp` vs `rp_type`** — `--edges type` puts the receiving piece's type into `e_ij`, which is + the spec's own channel into the CPPN. Without it the kernel is type-blind: type lives in + `attrs` and meets the kernel only as an elementwise product, so the *geometry function* is + shared across all six types. +- **`grp_type`** — memory, on the arm that works. Reachability is fully determined by the + present, so this is the redundant case and memory should buy nothing. + +400 games, 28 067 plies, 8 seeds, split by game. Affect neutral, kappa 0. + +## Results + +``` +arm loss prec@k pawn knight bishop rook queen king params +constant --- 0.4065 0.4300 0.0000 0.5017 0.1665 0.5921 0.6617 225 +rp 0.0527 0.4570 0.5115 0.0000 0.5185 0.1907 0.6320 0.7004 8961 +rp_type 0.0316 0.5587 0.4363 0.7575 0.6409 0.5763 0.6762 0.7461 9121 +grp_type 0.0537 0.4122 0.4328 0.0000 0.5012 0.1709 0.6244 0.6613 13281 + +random ranking scores 0.0191 + +rp_type - rp: +0.1016 +/- 0.0280 (paired se), 7/8 seeds +grp_type - rp_type: -0.1465 +/- 0.0010 (paired se), 0/8 seeds +``` + +Per-seed knight precision, which is the whole result in one row: + +``` +constant 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 +rp 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 +rp_type 0.742 0.755 0.749 0.768 0.750 0.768 0.766 0.763 +grp_type 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 +``` + +## What it establishes + +**The type must enter the kernel, not the features.** 160 extra parameters — 1.8% — flip the +knight from exactly zero to 0.758 on 8/8 seeds. That is not capacity, and the discontinuity +says why: the type-blind kernel is one geometry function scaled by a type vector, and the +knight's L cannot be reached by scaling the average movement shape. The bishop (0.52 -> 0.64) +and the rook (0.19 -> 0.58) move the same way; the rook's gain is the second-largest, and its +rays are the second-least average-like pattern. + +**Memory does not merely fail here; it destroys the result.** `grp_type` carries 46% more +parameters than `rp_type` and lands back on the floor's profile, knight at zero on 8/8 seeds, +at 146 paired standard errors. The mechanism is legible: the readout is `W_out M_i`, and with +the gate near 0.5 half of that vector is the previous ply's state. A task determined entirely +by the present is damaged by mixing in the past. + +This is the redundant case from the poker framing — the evidence is already in the present — +and it is the positive control the instrument needed. It also removes a possible objection to +the earlier chess nulls: the GRP path is measurably capable of destroying a signal that is +present, so those nulls were not produced by an inert mechanism. + +**Why the per-type breakdown is not decoration.** On seed 4 the aggregate gain is *negative* +(-0.082) while the knight sits at 0.750. Pawns are half the pieces on the board, so an +aggregate can be carried, or masked, by pawns alone. Reading only `prec@k` would have reported +this seed as evidence against the effect. + +## Limits, stated rather than discovered later + +- **Precision@k is a hard ranking threshold.** "Knight = 0.000" means no L cell reaches the + top-k, not that the logits carry nothing. A soft metric could show partial structure below + that threshold; this measurement does not look. +- **`rp_type` makes pawns worse** (0.5115 -> 0.4363). Type-conditioning redistributes capacity, + and the pawn — whose two diagonals are close to the average short-range shape — pays for it. + Reported because it is a cost, not an artefact to explain away. +- **Pawns are measured on captures only.** `board.attacks` is the two diagonals, not the + forward push, so for pawns this is capture geometry. +- **Pins and check are ignored.** `attacks` is geometry plus blockers. Legality proper is a + more global question and is not asked here. +- No width-matched arm for the memory comparison. `grp_type` already has 46% more parameters + and is worse, so matching would only widen the gap; the direction is safe, the magnitude is + not a clean estimate. + +## What it means for the memory line + +The earlier chess results (`chess_domain.py`, move prediction) were measured on a model whose +kernel was type-blind — one that, as this file shows, had not learned that a knight moves in an +L. Those nulls stand as facts about that setup and should not be read as facts about memory in +chess. The domain question `chess_history.md` answered positively is still open at the level of +the organism, and it is now askable on a model that understands the pieces. + +Reproduce with: + +```bash +uv run --with chess python chess_reach.py --games 400 --seeds 0,1,2,3,4,5,6,7 \ + --arms constant,rp,rp_type,grp_type +```