Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
docs: coupled drafts with Gumbel-max picks (STRATA_SPEC_GUMBEL), measured on Strix Halo
Jim Routh2088bd45f540
diff --git a/docs/DETAILS.md b/docs/DETAILS.mdindex 410483748..6d42315d6 100644--- a/docs/DETAILS.md+++ b/docs/DETAILS.md@@ -110,6 +110,20 @@ answer after a start differ from the next ones. Measured here (IQ3_XXS, a 3.6K-tthree switches 1 answer of 4, without `--pcie-frac 0` 2 of 4 (the first one differs), with the defaults 2 of 4.`--pcie-frac 0` costs decode speed (the missed experts all run on the CPU), so keep it for A/B runs.+**Coupled drafts with Gumbel-max picks (opt-in, `STRATA_SPEC_COUPLED=1` and `STRATA_SPEC_GUMBEL=1`):** for a request+that samples (temperature above 0), `STRATA_SPEC_COUPLED=1` lets the draft layer sample its guesses with the target's own+chain and random draw instead of taking its most likely token. `STRATA_SPEC_GUMBEL=1` changes how both of them pick from+that chain: the token with the largest p / E, where E is exponential noise keyed by the seed, the position and the token+id (the Gumbel-max trick; it is still an exact sample of the same distribution). With the default pick, one random number+walked over the candidates sorted by probability, a draft and a target whose candidate lists differ in one token tend to+land on different tokens; with noise keyed by the token, a token gets the same noise on both sides, so they agree on the+tokens they share. Greedy requests are unchanged, and without the variables nothing changes. Measured on a Ryzen AI+Max+ 395 (Radeon 8060S, Linux, ROCm 7.14.1, the iGPU alone), UD-Q4_K_XL, `--spec 4 --mtp` (the base model's draft+layer), temperature 1.0 / top_p 0.95 / top_k 20, a 1.3K-token prompt and 512 output tokens, 12-13 requests per arm:+drafts accepted 52.8% -> 59.9%, tokens per verify window 2.65 -> 2.88, output 41.1 -> 44.9 tokens/s (+9%); a window+costs the same (draft 8.8 -> 9.1 ms of 64). `sampler_parity` checks the pick against a host reference on every sampled+path, and that its frequencies match the softmax.+**The draft layer's tokens (0.1.27, `--draft-vocab`):** the MTP draft layer can only propose tokens from a subsetof the vocabulary (`mtp/rt/draft_vocab.bin`). Since 0.1.27 the subset includes every Chinese, Japanese and Koreantoken (106,299 ids), so answers in those languages are 15-38% faster (Q2_0, RTX 5070). Its head takes ~180 MiB ofdiff --git a/include/strata/core/coupled_draft.hpp b/include/strata/core/coupled_draft.hppindex 15963d4df..0b5ada295 100644--- a/include/strata/core/coupled_draft.hpp+++ b/include/strata/core/coupled_draft.hpp@@ -11,6 +11,11 @@// the two inverse-CDF picks from one uniform agree far more often than an argmax agrees with a sample; the target's// pick - and so the text - does not change, because verification is still exact-match against the target's sample.//+// STRATA_SPEC_GUMBEL=1 (opt-in) replaces the inverse-CDF pick on BOTH sides with a Gumbel-max pick: argmax p_i / E_i,+// E_i ~ Exp(1) keyed by (seed, counter, token id) (sampler.cu `gumbel_exp`). A token then gets the same noise in the+// draft's and the target's draw whichever other tokens survived either cut, so they agree on the tokens they share;+// with one uniform over two probability-sorted lists, a one-token difference in the lists shifts every later pick.+//// THE COUNTER ARITHMETIC (all positions are sequence indices; a window's row t holds the token at pos0 + t and its// pick is the token at pos0 + t + 1, drawn with counter pos0 + t):// * MTP cell c pairs the main model's residual at position c with the token at c + 1 and predicts the token at