Skip to content

[https://nvbugs/6707518][fix] Skip logprobs for the SA spec run in the Kimi-K3 SA harness - #18618

Closed
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6707518
Closed

[https://nvbugs/6707518][fix] Skip logprobs for the SA spec run in the Kimi-K3 SA harness#18618
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6707518

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: The kimi_k3_sa_harness.py logits-parity harness asks for logprobs=5 on both the baseline run and the speculative-decoding run. Under the one-engine sa spec mode the sampler's sample state carries tokens only, and commit 22e4cbc changed that combination from a warning that silently dropped logprobs into a hard RequestError at request admission. As a result the spec-side generation now aborts during admission and the test fails before any logits comparison happens.
  • Fix: The spec run now computes spec_want_logprobs = want_logprobs and spec_mode != "sa", so only the sa path stops asking for logprobs while every other spec mode and the baseline keep theirs. The baseline must retain logprobs because logits parity requires an aligned reference, and _compare_logits_parity already degrades to one-sided parity when the spec run has no logprobs — so dropping the unsupported request is sufficient and keeps the test meaningful without relaxing the new admission check.
  • Original test: pytest tests/integration/defs/test_kimi_k3_specdec.py::test_kimi_k3_sa_specdec_logits_parity -v
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Reproduction comparison

  • Failed commit: repro_on_failed_commit at 8c0d0cb
    Signature: AssertionError: sanity harness reported FAIL
  • ToT: repro_on_tot at 30316da
    Signature: AssertionError: sanity harness reported FAIL
  • Signature relation: needs_agent

Dev Engineer Review

  • The SA speculative-decoding run no longer requests unsupported logprobs.
  • Baseline and non-SA speculative runs retain logprob collection.
  • The change preserves logits-parity validation with one-sided validation for SA.
  • No public API, configuration, or test-list changes were identified.
  • The change is limited to the affected harness and avoids unintended scope changes.
  • Verdict: sufficient.

QA Engineer Review

  • Modified test function: test_kimi_k3_sa_specdec_logits_parity.
  • The test remains covered by the existing integration test configuration.
  • The change includes regression verification on the original GPU type.
  • Verdict: sufficient.

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@trtllm-agent

Copy link
Copy Markdown
Collaborator Author

[Repair Bot][Two-Leg Repro Comparison:6707518-30316da103a0-1788386971169698926]

Reproduction comparison:

  • Failed commit: repro_on_failed_commit at 8c0d0cb
    Signature: AssertionError: sanity harness reported FAIL
  • ToT: repro_on_tot at 30316da
    Signature: AssertionError: sanity harness reported FAIL
  • Signature relation: same

@coderabbitai

coderabbitai Bot commented Sep 3, 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: e538d51b-64f7-4a62-b04c-f61a6667250c

📥 Commits

Reviewing files that changed from the base of the PR and between 30316da and e501746.

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

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The integration harness disables logprob collection for SA speculative runs. Baseline and other runs continue collecting logprobs. Logits parity uses the existing one-sided comparison when SA output lacks aligned logprobs.

Changes

SA logprob handling

Layer / File(s) Summary
SA generation and parity validation
tests/integration/defs/kimi_k3_sa_harness.py
SA speculative runs no longer request logprobs. Baseline and other modes retain logprob collection, and parity comparison supports missing SA logprobs.

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

Merge Risk: ⚪ Minimal · up to e5017

This localized test-harness change avoids an unsupported SA logprobs request while preserving baseline coverage and other speculative modes; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. 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 identifies the NVBugs issue, fix type, affected SA harness, and primary change: skipping unsupported logprobs for the SA spec run.
Description check ✅ Passed The description clearly explains the root cause, implementation, affected test, validation, regression checks, and bug link. It does not use the template headings exactly and omits the full PR checkli…
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.
Full details: Description check

Explanation

The description clearly explains the root cause, implementation, affected test, validation, regression checks, and bug link. It does not use the template headings exactly and omits the full PR checklist, but it contains the critical information and is mostly complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@2ez4bz

2ez4bz commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #71109 [ run ] triggered by Bot. Commit: e501746 Link to invocation

@fredricz-20070104 fredricz-20070104 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.

Review summary - CONCERNS

Verdict: The one-line guard is the right shape for the described root cause and the change is correctly scoped to the harness, but it is applied inconsistently — line 509 uses the new spec_want_logprobs while line 512 still forwards the old want_logprobs — and it silently turns the sa case of a *_logits_parity test into a check that can no longer fail. I would fix the line 512 skew and add a signal for the degraded parity before merging; mergeable_state is reported as blocked in any case, so CI/approval gates still have to clear.

Issues

  • [MAJOR] tests/integration/defs/kimi_k3_sa_harness.py:512 - _dump_completions still told logprobs exist after they were suppressed
  • [MAJOR] tests/integration/defs/kimi_k3_sa_harness.py:508 - sa logits-parity check silently degrades to one-sided with no signal
  • [MINOR] tests/integration/defs/kimi_k3_sa_harness.py:508 - guard keyed on the bare literal "sa" rather than the capability
  • [NIT] tests/integration/defs/kimi_k3_sa_harness.py:502 - six-line comment for a one-line condition

QA view

  • Test coverage: partial - the only changed file is the harness itself. No new test case, no test-list entry. Still uncovered: nothing asserts the sa spec request is now admitted (a re-regression would look like the same opaque sanity harness reported FAIL); the output_json + want_logprobs=True + spec_mode="sa" combination at line 512 is untested; the one-sided parity branch that the sa case now always takes is not verified to be able to fail; test_kimi_k3_specdec.py is not in the diff, so its markers and assertions are unknown to me.
  • SM coverage: architecture-independent - no get_sm_version(), no sm_version comparison, no __CUDA_ARCH__, no arch-guarded kernel, no fp8/nvfp4 path. Pure Python boolean in a test harness. The PR body's claim of verification on the original GPU type is not something the diff can show.
  • Test code: argument skew between lines 509 and 512; the sa parity assertion can no longer fail on the property the test is named for; no warning/marker/xfail recording the degradation, so a degraded run is indistinguishable from a verified one in CI logs; this is effectively a capability waive inside the harness with no follow-up tracker referenced; magic string "sa" as a mode discriminator; the comment asserts behaviour of _compare_logits_parity, which is not in this diff and can rot unnoticed.
  • Test time: none - one boolean plus six comment lines; no new cases, parametrisations, timeouts, or larger models. Skipping logprob collection may make the sa run marginally cheaper, but the diff cannot quantify that.
  • Needs /qa-verify: yes - a bug fix whose test does not reproduce or assert the original failure, a change to test infrastructure itself, an effective waive that degrades the parity check, plus an untested output_json path. Please run the harness with logprobs enabled and --output-json under spec_mode=sa, confirm admission succeeds and the JSON is well formed, and confirm one non-sa spec mode still collects logprobs.

Does this actually fix nvbugs/6707518?

Partial. NVBugs resolved the id, but the synopsis is truncated ([TensorRT-LLM][L0][Post-Merge][main] Test failed: test_kimi_k3_specdec.py::test_kimi_k3_sa_specde...) and says only that the test failed — it does not state that the failure was the logprobs admission RequestError. The PR's own reproduction block reports the generic signature AssertionError: sanity harness reported FAIL with Signature relation: needs_agent, so the signature was not matched mechanically either. What the diff does is consistent with the stated root cause: spec_want_logprobs = want_logprobs and spec_mode != "sa" stops the spec-side _generate from requesting logprobs for exactly the mode the failing test exercises, which would remove the admission rejection. It is partial because (a) line 512 still forwards want_logprobs to _dump_completions, so the post-generation path can still fail or emit an inconsistent artifact on the same configuration, and (b) the guard matches only the exact literal "sa", so any sibling one-engine mode with a tokens-only sample state still hits the identical error.

Possible new issues

  • With want_logprobs=True, spec_mode="sa" and output_json set, _dump_completions is told to serialise logprobs that _generate never produced: either an exception (surfacing as the same harness FAIL this PR targets) or a JSON file whose logprobs entries are empty while claiming to contain them, so downstream comparison silently agrees with nothing.
  • An SA-sampler logits regression (e.g. wrong draft acceptance changing the distribution) now lands in a one-sided comparison and can report PASS, with no log line indicating the two-sided check was skipped.
  • A future spec mode with the same sampler limitation, or a differently spelled/suffixed sa variant, reproduces the original admission RequestError and will look like a new bug.
  • The harness now routes around the hard admission check introduced by commit 22e4cbc rather than exercising it, so later relaxation or extension of that rule will not be surfaced by this test.

What I could not verify

_generate, _dump_completions, _compare_logits_parity, the SpecSampler admission check, and test_kimi_k3_specdec.py itself are all outside this diff, so I am reasoning about the line 512 skew and the one-sided-parity claim from the call sites and the comment only — if _dump_completions tolerates a True flag over logprob-less completions, that finding drops to a NIT. I also cannot confirm the PR body's claims that the fix was verified on the original GPU type or that related tests were checked for regressions, nor the runtime status of any CI job referenced outside the diff.

Findings not attached to a line

  • [MINOR] tests/integration/defs/kimi_k3_sa_harness.py:508 - Guard keyed on the bare literal "sa" rather than the capability
    • The condition hardcodes the single string "sa". The underlying constraint is not 'the mode is named sa' but 'this sampler's sample state carries tokens only, so logprobs are rejected at admission'. Any future or existing sibling mode with the same one-engine SpecSampler (or a differently-cased / suffixed spelling such as "SA" or "sa_..." reaching this code path) will re-hit the exact RequestError this PR is fixing, and the failure will look like a brand-new bug rather than a known limitation. If the harness has a set of spec modes it recognises, prefer a named constant or a small membership set so the next mode with the same limitation is a one-line addition:
    # spec modes whose sample state carries tokens only
    _MODES_WITHOUT_LOGPROBS = {"sa"}
    spec_want_logprobs = want_logprobs and spec_mode not in _MODES_WITHOUT_LOGPROBS

Non-blocking; the current form is correct for the mode in the failing test.

Automated review by NVCortex Lite, run by @fredricz-20070104.

completions = _generate(llm, prompt_texts, max_tokens, spec_want_logprobs)
llm.shutdown()
if output_json:
_dump_completions(output_json, completions, want_logprobs)

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.

[MAJOR] _dump_completions still told logprobs exist after they were suppressed

completions on line 509 is now produced with spec_want_logprobs, but line 512 still forwards the original want_logprobs to _dump_completions. Concrete trigger: invoke the harness with logprobs enabled (want_logprobs=True), spec_mode="sa", and --output-json set (output_json truthy). _generate was called with False, so every completion carries no logprob field, while _dump_completions is told to serialise logprobs. Depending on how it reads them, the outcome is either an AttributeError/KeyError/TypeError on the absent field — which the caller surfaces as the same 'sanity harness reported FAIL' assertion this PR is trying to fix — or a JSON artifact whose logprobs entries are silently null/empty while claiming to contain them, so any downstream parity/diff tooling reading that file compares against nothing and reports spurious agreement. This is the same inconsistency the fix removed one line earlier, left in place one line later.

Suggested change
_dump_completions(output_json, completions, want_logprobs)
_dump_completions(output_json, completions, spec_want_logprobs)

If _dump_completions deliberately needs the requested flag rather than the available one, that asymmetry deserves an explicit comment, because the two arguments now diverge for exactly the sa path this PR adds.

# than silently dropping them, so this run must not ask for them at all.
# _compare_logits_parity already handles a spec run without logprobs via
# one-sided parity.
spec_want_logprobs = want_logprobs and spec_mode != "sa"

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.

[MAJOR] sa logits-parity check silently degrades to one-sided with no signal

For spec_mode == "sa" the spec run no longer produces logprobs, so per the comment _compare_logits_parity falls back to 'one-sided parity'. The concrete consequence: test_kimi_k3_sa_specdec_logits_parity — a test whose entire purpose is detecting logits divergence between the baseline and the SA speculative path — now runs its primary comparison with only one side's logprobs available. A real SA-sampler logits regression (wrong draft acceptance producing different distributions) would land in a test that still reports PASS, i.e. the assertion for the property under test can no longer fail on the sa configuration. Nothing in this diff records that degradation: no logger.warning, no pytest.xfail/skip, no marker, so from CI output the SA case is indistinguishable from a fully-verified one.

Suggested minimum: emit an explicit warning (or have the harness print a parity_mode: one-sided field into the summary/JSON) when want_logprobs and spec_mode == "sa", so a reader of the log knows the two-sided check was not performed:

    spec_want_logprobs = want_logprobs and spec_mode != "sa"
    if want_logprobs and not spec_want_logprobs:
        print("[harness] spec_mode=sa cannot return logprobs; "
              "logits parity degrades to one-sided", flush=True)

If one-sided parity genuinely cannot detect regressions, then skipping/xfailing the sa parity case is more honest than a green result, and the follow-up should be tracked.


llm = _build_llm(ckpt, tp, spec_mode, adp)
completions = _generate(llm, prompt_texts, max_tokens, want_logprobs)
# The baseline above keeps its logprobs (logits parity hard-requires an

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.

[NIT] Six-line comment for a one-line condition

The rationale block (lines 502-507) is six lines of prose in front of a single boolean expression, and it embeds a claim about another function's behaviour ('_compare_logits_parity already handles a spec run without logprobs via one-sided parity') that will silently rot if that function changes. Two lines are enough to carry the non-obvious part — that sa rejects logprobs at admission instead of dropping them — and the parity-degradation note is better placed as the runtime signal requested in the finding on line 508, where it cannot go stale unnoticed.

@fredricz-20070104 fredricz-20070104 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.

Review summary - Approve (non-blocking)

Approving so this is not blocked on me. The points raised in my review comment above are non-blocking — please read them and address what you agree with before merging.

Worth doing before this is relied on: Multiple triggers at once: (1) it is a bug fix whose test does not reproduce or assert the original failure mode — nothing checks that the sa spec request is now admitted, so a green run does not prove the RequestError is gone; (2) it is a change to test infrastructure itself (the harness), so the safety net is what changed; (3) it is effectively a capability waive that silently degrades the sa logits-parity check to one-sided, and a human should confirm the test still has value in that mode rather than passing vacuously; (4) the output_json + want_logprobs + spec_mode="sa" combination at line 512 is an untested path that may still fail; (5) the PR's own reproduction block reports the generic signature 'AssertionError: sanity harness reported FAIL' with 'Signature relation: needs_agent', so the mechanical signature match did not confirm the root cause. QA should run the harness with logprobs enabled and --output-json under spec_mode=sa, confirm admission succeeds, confirm the JSON is well-formed, and confirm at least one non-sa spec mode still collects logprobs.

Automated review by NVCortex Lite, run by @fredricz-20070104.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #71109 [ run ] completed with state FAILURE. Commit: e501746
/LLM/main/L0_MergeRequest_PR pipeline #58256 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

@mikeiovine

Copy link
Copy Markdown
Collaborator

Duplicate of #18682, which fixes a few minor issues of this one, so closing

@mikeiovine mikeiovine closed this Sep 3, 2026
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.

6 participants