-
Notifications
You must be signed in to change notification settings - Fork 104
speculative: stop plain drafter+target falling back to KV checkpoints #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -386,7 +386,7 @@ struct common_params_speculative { | |
|
|
||
| uint32_t need_n_rs_seq() const { | ||
| bool needs_rs_seq = std::any_of(types.begin(), types.end(), [&](auto t) { | ||
| return t == COMMON_SPECULATIVE_TYPE_DRAFT_MTP || t == COMMON_SPECULATIVE_TYPE_DRAFT_EAGLE3 || t == COMMON_SPECULATIVE_TYPE_DRAFT_DFLASH || t == COMMON_SPECULATIVE_TYPE_DRAFT_DSPARK; | ||
| return t == COMMON_SPECULATIVE_TYPE_DRAFT_SIMPLE || t == COMMON_SPECULATIVE_TYPE_DRAFT_MTP || t == COMMON_SPECULATIVE_TYPE_DRAFT_EAGLE3 || t == COMMON_SPECULATIVE_TYPE_DRAFT_DFLASH || t == COMMON_SPECULATIVE_TYPE_DRAFT_DSPARK; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. speculative-simple now keeps the seq_rm type and decides per round: a checkpoint is taken when the context is FULL, or when it is RS and the draft is longer than llama_n_rs_seq(), the same rule the server applies. The draft context only gets the extra checkpoint in the RS overflow case since a FULL draft context is already checkpointed before drafting, and the restore path guards load_dft the same way. |
||
| }); | ||
|
|
||
| return needs_rs_seq ? draft.n_max : 0u; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2416,9 +2416,7 @@ common_speculative_init_result::common_speculative_init_result( | |
| // the draft context holds as many tokens per sequence as the target context | ||
| cparams.n_ctx = llama_n_ctx(ctx_tgt); | ||
|
|
||
| // note: for small models maybe we can set this to the maximum possible draft from all speculative types | ||
| // the extra memory for small models is likely negligible? | ||
| cparams.n_rs_seq = 0; | ||
| // n_rs_seq stays as common_context_params_to_llama set it: the draft context needs the same rollback window as the target, with n_rs_seq == 0 its seq_rm fails silently on partial acceptance and keeps stale positions | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, the fitter and the real draft context had drifted apart. Removed the n_rs_seq override in the fit path so both contexts are measured with the same recurrent-state shape. |
||
| cparams.ctx_other = ctx_tgt; | ||
|
|
||
| std::string model_path; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This holds, thanks. The ubatch assertion was already reachable for MTP, EAGLE3 and DFlash since the target context took n_rs_seq from need_n_rs_seq(); this PR made it reachable from the plain drafter path too. cc02c36 checks the fit once in common_context_params_to_llama and keeps the checkpoint path with a warning when n_ubatch <= n_rs_seq + 1, so a small -ub configuration keeps working the way it did before. The draft context inherits that value instead of overriding it.