Skip to content

[CI] A10G Qwen3 MoE FlexAttention fails eager vs graph bitwise equivalence #5366

Closed

Description

@sanketpurandare

Current failure

GraphTrainer A10G run 38450889840, job 115481259173, TorchTitan bed2b9ea8b50e564c5fe1ba09f936cb66af78c51, torch 2.16.0.dev20261013+cu132:

TestQwen3MoEFlexAttnBitwiseDeterministic::test_aot_fx_trace_vs_eager
eager vs aot_fx_trace: loss mismatch:
7.010030746459961 vs 7.010027885437012

The updated-model and gradient hashes also differ. This test compares execution paths within one process; it is not a comparison against an old golden file. It runs with numerics-changing optimizations disabled and therefore exposes a violation of the default graph pipeline's bitwise-equivalence contract.

Regression boundary and attribution status

  • Last passing A10G GraphTrainer run: TorchTitan c1993f5201982752ddf519177dcfff4c1e1cee07, torch nightly October 9.
  • First subsequent failure: TorchTitan 49c4cff1f9, torch nightly October 10; this same test reports 7.010543346405029 versus 7.010554313659668.
  • The October 9 wheel's torch SHA is 146a5a2f73e2980170c08e5bb6d0c7ffb703f7de (upstream 7b95b29df235ff10f08229bb4966fe9798b264a1); October 10 is a38cd7b6ba7f9bad441e27830cb2d1cc450e3040 (upstream 7b60f0244d287b8587e7b9819dd8b8b1ee001d07). These identities were read directly from the wheels' torch/version.py.

The introducing PR is not yet proven: source and nightly changed together. In particular, #5023 causes separate precompile-fixture errors but this numerical mismatch predates it. #5252 changes DeepSeek auxiliary-loss compilation; chronology alone does not establish that it caused this Qwen failure. No PR author is assigned as the culprit without a matched source/runtime comparison.

Investigation and principled fix

The current-source test executed and passed on SM103 with torch d2f3a9d2e41e2fb201224ec61f74aa000a37e513; that does not reproduce the A10G/CUDA13.2 failure or clear the CI gate.

Run the failing test on A10G with the same TorchTitan revision against the two identified torch builds. Capture the first differing forward activation/backward gradient and compare eager versus regional-Inductor FlexAttention code, including selected kernel options. Both routes enable max autotuning and coordinate-descent tuning, so differing kernel selection is a hypothesis to test, not an established cause.

Fix the earliest differing operation or compile boundary so the default graph pipeline uses the same numerical contract as eager. If a transformation intentionally changes numerics, move it behind numerics_changing_optim and retain the default bitwise test. Do not refresh a golden, skip the test, or replace its equality assertion with a tolerance to hide this within-run mismatch.

Verification status

CI failure and wheel provenance inspected. Current-source SM103 focused test: executed and passed. Exact A10G matched-build reproduction, first differing op, introducing PR, and fix: pending.

Investigation owner: @wwwjn (Jiani Wang). The introducing PR and causal attribution remain pending.

Activity

  1. sanketpurandare commented on Oct 14, 2026

    @sanketpurandare
    ContributorAuthor

    Reproduced on current upstream main 58a3027d954327f3fade5fea561305684dd45041 in GraphTrainer A10G run 38612652689, job 116019769490.

    TestQwen3MoEFlexAttnBitwiseDeterministic::test_aot_fx_trace_vs_eager reports the same loss pair as the original report: eager 7.010030746459961, traced 7.010027885437012. This remains a comparison between execution paths within one run, separate from the now-passing standard-model golden checks fixed by #5368.

    No new introducing PR has been proven from this refresh. The existing investigation remains with @wwwjn; the required evidence is still a matched A10G source/runtime comparison and the first differing operation. The two other failures in this job are the precompile fixture issue #5362.

  2. wwwjn commented on Oct 19, 2026

    @wwwjn
    Contributor

    Root cause: the change that introduced this is pytorch/pytorch#198959 (in the Oct 10 nightly), not a torchtitan PR. The graph pipeline is fine; the eager reference is what changes.

    The test annotated the eager Trainer model with GraphTrainer's per-module module_fqn tags. #198959 makes Dynamo guard on the active annotation, so the eager compiled flex_attention compiled once per layer, and those graphs carried over between tests. Llama3 Flex leaves 6, and Qwen3 MoE Flex passes the limit of 8 at its third layer. Dynamo then runs unfused eager flex, so the eager loss changes. Forcing a hard error at the limit shows it fires in the eager run, not the traced run. The test passes alone and fails after Llama3 Flex. It reproduces on GB200 with the Oct 19 nightly, so the cause isn't specific to A10G.

    Fix: #5547. It annotates only the GraphTrainer runs, compiles flex with fullgraph=True, recompile_limit=16 as in #5442, and resets Dynamo in each test's setUp.

  3. added a commit that references this issue on Oct 20, 2026
    323cf2b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions