Add optional simple fallback for history ngram proposer misses - #1054
Merged
danielwinterw merged 1 commit intoJul 22, 2026
Merged
Conversation
When ngram_fallback = "simple" is set, a cache or suffix miss retries with the llama.cpp simple proposer (2-token minimum match) so a draft is always in flight. Default off. Aimed at high-latency links where a mediocre draft beats no draft; roughly neutral on LAN.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
michaelneale
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1037 (feat/suffix-ngram-proposer). Only the last commit is new.
What
Adds an opt-in fallback chain for the standalone N-gram proposers: when the
configured history proposer (
cacheorsuffix) proposes nothing, retry thesame window with llama.cpp's simple proposer so there is always some draft in
flight.
New config key, default off:
Why
A suffix miss currently means zero draft, which costs one token per network
round trip. On a WAN split that round trip dominates, so a mediocre draft
beats no draft. This raises the worst-case floor without touching the hit
path: a history-proposer hit is returned unchanged, and the fallback only
runs on a miss.
Expected impact: roughly neutral on LAN, possibly slightly negative (we
measured simple at 13.6 vs 15 tok/s baseline on freeform chat locally).
Estimated +10-20% on WAN from the raised floor. WAN numbers are estimates,
not measurements; the LAN numbers are mechanism microbenchmarks, not quality
results.
Design notes
ngram_proposer: string config surfaceand validation in mesh-llm-config, schema + control behavior, resolver into
NgramProposalConfig.fallback_simple, dispatch inspeculative/standalone.rs. The resolved-plan field is serde-defaulted soexisting JSON plans keep parsing.
proposer's bounds. Suffix runs at min 5, which simple would rarely satisfy;
llama.cpp's simple proposer takes only a minimum, and 2 is its useful floor.
Fine to make configurable later if anyone needs it.
ngram_fallback = "simple"with a simple primary is rejected in validationsince it can never do anything.
"simple"when the fallback produced thedraft, via the existing
ConfiguredNgramProposal.sourcefield, soacceptance can be split by source when measuring.
Tests
Co-located in
standalone.rs: fallback fires on a history-proposer miss,does not replace a hit, stays off by default, and a fallback miss still
reports the primary source. Plan validation test for the simple-primary
rejection. Docs updated in USAGE.md and the CONFIGURATION.md matrix.