Esperimenti #173kt
The hot prefix cache's trim copy at commit (row 173ks: 23 of 150 replayed requests, 37 ms each, 5.8 ms a...
done
Il testo degli esperimenti resta in inglese, come l'ha scritto il laboratorio.
Cosa è stato provato
The hot The server remembers the processed start of earlier prompts so that a repeated start is not recomputed. Approfondisci's trim copy at commit (row 173ks: 23 of 150 replayed requests, 37 ms each, 5.8 ms a request): `commitWithMediaState` prices a A frozen copy of files or a model state at a moment, used so a result can be reproduced. by its arrays' capacity rows (`src/prefix_cache.zig:504`) and over the 2 GB budget materializes a trimmed copy of every layer (`:1063`, `src/transformer.zig:4222`) before the terminator. Step 1, timing-free: per trimmed request, whether its used rows fit (7 of 23 trim to their own length) and whether a resident entry already holds the trimmed prefix; and peak memory around each trimmed commit (MLX active plus cache memory, and swap used, read just before and after the copy and at the next turn's first The unit of text a model reads and writes: roughly a short word or a piece of a longer one.), against the untrimmed requests, with the next turn's Prefill: the model reading the whole prompt before it can write the first token. Approfondisci and first The writing phase: the model produces the reply one token at a time. Approfondisci rounds beside it (the M4's swap sat at 1.72 of 2.0 GB at diag173ks's gate, so a 1.6 to 2.0 GB copy beside the live KV may push out pages the next turn pays for; coordinator 2026-11-20). Any such cost goes into this row's sizing and raises its priority; then the fix (no copy in those cases, or the copy off the request's path, minding the slot ownership row 173ks names) and its own pair on reply
Modello e configurazione
the hot prefix cache
Guadagno atteso
up to 5.8 ms a request, about 0.43% of the replay's window (inferred, the whole copy removed)
Da dove viene l'idea
row 173ks
Esito
done 2026-11-20 20:07 (engine-rows): both copy lines met on both sets (whole copy 5.8 and 6.6 ms a request; avoidable 1.7 and 6.6, every general-set trim self-length); no swap growth; fix rows 173km and 173kv (`2026-11-20-mac-r173kt-trim-copy/README.md` § Result, rows 173kt and 173kc step 1)
Lezione
the hot cache's trim copy costs 5.8 to 6.6 ms a request on both the sessions and the general set, and on general text every trim is a self-length copy that sheds only capacity rows, so pricing the cache by used rows removes it entirely there; the copy's 1.9 GB beside the live KV did not grow swap on the M4, and its replaced buffers reach MLX's pool only after the turn's clear, so they inflate the next turn's clear instead.
Adottato
no (diagnostics; their fix rows are queued as rows 173km, 173kv and 173kd).