Add speculative decoding telemetry and memory gating#314
Open
aleroot wants to merge 1 commit into
Open
Conversation
19cd054 to
eb33b2d
Compare
eb33b2d to
a4a75f8
Compare
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.
Proposed changes
Speculative decoding is workload and hardware-sensitive. A draft model can look good in theory but fail to pay off if acceptance is low or if the extra model pressure is too high.
The change set prepares the project for edge-aware speculative decoding by adding the two missing foundations:
Telemetry
It exposes whether speculative decoding is actually helping at runtime. Callers can now inspect acceptance rate, draft tokens, target verification calls, emitted tokens, and average emitted tokens per target call through GenerateCompletionInfo.speculativeDecodingTelemetry.
Memory-Aware Gating
ChatSession now defaults speculative decoding to a memory policy based on GPU.maxRecommendedWorkingSetBytes(). Before this, enabling speculative decoding meant loading/running the main model plus draft model whenever requested. On memory-constrained systems, that can make things slower or less stable.
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes