Repository navigation
[None][feat] DFlash: TRTLLM drafter attention by default wherever it runs, cold-page compression with a TRTLLM drafter, and acceptance-length tests - #21535
Draft
zheyuf wants to merge 5 commits into
Conversation
…s, cold-page compression with a TRTLLM drafter, and acceptance-length tests - AUTO resolves to TRTLLM on a disaggregated server that shares the draft KV for unwindowed drafters too, when nothing known from the arguments keeps the target and draft KV out of one manager; it also checks the drafter's head geometry against the TRTLLM kernels. - The frontend, the rank and the hub-download path resolve AUTO alike. - An explicit VANILLA where AUTO runs the drafter on TRTLLM warns that it is deprecated and why (prefix-cache hits and disaggregated generation draft without the reused or transferred context). - A disaggregated TRTLLM drafter kept in a separate pool is named instead of silently drafting without the prompt. - Cold-page KV-cache compression admits DFlash on every backend; a TRTLLM drafter's separate draft KV cache manager gets no cold-page codec. - Tests: acceptance length under prefix-cache reuse (Qwen3-8B DFlash, TRTLLM and a strict-xfail VANILLA), default-config 1P1D vs aggregated acceptance length, Muse modeling_v2 golden SPEED-Bench acceptance and prefix reuse, and unit tests for the resolution, warnings and compression admission. Signed-off-by: zheyuf <zheyuf@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…after could not share its KV On a disaggregated server whose arguments already rule out a shared target and draft KV cache manager, a TRTLLM drafter cannot carry the prompt context either, so pinning VANILLA there is not discouraged. The VANILLA prefix-reuse acceptance-length case expects only the assertion to fail. Signed-off-by: zheyuf <zheyuf@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at-templated prompts The Muse chat template emits <|begin_of_text|> and tokenizer_config.json sets add_bos_token, so LLM.generate's default add_special_tokens=True can prefix a second BOS. The served chat endpoint, which the SemiAnalysis golden protocol goes through, tokenizes the templated prompt with add_special_tokens=False. Signed-off-by: zheyuf <zheyuf@nvidia.com>
With KV cache compression the drafter cannot share the target's KV cache manager, so a TRTLLM drafter keeps a separate draft KV cache that prefix reuse does not reach. That pool is sized from the drafter's declared attention windows while its mirror reserves the full prompt, so on long agentic contexts it admits only a few requests at a time. AUTO now resolves to VANILLA there; an explicit TRTLLM still runs. Signed-off-by: zheyuf <zheyuf@nvidia.com>
…a Rubin On sm107 the sharded projections and the fused MoE finalize all-reduce also need MUSESPARK_OPEN_SM107_FUSED_KERNELS=1, so without it the target refuses to build on Vera Rubin. sm103 ignores it. Signed-off-by: zheyuf <zheyuf@nvidia.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
The DFlash drafter's VANILLA attention backend keeps the drafter's context K/V in a private arena outside the KV cache manager. Verification is lossless, so nothing fails, but acceptance length (AL) silently drops in three situations:
cache_salt. Multi-turn AgentX traffic hits it constantly.max_seq_len(245-309 GiB per GPU at 1M tokens on the Muse Vera Rubin deployments). A separate budget-check apparatus exists only because of it.TRTLLM keeps the drafter KV in the KV cache manager. With KVCMv2 and TRTLLM target attention it lives in the unified pool; otherwise it uses a separate draft KVCM that is paired for joint reuse on V2. That makes the drafter's context reusable on a prefix hit, transferable to the generation worker, and counted in the KV budget.
The tracker item reads "remove VANILLA, add AL testing, make TRTLLM the default". This PR does the second and third parts. For the first, it scopes VANILLA down instead of deleting it, because deleting it is not safe yet:
drafter_fc_early_fork,drafter_kv_side_chain,drafter_preamble_from_commit,incremental_block_offsets,windowed_commit_parallel), but they are not where the gap is: turning the four that apply at c1 off on VANILLA costs +0.22%, so about 2.6 points are the paged drafter attention itself.What changed
modeling_v2. That is unchanged.dflash_auto_shares_draft_kv) mirrors the config-time half of_dflash_unify_blocker: a transceiver is set, sharing is not disabled, the target uses TRTLLM attention, KVCMv2 is set explicitly, pp=1, cp=1, there is no KV compression and nodraft_len_schedule._pin_dflash_auto_attention_backend) and the HF-hub download path all resolve AUTO the same way.TRTLLM_DISAGG_SHARED_DRAFT_KV=0.attention_backend: VANILLAlogs a deprecation warning that names the lost context.validate_kv_cache_compression_compatibilitynow admits DFlash on every backend.draft_kv_cold_page_codec_provider), so draft pages move to and from Host/Disk losslessly. VANILLA's arena never leaves the GPU, so this matches it. The codec only ever sees target pages.sliding_attention,sliding_window: 2048, so the split charges it 0 bytes/token and gives it 0.55 GiB per GPU), while the unpaired mirror reserves the full prompt. On AgentX traffic at the Muse cold-page point (pareto9, TEP4 c96, 64k-336k-token contexts) only 1-3 requests fit at a time: 44 active requests, 2.9 generating on average, prefix hit 22%, output throughput 123 vs 955-968 tok/s/GPU on VANILLA (-87%), TTFT p90 ~400 s. SPEED-Bench (80 short prompts) passes and does not show it.kv_cache_compression_configis set (resolve_from_checkpoint(kv_cache_compression=...), passed by every place that pins AUTO). An explicit TRTLLM still runs.attention_backendand the draft KV cache, and the cold-page example's list of supported speculative modes.Out of scope: the CTX memory transient when
TRTLLM_SKIP_KV_CACHE_ESTIMATION=1(Remaining blockers).Interplay with #21377 (either order)
_util.pyandllm_args.pyauto-merge. I checked this withgit merge-treeagainst [None][feat] Muse Spark Open modeling_v2 TEP target: a per-deployment lever resolver and the Vera Rubin high-concurrency, mid-concurrency and low-latency fast paths #21377 at e05bfc4.dflash_without_draft_kvcmterm is dead code and can be dropped.tests/unittest/_torch/kv_cache_compression/test_quantization_for_cold_page.py.test_speculative_admission_accepts_verified_one_model_modesidentically, but [None][feat] Muse Spark Open modeling_v2 TEP target: a per-deployment lever resolver and the Vera Rubin high-concurrency, mid-concurrency and low-latency fast paths #21377 appends tests right after it.test_speculative_admission_rejects_dflash_with_draft_kv_cache. That test asserts the rejection this PR removes;test_cold_page_dflash.pycovers TRTLLM admission and the codec-free draft manager instead.global_scale/uncompressed_layer_typesthen apply only to target pages. That matches the deployment'suncompressed_layer_types: [sliding_window]for its all-SWA drafter.Test Coverage
New tests, and the CI lists that carry them:
unittest/_torch/speculative/hw_agnostic/test_dflash_draft_kv.py, 5 new tests (CPU,l0_cpu_musespark):unittest/_torch/executor/kv_cache/test_dflash_unified_kv_gate.py, 1 new test (CPU): the unshared TRTLLM pool on a disaggregated worker warns, andTRTLLM_DISAGG_SHARED_DRAFT_KV=0silences it.unittest/_torch/kv_cache_compression/test_cold_page_dflash.py, new (CPU): cold-page compression admits DFlash on every backend, the DFlash draft KVCM gets no codec, and EAGLE3 keeps its codec.accuracy/test_llm_api_pytorch.py::TestQwen3_8B::test_dflash_acceptance_under_prefix_reuse[TRTLLM|VANILLA](1 GPU SM100+,l0_b200,l0_gb300_musespark):cache_salt. A cold pass is followed by a warm pass that must reuse blocks; warm AL must be at least 0.95 x cold AL.accuracy/test_disaggregated_serving.py::TestQwen3_8BDFlash::test_default_1p1d_acceptance_matches_aggregated(2 GPU,l0_dgx_b200,l0_gb300_musespark):attention_backendnor the sharing env.accuracy/modeling_v2/test_musespark_open.py::TestModelingV2MuseSparkOpenNvfp4Tep4(4x GB300/VR,l0_gb300_multi_gpus; commented out inl0_gb300_musesparkuntil the DFlash2 checkpoint is in the CI cache):test_dflash2_speed_bench_coding_golden_acceptance: the SemiAnalysis golden protocol, with the drafter on AUTO (TRTLLM).min_al3.969, the golden 4.05 less 2%.ref_alis the golden itself, not a measurement.MUSESPARK_SPEED_BENCH_CODINGorllm-models/datasets/nvidia/SPEED-Bench/qualitative_coding_turn0.jsonl, and the test skips if they are absent.test_dflash2_acceptance_under_prefix_reuse: the Muse modeling_v2 target, drafter on AUTO.test_quantization_for_cold_page.pyis updated: DFlash is no longer in the rejected list.Validated
Run on one Vera Rubin node, inside the Muse delivery image, with this PR's six changed
tensorrt_llmfiles bind-mounted over the image. Those files are identical to this branch except that_util.pykeeps #21377's cold-page exemption.Unit tests: 246 passed. Files:
test_dflash_draft_kv.py,test_dflash_unified_kv_gate.py,test_cold_page_dflash.py,test_quantization_for_cold_page.py,test_disagg_dflash_guard.py,test_dflash_worker.py,test_dflash_trtllm_window.py,test_dflash2_semantics.py.TestQwen3_8B::test_dflash_acceptance_under_prefix_reuse: 1 passed, 1 xfailed.reuse_addressable=True.reuse_addressable=False.TestQwen3_8BDFlash::test_default_1p1d_acceptance_matches_aggregated: passed.Unwindowed drafter cost on TRTLLM, measured on the same node. Ad-hoc run, not a repo test. Qwen3-8B with Qwen3-8B-DFlash-b16, K=15, prompts of about 1.2K tokens, no reuse. Median GPU forward time per pure-decode step, TRTLLM vs VANILLA:
Cold-page compression in the same session. The ad-hoc run left the backend on AUTO, so this unwindowed aggregated drafter resolved to VANILLA. It started with NVFP4 cold pages and a host tier, and AL fell 24.5% on the warm pass. The TRTLLM + cold-page combination (separate draft KVCM without a codec) is therefore only unit-tested so far.
Muse Spark Open on Vera Rubin (delivery image 32862f7e42 with this PR's files bind-mounted, MR !163 recipes with
attention_backendunset):test_musespark_open.py, 4x VR: it needsMUSESPARK_OPEN_SM107_FUSED_KERNELS=1on sm107, now in the test's environment.test_dflash2_speed_bench_coding_golden_acceptance: passed, AL 4.0815 (golden 4.05, floor 3.969).test_dflash2_acceptance_under_prefix_reuse: passed, AL cold 3.6568, warm 3.6963 (+1.08%).trtllm-serve(80 coding prompts, 4 cold passes pooled):AUTO keeps VANILLA: with KV cache compression ...): 965 tok/s/GPU, x p10 97.8 tok/s/user, TTFT p90 3.3 s, prefix hit 86.7%, against an explicit VANILLA at 955 and 968, 97.8 and 99.5, 3.2 s.Not validated here:
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
Remaining blockers to deleting VANILLA
_ctx_block_counts[:num_contexts].tolist()from the GPU, which blocks the host for the whole context forward (nsys: 37 blocking 8-40-byte copies, 105 ms each, per 300 iterations at pareto9; none on VANILLA). In disaggregated serving at pareto7 the shared pool also costs the CTX server 18% of its KV blocks, and its prefix hit falls from 86% to about 50% when long agentic sessions resume (TTFT p99 17 s to 122-149 s, throughput -10%).1 - free_gpu_memory_fraction(Muse CTX: 0.8 to 0.7). With estimation on, the transient is measured. Accounting for it in code needs a measured transient model; this is a follow-up.🤖 Generated with Claude Code