From aece46db8900cf5b19231d73ad455c9c3072ba7b Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Tue, 20 Oct 2026 23:41:24 +0200 Subject: [PATCH] generate: --spec on a native pack starts the speculative loop for a 1-token prompt (spec_pos -1 = unused, 0 is a real position) --- src/program/generate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 3cef8621..48245995 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -15482,7 +15482,7 @@ int main(int argc, char** argv) { // ---- plan v0.3 P5: the prompt's conditioning positions [0, n_prompt - 1) in batched chunks. The token loop // then starts at the last prompt position, whose prediction is the first generated token. int64_t pos_start = 0; - int64_t spec_pos = 0; // plan v0.3 P6: where the speculative loop starts (0 = not used) + int64_t spec_pos = -1; // plan v0.3 P6: where the speculative loop starts (-1 = not used; 0 is a real position: a 1-token prompt on a native pack) strata::prefill::Prefill prefill; // #1595: not by default when the cache holds every expert (nothing to take) strata::prefill::Prefill::arm_cpu_share(!multi_gpu && !o.no_pool, @@ -15872,7 +15872,7 @@ int main(int argc, char** argv) { // round emits (accepted drafts + 1) tokens. `commit` keeps the state of the tokens that were emitted. const bool ended = o.stop_eos && !produced.empty() && std::find(o.eos_ids.begin(), o.eos_ids.end(), (int64_t) produced.back()) != o.eos_ids.end(); - if (spec_pos > 0 && (int64_t) produced.size() < o.max_new && !ended) { + if (spec_pos >= 0 && (int64_t) produced.size() < o.max_new && !ended) { auto read_ids = [](const std::string& path, std::vector& ids) { std::ifstream in(path); std::string text((std::istreambuf_iterator(in)), std::istreambuf_iterator());