From 0a167082a38a313098192072d9e295e150f7fec4 Mon Sep 17 00:00:00 2001 From: Paul Dubs Date: Mon, 27 Apr 2026 14:05:36 +0200 Subject: [PATCH] Reset i_last when low acceptance streak occurs (#1701) By resetting i_last to zero, we will include the current context when rebuilding the speculative map. --- common/speculative.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/speculative.cpp b/common/speculative.cpp index f76d40ab..d63edd74 100644 --- a/common/speculative.cpp +++ b/common/speculative.cpp @@ -693,6 +693,7 @@ struct common_speculative_state_ngram_mod : public common_speculative_state { mod.reset(); n_low = 0; + i_last = 0; } } else { n_low = 0; @@ -1459,4 +1460,4 @@ void mtp_accept_tokens( mtp_update_kv_cache(ctx, accepted_batch, false); llama_batch_free(accepted_batch); -} \ No newline at end of file +}