Commit Graph
2 Commits
Author SHA1 Message Date
Pavlo RatushnyiandClaude Sonnet 5.5 4725df5bdf feat: --cache-slots, one worker keeps the KV caches of several agents and picks the right one (STRA-220)
GptOssEngine holds up to N conversation caches (--cache-slots N on the four workers, default 1 =
unchanged). crates/cpu-worker/src/slots.rs chooses per prompt: continue in place a slot that is
wholly a prefix of the prompt (the same agent's next turn); otherwise take the slot sharing the
longest prefix as a donor and either continue it (losing its tail) or copy the shared part into
a new/empty/least recently used slot (State::copy_prefix_from), whichever discards fewer cached
tokens, so a new agent gets the shared system prompt without destroying another agent's cache.
Results are bit-identical to a fresh prefill (synthetic test: copied prefix continues bit for
bit, donor untouched).

Measured: CPU only, 3 agents, 36 requests: 1.37x/1.46x prompt time, outputs identical.
Through the control plane, 4 agents on one iGPU worker, 3 clean alternating pairs: 986/993/995 s
with 1 slot against 569/575/575 s with 4 slots (1.73x), answers identical in all six runs. The
first run of pair 1 was disturbed by the UTC date in the system prompt changing mid-run and was
repeated. Compare-ConcurrentEpisodes.ps1 takes -Agents, -SharedInstructionTokens and the
'slots' arm and records output hashes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 03:45:20 +02:00
Pavlo RatushnyiandClaude Opus 5.5 c58173097d test: paired speculation A/B, CPU batch-cost curve and accelerator verify cost; docs (STRA-220)
ab_speculation: four agent-style prompts, 3 alternating pairs, greedy, identical
outputs in all 96 runs; copy-heavy output 1.10-1.36x decode, new text within noise
of 1.0. batch_cost: a CPU pass over n >= 4 tokens costs about 0.65 n single steps, so
CPU speculation is capped near 1.5x. One 9-token pass takes 7.3 s on the iGPU and
6.3 s through the NPU service against 0.75-0.93 s on the CPU, so neither is used for
verification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:11:02 +02:00