Skip to content

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison#7455

Merged
wangxiyuan merged 6 commits intovllm-project:mainfrom
Potabk:logits
Mar 23, 2026
Merged

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison#7455
wangxiyuan merged 6 commits intovllm-project:mainfrom
Potabk:logits

Conversation

@Potabk
Copy link
Copy Markdown
Collaborator

@Potabk Potabk commented Mar 19, 2026

What this PR does / why we need it?

Replace text-match assertions with a two-tier logprob accuracy check:

  • Prefill (token 0): assert token ID is identical between eager baseline and compiled mode, then verify logprob matches within atol.
  • Decode (tokens 1-2): if chosen tokens match, compare logprobs directly; if they differ, cross-lookup the baseline token in the compiled model's top-20 distribution and assert the assigned logprob is within decode_atol (defaults to 2x atol). This tolerates minor argmax drift caused by floating-point differences while still catching distribution divergence.

Does this PR introduce any user-facing change?

How was this patch tested?

@Potabk Potabk requested a review from wangxiyuan as a code owner March 19, 2026 06:45
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of aclgraph accuracy tests by transitioning from simple text-match assertions to a sophisticated two-tier log probability comparison. This change addresses the limitations of text-based comparisons, which can be overly sensitive to minor floating-point variations in model outputs. By comparing log probabilities with specific tolerances and implementing a cross-lookup mechanism for differing tokens, the tests now more accurately reflect the numerical consistency of the model's output distributions between eager and compiled execution modes, thereby improving the reliability of accuracy validation.

Highlights

  • Refactored ACLGraph Accuracy Tests: The existing text-match assertions in aclgraph accuracy tests were replaced with a new two-tier logprob-based comparison mechanism.
  • Prefill Token Validation: For the first token (prefill pass), the test now asserts that the token ID is identical between the eager baseline and compiled mode, and their log probabilities match within a specified absolute tolerance (atol).
  • Decode Token Validation: For subsequent tokens (decode passes), if the chosen tokens match, their log probabilities are directly compared. If they differ, the baseline token's log probability is cross-referenced within the compiled model's top-20 distribution, asserting that the assigned log probability is within a decode_atol (defaults to 2x atol). This allows for minor argmax drift due to floating-point differences.
  • Removed golden_answers: The golden_answers field was removed from LLMTestCase instances in the accuracy tests, as the new validation method no longer relies on pre-defined text outputs.
  • Introduced compare_logprobs: A new utility function, compare_logprobs, was added to handle the detailed log probability comparison logic, replacing the previous gen_and_valid function.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the aclgraph accuracy test to use a logprob-based comparison instead of text-match assertions. The changes involve removing golden answers from test cases and introducing a compare_logprobs function to verify accuracy by comparing log probabilities against an eager-mode baseline. Additionally, the PR adds @wait_until_npu_memory_free(0.7) decorator to ensure sufficient NPU memory before running tests. The PR also removes the gen_and_valid function and replaces it with compare_logprobs calls.

Comment thread tests/e2e/singlecard/test_aclgraph_accuracy.py
Comment thread tests/e2e/singlecard/test_aclgraph_accuracy.py
Comment thread tests/e2e/singlecard/test_aclgraph_accuracy.py
Comment thread tests/e2e/singlecard/test_aclgraph_accuracy.py
Comment thread tests/e2e/singlecard/test_aclgraph_accuracy.py
@Potabk Potabk requested a review from Yikun as a code owner March 19, 2026 11:01
@Potabk Potabk added ready read for review ready-for-test start test by label for PR labels Mar 19, 2026
Potabk added 6 commits March 20, 2026 11:58
Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: wangli <wangli858794774@gmail.com>
@wangxiyuan wangxiyuan merged commit 75fae61 into vllm-project:main Mar 23, 2026
38 checks passed
starmountain1997 pushed a commit to starmountain1997/vllm-ascend that referenced this pull request Mar 25, 2026
vllm-project#7455)

### What this PR does / why we need it?

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
lihaokun-2026 pushed a commit to lihaokun-2026/vllm-ascend that referenced this pull request Mar 29, 2026
vllm-project#7455)

### What this PR does / why we need it?

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
wangyibo1005 added a commit to wangyibo1005/vllm-ascend that referenced this pull request Apr 1, 2026
…ode/moe_combine_normal/moe_dispatch_normal

