Repository navigation
Conversation
This was referenced Nov 3, 2026
2 tasks
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 4, 2026 01:54
48795a8 to
7b33941
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
from
November 4, 2026 01:54
b2aca89 to
71eb967
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 4, 2026 21:15
7b33941 to
964e954
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
from
November 4, 2026 21:15
71eb967 to
223be19
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 5, 2026 08:21
964e954 to
a5efda3
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
from
November 5, 2026 08:21
223be19 to
51b450b
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 5, 2026 20:05
a5efda3 to
2addbca
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
2 times, most recently
from
November 5, 2026 20:14
6608e4e to
72d0de7
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
2 times, most recently
from
November 6, 2026 00:55
84d08ed to
3585676
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
from
November 6, 2026 00:55
72d0de7 to
bc22fd5
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 6, 2026 03:39
3585676 to
a725047
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
from
November 6, 2026 03:40
bc22fd5 to
f72e254
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 7, 2026 02:07
a725047 to
9b07f3f
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
from
November 7, 2026 02:07
f72e254 to
ba80b84
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 9, 2026 07:55
9b07f3f to
5682a74
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-04-determinism
branch
from
November 9, 2026 07:55
ba80b84 to
f521fcb
Compare
shuhuayu
changed the base branch from
users/shuhuayu/qwen3-8-fn-04-determinism
to
users/shuhuayu/qwen3-8-fn-03-tp-ep
November 9, 2026 07:55
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 9, 2026 10:21
5682a74 to
ccae348
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-03-tp-ep
branch
from
November 9, 2026 10:21
62df501 to
b07872a
Compare
shuhuayu
force-pushed
the
qwen3-8-fn-05-pipeline
branch
from
November 9, 2026 10:46
ccae348 to
0d9fb8d
Compare
shuhuayu
force-pushed
the
users/shuhuayu/qwen3-8-fn-03-tp-ep
branch
from
November 9, 2026 10:46
b07872a to
92ab189
Compare
shuhuayu
added a commit
that referenced
this pull request
Nov 10, 2026
## Summary (human-written)
<!-- Write this yourself, not with an AI tool. 2-5 sentences: the
problem, why
this approach, and what you checked yourself. -->
this pr is to add `deterministic ` option to gdn backend (an existing
bug) so gdn has reproducible numerics.
## Why
Independent prerequisite based on `main`. Merge this before #5782; the
model stack is based on this branch.
`torch.use_deterministic_algorithms(True)` does not reach Attention
Gym's GDN L2 normalization policy. Its forward schedule is fixed, but
backward autotuning benchmarks different tile schedules. Two
strict-deterministic runs can therefore choose different backward
schedules and train differently.
**Example.** The eight-GB300 Flash-Next first-step diagnostic observes a
difference in `kda_l2norm_bwd` before the PLE output gradient or any
lookup-gradient exchange. Hash IDs and selected vectors are identical.
Disabling normalization autotuning under PyTorch's existing
deterministic flag pins the schedule.
```python
autotune = not torch.are_deterministic_algorithms_enabled()
normalized_q = l2norm(q, cu_seqlens=cu_seqlens, autotune=autotune)
```
## What changed
Pass that policy through all shared GDN normalization callsites:
ordinary chunk/recurrent forward, recurrent backward's chunk-gradient
recomputation, and CP GDN. Nondeterministic runs retain autotuning. No
model flag or alternate kernel is added.
## User-facing changes
| Before | After |
| --- | --- |
| Strict determinism still allows GDN backward normalization autotuning
| The existing PyTorch deterministic flag selects a fixed schedule. |
## Numerics and testing
- The CUDA regression checks that deterministic backward bypasses the L2
autotuner and produces finite, nonzero gradients in ordinary and
batch-invariant GDN modes. It does not assert how many times upstream
internals run in nondeterministic mode.
- The shared GDN computation in this PR is unchanged by the PLE storage
refactor. Both native DTensor and plain-owned-row qualification sources
include this same committed policy.
- Two-GB300 controlled A/B runs match first-step logits and 190 gradient
shards per rank, all twenty ten-step loss/norm values, and all 763 final
model/optimizer tensors bitwise. Full remat and checkpoint resume
preserve the result.
- The restacked TP2/SP/EP2 registered GB300 regression matches all
twenty unchanged golden values bitwise. Runtime: PyTorch
`2.16.0.dev20261030+cu132`, revision
`bf270c3251d8e84723cedbf5b60eaa60cacaa3f2`; seed 42 and strict
determinism. No production kernel or runtime patch is used.
- Existing GDN integration coverage exercises the default path; all-file
lint/typechecking pass.
```bash
python -m pytest -q tests/unit_tests/gpu/models/qwen3_5/test_qwen3_5_deltanet.py
```
The fix intentionally chooses a fixed backward schedule in deterministic
mode; it does not claim bitwise equivalence to every autotuned schedule.
#5785 carries the registered strict numerical integration. EP remains in
#5782 and TP/SP in #5783.
## Rebase validation
Rebased onto `main` at `c62c6a7552137d10d4fc3927aa20dcd69925aaf2`. This
includes #5909's upstream RL golden-reference fix. All ten losses from
the old failing RL job exactly match that corrected reference; this PR
does not edit the RL golden.
- Runtime: PyTorch `2.16.0.dev20261108+cu132`, revision
`1392e1f8e4903657d4391f3bd8fcc9ca8a74b758`; Attention Gym
`0.0.19.dev10+g26beb363c`, pinned revision
`26beb363c6d1328851bfc5c9c8691fa2066bd1fa`.
- The retained
`test_deterministic_backward_bypasses_normalization_autotuner` passes on
a GB300, covering ordinary and batch-invariant GDN forward/backward with
finite, nonzero gradients.
- All-file pre-commit, including typechecking, passes on this PR and the
complete rebased stack. Typechecking uses this runtime and isolated
stubs for optional dependencies.
- The complete stack's targeted CPU suite passes 123 tests.
The earlier multi-GPU model qualification results above apply to their
recorded pre-rebase sources and October 30 runtime. They have not been
repeated after this rebase. GitHub CI for the new head is pending.
## Stack
Prerequisite: #5784, shared GDN deterministic normalization,
independently based on `main`. Merge it first.
1. #5782: Flash-Next model, native DTensor PLE, FSDP and EP, based on
the prerequisite.
2. #5783: TP/SP and PLE feature-column sharding, based on #5782.
3. #5785: PP, remat and registered numerical integration, based on
#5783.
Local all-file hooks pass; Pyrefly uses the pinned validation runtime
and isolated optional-dependency stubs. GitHub CI is pending.
Contributor
Author
|
Closing as stale: this was based on an older revision of 1/n. The Flash-Next stack now lives on upstream branches managed with |
This was referenced Nov 12, 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
Stacked on #5783; GDN prerequisite #5784 is already in its ancestry.
A pipeline stage without PLE should own no lookup weights, optimizer moments or lookup collectives. Interleaved scheduling can put PLE in a later local model part, while the shared engine preprocesses inputs through the first part. Local-only optimizer regex validation also rejects valid global patterns on stages with no PLE.
Example. The eight-GPU recipe uses DP2, TP2, EP4, PP2 and four virtual stages:
PP rank 0's first part prepares routing through a weak reference to its second part's embedding. Only the second part registers table parameters. PP rank 1 has no table or table moments.
What changed
User-facing changes
Numerics and testing
126 targeted CPU tests and six two-GB300 tests pass on the native DTensor stack, covering shared optimizer patterns, model lifecycle, remat and pipeline ownership. The alternate split uses public
model.pipeline()/preprocess_inputs, checks stage-owned native DTensor chunk coordinates and globally partitioned model/optimizer keys, and restores optimizer/LR state after two updates.The registered TP2/SP/EP2 GB300 C4 regression matches all twenty committed full-precision loss/norm values bitwise; the golden is unchanged. Ten updates, seed 42 and strict determinism, PyTorch
2.16.0.dev20261030+cu132, revisionbf270c3251d8e84723cedbf5b60eaa60cacaa3f2.Eight DCT GB300s, actual C4 Trainer and native asynchronous checkpoints: DP2/TP2/EP4/PP2 with four Interleaved1F1B stages and full remat matches A/B on all twenty loss/norm values and all 2,866 final checkpoint entries (763 tensors). A repeated native run and B resume from A's step-5 checkpoint reach the identical final state. Loss:
7.70045804977417 -> 5.246838569641113.HSDP2x2/TP2/EP4/PP1 with full remat and SPMD type checking matches A/B on all twenty loss/norm values and all 2,874 final entries (763 tensors). Loss:
7.747829437255859 -> 5.494491100311279.All 48 child training processes exit zero and verify the October 30 runtime. The job wrapper then fails because it expects
tb_baselineinstead of the recipe'stb; local postprocessing of the saved full-precision events and native checkpoints passes. No training source or runtime patch is used. The committed provenance records the recovery explicitly.All-file
pre-commit run --all-files: pass.Precision and scope
Explicit
fsdp_defer_gradient_reductionis rejected. Real PP still uses PyTorch's group-level FSDP finalization: backbone gradients accumulate in FP32 on requesters before DP reduction. PLE sums each microbatch's BF16 requester gradients in FP32 on row owners, then accumulates owner gradients. Both compute the same globally token-normalized sum with different floating-point association. PP coverage qualifies native determinism and C4 training; bitwise parity with the former full-table FSDP path is not claimed for PP.Only the stage containing PLE adds table capacity; other PP stages join no lookup collectives. CP, CPU offload, released-model capacity and production throughput remain outside the qualified configurations.
Qualification source
bdc26ae0e, preserved A stacka725047d4; DCT jobqwen38-fn-01a1b222-dct-gb300-dtensor-stack-v2-sb702lrl, two hosts with four GB300s each. Those GPU results apply to the recorded pre-rebase sources. The subsequent HF bookkeeping follow-up and current rebase have targeted CPU coverage; the eight-GPU model qualification has not been repeated after the rebase. The registered golden is unchanged.Rebase validation
Rebased onto
mainatc62c6a7552137d10d4fc3927aa20dcd69925aaf2, including the upstream RL golden-reference fix in #5909. The Flash-Next compatibility edits narrow config types and initialize the BF16 router test through the current meta-materialization lifecycle; they do not change model equations.2.16.0.dev20261108+cu132, revision1392e1f8e4903657d4391f3bd8fcc9ca8a74b758; Attention Gym0.0.19.dev10+g26beb363c, pinned revision26beb363c6d1328851bfc5c9c8691fa2066bd1fa.The earlier two/eight-GPU model qualification results above apply to their recorded pre-rebase sources and October 30 runtime. Those model training comparisons have not been repeated after this rebase. GitHub CI for the new heads is pending.
Stack
Prerequisite: #5784, shared GDN deterministic normalization, independently based on
main. Merge it first.Local all-file hooks pass; Pyrefly uses the pinned validation runtime and isolated optional-dependency stubs. GitHub CI is pending.