Repository navigation
[graph_trainer] Enable GPT-OSS in GraphTrainer - #5832
Merged
Merged
Conversation
Add GraphTrainerGptOssModel and its flavor builder so GPT-OSS (attention
sinks, sliding-window attention, biased grouped experts) trains through
GraphTrainer with SimpleFSDP, TP, EP, and PP. CP raises ValueError until its
attention backends are validated under GraphTrainer.
The GraphTrainer README gains a Supported Models table.
The multi-GPU numerics comparison uses FlexAttention: on Blackwell, FA4's
Varlen backward is not deterministic for full causal attention (dQ differs
run to run even with deterministic=True; sliding-window layers are
deterministic), so an eager Varlen run does not reproduce itself.
Testing:
- test_bitwise_deterministic.py::TestGptOss{,FlexAttn}BitwiseDeterministic:
eager vs aot_fx_trace, trace vs precompile (Varlen), and
numerics_changing_optim run-to-run are bitwise identical in loss, model
hash, and gradient hash (GB300).
- test_numerics.py::test_moe_gpt_oss_aot_fx_trace_vs_eager: eager FSDP2 vs
GraphTrainer with FSDP2+TP2+EP2 on 4 GPUs, loss and grad_norm bitwise
identical for 20 steps.
- The Varlen GraphTrainer recipe trains 10 steps with FSDP2+TP2+EP2.
- Local: Interleaved1F1B PP2 eager vs GraphTrainer on 2 GPUs, loss and
grad_norm bitwise identical for 10 steps.
SherlockNoMad
force-pushed
the
SherlockNoMad/gt_gpt_oss
branch
from
November 4, 2026 23:30
259b540 to
dbe4475
Compare
SherlockNoMad
marked this pull request as ready for review
November 4, 2026 23:38
SherlockNoMad
requested review from
IvanKobzarev,
acisseJZhong,
aditvenk,
fegin,
felipemello1,
sanketpurandare,
shuhuayu,
tianyu-l,
wwwjn and
ydwu4
as code owners
November 4, 2026 23:38
aditvenk
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary (human-written)
Why
GPT-OSS (attention sinks, sliding-window attention, biased grouped experts)
has no GraphTrainer model class, so it cannot train through GraphTrainer's
whole-step trace.
Example.
What changed
graph_trainer/gpt_oss/:GraphTrainerGptOssModeland itsbuild_model_config. CP raisesValueErroruntil its attention backendsare validated under GraphTrainer.
torchtitan_recipes/tests/graph_trainer/gpt_oss.py(Varlenand FlexAttention).
runs today, with GPT-OSS added.
Numerics
Eager FSDP2 vs GraphTrainer, seed 42, deterministic,
scripts/loss_compare.py --assert-equal, based0ab95e46:debugmodel, FlexAttention, FSDP2 + TP2 + EP2, 20 stepsdebugmodel, FlexAttention, Interleaved1F1B PP2, 10 stepsThe 4-GPU comparison uses FlexAttention. On Blackwell, FA4's Varlen backward is
not deterministic for full causal attention (dQ differs run to run even with
deterministic=True; the sliding-window layers are deterministic), so an eagerVarlen run does not reproduce itself.
Testing
test_bitwise_deterministic.py::TestGptOssBitwiseDeterministicandTestGptOssFlexAttnBitwiseDeterministic(1 GPU): eager vs aot_fx_trace,trace vs precompile, and
numerics_changing_optimrun-to-run produce bitwiseidentical loss, model hash, and gradient hash.
test_numerics.py::test_moe_gpt_oss_aot_fx_trace_vs_eager(4 GPUs): theFSDP2 + TP2 + EP2 row above.
Known issues / follow-ups
ValueError.20band120bflavors build through the samebuild_model_config,but only
debugmodelis verified. A random-init20bFSDP4 + EP4 runmatches eager for 3 steps, then diverges slightly from step 4.