Skip to content

[Spec Decode] Add kv_cache_dtype to speculative_config to control separately from target - #48787

Merged
mgoin merged 3 commits into
vllm-project:mainfrom
neuralmagic:drafter-kv-cache-dtype
Jul 16, 2026
Merged

mgoin merged 3 commits into
vllm-project:mainfrom
neuralmagic:drafter-kv-cache-dtype

Conversation

@mgoin

@mgoin mgoin commented Jul 15, 2026

Copy link
Copy Markdown
Member

Purpose

Currently running vllm serve RedHatAI/GLM-5.2-NVFP4-FP8 --tensor-parallel-size 4 --spec-model GLM-5.2-speculator.dspark --spec-method dspark --spec-tokens 7 --kv-cache-dtype fp8 will fail on Blackwell since the global --kv-cache-dtype fp8 will apply to both the GLM 5.2 target and the DSpark drafter. We don't currently have an attention backend that simultaneously supports non-causal attention and FP8 kv cache, so the drafter fails to find a valid attention backend.

With this PR, at least we have an escape hatch by adding --speculative_config.kv_cache_dtype bfloat16 so that the drafter is kept in BF16 while the target (majority of kv cache space) is running in FP8

Test Plan

Test Result

Manually verified with vllm serve RedHatAI/GLM-5.2-NVFP4-FP8 --tensor-parallel-size 4 --spec-model GLM-5.2-speculator.dspark --spec-method dspark --spec-tokens 7 --kv-cache-dtype fp8 --speculative_config.kv_cache_dtype bfloat16 on B300 to get 95% on GSM8k


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mgoin mgoin changed the title Add kv-cache-dtype to speculative-config [Spec Decode] Add kv_cache_dtype to speculative_config to control separately from target Jul 15, 2026

@MatthewBonanni MatthewBonanni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please just add a gsm8k with the mixed KV cache dtypes to make sure everything works correctly

Apply the drafter kv_cache_dtype override in the MRV2 autoregressive
proposer (eagle/mtp via load_eagle_model), which builds its draft config
independently of _create_draft_vllm_config.

Normalize '-' to '_' in --speculative-config dotted keys so
--speculative-config.kv-cache-dtype resolves to the kv_cache_dtype field
instead of failing pydantic. Scoped to spec config, whose fields are all
identifiers; free-form dict args (e.g. --hf-overrides) are untouched.

Verified end-to-end: GLM-5.2-NVFP4-FP8 TP4 + dspark, target kv-cache
fp8 with draft bfloat16, GSM8K 95.0% (200 q, 0 invalid).

Signed-off-by: mgoin <mgoin64@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mgoin
mgoin requested a review from hmellor as a code owner July 16, 2026 00:38
@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 16, 2026
@mgoin
mgoin merged commit 8bfd683 into vllm-project:main Jul 16, 2026
120 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed speculative-decoding v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants