speculative: window dspark drafter staging to its trained position range#98
Open
thadreber-web wants to merge 1 commit into
Open
speculative: window dspark drafter staging to its trained position range#98thadreber-web wants to merge 1 commit into
thadreber-web wants to merge 1 commit into
Conversation
The drafter was staged at absolute target positions, so past its 4096 n_ctx_train its acceptance collapsed (59% -> 4.6% between short and 28k prompts on Ternary-Bonsai-27B). Stage rows at rebased positions inside window = min(drafter n_ctx_train, n_batch) and slide the window (wipe + restage last w_keep rows) when a block would cross it. Cap the draft context n_batch at the drafter's n_ctx_train instead of the target n_ctx, which forced a full-context micro-batch that stalled startup at large -c. Measured (target Q2_0, drafter Q4_1, ctx 131072): acceptance holds ~70-78% at short context (54-58 tok/s decode) and ~69% at 60k (32 tok/s); 1.36x over no-speculation at 24k depth vs 0.69x for the old staging. Assisted-by: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01PhRPgjy3fSwQ2dhdxdWkzW
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.
Overview
draft-dspark stages every context row since the drafter's cache position plus a full draft block in one batch. To make that fit, the server raised the draft context's n_batch to the target n_ctx + block size. Causing two problems:
This PR windows the drafter's staging instead:
No new CLI flags, no API changes. A drafter GGUF without context_length metadata falls back to the batch-size ceiling, i.e. the old behavior.
Measured (ctx 131072, DGX Spark GB10):
Additional information
Fixes #74. The failed-decode and failed-crop recovery paths reset the window bookkeeping (pos_base, n_retained) along with the existing cache reset, so a rebase that fails mid-round
cannot leave the drafter cache and the staging buffer out of sync. Buffer head trimming is done lazily in 512-row chunks to keep the erase off the per-round hot path.
Requirements