Verba/Rapida

Experiments #174

The init error exits leak MLX arrays (a defect in our own engine, error path only)...

done

What was tested

The init error exits leak MLX arrays (a defect in our own engine, error path only): `Generator.initWithOptions` frees the logits only after `firstTokenLogprobs` returns, so a failure there leaks them on the server path (`src/generate.zig` at tag best-2026-11-19-stk2: 2236) and leaks them with the pre-built `next_logits` on the regular path (2291); free both on every error exit of the two branches (errdefer), with a unit test that injects the failure (mlx.zig's test fault hooks) and checks no array is left; lossless by construction, no pair; rides with 159z in the next stack

Model and setup

the best

Expected gain

none on speed: a leak removed on a failed request (**measured** by the test only)

Where the idea came from

row 159z step 1 (Noticed), coordinator 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/174` b7bd589e (errdefers in both tails; test r174 sweeps every checked op of the tails outside the forward, both paths, logprobs on; 5 rounds, the last clean); test passed 2026-11-19 in diag174fb (row/174f's build, which contains it: 14 server-path and 175 regular-path faults, each returned its error with active bytes unchanged); rides in stk3, whose identity count proves the success path

Lesson

an init tail that frees its outputs only after the last checked op leaks them on every earlier error; a fault armed at each checked op in turn, with settled active bytes as the oracle, finds every such exit on both paths (14 server, 175 regular) without a model or a pair.

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)

Want to see what these experiments produced? Lesto, the Gemma 4 inference engine for Apple silicon Macs, is on lestoengine.com

Made by Federico Andrioli, @fedeandri on X A research lab's own measurements, generated from its files. Data built