From 2ea46ded73ef490e586b29de400fd8e50139b355 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Wed, 28 Oct 2026 14:04:52 +0100 Subject: [PATCH] dsv41: the post-prompt cache settle's budget 6,000 -> 800 ms on every platform The settle sits inside the prompt's own time: prompt: N tokens in X ms includes it, so a 6 s budget was 6 s of every DeepSeek first token. Measured on Strix Halo 2026-10-28 (p4k fixture, three interleaved rounds each, --dspark off): 6,000 ms -> 153.1 tok/s, 800 ms -> 190.0 (+24.1%), 0 -> 197.4 (+29.0%); the decode of the 256-token answer that follows pays 2.9% at 800 ms and 3.8% at 0. 800 ms keeps 1,412-1,436 swaps against the 6,000's 987-1,046, so it is still moving the hot experts in, it just stops paying for the last 5 s. An agent turn's answer is 50-300 tokens (where the swaps buy nothing) and its first token is the 800 ms, so this is the plan's WP-8 option (2) without the server-loop work of the idle settle (option 1, still the better answer and not done here). DS4_SETTLE_MS still overrides it (0 = off, any value in ms). --- src/dsv41/ds4_model.cu | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dsv41/ds4_model.cu b/src/dsv41/ds4_model.cu index 7ffa7cc4..dadc0bf1 100644 --- a/src/dsv41/ds4_model.cu +++ b/src/dsv41/ds4_model.cu @@ -6933,10 +6933,15 @@ struct Model::Impl { // after a chunked prompt: the expert cache catches up with what the prompt picked at once - a window prompt gets // its swaps one tick at a time over its hundreds of windows, a chunked one has a single tick - so the decode that // follows finds the hot experts in VRAM. Rounds of the ordinary swap rule (the hottest CPU-lane pick of each layer - // in, its coldest VRAM expert out) until nothing is worth moving or DS4_SETTLE_MS (6000) is spent + // in, its coldest VRAM expert out) until nothing is worth moving or DS4_SETTLE_MS is spent. + // The budget was 6,000 ms, and it sits inside the prompt's own time ("prompt: N tokens in X ms"): measured on Strix Halo + // 2026-10-28, the same p4k fixture took 26.6 s with it and 20.4 s without, +30.5% on the prompt (153.9 -> 200.8 tok/s). + // What the swaps buy is decode: about 10% on a 256-token answer, i.e. 6.2 s of prompt against 1.6 s of decode on that + // answer and nothing at all on a 50-300-token tool-call answer. 800 ms keeps the hottest of them and gives the prompt + // back about 5 s (the plan's own table: prompt + 256 tokens, 27.2 s at 6,000 ms, 23.9 s at 800, 23.4 s at 0). void cache_settle() { if (!o.expert_cache || cache_ths.empty()) return; - static const double budget = env_f("DS4_SETTLE_MS", 6000.0f); + static const double budget = env_f("DS4_SETTLE_MS", 800.0f); if (budget <= 0.0) return; const double t0 = now_ms(); const int64_t s0 = st.swaps;