Skip to content

[None][test] Assert MTP acceptance length in ADP + LM-head-TP accuracy tests#16521

Open
qiaoxj07 wants to merge 1 commit into
NVIDIA:mainfrom
qiaoxj07:test/mtp-adp-lmtp-acceptance-guard
Open

[None][test] Assert MTP acceptance length in ADP + LM-head-TP accuracy tests#16521
qiaoxj07 wants to merge 1 commit into
NVIDIA:mainfrom
qiaoxj07:test/mtp-adp-lmtp-acceptance-guard

Conversation

@qiaoxj07

@qiaoxj07 qiaoxj07 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Background

https://nvbugs/6460072 (fix in #16440): on main, the ADP + enable_lm_head_tp_in_adp + greedy draft-sampling path produced wrong MTP draft tokens (per-rank argmax on the wrong all-gather rows / a local vocab shard).

The bug shipped through green CI even though three parametrizations of TestDeepSeekR1::test_nvfp4_multi_gpus (latency_adp_lmtp, latency_trtllmgen_adp_lmtp, latency_adp_lmtp_tp4) exercise exactly this configuration — because accuracy scores cannot see this bug class: rejected drafts are regenerated by the target model, so outputs (and GSM8K/MMLU scores) stay correct and the only observable symptom is the acceptance length collapsing to ~1.0, i.e. a pure perf regression. In one production benchmark this manifested as a hidden +13% gen-only iteration-time regression (force-accepted wrong drafts degrading MoE routing balance).

Summary

Add an acceptance-length guard to the three ADP + LM-head-TP parametrizations:

  • enable enable_iter_perf_stats for those cases only (all other parametrizations keep the default False — zero behavior change),
  • after the accuracy tasks, read llm.get_stats() and assert the mean specDecodingStats.acceptanceLength over the retained iterations is >= 1.5.

Healthy DeepSeek-R1 + MTP3 greedy acceptance length is ~2.5–3.0; a broken draft path gives ~1.0, so the 1.5 threshold has wide margins on both sides. The stats-reading pattern follows the existing test_eagle3_spec_decoding_stats unit test.

With this assertion, a regression of the same class as https://nvbugs/6460072 fails these tests instead of silently passing.

Impact

Test-only change. No runtime behavior change for any other parametrization.

Related PRs

Summary by CodeRabbit

  • Tests
    • Enhanced validation for multi-GPU speculative decoding scenarios.
    • Added runtime checks for draft-token acceptance, including a minimum average acceptance threshold.
    • Improved diagnostics when speculative decoding produces unexpectedly low-quality drafts.

…y tests

Wrong MTP draft tokens are invisible to accuracy scores: the target model
rejects and regenerates them, so GSM8K/MMLU stay intact and the only
observable symptom is a collapsed acceptance length (~1.0). This is how
https://nvbugs/6460072 (wrong draft argmax in the ADP + LM-head-TP greedy
path) shipped through green CI.

Enable iteration stats for the latency_adp_lmtp, latency_trtllmgen_adp_lmtp
and latency_adp_lmtp_tp4 parametrizations of
TestDeepSeekR1::test_nvfp4_multi_gpus and assert the mean acceptance length
over the profiled iterations stays >= 1.5 (healthy MTP3 is ~2.5, a broken
draft path gives ~1.0).

Signed-off-by: Xianjie <5410381+qiaoxj07@users.noreply.github.com>
@qiaoxj07

Copy link
Copy Markdown
Collaborator Author

Merge-order dependency: #16440 must land first. The motivating bug is still live on main, so on the current tip these assertions will (correctly) fail with an acceptance length of ~1.0 — which is exactly the detection this PR adds. Will trigger /bot run after #16440 merges and this branch is rebased.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 156f1b2e-94cf-4073-a010-597155294864

📥 Commits

Reviewing files that changed from the base of the PR and between 1228fed and 21b9116.

📒 Files selected for processing (1)
  • tests/integration/defs/accuracy/test_llm_api_pytorch.py

📝 Walkthrough

Walkthrough

The integration test now conditionally enables iteration statistics and validates MTP speculative-decoding acceptance length for configurations using MTP with LM-head tensor parallelism in ADP.

Changes

MTP acceptance validation

Layer / File(s) Summary
Conditional statistics and acceptance assertion
tests/integration/defs/accuracy/test_llm_api_pytorch.py
Determines when acceptance validation applies, enables iteration performance statistics, computes average acceptanceLength from speculative-decoding stats, and requires an average of at least 1.5.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: nv-guomingz

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change: adding an MTP acceptance-length assertion to ADP + LM-head-TP accuracy tests.
Description check ✅ Passed The description explains the bug, fix, impact, and related PR, but it omits the template's Test Coverage and PR Checklist sections.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

# stays intact and the only observable symptom is a collapsed
# acceptance length (https://nvbugs/6460072). Assert on it for the
# ADP + LM-head-TP cases, whose draft sampling takes a dedicated path.
check_acceptance = mtp_nextn > 0 and enable_lm_head_tp_in_adp

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.

@mikeiovine for viz. @qiaoxj07 contributed one such AL protection test. Is it suitable for test suite? I'm not sure if this is connected to any CI testing system already.

@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 — test-only; the MTP acceptance-length assertion and iter-perf-stats are scoped to the 3 ADP+LM-head-TP parametrizations, no behavior change elsewhere.

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.

3 participants