[Spec Decode] DSpark confidence-scheduled verification (#47808)
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Signed-off-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com> Signed-off-by: Benjamin Chislett <chislett.ben@gmail.com> Signed-off-by: Lucas Wilkinson <wilkinson.lucas@gmail.com> Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Benjamin Chislett <chislett.ben@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: OpenAI Codex <noreply@openai.com>
This commit is contained in:
co-authored by
OpenAI Codex
Claude Opus 5
Benjamin Chislett
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Nick Hill
OpenAI Codex
parent
fe889ac925
commit
7f7a32cfec
@@ -238,6 +238,10 @@ class SpeculativeConfig:
|
||||
synthetic_acceptance_rates. Only valid when rejection_sample_method is 'synthetic'.
|
||||
Mutually exclusive with synthetic_acceptance_rates."""
|
||||
|
||||
enable_adaptive_verification: bool = False
|
||||
"""Whether to adaptively size the draft-verification budget from per-request
|
||||
confidence. Currently only supported for method="dspark"."""
|
||||
|
||||
@staticmethod
|
||||
def _acceptance_length_to_rates(length: float, n: int) -> list[float]:
|
||||
"""Mean acceptance length to unconditional per-position rates, using
|
||||
@@ -1014,6 +1018,9 @@ class SpeculativeConfig:
|
||||
self.draft_model_config.hf_config.architectures = [
|
||||
"DSparkDraftModel"
|
||||
]
|
||||
self.draft_model_config.quantization = (
|
||||
self.target_model_config.quantization
|
||||
)
|
||||
self.update_arch_()
|
||||
elif (
|
||||
self.method == "dspark"
|
||||
@@ -1159,6 +1166,10 @@ class SpeculativeConfig:
|
||||
self.target_parallel_config, self.draft_tensor_parallel_size
|
||||
)
|
||||
)
|
||||
|
||||
if self.method != "dspark" and self.enable_adaptive_verification:
|
||||
raise ValueError("Adaptive verification only supported with DSpark")
|
||||
|
||||
return self
|
||||
|
||||
def _validate_suffix_decoding(self):
|
||||
|
||||
@@ -2403,6 +2403,34 @@ class VllmConfig:
|
||||
):
|
||||
unsupported.append("EAGLE3 with pipeline parallelism")
|
||||
|
||||
if (
|
||||
speculative_config.enable_adaptive_verification
|
||||
and self.lora_config is not None
|
||||
):
|
||||
# The per-token LoRA mapping is built from CPU placeholder boundaries,
|
||||
# while the trimmed batch's true boundaries are decided on the GPU.
|
||||
unsupported.append("adaptive verification with LoRA")
|
||||
|
||||
if (
|
||||
speculative_config.enable_adaptive_verification
|
||||
and self.compilation_config.cudagraph_mode == CUDAGraphMode.NONE
|
||||
):
|
||||
# The draft budget divides by step costs profiled from captured
|
||||
# cudagraphs; eager execution captures none.
|
||||
unsupported.append(
|
||||
"adaptive verification with enforce_eager/cudagraph_mode=none"
|
||||
)
|
||||
|
||||
if (
|
||||
speculative_config.enable_adaptive_verification
|
||||
and self.parallel_config.pipeline_parallel_size > 1
|
||||
):
|
||||
# Cost curves and confidences currently only exist on the last PP rank;
|
||||
# earlier ranks would diverge on the trimmed batch shape.
|
||||
# TODO: we should be able to support adaptive verification with PP by
|
||||
# broadcasting the cost curves and confidences to all ranks.
|
||||
unsupported.append("adaptive verification with pipeline parallelism")
|
||||
|
||||
if self.parallel_config.enable_dbo:
|
||||
unsupported.append("dual batch overlap")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user