Files
ailed-experiments-rp/results/a1.md
T

20 KiB
Raw Blame History

Claim A1: does affect move a gate that gradient descent left inert, and does moving it help?

Task 8. results/frozen.md §3 measured the GRP's gate at g = 0.500 ± 0.029 after 8000 steps, on every seed, never above 0.9, never below 0.1: M ← (1−g)M̃ + gM had degenerated to a fixed 50/50 blend with no input dependence. The gate's pre-activation is W_g[h‖M] + b_g − κa, and the −κa term never passes through the gradient, which makes it the only available lever on that gate. This file measures what pulling it does.

Verdict: affect moves the gate, decisively and by a visible mechanism. Moving it buys nothing, and the one effect that is specific to real surprise timing is a harm. Steady error is flat across κ ∈ {0,1,2,4,8,16} to within 1.2%, on a coin flip of seeds. Two steps after a switch, real affect is worse than κ=0 on 14–16 of 16 seeds, monotonically in κ, and worse than a shuffled-affect control that delivers the same gate-value distribution with the wrong timing on 15/16.

Environment: experiments/, ailed/ unmodified, no default in particles.py or regime.py changed. 16 seeds (0–15), 8000 training steps, lr=1e-3, bptt=20, hidden=32, omega=10, window=20. Noise floor noise² = 4.0e-06. All metrics are regime._metrics on the second half of training, so they are directly comparable with the tables in headroom.md and frozen.md. 288 runs.

uv run python a1.py --stage sweep    --out results/a1_sweep.json
uv run python a1.py --stage controls --out results/a1_controls.json
uv run python a1.py --stage shuffle  --kappa 4  --out results/a1_shuffle_k4.json
uv run python a1.py --stage shuffle  --kappa 16 --out results/a1_shuffle_k16.json
uv run python a1.py --stage report --inputs results/a1_sweep.json,results/a1_controls.json

0. What is measured, and how it is checked

Organism.forward returns only out(M), so g has to be reconstructed. a1.GateTrace rebuilds h from the public org.rp exactly as core.py builds it, then asserts org.grp(h, M_prev, a) equals the M the organism actually returned — every step of every run — 272 gated runs, 2.18M assertions, none of which fired. That is what makes the reported g the organism's own gate rather than a plausible lookalike; test_gate_reconstruction_is_the_organisms_own_gate shows the assert can fail, by perturbing the reconstructed h by 1e-6.

The A1 comparison is grp_k against grp_k0: identical architecture, identical 5602 parameters, one seed, differing only in κ. rp_only (1442 parameters) and grp_k0_nostate are context and never the claim — frozen.md §5. For the record, at 16 seeds in the trained phase the same decomposition reads:

                              mean   median   seeds won
capacity  rp_only / nostate   3.04x   2.71x      16/16
state     nostate / grp_k0    1.19x   1.11x      11/16

which is frozen.md's trained-phase decomposition (3.06x on 8/8, 1.25x on 4/8) at twice the seeds. The state row is firmer than it was at 8 seeds and still modest: five seeds go the other way and the median is 1.11x.

grp_k at κ=0 is grp_k0 by construction, and test_run_a1_reports_the_same_metrics_regime_run_does asserts the two produce bit-identical metrics, so the sweep's κ=0 row is the baseline rather than a re-implementation of it.

1. Part A — the gate moves, and the learned part does not

Second half of training, pooled over all entity-steps, means over 16 seeds. g_post is the union of the 20 steps each switch opens — exactly the steps recovery[0..19] averages over — and g_far is _metrics's own steady_idx, so the gate contrast and the error contrast are measured on the same steps. pre is the learned part of the pre-activation, W_g[h‖M] + b_g, with the forcing left out.

kappa   g_all     sd  g_post  g_far   delta  frac>0.9  frac<0.1     pre  a_post  a_far
--------------------------------------------------------------------------------------
    0   0.501  0.025   0.501  0.500  +0.000     0.000     0.000   0.002   0.229  0.109
    1   0.465  0.068   0.446  0.474  -0.029     0.000     0.000   0.000   0.227  0.106
    2   0.436  0.114   0.402  0.453  -0.052     0.000     0.000   0.000   0.228  0.106
    4   0.400  0.164   0.349  0.427  -0.078     0.000     0.124   0.002   0.229  0.106
    8   0.368  0.197   0.307  0.400  -0.094     0.000     0.206   0.002   0.231  0.107
   16   0.343  0.213   0.277  0.378  -0.100     0.000     0.264  -0.002   0.232  0.108

Read down the columns:

  • κ=1 is enough. Mean g moves from 0.501 to 0.465 and its sd nearly triples, 0.025 → 0.068. The mean shift is the trivial part; the sd is not, and it is what says the gate has acquired input dependence it did not have.
  • Saturation begins between κ=2 and κ=4. No entity-step has g<0.1 at κ≤2; 12.4% do at κ=4, 20.6% at κ=8, 26.4% at κ=16. The gate never saturates the other way at any κ, which it cannot: a ≥ 0, so the forcing is one-sided.
  • The forcing signal is real and switch-locked. Mean arousal is 0.229 in the post-switch window against 0.106 far from one, a factor of 2.2, at every κ.
  • Gradient neither compensates nor participates. pre is 0.000 ± 0.002 at every κ, the same value frozen.md §3 measured at κ=0. The learned part of this gate is inert whether or not it is being forced: −κa is not modulating a learned gating policy, it is the entire gate.

Per-seed, the post-vs-far contrast is unanimous rather than an average:

kappa   mean delta   median   seeds with post < far
--------------------------------------------------
    0      +0.0000  +0.0001           4/16
    1      -0.0288  -0.0296          16/16
    2      -0.0518  -0.0528          16/16
    4      -0.0778  -0.0769          16/16
    8      -0.0936  -0.0942          16/16
   16      -0.1004  -0.0970          16/16

The κ=0 row is the control on this contrast: with the forcing off, the gate is as likely to sit higher after a switch as lower (4/16) and the effect size is 0.0000.

1a. The excursion, lag by lag

The same quantity recovery[k] measures on the loss, measured on the gate: lag k after a switch, averaged over the second half's switches, means over 16 seeds.

kappa    @0    @2    @4    @6    @8   @10   @12   @14   @16   @18     far
-------------------------------------------------------------------------
    0  0.500 0.500 0.500 0.500 0.500 0.501 0.501 0.501 0.501 0.501   0.500
    1  0.486 0.457 0.448 0.445 0.440 0.436 0.434 0.435 0.440 0.447   0.474
    2  0.473 0.419 0.405 0.400 0.392 0.386 0.383 0.384 0.391 0.404   0.453
    4  0.456 0.370 0.355 0.347 0.336 0.328 0.323 0.325 0.334 0.349   0.427
    8  0.439 0.330 0.319 0.307 0.293 0.283 0.280 0.278 0.286 0.302   0.400
   16  0.421 0.302 0.292 0.278 0.260 0.252 0.251 0.251 0.256 0.269   0.378

arousal (identical at every kappa, so the forcing is an input, not a feedback loop)
       0.061 0.184 0.223 0.236 0.253 0.267 0.279 0.272 0.249 0.220   0.106

The gate is an exact mirror of the arousal transient, which is what it must be given that pre is flat. Two details worth carrying into the paper:

  • Arousal is lowest at the switch step itself (0.061, below its far-from-switch level of 0.106) and peaks 12 steps later. Affect.update compares the loss to a slow baseline, so the surprise register lags the event by several steps. The gate therefore opens after the error has already begun to rise, not at the moment the world changes.
  • The arousal curve is the same at every κ to within 0.01. Forcing the gate does not change the error stream enough to change the affect built from it, so there is no feedback loop to worry about here.

2. Part B — moving it buys nothing

steady and recovery[k] from regime._metrics, means over 16 seeds. rp_only and grp_k0_nostate are the context rows.

condition            steady       (sd)      rec@0      rec@2      rec@5     rec@10     rec@19
---------------------------------------------------------------------------------------------
grp_k0            2.399e-05  1.163e-05  3.177e-05  3.166e-05  3.477e-05  3.952e-05  3.196e-05
grp_k1            2.425e-05  1.223e-05  3.224e-05  3.323e-05  3.629e-05  4.050e-05  3.221e-05
grp_k2            2.409e-05  1.162e-05  3.224e-05  3.382e-05  3.640e-05  4.043e-05  3.186e-05
grp_k4            2.413e-05  1.163e-05  3.209e-05  3.453e-05  3.644e-05  4.065e-05  3.218e-05
grp_k8            2.415e-05  1.160e-05  3.185e-05  3.542e-05  3.619e-05  4.075e-05  3.185e-05
grp_k16           2.428e-05  1.158e-05  3.218e-05  3.605e-05  3.686e-05  4.061e-05  3.179e-05
rp_only           7.708e-05  3.668e-05  8.322e-05  8.702e-05  9.174e-05  9.437e-05  8.391e-05
grp_k0_nostate    2.791e-05  1.213e-05  3.539e-05  3.689e-05  3.947e-05  4.515e-05  3.707e-05

The across-seed sd (1.16e-05) is 40 times the largest difference between any two κ rows, so the paired comparison is the only one worth reading.

paired grp_k0 / grp_k on steady
kappa    mean  median    won   per-seed
---------------------------------------------------------------------------
    1    0.99    1.00   6/16   1.03 1.00 1.00 1.00 1.01 1.01 0.99 1.01 0.99 0.99 0.96 1.00 0.99 0.98 0.96 1.02
    2    1.00    1.00   9/16   1.03 1.00 1.00 1.00 1.01 1.00 1.00 1.01 0.98 1.01 1.01 0.99 1.00 0.98 0.92 1.02
    4    1.00    1.00   8/16   1.05 1.01 0.99 1.00 1.00 1.00 0.93 1.02 0.98 1.02 1.02 0.99 1.00 0.94 0.94 1.05
    8    1.00    1.00   7/16   1.04 1.01 0.99 0.99 1.03 0.99 0.94 1.01 0.97 1.02 1.02 0.99 1.00 0.94 0.92 1.08
   16    0.99    1.00   9/16   1.09 1.01 0.99 0.98 1.02 1.01 0.92 1.01 0.97 1.01 1.03 0.98 1.00 0.92 0.88 1.01

A coin flip at every κ: median 1.00, between 6 and 9 seeds out of 16, no trend in κ. A gate driven from an inert 0.500 to a switch-locked excursion between 0.42 and 0.25 changes steady error by nothing that 16 seeds can see.

2a. The one systematic effect, and it is a harm

frozen.md §1b showed recovery[k] tracks the world's post-switch configuration transient — a stateless frozen model reproduces its shape at every lag — so the raw curve is not an adaptation measurement. That transient is common to every condition here, which is what makes a difference between conditions at matched lag interpretable where the curve itself is not.

paired grp_k0 / grp_k at matched lag (mean ratio, seeds won; <1 means kappa is worse)
kappa           @0            @2            @5           @10           @19
---------------------------------------------------------------------------
    1   0.99   7/16   0.96   2/16   0.97   2/16   0.98   3/16   1.00   7/16
    2   0.99   5/16   0.94   0/16   0.96   3/16   0.98   3/16   1.00  12/16
    4   0.99   6/16   0.92   1/16   0.96   4/16   0.97   3/16   0.99   8/16
    8   1.00   7/16   0.91   0/16   0.96   5/16   0.97   2/16   1.00  10/16
   16   0.99   7/16   0.89   0/16   0.95   4/16   0.97   3/16   1.00  10/16

At lag 2 the forced gate is worse on 14–16 seeds out of 16, monotonically in κ, from 4% at κ=1 to 11% at κ=16. The effect is present but smaller at lags 5 and 10, absent at lag 0 (arousal has not risen yet) and gone by lag 19 (it has decayed). It is the only sign-definite, κ-monotone effect anywhere in this file.

The mechanism is visible in §1a. Overwriting M with a fresh candidate discards the temporal averaging the blend was providing, and frozen.md §1b already established that the post-switch excess belongs to the world's configuration transient, which no amount of state can shorten. There is nothing for a freshly written memory to gain here, and the smoothing is what it costs.

3. Part C — the shuffled-affect control

If a forced gate had helped, the obvious alternative reading is that −κa acts as a generic regulariser or bias shift rather than as an affective signal. Three controls, all replaying the arousal sequence the gate itself saw, all at the same seed with everything else unchanged:

arm what it delivers
real the live signal — replayed from the recorded trace, so this arm must reproduce the unhooked run bit for bit
shuffled the same values permuted within each half, so the marginal is matched exactly in the measured window, not merely in expectation
shifted the whole trace circularly rolled — also preserves arousal's own autocorrelation, and breaks only its alignment with the switches
const the run's mean arousal, i.e. −κa reduced to a pure bias shift with no timing information at all

Only the arousal reaching the gate is replaced. The CPPN keeps the organism's own live (valence, arousal), passed explicitly and built exactly as Organism.forward would have built it, so −κa is the single thing that moves. test_replaying_the_runs_own_arousal_reproduces_it_exactly pins this, the driver asserts it again on all 16 seeds at run time, and the real arm is separately verified identical to the sweep's grp_k4 / grp_k16 rows on steady and on all 20 recovery lags. The replay machinery is checked, not trusted.

3a. The controls do what they are supposed to do

κ=4, means over 16 seeds:

arm         g_all     sd  g_post  g_far   delta  frac<0.1  a_post  a_far
------------------------------------------------------------------------
real        0.400  0.164   0.349  0.427  -0.078     0.124   0.229  0.106
shuffled    0.400  0.165   0.399  0.400  -0.001     0.124   0.150  0.147
shifted     0.408  0.158   0.411  0.407  +0.004     0.105   0.130  0.135
const       0.369  0.024   0.369  0.369  +0.000     0.000   0.136  0.136

shuffled matches real's gate distribution to three decimals — same mean, same sd, same saturated fraction — while its post-vs-far contrast collapses from −0.078 to −0.001. The values are preserved and the timing is destroyed, which is exactly what the control has to do. Lag by lag, κ=4:

arm            @0     @2     @4     @6     @8    @10    @12    @14    @16    @18     far
real        0.456  0.370  0.355  0.347  0.336  0.328  0.323  0.325  0.334  0.349   0.427
shuffled    0.414  0.405  0.400  0.398  0.407  0.402  0.405  0.398  0.394  0.395   0.400
shifted     0.409  0.410  0.413  0.415  0.416  0.413  0.408  0.409  0.409  0.410   0.407
const       0.369  0.369  0.369  0.369  0.369  0.369  0.369  0.369  0.369  0.369   0.369

Note const at κ=16: g = 0.103 ± 0.010 with 47.9% of entity-steps below 0.1. A gate pinned near zero is not an open gate, it is a different dead gate, and this is what a constant-arousal bias shift degenerates into at large κ.

3b. The result

κ=4, steady, means over 16 seeds, with the paired comparison against shuffled:

arm         steady        rec@0      rec@2      rec@5     rec@10     rec@19
---------------------------------------------------------------------------
real     2.413e-05    3.209e-05  3.453e-05  3.644e-05  4.065e-05  3.218e-05
shuffled 2.378e-05    3.191e-05  3.243e-05  3.591e-05  4.036e-05  3.216e-05
shifted  2.438e-05    3.222e-05  3.280e-05  3.619e-05  4.062e-05  3.261e-05
const    2.391e-05    3.223e-05  3.286e-05  3.585e-05  4.009e-05  3.170e-05
(grp_k0  2.399e-05    3.177e-05  3.166e-05  3.477e-05  3.952e-05  3.196e-05)

paired shuffled / arm, per seed
             steady           @0           @2           @5          @10          @19
-------------------------------------------------------------------------------------
real     0.99   5/16   1.00  8/16   0.94  1/16   0.99  5/16   0.99 10/16   1.00  8/16
shifted  0.98   6/16   1.00  9/16   0.99  7/16   1.00  8/16   1.00 10/16   0.99  7/16
const    1.00   8/16   1.00 10/16   0.99  8/16   1.00 10/16   1.01 12/16   1.01 11/16

κ=16:

arm         steady        rec@0      rec@2      rec@5     rec@10     rec@19
---------------------------------------------------------------------------
real     2.428e-05    3.218e-05  3.605e-05  3.686e-05  4.061e-05  3.179e-05
shuffled 2.371e-05    3.171e-05  3.269e-05  3.584e-05  4.033e-05  3.221e-05
shifted  2.426e-05    3.236e-05  3.293e-05  3.575e-05  4.068e-05  3.204e-05
const    2.413e-05    3.239e-05  3.438e-05  3.673e-05  4.095e-05  3.210e-05

paired shuffled / arm, per seed
             steady           @0           @2           @5          @10          @19
-------------------------------------------------------------------------------------
real     0.98   5/16   0.99  7/16   0.92  1/16   0.98  4/16   0.99  6/16   1.01 11/16
shifted  0.98   8/16   0.98  6/16   0.99  5/16   1.00  7/16   0.99  9/16   1.00 10/16
const    0.99   8/16   0.98  4/16   0.95  1/16   0.98  6/16   0.99  5/16   1.01  9/16

On steady, real affect is indistinguishable from shuffled affect — 5/16 seeds at both κ, mean ratio 0.98–0.99. The values matter as little as the timing does, because neither matters at all.

On recovery[2], real affect is worse than shuffled on 15/16 seeds, by 6% at κ=4 and 8% at κ=16, while shifted (which preserves arousal's autocorrelation and breaks only its alignment with the switches) sits at parity, 0.99 on 5–7/16. So the lag-2 degradation of §2a is genuinely about surprise timing: it is the one thing correlating −κa with the switches does that a distribution-matched control does not, and what it does is make the error worse. const reproduces about half of it at κ=16 (0.95 on 1/16) and none of it at κ=4, which is the bias-shift channel appearing only once the constant is large enough to shut the gate outright.

4. Verdict

Does affect move the gate? Yes. κ=1 moves mean g off 0.500 and triples its sd; κ=4 opens 12% of entity-steps past g<0.1; the gate traces the arousal transient lag for lag, with a post-vs-far contrast of −0.078 at κ=4 on 16/16 seeds. The learned part of the pre-activation stays at 0.000 ± 0.002 throughout, so this is not affect modulating a learned gating policy — it is affect supplying the whole of a gating policy gradient descent never built. A1's premise holds: the −κa term activates a mechanism that gradient descent left inert.

Does moving it help? No. Steady error is flat to 1.2% across a 16-fold range of κ and wins on 6–9 seeds of 16 — a coin flip. The only sign-definite effect is a 4–11% degradation of error two steps after a switch, monotone in κ, on 14–16 of 16 seeds. The shuffled control confirms that this degradation is specifically about surprise timing and not a generic bias shift, which makes it the cleanest positive measurement in the file and it points the wrong way.

A1 does not hold on this domain, and the reason is the one headroom.md §6(c) and frozen.md §4 both reached from other directions. The post-switch error here is dominated by the world's own configuration transient, which no gating policy can shorten; memory's only contribution is temporal smoothing; and a gate that opens on surprise spends exactly that smoothing at the moment it is worth most. The mechanism works. The domain gives it nothing to do, and a small amount to lose.

This is a measured null about this domain and this budget, not an impossibility result. What would give the mechanism a job is what the two earlier files already asked for: a domain where regime identity is worth something to a per-entity state — a short world transient and a long ambiguity — so that discarding a stale memory buys more than the averaging it costs. Three things this file establishes that carry forward regardless:

  • The forcing lever works and is measurable. Any future domain can be checked for A1 with the same instrument, and pre ≈ 0 gives the null a mechanism rather than an absence.
  • Arousal lags the event by ~12 steps. Affect.update's slow baseline means the gate opens after the error rises, not when the world changes. In a domain where timing matters, that lag is a design parameter (rho_a, rho_slow) and not a constant.
  • recovery[2] is where affect shows up at all. Whatever replaces this domain should be checked for an effect at short lag before its steady-state error is quoted.