Experiments #174f
The forward's own error exits leak MLX locals (a defect in our own engine, error path only, found by row...
done
What was tested
The forward's own error exits leak MLX locals (a defect in our own engine, error path only, found by row 174's An independent check of the work by a different AI model, to catch mistakes the main one might share with itself. rounds): `rawEmbedding`'s reshape and scale outputs, the RMS norm result, the The writing phase: the model produces the reply one token at a time. Read more mask, `forwardStandardWith`'s hidden state `h` and `final_normed` are not freed when a later check fails (`src/transformer.zig` at tag best-2026-11-19-stk2: 7943, 7953, 7884, 12040, 9061, 9595); free them with errdefers and extend row 174's fault sweep over the ops inside `lazyForward` (the skip window `init_forward_from`/`init_forward_to` removed); lossless by construction, no pair; rides with the next stack
Model and setup
the best
Expected gain
none on speed: leaks removed on a failed request (**measured** by the test only)
Where the idea came from
row 174 Codex round 2, 2026-11-19
Outcome
done 2026-11-20: adopted via row 173es (ledger lesto_r173e, LESTO row/173es 79ae5615 carries stk3); test r174 passed in diag174fb, stk3's identity count proved the success path; earlier: built 2026-11-19: LESTO `row/174f` a030caad (about 130 error exits in the forward and its kernel wrappers free their arrays, 19 kernel config caches fixed; Codex 4 rounds, the last clean); test r174 passed in diag174fb (175 regular-path faults, 161 inside lazyForward, every one returned its error with active bytes unchanged; the dense trunk only, no Mixture of experts: a model made of many specialist sub-networks where only a few run per token. Read more fixture exists, `docs/experiments/2026-11-19-mac-r174-init-leaks/`); rides in stk3
Lesson
the forward's own error exits leaked their array locals the same way, and the init sweep reached them only because the regular path's lazyForward runs inside it (161 of its 175 faults); the MoE layers got the same fixes with no sweep, since Lesto has no small MoE fixture, so Codex is their only check.
Adopted
yes (via row 173es: ledger row lesto_r173e, LESTO row/173es 79ae5615 carries stk3, whose identity count proved the success path; coordinator 2026-11-20)