Skip to content

Commit 5d3d111

Browse files
[Spec Decode] DSpark confidence-scheduled verification
Implement host-side confidence scheduling for DSpark with automatically selected compact or masked verification, request-conditioned SPS profiling, and online temperature calibration. Centralize scheduling and batch transformation in ConfidenceManager, use a fixed two-slot pinned-host copy ring, fuse compact batch rewrites, and keep shared model-runner and warmup hooks minimal. Validated with focused CUDA tests, a GPU-sync-checked serving probe, GSM8K, and a 25-cell natural-EOS throughput matrix. Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
1 parent 8347c6e commit 5d3d111

36 files changed

Lines changed: 2502 additions & 133 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
model_name: "deepseek-ai/DeepSeek-V4-Flash-DSpark"
2+
accuracy_threshold: 0.92
3+
num_questions: 1319
4+
num_fewshot: 5
5+
startup_max_wait_seconds: 1800
6+
server_args: >-
7+
--tokenizer-mode deepseek_v4
8+
--trust-remote-code
9+
--dtype bfloat16
10+
--max-model-len 8192
11+
--tensor-parallel-size 4
12+
--enable-expert-parallel
13+
--block-size 256
14+
--gpu-memory-utilization 0.5
15+
--kv-cache-dtype fp8
16+
--max-num-batched-tokens 16384
17+
--max-num-seqs 32
18+
--speculative-config '{"method":"dspark",
19+
"model":"deepseek-ai/DeepSeek-V4-Flash-DSpark",
20+
"attention_backend":"FLASH_ATTN","num_speculative_tokens":7,
21+
"draft_sample_method":"probabilistic","dspark_confidence_threshold":0.0,
22+
"dspark_budget_frac":0.5,"confidence_based_verification":"auto"}'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DeepSeek-V4-Flash-DSpark-varlen-TP4.yaml

tests/test_config.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,62 @@ def test_draft_sample_method_gumbel_is_rejected():
15721572
)
15731573

15741574

1575+
def test_dspark_confidence_config_validation():
1576+
speculative_config = SpeculativeConfig(
1577+
method="ngram",
1578+
num_speculative_tokens=1,
1579+
dspark_confidence_threshold=0.25,
1580+
dspark_budget_frac=0.5,
1581+
confidence_based_verification="mask",
1582+
)
1583+
assert speculative_config.dspark_confidence_threshold == 0.25
1584+
assert speculative_config.dspark_budget_frac == 0.5
1585+
assert speculative_config.confidence_based_verification == "mask"
1586+
assert (
1587+
SpeculativeConfig(
1588+
method="ngram", num_speculative_tokens=1
1589+
).confidence_based_verification
1590+
== "auto"
1591+
)
1592+
for mode in ("none", "off", "auto", "mask"):
1593+
assert (
1594+
SpeculativeConfig(
1595+
method="ngram",
1596+
num_speculative_tokens=1,
1597+
confidence_based_verification=mode,
1598+
).confidence_based_verification
1599+
== mode
1600+
)
1601+
with pytest.raises(ValidationError, match="confidence_based_verification"):
1602+
SpeculativeConfig(
1603+
method="ngram",
1604+
num_speculative_tokens=1,
1605+
confidence_based_verification="compact",
1606+
)
1607+
assert (
1608+
SpeculativeConfig(
1609+
method="ngram", num_speculative_tokens=1
1610+
).dspark_confidence_threshold
1611+
== 0.0
1612+
)
1613+
1614+
for threshold in (-0.1, 1.1):
1615+
with pytest.raises(ValueError, match="dspark_confidence_threshold"):
1616+
SpeculativeConfig(
1617+
method="ngram",
1618+
num_speculative_tokens=1,
1619+
dspark_confidence_threshold=threshold,
1620+
)
1621+
1622+
for budget_frac in (0.0, -0.1, 1.1):
1623+
with pytest.raises(ValueError, match="dspark_budget_frac"):
1624+
SpeculativeConfig(
1625+
method="ngram",
1626+
num_speculative_tokens=1,
1627+
dspark_budget_frac=budget_frac,
1628+
)
1629+
1630+
15751631
def test_ir_op_priority_default():
15761632
"""Test that IR op priority defaults are set correctly."""
15771633
from vllm.config.kernel import IrOpPriorityConfig

0 commit comments

Comments
 (0)