Skip MTP probes while drafts go unused#385
Open
pandysp wants to merge 1 commit into
Open
Conversation
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.
Loading
--mtpmakes every plain (non-speculative) eval run the MTP drafter, and when the next call is also a plain eval the draft is invalidated unused. Sampled decoding does this on every token, so any temp>0 span pays a full drafter pass per token with no way to use the result. Measured on an M4 Max (q2-q4-imatrix base, Q4K/Q8 MTP head), paired and interleaved: generating at temp 0.7 with--mtploaded runs 6.5% slower [6.3, 6.7] than without it. The tax is easy to miss because any baseline with--mtploaded pays it too, includingDS4_MTP_SPEC_DISABLEruns.The fix is one session counter: when a pending draft is invalidated unused, skip the next 15 probes; a consumed draft resets it. Greedy decoding never arms the skip, since its drafts are always consumed, so the speculative path is untouched: greedy output is byte-identical with and without the patch on copy and prose prompts, and
--mtp-verify-depthpasses.With the patch, sampled generation with
--mtploaded is back to within 0.4% [0.1, 0.8] of not loading it. Under a live pi coding-agent task against ds4-server (mixed greedy tool-call spans and sampled spans, 250k ctx), token-weighted decode improves +2.7% to +7.6% over three paired rounds (mean +5.4%), with the task succeeding in every run.Not addressed, measured for scope: low-acceptance greedy content (free-flowing prose at temp 0) still pays the probe for drafts that are consumed but rejected; that is the -5.4% draft-2 row in the #369 table, a different effect from this tax. A rate-based gate prototype recovers about half of it; glad to send that separately if you want it, kept out of here so this stays one mechanism.