Ablation: the radial TM is replaceable by a CONSTANT, and its avenue is dead on the

shipped metric

The radial TM beats Linear on bmPoint, but its head never beat the majority
baseline after the label bias was fixed - suggesting the win is a constant lean
rather than learning. So: sweep a stateless constant short-range offset (new
`common_libs/guns/radial_offset.nim`, no learning at all) against the learned TM.

VERDICT (measured, offline range, seeds=3, 18 paired runs, 231 TM rounds):
1. **bmPoint - REPLACE the TM with a constant.** `RO_s0.95` (aim distance x0.95)
   TIES it early (9/9, p=1.0) and BEATS it overall (15/3, p=0.0075; 7.47% vs
   6.89% per-run mean). A fixed -20px does the same. The head never beats its
   majority baseline (56.2% vs 57.2%).
2. **bmPath (the SHIPPED metric) - the radial avenue is a DEAD END.** TMRadial is
   a systematic LOSS there (2/16, p=0.0013); every constant is within +-0.2pp; the
   only real bmPath effect is the BotRadius clamp. So the radial shift cannot help
   the shipped configuration.
3. The per-adversary optimum DOES vary (fixed -10 for crazy, -30 for tr_crazy,
   scale 0.95 for three others) - but ONE GLOBAL CONSTANT still beats the
   adaptively-trained head, so the "fragility justifies learning" argument FAILS.

THE REAL FINDING UNDERNEATH, and it generalises beyond this gun: the base linear
prediction systematically OVERSHOOTS. Measured raw per-tick base radial error has
mean -71 to -100 px; the enemy is NEARER than the prediction in 63-81% of shots
and farther in only 4-14%, CONSISTENT ACROSS ALL SIX CAPTURES. Radial label
histogram [415166,126461,120325,44694,19351] = 57.2% majority class, mean label
-82.3 px, mean applied shift -37.6 px. So the net-short bias is a GENUINE property
of these range-holders against a constant-velocity extrapolation (they decelerate
and turn, so the true position is closer than the straight-line guess) - NOT a
fixture artefact. That is worth chasing for the guns that actually ship.

Caveat: bmPoint is not the shipped metric (bmPath won the real-hit-rate A/B for
SELECTION), so a bmPoint win is not yet evidence of a real win. That needs a live
test - and the natural target is Pattern, which is now the default and best gun.

Adds radial_offset.nim + sweep_radial_offset.nim; tm_pattern.nim gains additive
instrumentation only (radial label mean and applied-shift mean; no behaviour
change, and test_tm_pattern_registration still passes all 20 checks).
This commit is contained in:
2026-09-22 02:08:38 +02:00
parent 589a230106
commit 9cd6e9b8ce
4 changed files with 792 additions and 0 deletions
+12
View File
@@ -179,6 +179,13 @@ type
revLabelHist*: array[2, int]
radCorrect*, radTotal*: int
revCorrect*, revTotal*: int
## Radial-target instrumentation (ablation support): raw label statistics
## and the mean APPLIED aim-distance shift, so a constant-offset control can
## be compared against the actual average readout the TM produces.
radDeltaSum*, radDeltaAbsSum*: float
radDeltaN*: int
radOffsetSum*: float
radOffsetN*: int
classCorrect*: int ## warm predictions whose class matched the eventual label
classTotal*: int ## warm predictions with a resolvable label
lastChosen*: int
@@ -502,6 +509,9 @@ proc tmResolveTrace(g: var TmPatternGun, t: TmPatternTrace, power: float) =
# distance. Independent of our own aim, so it is a clean target.
let actualRadius = hypot(g.posRing[s].x - t.fireX, g.posRing[s].y - t.fireY)
let radDelta = actualRadius - t.fireDist
inc g.radDeltaN
g.radDeltaSum += radDelta
g.radDeltaAbsSum += abs(radDelta)
let radWinner = if shuffleRad: rand(TM_CLASSES - 1) else: radToBucket(radDelta)
inc g.radLabelHist[radWinner]
if t.warm:
@@ -612,6 +622,8 @@ proc predict*(g: var TmPatternGun, state: WorldState, bulletSpeed: float):
else: gf = TM_SHRINK * bucketToGF(chosen)
of tmRadial:
radOffset = bucketToRadial(radChosen)
g.radOffsetSum += radOffset
inc g.radOffsetN
of tmReversal:
if TM_GF_MODE == "soft": gf = TM_SHRINK * tmSoftGF(votes)
else: gf = TM_SHRINK * bucketToGF(chosen)