-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[None][feat] Add Qwen3-based DSpark drafter (DeepSpec dense checkpoints) #16813
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
base: main
Are you sure you want to change the base?
Changes from all commits
40289c8
a23949d
f301332
d820ad7
cc82644
df30e8a
2f43213
ad5f580
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2837,6 +2837,15 @@ class DSparkDecodingConfig(DecodingBaseConfig): | |
| "read from the draft model config (dspark_markov_head_type), " | ||
| "defaulting to \"vanilla\".") | ||
|
|
||
| ctx_window_size: Optional[PositiveInt] = Field( | ||
| default=None, | ||
| description= | ||
| "Ring-window length, in tokens, of the worker-owned per-layer context " | ||
| "K/V buffer used by the dense (Qwen3-style) DSpark drafter. Clamped to " | ||
| "[block_size + 2, max_position_embeddings]. Only applies to the dense " | ||
| "Qwen3 DSpark drafter (ignored by the DeepSeek-V4 drafter, which uses " | ||
| "the checkpoint's own sliding_window instead). Defaults to 2048.") | ||
|
|
||
| # NOTE: confidence-based dynamic drafting (the draft model's confidence head | ||
| # that truncates the proposed block) is NOT enabled in this PR. The user-facing | ||
| # ``enable_confidence_head`` / ``confidence_threshold`` knobs are intentionally | ||
|
|
@@ -5726,11 +5735,23 @@ def validate_speculative_config(self): | |
| with open(draft_config_path) as f: | ||
| draft_cfg = json.load(f) | ||
| dspark_cfg = draft_cfg.get("dspark_config", {}) | ||
| # DeepSpec-released dense drafter checkpoints (e.g. | ||
| # Qwen3DSparkModel) use unprefixed top-level keys in their | ||
| # own config.json; gate that fallback on the checkpoint's | ||
| # architectures (mirroring the dispatch in | ||
| # get_draft_model) so a V4-style checkpoint that happens | ||
| # to carry an unrelated top-level key with the same name | ||
| # (e.g. `block_size`) doesn't get silently misread. | ||
| draft_arches = draft_cfg.get("architectures") or [] | ||
| is_dense_drafter = any("Qwen3DSpark" in arch | ||
| for arch in draft_arches) | ||
|
|
||
| def _dspark_get(key, top_level_key): | ||
| value = dspark_cfg.get(key) | ||
| if value is None: | ||
| value = draft_cfg.get(top_level_key) | ||
| if value is None and is_dense_drafter: | ||
| value = draft_cfg.get(key) | ||
|
Collaborator
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. This unprefixed fallback runs for every DSpark checkpoint, not just the DeepSpec dense drafters: a V4-style checkpoint that happens to carry an unrelated top-level |
||
| return value | ||
|
|
||
| # The checkpoint's ``dspark_target_layer_ids`` is | ||
|
|
||
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add annotations to
_dspark_get.The new helper has unannotated parameters and no return annotation. Add precise annotations for both parameters and the mixed JSON value returned by the helper.
As per coding guidelines: “Annotate every function, use
Nonefor procedures, and use precise types.”🤖 Prompt for AI Agents
Source: Coding guidelines