[None][feat] Add Laguna DFlash drafter support - #15666
Conversation
📝 WalkthroughWalkthroughThis PR adds Laguna-specific DFlash speculative decoding support, introduces a DFlash architecture selector, and updates hidden-state projection, fused KV preparation, and attention gating paths. ChangesDFlash Laguna speculative decoding
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tensorrt_llm/_torch/models/modeling_speculative.py`:
- Around line 1517-1531: The Laguna aux-norm loading in model loading should
fail fast when expected per-aux norms are missing instead of silently falling
back to a generic path. Update the weight handling in
DFlashLagunaForCausalLM.load_weights to detect the Laguna case and verify
aux_hidden_norms.* are present before building self.fc_norm; if none are found,
raise an error rather than proceeding. Keep the existing aux_keys sorting and
ModuleList construction, but make the incomplete-check explicit so
project_target_hidden() cannot run with a partially loaded Laguna checkpoint.
- Around line 981-982: The fused-QKV setup in modeling_speculative uses
self.config.head_dim directly, which can fail for pretrained configs that do not
define it. Update the q and kv dimension calculation in the relevant method to
derive head_dim using the same fallback logic used elsewhere in the model code,
so the speculative loading path works even when head_dim is missing. Use the
existing configuration access pattern in the surrounding class/method to keep
the behavior consistent.
- Around line 1183-1187: The KV folding in modeling_speculative.py’s speculative
context path is using only input_layernorm.weight, but Gemma-style RMSNorm
requires folding the actual scale used by the forward path, namely the effective
weight plus the base offset. Update the folding logic in the block guarded by
hasattr(dl, 'input_layernorm') so the precomputed KV weights match the query
path for use_gemma-style RMSNorm. While making that change, verify the single
_input_ln_eps assumption across all dlayers before storing _input_ln_eps, and
use the existing input_layernorm/config symbols to keep the behavior consistent
with the rest of the model code.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: cec08356-5c36-4f48-893a-e0d8f8a72da0
📒 Files selected for processing (3)
tensorrt_llm/_torch/models/modeling_speculative.pytensorrt_llm/_torch/speculative/dflash.pytensorrt_llm/llmapi/llm_args.py
b338758 to
7f506ef
Compare
7f506ef to
f5c0284
Compare
|
/bot run |
|
PR_Github #56121 [ run ] triggered by Bot. Commit: |
|
PR_Github #56121 [ run ] completed with state
|
f5c0284 to
95c2442
Compare
|
/bot run |
|
PR_Github #56174 [ run ] triggered by Bot. Commit: |
|
PR_Github #56174 [ run ] completed with state
|
|
/bot run |
|
PR_Github #56192 [ run ] triggered by Bot. Commit: |
|
PR_Github #56192 [ run ] completed with state |
95c2442 to
20c90d2
Compare
e95273a to
f3aa937
Compare
|
/bot run |
|
PR_Github #59152 [ run ] triggered by Bot. Commit: |
|
PR_Github #59152 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #59160 [ run ] triggered by Bot. Commit: |
ac67e2e to
f844ae3
Compare
|
/bot kill |
|
PR_Github #59191 [ kill ] triggered by Bot. Commit: |
The BF16 DFlash test (base + drafter) exceeds the RTX PRO 6000 memory budget; move it next to its nvfp4_dflash sibling on l0_b200. The plain XS.2 BF16 test stays on RTX PRO 6000. Signed-off-by: Joe Rowell <joerowell4@gmail.com>
f844ae3 to
c5b95cc
Compare
|
PR_Github #59160 [ run ] completed with state |
|
PR_Github #59191 [ kill ] completed with state |
|
/bot run |
|
PR_Github #59193 [ run ] triggered by Bot. Commit: |
|
PR_Github #59193 [ run ] completed with state
|
|
/bot run |
|
PR_Github #59196 [ run ] triggered by Bot. Commit: |
|
PR_Github #59196 [ run ] completed with state |
Description
Adds DFlash speculative-decoding support for poolside Laguna drafters (XS.2 / XS-2.1 / M.1):
DFlashForCausalLM(generic block decode — target-hidden projection,input_layernorm-folded fused KV, per-layer causal, output-gate hook) andDFlashLagunaForCausalLM(per-head softplus gating, per-auxfc_norm).get_draft_model()selects the Laguna drafter from the draft config'sarchitectures— no new flag.Test Coverage
Validated on
poolside/Laguna-XS-2.1(tensorrt-llm 1.3.0rc20): loads withtrust_remote_code=True(no overlay,transformers 5.5.4) and generates; BFCL viatrtllm-serve --tool_parser poolside_v1 --reasoning_parser laguna= 94.0% / 96.5% (simple_python / multiple), on par with the vLLM / SGLang / llama.cpp references.PR Checklist