[Spec Decode] Cache adaptive verification profiles - #52233
calvarado2004 wants to merge 3 commits into
Conversation
Persist exact calibrated DSpark cost curves behind a strict runtime fingerprint and validate hits with a TP-wide GPU sentinel before reuse. Any mismatch falls back to full profiling. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Carlos <karlitroz2004@gmail.com>
|
Documentation preview: https://vllm--52233.org.readthedocs.build/en/52233/ |
|
This pull request has merge conflicts that must be resolved before it can be |
…e-verification-profiles # Conflicts: # vllm/v1/worker/gpu/model_runner.py
|
The merge conflicts with main are now resolved, and the branch is up to date with the latest main. Ruff checks pass locally and the diff is limited to the PR's original scope (6 files). This PR is ready for review — could a maintainer please take a look when they have a chance? Thank you! |
|
Requesting a
Rechecked against (The teardown The change is opt-in and off by default: the cache is gated behind a new env var in Happy to rebase, split it, or adjust the scope if a reviewer would prefer a different shape. AI assistance was used on this PR; I reviewed every changed line and ran the commands above. |
|
This pull request has merge conflicts that must be resolved before it can be |
Purpose
DSpark adaptive verification profiles target-forward and drafter costs at every captured and eager-tail shape during each engine boot. The calibration is deterministic for a fixed model, runtime, backend, hardware, and serving configuration, but it currently runs five replays per shape every time.
This PR adds an opt-in persistent cache for the exact calibrated draft and verification curves. Enable it with:
export VLLM_ENABLE_ADAPTIVE_VERIFICATION_PROFILE_CACHE=1Cache entries live under
$VLLM_CACHE_ROOT/adaptive_verification/.Why this is not a duplicate
I searched open and closed PRs for
adaptive verification cache,adaptive verification profile,DSpark profile cache, and the proposed environment variable. No existing PR persists these curves.Design
Cache reuse is fail-closed:
set_cost_curves.The feature is disabled by default. Cold-start behavior and the cost-table construction are unchanged; a valid hit passes the same curves through the existing
set_cost_curvespath. This does not change token sampling or output correctness.Startup impact
For the DeepSeek-V4 DSpark configuration that motivated this change (12 captured shapes, 8 eager-tail shapes, 5 replays each), a cold calibration performs 100 dummy runs while a warm hit performs 2 sentinel runs: 98% fewer profiling runs.
In a saved TP2 DGX Spark startup log, graph capture plus adaptive calibration took 353 seconds, with approximately 340 seconds after DSpark graph capture attributable to the calibration phase. The projected warm graph/profile phase is about 13-15 seconds. These are projected warm-cache savings from the observed cold log; this branch has not yet been benchmarked end-to-end on that GPU, so the PR remains draft.
Test plan
Passed:
The focused tests cover exact round trips/fingerprint misses, payload corruption, schema-version rejection, and sentinel point/mode/timing rejection.
I also attempted the pre-existing
tests/v1/spec_decode/test_adaptive_verification.pysuite. It could not collect in this macOS development environment because the partial environment lacks the full vLLM test dependency set (einopswas the final reported missing dependency after installingtblib,pyzmq,cbor2, andopenaiinto a temporary target). No output/model evaluation was run because this is an opt-in startup-only change that reuses exact calibrated inputs and fails closed; a warm/cold GPU startup comparison is still required before marking the PR ready.AI assistance
AI assistance was used to port the implementation, write tests, and prepare this description. I reviewed every changed line and confirm that I understand the design and can defend the implementation. A warm/cold GPU validation is still required before moving this PR out of draft.