Verba/Rapida

Experiments #143fr

The answer mask's warm first-token cost (row 143fq: +1.12 ms [+0.69, +2.08] with the mask on, decode and...

done

What was tested

The answer mask's first-token cost (row 143fq: +1.12 ms [+0.69, +2.08] with the mask on, and replies unchanged): `headTailPrepare` (`src/transformer.zig:29743` at LESTO 27081e53) caches the head tail's prepared kept-row state for one mask id and rebuilds it (`headTailPrepareImpl`, `:29813`) when the chosen mask changes; the choice reads `ctx.head_tail_answer`, false by default (`:4793`) and set only after a `sampleLazy` draw (`src/generate.zig:2541`), so a first decode forward before that draw may choose `suppress_mask` and the next `answer_mask`, two rebuilds a request with the mask on. Step 1 a build on lesto-r143f that counts and times `headTailPrepareImpl` calls per request and stamps them against the first SSE write, 10 sessions; then the fix (set `head_tail_answer` from the request before its first forward, or two cached slots), the 150 identity count, a pair on the warm first

Model and setup

the best

Expected gain

warm first token about -1.1 ms (0.05% of a warm reply), lossless

Where the idea came from

row 143fq

Outcome

done 2026-11-19: confirmed, one rebuild a request (`mask=suppress`, 0.86 ms) before the first content chunk with the mask on, none with it off; the fix is row 143fs

Lesson

the answer mask's warm first-token cost is one rebuild a request of the head tail's prepared kept-row state (median 0.86 ms), caused by a flag that is false until the request's first draw, so a thinking-off request first prepares the other mask: a one-slot cache keyed by a per-request choice must take that choice before its first use.

Adopted

no (a diagnostic probe, never ; its fix is row 143fs)

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