Skip to content

[https://nvbugs/6418815][test] Pin fp32-matmul precision in VisualGen LPIPS tests and re-baseline Cosmos3 goldens - #17780

Merged
chang-l merged 15 commits into
NVIDIA:mainfrom
ishovkun:cosmos3-rebaseline-goldens
Aug 21, 2026
Merged

[https://nvbugs/6418815][test] Pin fp32-matmul precision in VisualGen LPIPS tests and re-baseline Cosmos3 goldens#17780
chang-l merged 15 commits into
NVIDIA:mainfrom
ishovkun:cosmos3-rebaseline-goldens

Conversation

@ishovkun

@ishovkun ishovkun commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Dev Engineer Review

  • Pins FP32 matmul precision to "highest" and disables cuDNN TF32 for Cosmos3 LPIPS generation paths.
  • Limits the precision pin to Cosmos3 paths.
  • Preserves defaults for unrelated VisualGen models.
  • Updates seven Cosmos3 goldens with self-regression provenance and reproducibility metadata.
  • Removes two obsolete Cosmos3 Nano waivers.
  • Keeps i2v_4step and nvfp4 out of scope.
  • No correctness, configuration, or scope issue is evident from the provided changes.

QA Engineer Review

  • Modifies Cosmos3 LPIPS test paths and precision handling.
  • Removes the precision pin from i2v_4step.
  • Re-baselines seven Cosmos3 LPIPS goldens.
  • Adds precision, determinism, environment, version, commit, and checksum metadata.
  • Removes two Cosmos3 Nano entries from tests/integration/test_lists/waives.txt.
  • The seven goldens self-verify with LPIPS 0.000000 on B300.
  • Test-list coverage is present through the waiver updates.
  • No CBTS coverage data was provided.
  • Verdict: needs follow-up.

Description

The Cosmos3 LPIPS goldens passed in CI but reproduced on no developer machine
(0.117–0.78 vs thresholds 0.05–0.13), and the nano t2i/t2v goldens were
additionally stale since the 2026-07-02 negative-prompt default change
(waived as nvbugs 6418815 / 6437341).

Root cause: NGC PyTorch containers default matmul TF32 on
(float32_matmul_precision="high"), PyPI torch defaults it off
("highest"), and Cosmos3 is the only VisualGen model with fp32 GEMMs inside
its denoising loop — the RoPE frequency product, the fp32 timestep embedder,
and an explicit autocast(dtype=torch.float32) block, all deliberately
upcast for accuracy. The goldens therefore encoded the golden-cutting
container's arithmetic. A CI-side fingerprint proved the inputs bit-identical
between CI and local with the trajectory diverging, and a single-flag A/B
moved LPIPS-to-golden 0.132 → 0.054.

Fix: pin float32_matmul_precision("highest") and cudnn.allow_tf32 on
Cosmos3's generation paths (tests only — production inherits environment
defaults), and re-baseline the seven runnable Cosmos3 goldens under the
pinned arithmetic, which measured bit-stable across torch 2.11/2.12 and
B200/B300. Edge goldens become TRT-LLM self-goldens (cross-stack correctness
remains covered by TestDiffusersParity). Provenance JSONs record the real
commit/torch/flags, explicit negative_prompt, and media sha256. The two
waivers are removed. The other 35 zip members are byte-identical
(CRC-verified on repack).

Scope of the pin. It is applied per Cosmos3 generation path rather than
inside _lpips_deterministic_algorithms, because that helper wraps
generation (not just scoring) for LTX-2, HunyuanVideo, FLUX, QwenImage and
WAN as well. Pinning there would have changed generation for five model
families whose goldens are not re-cut here — and undetectably so outside an
NGC container, since "highest" is already the PyPI default and those golden
tests are post_merge-gated. The helper is byte-identical to main; blast radius
equals the goldens this PR re-cuts. (This leaves the NVFP4 feature path
unpinned, as it generates in a spawned process via the shared helper — correct
for now, since that golden is waived under nvbugs/6572800 and not re-cut.)

On the deterministic_algorithms: true → false JSON edits. These are
corrections, not a loosening: _run_cosmos3_lpips_pipeline never called
_lpips_deterministic_algorithms for generation — only scoring goes through
it — so the previous true recorded a setting that was not in effect when
those goldens were cut.

Out of scope: i2v_4step (checkpoint absent in CI) and nvfp4
(nvbugs/6572800) — both need a pinned-flags re-cut when unblocked.

Investigation evidence
Measurement Value
CI fingerprint: initial latent / conditioning text bit-identical to local
CI flags vs local flags tf32_matmul=True fp32_prec=high vs False/highest
TF32 A/B (one flag, same seed/inputs) 0.132245 → 0.054325 vs old golden
Trajectory stability under "highest" 0.13224531710147858 identical to 8 digits across torch 2.11→2.12
fp32 GEMM islands transformer_cosmos3.py: RoPE freq product, fp32 time-embedder, fp32 autocast block
Models without fp32 GEMMs in the loop (qwenimage/wan/flux) reproduce cross-environment: 0.0033 / 0.0303 / 0.0126

Test Coverage

  • examples/visual_gen/test_visual_gen_cosmos3.py LPIPS golden tests
    (nano t2i / t2v / v2v / fp8-blockwise, edge t2i / t2v / i2v), post-merge on
    the B200 lane (l0_b200.yml, placement unchanged).
  • Self-verification on B300 (native, torch 2.12.0+cu130): all seven tests
    regenerate bit-exactly against the new goldens — LPIPS 0.000000 each,
    7 passed. The same tests measured 0.117–0.78 against the old goldens on the
    same host.
  • Re-verified after scoping the pin down to Cosmos3: LPIPS 0.000000 each,
    7 passed in 13:16 — confirming the rescope preserved the exact generation
    arithmetic the goldens were cut under.
  • Unaffected by construction: LTX-2, HunyuanVideo, FLUX, QwenImage and WAN
    generate through _lpips_deterministic_algorithms, which this PR leaves
    byte-identical to main.

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.

…ergence

The Cosmos3 LPIPS goldens pass in CI but reproduce on no developer machine we
can build. edge_t2i measures 0.117127 locally against the 0.0056 recorded at
creation, while every other VisualGen golden (qwenimage at 50 steps, wan, flux)
reproduces locally without trouble.

Ruled out locally, each by measurement and nearly all bit-identical across the
change: GPU generation (B200 vs B300), torch build (PyPI 2.11.0, 2.12.0, and
NVIDIA-patched 2.13.0a0 inside an NGC container), the container itself, the
checkpoint, the models root, negative and system prompts, tokenization,
per-step transformer parity against diffusers, VAE round-trip, the flow
schedule, the SDPA backend, diffusers/transformers versions, and test order.

This instruments test_cosmos3_edge_t2i_lpips_against_golden to fingerprint the
inputs and intermediates CI actually uses -- environment, checkpoint config
hashes, golden bytes, conditioning text, the first and last transformer latent,
and the measured score -- so they can be diffed against the local values.

It reports through the assertion message and fails unconditionally because the
CI report API returns empty stdout for tests that pass.

To be reverted once the divergence is understood.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66551 [ run ] triggered by Bot. Commit: a9da8da Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

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

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast --extra-stage "DGX_B200-PyTorch-Post-Merge-1"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66554 [ run ] triggered by Bot. Commit: a9da8da Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66554 [ run ] completed with state SUCCESS. Commit: a9da8da
/LLM/main/L0_MergeRequest_PR pipeline #54185 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

The Cosmos3 LPIPS golden tests sit in an l0_b200.yml block whose terms are
`stage: post_merge`, so a PR pipeline never schedules them. Two bot runs
confirmed this: neither pipeline #54182 nor #54185 produced any record for
test_visual_gen_cosmos3.py, including with
--extra-stage "DGX_B200-PyTorch-Post-Merge-1", because the gate is in the
test-db terms rather than in the stage selection.

List the instrumented test in the pre_merge pytorch b200 block so the
diagnostic actually runs on a PR pipeline. Remove together with the
diagnostic itself.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66651 [ run ] triggered by Bot. Commit: 0ed750f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66651 [ run ] completed with state FAILURE. Commit: 0ed750f
/LLM/main/L0_MergeRequest_PR pipeline #54270 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

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66804 [ ] completed with state FAILURE. Commit: 0ed750f

Link to invocation

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66812 [ run ] triggered by Bot. Commit: 0ed750f Link to invocation

…er too

The payload hashed only checkpoint config JSONs, so a CI checkpoint with
identical configs but different weight bytes would evade it -- and weights do
not reach latent[first] either, so nothing else in the payload covers them.
Add per-safetensors size plus head/tail-1MiB digests and the tokenizer.json
hash, closing the different-checkpoint and different-tokenizer branches.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66834 [ run ] triggered by Bot. Commit: a36c902 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66834 [ run ] completed with state SUCCESS. Commit: a36c902
/LLM/main/L0_MergeRequest_PR pipeline #54398 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

… LPIPS paths

Root cause of the Cosmos3 LPIPS golden divergence (nvbugs 6418815, 6437341):
NGC PyTorch containers default matmul TF32 on (float32_matmul_precision
"high") while PyPI torch defaults it off ("highest"), and Cosmos3 is the only
VisualGen model with fp32 GEMMs inside its denoising loop -- the RoPE
frequency matmul (transformer_cosmos3.py:863) and the fp32 timestep embedder
(:1604), both deliberately upcast for accuracy. A CI-side fingerprint proved
the inputs bit-identical (same conditioning text, checkpoint, golden bytes,
and initial latent) with the trajectory diverging, and a single-flag A/B
moved LPIPS-to-golden 0.132 -> 0.054. bf16 compute is unaffected by the knob.

Pin "highest" (measured bit-stable across torch 2.11/2.12 and B200/B300) and
cuDNN TF32 in _lpips_deterministic_algorithms and around the three Cosmos3
generation helpers that do not use it, so goldens are portable across hosts
instead of encoding the golden-cutting container's arithmetic. Production
code inherits environment defaults unchanged; this pins tests only.

This also reverts the temporary CI diagnostic instrumentation from
test_cosmos3_edge_t2i_lpips_against_golden.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
…r pinned arithmetic

Re-cut all seven runnable Cosmos3 goldens with fp32-matmul precision pinned to
"highest" (see the previous commit for the root cause: NGC-vs-PyPI TF32
defaults acting on Cosmos3's fp32 GEMM islands). Cut natively on B300 at
torch 2.12.0+cu130; under the pin the trajectory measured bit-stable across
torch versions and GPU generations, so these goldens are host-portable rather
than bound to the golden-cutting container.

- nano t2i / t2v: the two stale goldens (cut 2026-06-29, invalidated by the
  07-02 negative-prompt default change) -- re-cut and unwaived
  (nvbugs 6418815, 6437341).
- nano v2v, fp8-blockwise, edge t2i/t2v/i2v: previously CI-container-bound;
  re-cut under the pin. Edge goldens become TRT-LLM self-goldens; cross-stack
  correctness stays covered by TestDiffusersParity.
- Provenance JSONs rewritten with real commit/torch/flags, explicit
  negative_prompt, and media sha256; first provenance record for v2v.
- The other 35 zip members are byte-identical (CRC-verified on repack).
- l0_b200.yml gains TEMPORARY pre_merge listings (marked REMOVE BEFORE MERGE)
  so the post_merge-gated tests run on this PR's pipeline for verification.

Out of scope: i2v_4step (checkpoint absent in CI) and nvfp4 (nvbugs/6572800,
cross-model break) -- both need a pinned-flags re-cut when unblocked.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #66885 [ run ] triggered by Bot. Commit: ccf3fda Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

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

…temporary test listings

All seven re-baselined goldens self-verified at LPIPS 0.000000 (bit-exact
regeneration under the pinned arithmetic; 7 passed in 19m12s on B300 native,
torch 2.12.0+cu130). Record that in the provenance JSONs and remove the
temporary pre_merge listings -- the tests return to their permanent post_merge
home in l0_b200.yml, which is now identical to main.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
@ishovkun ishovkun changed the title [None][test] DO NOT MERGE: CI diagnostic for Cosmos3 LPIPS golden divergence [https://nvbugs/6418815][test] Pin fp32-matmul precision in VisualGen LPIPS tests and re-baseline Cosmos3 goldens Aug 18, 2026
@ishovkun
ishovkun marked this pull request as ready for review August 18, 2026 04:21
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67871 [ run ] triggered by Bot. Commit: 90b9866 Link to invocation

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67886 [ run ] triggered by Bot. Commit: 9ad6e39 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67871 [ run ] completed with state ABORTED. Commit: 90b9866

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67886 [ run ] completed with state FAILURE. Commit: 9ad6e39
/LLM/main/L0_MergeRequest_PR pipeline #55371 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

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67988 [ run ] triggered by Bot. Commit: 9ad6e39 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67988 [ run ] completed with state FAILURE. Commit: 9ad6e39
/LLM/main/L0_MergeRequest_PR pipeline #55453 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

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68023 [ run ] triggered by Bot. Commit: 9ad6e39 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68023 [ run ] completed with state FAILURE. Commit: 9ad6e39
/LLM/main/L0_MergeRequest_PR pipeline #55478 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

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

1 similar comment
@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68150 [ run ] triggered by Bot. Commit: 9ad6e39 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68151 [ run ] triggered by Bot. Commit: 9ad6e39 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68150 [ run ] completed with state ABORTED. Commit: 9ad6e39

Link to invocation

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68175 [ run ] triggered by Bot. Commit: d701313 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68151 [ run ] completed with state ABORTED. Commit: 9ad6e39

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

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

@ishovkun

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68252 [ run ] triggered by Bot. Commit: d701313 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #68252 [ run ] completed with state SUCCESS. Commit: d701313
/LLM/main/L0_MergeRequest_PR pipeline #55689 completed with status: 'SUCCESS'

CI Report

Link to invocation

@chang-l
chang-l merged commit bc12697 into NVIDIA:main Aug 21, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown

LFS objects already in storage (1 file) — no sync needed.

These LFS-tracked files are already present in this repository's LFS storage:

  • tests/integration/defs/examples/visual_gen/golden/visual_gen_lpips/visual_gen_lpips_golden_media.zip

ishovkun added a commit to ishovkun/TensorRT-LLM that referenced this pull request Aug 24, 2026
…eshold

The static-FP8 T2I golden generated under the host's torch defaults. Cosmos3
runs fp32 GEMMs inside the denoising loop (RoPE frequencies, the timestep
embedder, the fp32 autocast block), so their arithmetic follows
float32_matmul_precision -- "high" (TF32) in NGC containers, "highest" on PyPI
torch. NVIDIA#17780 measured that single flag moving LPIPS-to-golden 0.132 -> 0.054 on
the sibling Cosmos3 goldens, and applies the pin per generation path rather than
from the shared determinism helper, so this path did not inherit it.

The threshold moves 0.05 -> 0.1. The golden is cut on B300 (sm_103) but
scheduled only on B200 (sm_100), and a stored quantized golden does not carry
across that boundary: kernel selection, split-k and reduction order, and
autotuner choices all change with the architecture, none of which the fp32
pin addresses. The old 0.05 was calibrated on same-host self-regeneration
distance (two renders were bit-identical, LPIPS 0.000000), which measures
reproducibility on the cutting host rather than portability to the running one.
0.1 gates drastic divergence; the topology assertion and the unit suites remain
the feature's real protection.

Signed-off-by: Igor Shovkun <igshov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants