diff --git a/docs/DETAILS.md b/docs/DETAILS.md index bcca1fc6..d385aa10 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -1372,6 +1372,29 @@ test images. --- +## Short prompts: let the CPU share the experts (opt-in, `STRATA_PREFILL_CPU_SHARE`) + +A prompt chunk below 1,024 tokens (an agent's tool result, a test's output, a short follow-up) streams every routed +expert that is not in VRAM over PCIe, while the CPU pool that decodes sits idle and the RAM arena already holds those +experts. `STRATA_PREFILL_CPU_SHARE=auto` hands the pool the experts few of the chunk's tokens route to, measures per +layer how long each side takes and gives the CPU the share at which both end together (`STRATA_PREFILL_CPU_SHARE=0.4` +fixes a share). It is off unless you set it, and then the output is byte-identical to the build without it. + +When on, the CPU's rows are computed in the CPU's own activation format, so the output changes in the last bits (first +token KL against off: mean 0.006, max 0.026 nats over 22 prompts; about half of the 32-token greedy answers on 500 and +1,000-token prompts are identical, the rest part at a near tie after about 23 tokens). Prompts of 2K tokens and longer +read the same either way (their chunks are above the limit). Serve without `--batch`, one GPU. + +Prompt time, medians of 10 interleaved pairs (off / auto, ms, `--expert-cache 1500`): + +| machine | 512 tokens | 1,000 tokens | 2K / 4K / 16K | +|---|---|---|---| +| RTX 5070, Ryzen 5 7600, Q2_0 | 1,376 / 1,019 (-26%) | 1,788 / 1,392 (-22%) | unchanged | +| RTX 3060, Core Ultra 7 265, IQ3_XXS | 1,620 / 1,159 (-28%) | 2,196 / 1,770 (-19%) | unchanged | +| Tesla P100, Xeon E5-2690 v4, IQ3_XXS | 4,805 / 3,126 (-35%) | 6,821 / 5,085 (-25%) | unchanged | + +--- + ## Experimental speed projection (EXPERIMENTAL, off by default) **This is an experiment, not a finished feature.** It ships with Strata but stays off unless you turn it on.