Skip to content

[None][fix] Fix Qwen3 w4a8 model execution failure and add unit test - #14527

Open
leo0519 wants to merge 4 commits into
NVIDIA:mainfrom
leo0519:qwen3-w4a8
Open

[None][fix] Fix Qwen3 w4a8 model execution failure and add unit test#14527
leo0519 wants to merge 4 commits into
NVIDIA:mainfrom
leo0519:qwen3-w4a8

Conversation

@leo0519

@leo0519 leo0519 commented May 25, 2026

Copy link
Copy Markdown

Models utilizing w4a8 + fp8 kvcache failed to correctly retrieve quant_config. As a result, the system failed to trigger and use the correct load weight method during model initialization or weight loading.

Summary by CodeRabbit

  • Bug Fixes

    • Improved quantization configuration synchronization in Mixture of Experts layer.
  • Tests

    • Added accuracy test coverage for Qwen3-30B with W4A8 quantization variant.

Review Change Stack

@leo0519
leo0519 requested review from a team as code owners May 25, 2026 09:29
@leo0519
leo0519 requested a review from mikeiovine May 25, 2026 09:29
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR adds backend quantization config synchronization to ensure per-layer quantization settings propagate correctly during weight creation, and introduces an accuracy test validating W4A8 quantization for Qwen3 30B.

Changes

W4A8 Quantization Support

Layer / File(s) Summary
Backend quantization config sync
tensorrt_llm/_torch/modules/fused_moe/configurable_moe.py
ConfigurableMoE.create_weights() syncs self.quant_config to self.backend.quant_config before delegating to self.backend.create_weights(), ensuring the backend applies the correct per-layer quantization configuration during weight initialization.
W4A8 accuracy test for Qwen3
tests/integration/defs/accuracy/test_llm_api_pytorch.py
New test_w4a8 method added to TestQwen3_30B_A3B to evaluate MMLU accuracy on the Qwen3 30B A3B W4A8 checkpoint, parameterized for tensor-parallel, pipeline-parallel, and expert-parallel configurations with CUDA graph and scheduler options.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested reviewers

  • xinhe-nv
  • liji-nv
  • syuoni
  • shaharmor98
  • Wanli-Jiang
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description explains the issue (w4a8 + fp8 kvcache failed to retrieve quant_config) and its consequence (incorrect weight-loading method), but the description template requires additional sections like Test Coverage and PR Checklist completion. Complete the PR description template by adding Test Coverage section listing the new test_w4a8 test and confirming all PR Checklist items are reviewed.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix (Qwen3 w4a8 model execution failure) and the addition (unit test), accurately reflecting the main changes in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/integration/defs/accuracy/test_llm_api_pytorch.py (1)

4913-4935: ⚡ Quick win

Add this new accuracy test to QA scheduling lists (if not already done in another file).

Since this adds an integration accuracy test under tests/integration/defs/, ensure there is a matching entry in QA functional lists (and exact test target formatting), otherwise scheduled QA runs may not execute it.

As per coding guidelines, “If the change adds or materially alters an integration test under tests/integration/defs/, call out whether an entry is needed under tests/integration/test_lists/qa/,” and the referenced QA docs require exact pytest target matching.

🤖 Prompt for 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.

In `@tests/integration/defs/accuracy/test_llm_api_pytorch.py` around lines 4913 -
4935, You added a new integration accuracy test function test_w4a8 (which
constructs LLM and runs MMLU.evaluate) under the integration defs; update the QA
scheduling lists so this pytest target is executed by CI: add the exact pytest
target string for this test to the appropriate QA list file under
tests/integration/test_lists/qa (or the project’s equivalent QA scheduling
list), following the exact formatting used by other entries so the test runner
discovers it (use the full pytest target for the test function/test module and
ensure any TP/PP/etc. variants are covered if required).
🤖 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 `@tests/integration/defs/accuracy/test_llm_api_pytorch.py`:
- Around line 4919-4931: The test test_w4a8 currently only exercises W4A8
quantization; update the LLM instantiation in test_w4a8 to enable an FP8 KV
cache by passing kv_cache_config=KvCacheConfig(dtype="fp8", ...) to LLM so the
test covers the W4A8 + FP8 KV cache regression; ensure you construct
KvCacheConfig with the same required FP8 parameters used elsewhere in tests (or
import the shared FP8 config), keep the existing model path and other args, and
add any necessary import for KvCacheConfig so the test actually exercises the
faulty combination.

---

Nitpick comments:
In `@tests/integration/defs/accuracy/test_llm_api_pytorch.py`:
- Around line 4913-4935: You added a new integration accuracy test function
test_w4a8 (which constructs LLM and runs MMLU.evaluate) under the integration
defs; update the QA scheduling lists so this pytest target is executed by CI:
add the exact pytest target string for this test to the appropriate QA list file
under tests/integration/test_lists/qa (or the project’s equivalent QA scheduling
list), following the exact formatting used by other entries so the test runner
discovers it (use the full pytest target for the test function/test module and
ensure any TP/PP/etc. variants are covered if required).
🪄 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: e69a564d-eef0-402f-b69b-6fcdcc73c67e

📥 Commits

Reviewing files that changed from the base of the PR and between 2e3a75c and 190ed08.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/modules/fused_moe/configurable_moe.py
  • tests/integration/defs/accuracy/test_llm_api_pytorch.py

Comment on lines +4919 to +4931
def test_w4a8(self, tp_size, pp_size, ep_size, attention_dp, cuda_graph,
overlap_scheduler):
pytorch_config = dict(
disable_overlap_scheduler=not overlap_scheduler,
cuda_graph_config=CudaGraphConfig() if cuda_graph else None)

llm = LLM(
f"{llm_models_root()}/Qwen3/saved_models_Qwen3-30B-A3B_w4a8_hf",
tensor_parallel_size=tp_size,
pipeline_parallel_size=pp_size,
moe_expert_parallel_size=ep_size,
**pytorch_config,
enable_attention_dp=attention_dp)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Cover the actual regression trigger (w4a8 + fp8 kv cache) in this test.

This test currently runs W4A8 only, but the PR fix is specifically about W4A8 combined with FP8 KV cache. Add kv_cache_config=KvCacheConfig(dtype="fp8", ...) (and keep this test path) so it actually guards the reported failure mode.

As per coding guidelines, QA/test coverage should include relevant failure modes for the feature/fix, and this PR objective explicitly targets W4A8 + FP8 KV cache behavior.

🤖 Prompt for 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.

In `@tests/integration/defs/accuracy/test_llm_api_pytorch.py` around lines 4919 -
4931, The test test_w4a8 currently only exercises W4A8 quantization; update the
LLM instantiation in test_w4a8 to enable an FP8 KV cache by passing
kv_cache_config=KvCacheConfig(dtype="fp8", ...) to LLM so the test covers the
W4A8 + FP8 KV cache regression; ensure you construct KvCacheConfig with the same
required FP8 parameters used elsewhere in tests (or import the shared FP8
config), keep the existing model path and other args, and add any necessary
import for KvCacheConfig so the test actually exercises the faulty combination.

@leo0519
leo0519 requested a review from a team as a code owner June 29, 2026 00:12
@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot run

@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot run

@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot help

@github-actions

Copy link
Copy Markdown

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental) --high-priority]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Supports wildcard * for pattern matching (e.g., "*PerfSanity*" matches all stages containing PerfSanity). Examples: "A10-PyTorch-1, xxx", "PerfSanity". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Supports wildcard * for pattern matching. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx", --extra-stage "Post-Merge".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

--high-priority (OPTIONAL) : Run the pipeline with high priority. This option is restricted to authorized users only and will route the job to a high-priority queue.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot run

1 similar comment
@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot run

@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot run --add-multi-gpu-test

@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot run

3 similar comments
@leo0519

leo0519 commented Jun 29, 2026

Copy link
Copy Markdown
Author

/bot run

@yumin066

Copy link
Copy Markdown
Collaborator

/bot run

@yumin066

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56343 [ run ] triggered by Bot. Commit: 4288812 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56346 [ run ] triggered by Bot. Commit: 4288812 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56343 [ run ] completed with state ABORTED. Commit: 4288812

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56346 [ run ] completed with state SUCCESS. Commit: 4288812
/LLM/main/L0_MergeRequest_PR pipeline #45195 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@leo0519

leo0519 commented Jul 6, 2026

Copy link
Copy Markdown
Author

/bot run

1 similar comment
@leo0519

leo0519 commented Jul 13, 2026

Copy link
Copy Markdown
Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58847 [ run ] triggered by Bot. Commit: 8fb8502 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58847 [ run ] completed with state SUCCESS. Commit: 8fb8502
/LLM/main/L0_MergeRequest_PR pipeline #47401 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@leo0519

leo0519 commented Jul 20, 2026

Copy link
Copy Markdown
Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60212 [ run ] triggered by Bot. Commit: 79af0a2 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60212 [ run ] completed with state FAILURE. Commit: 79af0a2
/LLM/main/L0_MergeRequest_PR pipeline #48578 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@BowenFu BowenFu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — the create_weights change (propagate quant_config to .backend) is a no-op for uniform-quant MoE (same global config) and only corrects the per-layer/mixed-precision path where the .backend-suffixed module name couldn't be matched — i.e. it fixes the already-broken Qwen3 w4a8 path. Default MoE unchanged. 2 approvals.

@leo0519

leo0519 commented Jul 27, 2026

Copy link
Copy Markdown
Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61872 [ run ] triggered by Bot. Commit: 0a871d3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61872 [ run ] completed with state FAILURE. Commit: 0a871d3
/LLM/main/L0_MergeRequest_PR pipeline #50068 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@rosenrodt

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61913 [ run ] triggered by Bot. Commit: 0a871d3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61913 [ run ] completed with state FAILURE. Commit: 0a871d3
/LLM/main/L0_MergeRequest_PR pipeline #50105 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@rosenrodt

Copy link
Copy Markdown
Collaborator

/bot run

@rosenrodt

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62055 [ run ] triggered by Bot. Commit: 0a871d3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62055 [ run ] completed with state SUCCESS. Commit: 0a871d3
/LLM/main/L0_MergeRequest_PR pipeline #50239 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@rosenrodt

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62078 [ run ] triggered by Bot. Commit: 0a871d3 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62078 [ run ] completed with state FAILURE. Commit: 0a871d3
/LLM/main/L0_MergeRequest_PR pipeline #50263 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@rosenrodt

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62149 [ run ] triggered by Bot. Commit: 0a871d3 Link to invocation

@ZhanruiSunCh ZhanruiSunCh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for infra part.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62149 [ run ] completed with state SUCCESS. Commit: 0a871d3
/LLM/main/L0_MergeRequest_PR pipeline #50325 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants