README: sample-bot gate — ELM vs intercept on 13 held-out Nim sample bots (null/negative)

This commit is contained in:
2026-10-06 09:05:36 +02:00
parent cd4b53ec52
commit d011a2bfed
+109
View File
@@ -448,3 +448,112 @@ nim c -d:release -d:baselineGun --out:/tmp/DevBase DevControlBot.nim # intercep
# --dir /tmp/rec --rounds 20 --bot <DevElm dir> --bot <opponent dir>
python3 tools/elm_bench/score_battles.py /tmp/rec_Elm_DrussGT /tmp/rec_Base_DrussGT
```
## Sample-bot gate (held-out opponents)
**Question.** The movement-prediction ELM beat the geometric intercept by
2.7x–14x on DrussGT, CassiusClay, Komarious and Phoenix — but all four are *in*
the pooled training corpus. Do the gains survive on bots the model has never
trained on? This is the first genuine held-out-opponent test.
**Method.** The 13 runnable Nim sample bots from `tr_bots/` (`SAMPLE_BOTS.md`;
`MyFirstTeam` skipped, it is a team container). Each fought both arms for 10
rounds, RawRecord observer ground truth: `Base` = `-d:baselineGun` (pure
intercept), `ELM` = default build. The ELM arm additionally carries
`-d:gunLog`, a logging-only define that changes no gun behaviour, so the raw
per-shot corrections (and therefore the gate state) could be read. All 26
recordings `query.py --verify`: **CONTIGUOUS, no drops, no dups**. Build:
`nim c -d:release [-d:baselineGun|-d:gunLog]`.
### Damage per round (primary)
Most sample bots are so weak that both arms kill them every round, so this
metric saturates at the ~100–110 dmg/rd ceiling. The un-saturated rows are the
moving/beatable bots (Crazy, MyFirstBot, MyFirstLeader, SpinBot, Walls).
| sample bot | intercept dmg/rd | ELM dmg/rd | delta | won/rd int / ELM |
|---|---:|---:|---:|---:|
| Corners | 93 | 93 | 0 | 10/10 / 10/10 |
| Crazy | 64 | 73 | **+9** | 10/10 / 10/10 |
| Fire | 105 | 105 | 0 | 10/10 / 10/10 |
| MyFirstBot | 74 | 90 | **+16** | 10/10 / 8/10 |
| MyFirstDroid | 110 | 110 | 0 | 10/10 / 10/10 |
| MyFirstLeader | 70 | 42 | **−28** | 10/10 / 9/10 |
| PaintingBot | 85 | 85 | 0 | 10/10 / 10/10 |
| RamFire | 98 | 99 | **+1** | 10/10 / 10/10 |
| SpinBot | 45 | 43 | **−2** | 4/10 / 0/10 |
| Target | 105 | 108 | **+3** | 10/10 / 10/10 |
| TrackFire | 105 | 92 | **−13** | 10/10 / 10/10 |
| VelociBot | 100 | 98 | **−2** | 9/10 / 9/10 |
| Walls | 63 | 59 | **−4** | 10/10 / 10/10 |
**ELM beats intercept on 4/13, ties 4/13, loses on 5/13. Median delta 0.0
dmg/rd; mean delta −1.5.** Pooled over all 13: intercept 11170 damage / 3728
shots / 30.0% hits; ELM 10970 / 3688 / 29.7% — the ELM is **1.8% worse in
aggregate**.
### Gate open-rate per battle
Gate open = `|correction| > GATE_TAU (0.10 rad)` at an actual shot (read from
the `-d:gunLog` stream).
| sample bot | shots | gate open | rate |
|---|---:|---:|---:|
| Corners | 284 | 173 | 60.9% |
| Crazy | 344 | 267 | 77.6% |
| Fire | 226 | 57 | 25.2% |
| MyFirstBot | 467 | 149 | 31.9% |
| **MyFirstDroid** | **116** | **0** | **0.0%** |
| MyFirstLeader | 484 | 321 | 66.3% |
| PaintingBot | 434 | 188 | 43.3% |
| RamFire | 121 | 44 | 36.4% |
| SpinBot | 592 | 343 | 57.9% |
| Target | 173 | 31 | 17.9% |
| TrackFire | 111 | 15 | 13.5% |
| VelociBot | 396 | 213 | 53.8% |
| Walls | 610 | 472 | 77.4% |
| **all** | **4358** | **2273** | **52.2%** |
The gate opened in 12 of 13 battles (52.2% overall, versus the 61.4% calibration
figure). **Against MyFirstDroid the gate never opened: that ELM arm is
bit-for-bit the intercept arm**, which is why its damage, hits and aim spread
are identical. Every other battle genuinely exercised the correction.
### Comparison with the in-training legacy result (memorization check)
| test | opponents | improved | median delta | verdict |
|---|---|---:|---:|---|
| legacy (in training corpus) | DrussGT, CassiusClay, Komarious, Phoenix | **4/4** | +5.75 dmg/rd (2.7x–14x) | large, consistent gain |
| sample bots (held out) | 13 Nim samples | **4/13** | **0 dmg/rd** | no gain |
On bots it was trained on, the ELM improved every opponent by a large factor; on
bots it has never seen, it is a coin flip that trends slightly negative. **The
legacy gains do not transfer. The most parsimonious reading is that a
substantial part of the legacy result was memorization of those four opponents'
motion, not a general movement-prediction skill.** This echoes the earlier
offline finding that the label law is ≈ `0.87 × lead` — an opponent-shape
idiosyncrasy captured by the corpus, not a universal correction.
### Trivial-bot sanity (stationary / near-stationary cases)
* **Target** (stationary until damaged): intercept 105 → ELM 108 dmg/rd. Not a
regression, but the gain is within the saturation ceiling.
* **Walls** (stationary): intercept 63 → ELM 59 dmg/rd, **−4**. This is the red
flag the gate design is supposed to prevent. Walls does not move, so the true
correction is ~0, yet the gate opens on **77.4%** of shots and the ELM *adds*
a correction: aim spread goes 9.93° → 10.45° sd. The correction is not
trustworthy on stationary targets, and `GATE_TAU` is too low to catch it.
### Bottom line
**No — on bots it has never trained on, the movement-prediction ELM does not
beat the plain geometric intercept.** It wins 4 of 13 sample bots, ties 4,
loses 5, with a median delta of exactly 0 and an aggregate damage 1.8% *below*
the baseline. The large in-training gains reported above are therefore not
evidence of general movement prediction. Two concrete defects are visible: the
gate admits corrections against stationary targets (Walls), and one entire
battle (MyFirstDroid) never opened the gate at all. A null-to-negative held-out
result this clean says the current ELM should not be shipped as an improvement;
the next step is to make the gate/correction honest on non-moving targets before
re-measuring held-out opponents. 10 rounds per bot means the ~±4 dmg/rd rows are
noisy — but no amount of extra rounds turns a median of 0 into a win.