Repository navigation
[NNX] Delete Linen 2/5: collapse dispatch in trainers (pre-train, DiLoCo, GRPO) - #4358
Merged
Merged
Conversation
Merged
4 tasks done
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-2-trainers
branch
2 times, most recently
from
July 7, 2026 21:00
752e83b to
1f73932
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-2-trainers
branch
7 times, most recently
from
July 21, 2026 18:55
903cf42 to
b235d8f
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-2-trainers
branch
6 times, most recently
from
July 29, 2026 14:48
61857b2 to
551d742
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-2-trainers
branch
5 times, most recently
from
August 20, 2026 21:38
fee6d95 to
34e33cd
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-2-trainers
branch
4 times, most recently
from
August 31, 2026 21:17
9dab7c0 to
1a196ec
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-2-trainers
branch
2 times, most recently
from
September 8, 2026 22:19
d1d081b to
6d7511d
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-2-trainers
branch
from
September 9, 2026 14:34
fa858b5 to
efc5353
Compare
ecnal-cienet
marked this pull request as ready for review
September 9, 2026 15:22
ecnal-cienet
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
richjames0,
shralex,
shuningjin,
vipannalla,
xibinliu and
xuefgu
as code owners
September 9, 2026 15:22
bvandermoon
approved these changes
Sep 9, 2026
hengtaoguo
approved these changes
Sep 9, 2026
4 tasks done
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.
NNX Migration Route Map
pure_nnxflag,init_state_fn,TrainStateNNX, NNX utils. Linen workflow unchanged. (PR NNX migration prep (1/N): pure_nnx flag and init_state_fn scaffolding #3427)get_abstract_state_nnx,get_named_sharding_nnx,set_named_sharding_nnx,get_partition_spec_nnx,get_mesh_from_config. (PR NNX migration prep (2/N): NNX utils and sharding utilities #3470)TrainStateNNX, model creation, gradient accumulation, checkpointing, and training loop dispatch. (PR NNX migration prep (3/N): TrainState, model creation, and end-to-end training loop #3500)9.5. ✅ NNX + AQT in MaxEngine + serve-mode reload + gpt3 prefill fix. (PR [NNX] NNX migration prep (9.5/N): NNX + AQT in MaxEngine + serve-mode reload + gpt3 prefill fix #3844)
custom_vjpfor NNX.True; regenerate sharding goldens; flip back integration-testpure_nnx=Falseannotations. (PR [NNX] NNX migration (11/N): set pure_nnx / enable_nnx / pure_nnx_decoder defaults to True #3526)12.1. ✅ Collapse Linen dispatch in utils / quantization / checkpointing / sharding. (PR [NNX] Delete Linen 1/5: collapse dispatch in utils, quantization, checkpointing, sharding #4357)
12.2. 🔄 [This PR] Collapse Linen dispatch in trainers —
pre_train/train.py(loss/train/eval step),train_compile.py,diloco.py, GRPO trainer + tests. After thistrain.pyno longer references the LinenDecoder. Also regeneratesgolden_dpo_correctness.jsonfor the NNX decoder (forward is bit-identical to Linen; the different RNG-init scheme just reseeds weights, so the init-specific golden is refreshed — not a numerics change). Stacks on 12.1.12.3. ❌ Collapse Linen dispatch in inference (maxengine, kvcache, vLLM, LoRA).
12.4. ❌ Delete the Linen decoder/attention/embedding layers +
*_as_linenmodel wrappers.12.5. ❌ Remove the
pure_nnx/enable_nnx/pure_nnx_decoderconfig flags.Description
Second of the stacked "Delete Linen" series (see 1/5). This one collapses the Linen dispatch in the training paths —
pre_train/train.py(loss/train/eval step),train_compile.py,diloco.py, and the GRPO trainer — and updates the trainer tests. After this PRtrain.pyno longer references the LinenDecoder.It also regenerates
golden_dpo_correctness.jsonfor the NNX decoder. The DPO correctness test used to pin the bridged Linen decoder to match its PyTorch-synced golden; on the NNX decoder the forward pass is bit-identical (checked by transplanting weights across,max|logits diff| = 0) but the layer weights are seeded from a different RNG scheme, so the init-specific golden needed regenerating. It's an init difference, not a numerics change. The test passes against the new golden on CPU.Like 1/5 this is dead-branch removal under the NNX defaults, and the Linen
Decoderclass is still present (it's deleted in 4/5), so nothing dangles. Base branch isfeat/nnx-del-linen-1-utils. ~13 files, +432 / −1235.Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.