Repository navigation
Support loading sample_from_anchor flag from speculators config - #48639
Conversation
Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com>
Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com>
44fc868 to
8daf9da
Compare
| dflash_config = ( | ||
| getattr(self.draft_model_config.hf_config, "dflash_config", None) or {} | ||
| ) | ||
| self.sample_from_anchor = dflash_config.get("sample_from_anchor", False) |
There was a problem hiding this comment.
We still set num_query_per_req = 1 + N so this isn't actually doing anything for dflash. If we want to add that support for dflash in vllm, we should probably do that separately and actually test e2e. Not sure if it would "just work" with adjusting num_query_per_req. We should probably just fail dflash if sample_from_anchor=True for now
There was a problem hiding this comment.
Good call — reverted to self.sample_from_anchor = False (hardcoded) and added a ValueError if the config sets sample_from_anchor=True. We'll add proper dflash support for it separately with e2e testing.
| - sample_from_anchor: Whether to sample from the anchor position. Default | ||
| True (sample from anchor and all mask positions, yielding block_size | ||
| speculative tokens). | ||
| """ | ||
| pre_trained_config["architectures"] = ["Qwen3DSparkModel"] | ||
| # Speculators DSpark uses the 1+N fill-in block (anchor is a bonus token). | ||
| pre_trained_config["dspark_bonus_anchor"] = True | ||
| pre_trained_config["sample_from_anchor"] = config_dict.get( | ||
| "sample_from_anchor", True | ||
| ) |
There was a problem hiding this comment.
For speculators we should actually default to False, since the checkpoints made before sample_from_anchor existed use the bonus token
There was a problem hiding this comment.
Fixed — changed the default to False for both dflash and dspark speculators configs so pre-existing checkpoints (without sample_from_anchor) use the bonus token layout.
- Default sample_from_anchor to False for both dflash and dspark speculators configs, since pre-existing checkpoints use the bonus token layout. - Raise ValueError in DFlash if sample_from_anchor=True, since dflash hardcodes num_query_per_req=1+N and does not support anchor sampling. Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com>
|
Hi @fynnsu, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com>
…-project#48639) Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com> Co-authored-by: Michael Goin <mgoin64@gmail.com>
### What this PR does / why we need it? The following PRs are not cherry-picked to vllm v0.26.0 branch, so patches should be added on vllm-ascend releases/v0.26.0rc branch, if we want to use some kinds of DSpark (e.g. https://huggingface.co/RedHatAI/GLM-5.2-speculator.dspark). - vllm-project/vllm#48524: solving fc shape error when num_target_layers != num_hidden_layers - vllm-project/vllm#48776: solving KV Cache planning when target model is sparse-MLA and draft model is SWA - vllm-project/vllm#48639: solving `sample_from_anchor` wrongly loaded ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? - GLM-5.2 W4A8 + DSpark acceptance rate ``` INFO 08-14 15:40:22 [metrics.py:120] SpecDecoding metrics: Mean acceptance length: 2.82, Accepted throughput: 73.39 tokens/s, Drafted throughput: 282.88 tokens/s, Accepted: 790 tokens, Drafted: 3045 tokens, Per-position acceptance rate: 0.729, 0.457, 0.278, 0.161, 0.083, 0.064, 0.044, Avg Draft acceptance rate: 25.9% INFO 08-14 15:40:32 [metrics.py:120] SpecDecoding metrics: Mean acceptance length: 4.38, Accepted throughput: 146.65 tokens/s, Drafted throughput: 303.29 tokens/s, Accepted: 1469 tokens, Drafted: 3038 tokens, Per-position acceptance rate: 0.836, 0.652, 0.537, 0.408, 0.353, 0.318, 0.281, Avg Draft acceptance rate: 48.4% INFO 08-14 15:40:42 [metrics.py:120] SpecDecoding metrics: Mean acceptance length: 3.48, Accepted throughput: 59.89 tokens/s, Drafted throughput: 169.09 tokens/s, Accepted: 600 tokens, Drafted: 1694 tokens, Per-position acceptance rate: 0.719, 0.537, 0.372, 0.273, 0.219, 0.186, 0.174, Avg Draft acceptance rate: 35.4% ``` - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@d02df74 Signed-off-by: Wangbingjie <wangbj1207@126.com>
…-project#48639) Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com> Co-authored-by: Michael Goin <mgoin64@gmail.com>
### What this PR does / why we need it? The following PRs are not cherry-picked to vllm v0.26.0 branch, so patches should be added on vllm-ascend releases/v0.26.0rc branch, if we want to use some kinds of DSpark (e.g. https://huggingface.co/RedHatAI/GLM-5.2-speculator.dspark). - vllm-project/vllm#48524: solving fc shape error when num_target_layers != num_hidden_layers - vllm-project/vllm#48776: solving KV Cache planning when target model is sparse-MLA and draft model is SWA - vllm-project/vllm#48639: solving `sample_from_anchor` wrongly loaded ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? - GLM-5.2 W4A8 + DSpark acceptance rate ``` INFO 08-14 15:40:22 [metrics.py:120] SpecDecoding metrics: Mean acceptance length: 2.82, Accepted throughput: 73.39 tokens/s, Drafted throughput: 282.88 tokens/s, Accepted: 790 tokens, Drafted: 3045 tokens, Per-position acceptance rate: 0.729, 0.457, 0.278, 0.161, 0.083, 0.064, 0.044, Avg Draft acceptance rate: 25.9% INFO 08-14 15:40:32 [metrics.py:120] SpecDecoding metrics: Mean acceptance length: 4.38, Accepted throughput: 146.65 tokens/s, Drafted throughput: 303.29 tokens/s, Accepted: 1469 tokens, Drafted: 3038 tokens, Per-position acceptance rate: 0.836, 0.652, 0.537, 0.408, 0.353, 0.318, 0.281, Avg Draft acceptance rate: 48.4% INFO 08-14 15:40:42 [metrics.py:120] SpecDecoding metrics: Mean acceptance length: 3.48, Accepted throughput: 59.89 tokens/s, Drafted throughput: 169.09 tokens/s, Accepted: 600 tokens, Drafted: 1694 tokens, Per-position acceptance rate: 0.719, 0.537, 0.372, 0.273, 0.219, 0.186, 0.174, Avg Draft acceptance rate: 35.4% ``` - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@d02df74 Signed-off-by: Wangbingjie <wangbj1207@126.com>
…-project#48639) Signed-off-by: Fynn Schmitt-Ulms <fschmitt@redhat.com> Co-authored-by: Michael Goin <mgoin64@gmail.com>
Purpose
Add support for loading the
sample_from_anchorflag from speculators configs (added in vllm-project/speculators#760). This flag is used for dflash/dspark models to indicate if the anchor slot in each prediction block generates a draft prediction or predicts itself. Support for the flag already exists in vllm, this pr just adds support for loading from speculators config.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.