Skip to content

[None][test] Add coverage for LagunaForCausalLM - #22169

Open
StanleySun639 wants to merge 1 commit into
NVIDIA:mainfrom
StanleySun639:gap-fixer/job-105-draft-149-check-126
Open

StanleySun639 wants to merge 1 commit into
NVIDIA:mainfrom
StanleySun639:gap-fixer/job-105-draft-149-check-126

Conversation

@StanleySun639

@StanleySun639 StanleySun639 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

  • No source code changes. The only changed file is a test module, so there is no runtime behavior change.
  • The new test uses get_registered_model_class("LagunaForCausalLM") and asserts the exact class. It also checks the layer count and layer types.
  • The test builds a Hugging Face Qwen3ForCausalLM reference and loads its state dict into the Laguna model. This only holds if the Laguna dense, ungated full-attention path matches Qwen3 math. The comment in the test states this assumption.
  • The test calls model.load_weights(reference.state_dict()). The test does not check that every weight loaded. A partial load could still pass if shapes align.
  • Tolerances are atol=1e-2 and rtol=2e-3, on bfloat16 weights. Confirm these values are stable on target hardware.
  • The test requires CUDA and uses the TRTLLM attention backend. It runs only on CUDA-enabled machines.
  • The test uses torch.random.fork_rng and torch.manual_seed(42) for reproducible weights.
  • The test uses TrtllmAttentionMetadata with hand-built fields and calls metadata.prepare(). Changes to that metadata API may break the test.

QA Engineer Review

Test files and test-list files changed:

  • Modified: tests/unittest/_torch/speculative/hw_agnostic/test_lilicorr.py (+90 lines, 0 removed).

Test functions added:

  • test_laguna_for_causal_lm_forward, a CUDA-only test under inference_mode.

Behavior covered:

  • Registry resolution of LagunaForCausalLM to the exact class.
  • Model structure: two LagunaDecoderLayer instances.
  • Context forward with return_context_logits=True on two sequences of four tokens each.
  • Output shape (8, 64), dtype float32, and finite values.
  • Numerical match against a Hugging Face Qwen3 reference with identical weights.

Not covered:

  • Generation, decode steps, gated MLP, MoE experts, or sliding-window attention.
  • Rope scaling and non-default configurations.

Test-list status:

  • The new test function is not listed in tests/integration/test_lists/test-db/ or tests/integration/test_lists/qa/. The diff does not change any test-list file. The test lists contain only test_lilicorr_loading.py entries, which this PR does not change.
  • The PR objectives report that Jenkins job #110 passed. I did not verify this result from completed checks on the current head.

Coverage verdict: needs follow-up. The test covers one dense, ungated context path. It does not cover generation or decode. The test is not listed in test-db CI lists, so it does not run in the standard CI selection.

Per-File QA Perspective

  • tests/unittest/_torch/speculative/hw_agnostic/test_lilicorr.py: Adds a CUDA-only forward test for LagunaForCausalLM. It checks class registration, layer structure, context logit shape, dtype, finiteness, and numerical match against Qwen3. It is not listed in test-db/ or qa/, so CI does not select it by default.

Description

Adds unit-test coverage for existing supported model architectures.

  • tests/unittest/_torch/speculative/hw_agnostic/test_lilicorr.py::test_laguna_for_causal_lm_forward verifies: The production registry resolves LagunaForCausalLM to the exact LagunaForCausalLM class, and the constructed model contains two LagunaDecoderLayer instances. The real top-level context forward returns finite float32 logits with shape (8, 64). Every context logit agrees with an independently executed Hugging Face Qwen3 model with equivalent dense, ungated GQA configuration and identical weights.

Test Coverage

  • Test case: unittest/_torch/speculative/hw_agnostic/test_lilicorr.py::test_laguna_for_causal_lm_forward
  • Jenkins log: Jenkins #110 — SUCCESS

Gap Fixer Validation

  • Patch review: Passed with no unresolved must-fix findings.
  • Analyzed source snapshot: 461580bcd5ad
  • Gap Fixer run: Job #105

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

Signed-off-by: Stanley Sun <stsun@nvidia.com>
@StanleySun639
StanleySun639 marked this pull request as ready for review November 12, 2026 07:30
@StanleySun639
StanleySun639 requested a review from a team as a code owner November 12, 2026 07:30
@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a CUDA-only test that builds a two-layer, dense, ungated Laguna model and compares its context logits with those from a matching Qwen3 reference.

Changes

Laguna inference parity

Layer / File(s) Summary
Qwen3 reference parity test
tests/unittest/_torch/speculative/hw_agnostic/test_lilicorr.py
The test checks Laguna registration and decoder-layer types. It verifies output shape, finiteness, and float32 dtype, then compares logits with the Qwen3 reference using specified tolerances.

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

Change: Other

Merge Risk: Minimal · up to 9a3ee

This change adds test coverage for the Laguna model and does not alter runtime behavior. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "[None][test] Add coverage for LagunaForCausalLM" follows the repository template (ticket tag, lowercase type, short summary). It names the main change: new unit-test coverage for the Laguna…
Description check Passed The description covers the core content. It states what the new test verifies, reports the registry check, layer count, output shape, and the Qwen3 reference comparison, and lists a test case path. It…
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: Title check

Explanation

The title "[None][test] Add coverage for LagunaForCausalLM" follows the repository template (ticket tag, lowercase type, short summary). It names the main change: new unit-test coverage for the LagunaForCausalLM architecture, which matches the changeset's single added test module.

Full details: Description check

Explanation

The description covers the core content. It states what the new test verifies, reports the registry check, layer count, output shape, and the Qwen3 reference comparison, and lists a test case path. It includes a Test Coverage section and a Gap Fixer Validation section, and the checklist is marked. It does not fill in the template's Description wording beyond one sentence, and it leaves the template's comment blocks in place. It also does not explain why the coverage is needed or any issue being addressed. These gaps are minor, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c046811 and 9a3ee08.

Files selected for processing: 1

  • tests/unittest/_torch/speculative/hw_agnostic/test_lilicorr.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@StanleySun639

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #84398 [ run ] triggered by Bot. Commit: 9a3ee08 Link to invocation

@StanleySun639
StanleySun639 enabled auto-merge (squash) November 12, 2026 08:13

This branch has not been deployed

No deployments
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.

2 participants