Signed-off-by: Wangyibo1005 <2633333316@qq.com>

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison (vllm-project#7455)

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>

fix

123
wangyibo1005 added a commit to wangyibo1005/vllm-ascend that referenced this pull request Apr 1, 2026
…ode/moe_combine_normal/moe_dispatch_normal

Signed-off-by: Wangyibo1005 <2633333316@qq.com>

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison (vllm-project#7455)

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>

fix

123

delete
wangyibo1005 added a commit to wangyibo1005/vllm-ascend that referenced this pull request Apr 1, 2026
…ode/moe_combine_normal/moe_dispatch_normal

Signed-off-by: Wangyibo1005 <2633333316@qq.com>

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison (vllm-project#7455)

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>

fix

123

delete

[CI] Add wait logic for each individual case (vllm-project#6036)

Wait until the NPU memory is clean

- vLLM version: v0.13.0
- vLLM main:
vllm-project/vllm@2c24bc6

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: leo-pony <nengjunma@outlook.com>
Co-authored-by: leo-pony <nengjunma@outlook.com>

123123
wangyibo1005 added a commit to wangyibo1005/vllm-ascend that referenced this pull request Apr 1, 2026
…ode/moe_combine_normal/moe_dispatch_normal

Signed-off-by: Wangyibo1005 <2633333316@qq.com>

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison (vllm-project#7455)

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>

fix

123

delete

[CI] Add wait logic for each individual case (vllm-project#6036)

Wait until the NPU memory is clean

- vLLM version: v0.13.0
- vLLM main:
vllm-project/vllm@2c24bc6

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: leo-pony <nengjunma@outlook.com>
Co-authored-by: leo-pony <nengjunma@outlook.com>

123123

123
wangyibo1005 added a commit to wangyibo1005/vllm-ascend that referenced this pull request Apr 1, 2026
…ode/moe_combine_normal/moe_dispatch_normal

Signed-off-by: Wangyibo1005 <2633333316@qq.com>

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison (vllm-project#7455)

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>

fix

123

delete

[CI] Add wait logic for each individual case (vllm-project#6036)

Wait until the NPU memory is clean

- vLLM version: v0.13.0
- vLLM main:
vllm-project/vllm@2c24bc6

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: leo-pony <nengjunma@outlook.com>
Co-authored-by: leo-pony <nengjunma@outlook.com>

123123

123

pre-commit
chenchuw886 pushed a commit to chenchuw886/vllm-ascend that referenced this pull request Apr 1, 2026
vllm-project#7455)

### What this PR does / why we need it?

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
wangyibo1005 added a commit to wangyibo1005/vllm-ascend that referenced this pull request Apr 7, 2026
…ode/moe_combine_normal/moe_dispatch_normal

Signed-off-by: Wangyibo1005 <2633333316@qq.com>

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison (vllm-project#7455)

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>

fix

123

delete

[CI] Add wait logic for each individual case (vllm-project#6036)

Wait until the NPU memory is clean

- vLLM version: v0.13.0
- vLLM main:
vllm-project/vllm@2c24bc6

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: leo-pony <nengjunma@outlook.com>
Co-authored-by: leo-pony <nengjunma@outlook.com>

123123

123

pre-commit

pick use
wangyibo1005 added a commit to wangyibo1005/vllm-ascend that referenced this pull request Apr 8, 2026
…ode/moe_combine_normal/moe_dispatch_normal

Signed-off-by: Wangyibo1005 <2633333316@qq.com>

[Misc] Refactor aclgraph accuracy test to use logprob-based comparison (vllm-project#7455)

Replace text-match assertions with a two-tier logprob accuracy check:

- Prefill (token 0): assert token ID is identical between eager baseline
and compiled mode, then verify logprob matches within `atol`.
- Decode (tokens 1-2): if chosen tokens match, compare logprobs
directly; if they differ, cross-lookup the baseline token in the
compiled model's top-20 distribution and assert the assigned logprob is
within `decode_atol` (defaults to 2x atol). This tolerates minor argmax
drift caused by floating-point differences while still catching
distribution divergence.

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@8a68046

---------

Signed-off-by: wangli <wangli858794774@gmail.com>

fix

123

delete

[CI] Add wait logic for each individual case (vllm-project#6036)

Wait until the NPU memory is clean

- vLLM version: v0.13.0
- vLLM main:
vllm-project/vllm@2c24bc6

---------

Signed-off-by: wangli <wangli858794774@gmail.com>
Signed-off-by: leo-pony <nengjunma@outlook.com>
Co-authored-by: leo-pony <nengjunma@outlook.com>

123123

123

pre-commit

pick use

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

Labels

module:tests ready read for review ready-for-test start test by label for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants