ngram-mod: Reset i_last when low acceptance streak occurs#22168
Conversation
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
|
What speculative decoding parameters did you use in this test? |
|
Oh, sorry, it appears in cleaning up the layout I deleted the lines with the parameters. Additionally, I had to disable reasoning ( I've been using this change ever since proposing it for agentic coding with slightly different parameters: In my build I also added a little debug logging, and it is not uncommon to see a low acceptance streak right before a big chunk of 100% acceptance. With i_last not being reset, it wouldn't have anything to work with in those cases. |
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cherry-picks 4 upstream PRs to enable speculative decoding on hybrid MoE+SSM architectures (Qwen3.6-35B-A3B): - ggml-org#19493 — speculative checkpointing (save/restore recurrent state) - ggml-org#22114 — refactor "use checkpoint" logic - ggml-org#22168 — reset i_last on low acceptance streak - ggml-org#22223 — add --spec-default argument Smoke tested on M5 Max with turbo4 KV — zero regression. Co-Authored-By: tturney@psyguard.ai Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Overview
By resetting i_last to zero, we will include the current context when rebuilding the speculative map.
The existing behavior would skip the current context, thereby often losing the benefit of speculative decoding during later parts of the generation.
The effect of this seems to depend on both the model and the speculation parameters.
Benchmark:
vllm bench serve --model google/gemma-4-26B-A4B-it --host 127.0.0.1 --port 9876 --num-prompts 96 --dataset-name hf --dataset-path vdaita/edit_5k_char --backend openai-chat --endpoint '/v1/chat/completions' --max-concurrency 1Gemma 4 26B-A4B:
Qwen 3.6 35B-A3B:
As we can see, the effect isn't huge but at 3% to 9% it is still measurable.
The price we pay for it is 1 line of code and a moment longer for speculative map repopulation whenever a low acceptance streak occours.
Requirements