Repository navigation
fix(qwen): require native KV for Qwen3 - #959
Merged
Merged
Conversation
yifeif-nv
marked this pull request as ready for review
August 21, 2026 04:41
Allow eligible dense Qwen3 FP16 builds to preserve the requested dtype across native KV routing, fused attention, and runtime cache validation. Fail closed when native construction fails instead of falling back to the legacy masked-attention graph. Refs: NVIDIA#955 Signed-off-by: yifeif <[email protected]>
Require every Qwen3 build to satisfy the fixed-capacity native KV contract. Reject dynamic KV before weight loading, preserve legacy routing for older Qwen variants, and align the public CLI and Python documentation. Refs: NVIDIA#955 Signed-off-by: yifeif <[email protected]>
Remove the fixed 1 GiB workspace cap from every Qwen decoder builder so TensorRT can use its device-sized default and keep larger valid tactics eligible. Preserve the policy with a source-contract test. Refs: NVIDIA#955 Signed-off-by: yifeif <[email protected]>
Keep the Quick Start aligned with the full-context native KV contract so the documented Qwen3 build does not request a rejected partial cache. Refs: NVIDIA#955 Signed-off-by: yifeif <[email protected]>
Accept fixed Qwen3 native KV capacities up to the model context instead of requiring the full context. Keep dynamic KV and legacy fallback disabled while restoring the validated 16,384-token Quick Start. Refs: NVIDIA#955 Signed-off-by: yifeif <[email protected]>
yifeif-nv
force-pushed
the
agent/qwen3-native-fp16
branch
from
August 21, 2026 04:57
cbd1a0e to
8fe09ba
Compare
This was referenced Aug 21, 2026
Closed
2 tasks done
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.
Background
Qwen3 previously fell back to the legacy decoder graph whenever a build request missed the native-KV contract. That made FP16, dynamic KV, and other unsupported modes enter a path that can fail with workspace or TensorRT Myelin errors. The Qwen builders also imposed a fixed 1 GiB workspace cap that excluded valid larger tactics. Related: #955.
Exit Criteria
max_cache_lengthin[1, max_position_embeddings]; omitting it still selects the model context.Implementation
Validation
PYTHONPATH=python python -m pytest -q tests/builder/test_cli.py tests/builder/test_qwen_llama_native_kv_attention.py tests/e2e/models/qwen/test_qwen_native_kv_routing.py: 83 passed on exact head8fe09badd.trtmc build Qwen/Qwen3-0.6B --max-cache-length 16384 --output ...: passed on GB300 with BF16 split prefill/decode engines; inspection reportedMax cache length: 16384andRuntime strategy: qwen_decoder_kv_cache; inference producedParis.296889614336bytes (276.5 GiB), above the issue tactic request2598728448bytes.--precision fp16 --dynamic-kv-cache: failed before weight loading with the actionable Dynamic KV error and created no bundle.ruff check,git diff --check, focused canonical documentation reference checks, model ownership validation, and test-impact validation: passed.npmbuild was not run because this isolated checkout has nowebsite/node_modules.website/build/and a stale manifest-count claim.Notes For Future Readers