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++
generate, mtp: near the context's end the spec window and its drafts stay inside it
midagedeve85567b61781
diff --git a/src/core/mtp.cpp b/src/core/mtp.cppindex 7d46389db..afd1ef721 100644--- a/src/core/mtp.cpp+++ b/src/core/mtp.cpp@@ -1257,7 +1257,9 @@ bool MtpDrafter::draft(int T, const int32_t* tokens, int64_t p, int a, int32_t*if (!mtp_catchup_all()) T = a + 1;const bool cp = coupled_active_; // coupled draft sampling for this request: its own graphsif (!capture_round(T, cp, err)) return false;- const int max_steps = std::min(max_t_ - 1, max_drafts_);+ // Draft j writes its K/V at cell p + a + j, and the K/V ends at max_cells (its page table has no page past it):+ // near the context's end the round drafts only the cells that exist+ const int max_steps = (int) std::min<int64_t>(std::min(max_t_ - 1, max_drafts_), st_.max_cells - (p + a));for (int j = 1; j < max_steps; ++j)if (!capture_step(j, cp, err)) return false;const Clock::time_point t0 = Clock::now();diff --git a/src/program/generate.cpp b/src/program/generate.cppindex 3248acb16..e76e582b8 100644--- a/src/program/generate.cpp+++ b/src/program/generate.cpp@@ -12237,13 +12237,18 @@ int main(int argc, char** argv) {if (pk.lookup) { T = pk.t; from_sfx = true; }}}+ // The window's rows sit at p .. p + T - 1, and past the context there is no cell to verify them in: near+ // its end the window takes only the rows that fit (the admission checked the prompt and max_new, which a+ // full window can overrun)+ const int room = (int) std::min<int64_t>(o.spec, o.max_context - p);+ T = std::min(T, room);// --lookup-chain: what followed an earlier occurrence of the context + the MTP's drafts, after themint chain_n = 0, cm = 0;- if (o.lookup_chain > 0 && use_mtp && !first_window && !from_sfx && T < o.spec) {+ if (o.lookup_chain > 0 && use_mtp && !first_window && !from_sfx && T < room) {int csrc = -1;const int nt = chain_tail(sfx, drafts.data(), T - 1, ctail);chain_n = strata::spec::propose_from_sources(lookup_src, ctail.data(), nt, T - 1,- std::min(o.lookup_chain, o.spec - T), o.lookup_chain_min,+ std::min(o.lookup_chain, room - T), o.lookup_chain_min,cbuf.data(), &cm, &csrc);if (chain_n > 0 && std::getenv("STRATA_LOOKUP_CHAIN_FIXED") == nullptr) {double p_mtp = 1.0;