Repository navigation
feat(qwen4exp): reuse cached prompt prefixes across requests (stacked on #808) - #809
Merged
Merged
Conversation
This was referenced Oct 5, 2026
dusterbloom
force-pushed
the
feat/qwen4exp-prefix-cache
branch
from
October 8, 2026 09:03
f89be47 to
c08cf1b
Compare
Squashed onto main after Luce-Org#774's squash-merge. Per-commit history: dusterbloom/lucebox-hub branch history/qwen4exp-prefix-cache-20261008. Commits: - feat(qwen4exp): reuse cached prompt prefixes across requests - fix(ci): keep the renamed mmid target in the prefix stack - test(qwen4exp): cover model park reload lifecycle - fix(ci): restore the DS4 fused GPU test target - fix(ci): restore DS4.1 width-invariance target
davide221
force-pushed
the
feat/qwen4exp-prefix-cache
branch
from
October 8, 2026 10:12
c08cf1b to
fb69671
Compare
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #808 (MTP); PR #774 has merged. Merge order: #808, this. Review only the prefix-cache work: dusterbloom/lucebox-hub@d54df4b...f89be47
What
Agent turns re-send the whole conversation, and qwen4exp re-prefilled all of it every turn. The server's existing prefix cache now works for qwen4exp: at the chat cut points it saves a prefix-sized device snapshot of the full sequence state (KV, recurrent GDN/conv state, PLE history, QSA indexer and pooled keys, MTP K/V and carry), restores it on a hit and prefills only the new tokens. A resident slot continues without a copy.
--prefix-cache-slots/ resident budget.Exactness
A restored turn produces byte-identical output to the same request prefilled cold, with MTP adaptive and with MTP off.
test_qwen4exp_prefix_cache: save/restore, overwrite/reset, partial match, cancel, resident continuation, MTP rollback, allowance accounting, device bytes.Speed (gfx1151, UD-Q4_K_XL,
--max-ctx 131072)64K agent context plus ~2K-token turns, time to first token (MTP adaptive / MTP off):
Prefill keeps a 4096-row chunk in both cases. Memory is split speed-first: the chunk planner reserves the 4096-row prefill workspace and snapshots get the rest (6.3 GB at 131K with MTP). At 262K with MTP only ~0.6 GB remains, so long prefixes are not cached there; the guide recommends
--max-ctx 131072or less for agent workloads.2026-10-07 stacked validation. The cumulative parent at
a93d8befpassed the full gfx1151 HIP/model V7 gate (result sha256:93210dffb2442f36a841a066f10eb298898a84e389b94c55f2993bcde61e66f1). The only follow-up source change restores main's four-line backend-neutral CMake registration fortest_ds41_mmid_width_invariance; the fixture source, runtime, kernels, and model code are unchanged. The exact follow-up tree3bdbeee6compiled and the restored fixture passed on gfx1151 (result sha256:bcb945b7c3d749ac239269f3f7f553bd707d92a977dbba1747089b16b7c1a906;binary sha256:75883d3798beb1a1f68f6b2a3669c855813a84468395c9548a245fc744dfd73f). The #810 candidate at4a5a16f5is byte/mode-identical to that tested tree. The throughput tables above retain their original measurement attribution.For #809, this is cumulative stack evidence; its prefix-cache-only source boundary is the compare link above.