Repository navigation
[NNX] Delete Linen 4/5: remove the Linen decoder/attention layers and *_as_linen model wrappers - #4360
Merged
Conversation
Merged
4 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
2 times, most recently
from
July 7, 2026 21:00
892e98e to
430c4cc
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
7 times, most recently
from
July 21, 2026 18:55
06b40e9 to
80b6539
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
6 times, most recently
from
July 29, 2026 14:48
e158b27 to
2872844
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
4 times, most recently
from
August 20, 2026 21:38
120a06a to
34e8754
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
4 times, most recently
from
August 31, 2026 21:18
476b480 to
5e9b758
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
2 times, most recently
from
September 8, 2026 22:20
4076f82 to
a4835ed
Compare
ecnal-cienet
changed the base branch from
main
to
feat/nnx-del-linen-3-inference
September 8, 2026 23:06
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-3-inference
branch
from
September 8, 2026 23:10
3e451bd to
af93222
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
from
September 8, 2026 23:10
a4835ed to
e93ede5
Compare
ecnal-cienet
requested review from
A9isha,
NuojCheng,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
dipannita08,
gobbleturk,
hengtaoguo,
huytransformer,
khatwanimohit,
vipannalla and
xibinliu
as code owners
September 9, 2026 18:24
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-3-inference
branch
from
September 9, 2026 19:43
e60b030 to
9208fbd
Compare
ecnal-cienet
requested review from
Lumosis,
gpolovets1,
jrplatin,
mailvijayasingh,
mitalisi and
patemotter
as code owners
September 9, 2026 19:43
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
from
September 9, 2026 19:43
174a888 to
f0a8e9c
Compare
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
from
September 9, 2026 22:23
f0a8e9c to
72ea1de
Compare
…_as_linen model wrappers
ecnal-cienet
force-pushed
the
feat/nnx-del-linen-4-layers
branch
from
September 10, 2026 15:41
72ea1de to
642e6d0
Compare
bvandermoon
approved these changes
Sep 10, 2026
hengtaoguo
approved these changes
Sep 10, 2026
bvandermoon
reviewed
Sep 10, 2026
bvandermoon
left a comment
Collaborator
There was a problem hiding this comment.
nnx_decoders.py is fully up to date, right?
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. ✅ Collapse Linen dispatch in trainers (pre-train, DiLoCo, GRPO); regenerate the NNX DPO golden. (PR [NNX] Delete Linen 2/5: collapse dispatch in trainers (pre-train, DiLoCo, GRPO) #4358)
12.3. ✅ Collapse Linen dispatch in inference (maxengine, kvcache, vLLM, LoRA). (PR [NNX] Delete Linen 3/5: collapse dispatch in inference (maxengine, kvcache, vLLM, LoRA) #4359)
12.4. 🔄 [This PR] Delete the Linen model code now that 12.1–12.3 removed every reference: the
decoders.pystack (Decoder/DecoderLayer/SequentialBlockDecoderLayers, onlydeepstack_processkept), the Linen attention/embeddings/encoders/MTP paths, and the*_as_linen/transformer_as_linenwrappers in the model files. The tests importing those classes are removed in this same PR so the branch stays import-clean. The NNX↔Linen bridge + Linen GRPO reference are kept for the checkpoint converters / torch-gated tests (follow-up). Stacks on 12.3.12.5. ❌ Remove the
pure_nnx/enable_nnx/pure_nnx_decoderconfig flags.Description
Fourth of the stacked "Delete Linen" series (see 1/5). PRs 1–3 removed every source reference to the Linen model code, so this PR deletes it. That means the Linen decoder stack in
decoders.py(Decoder,DecoderLayer,SequentialBlockDecoderLayers— onlydeepstack_processstays), the Linen attention implementations, the Linenembeddings/encoders/multi_token_predictionpaths, and the*_as_linen/transformer_as_linenToLinen wrappers in the model files (the wrapped NNX classes stay). The tests that imported those classes are removed in this same PR so the branch stays import-clean — a repo-wide grep for the deleted symbols now returns only the deletions themselves.Note that the NNX↔Linen bridge (
transformer_as_linen/TransformerLinen/init_initial_state) and the Linen GRPO reference are deliberately kept here, since the checkpoint-conversion tools and the torch-gated correctness tests still use them; migrating those to pure NNX is a follow-up. Base branch isfeat/nnx-del-linen-3-inference. ~16 files, +56 / −3498.Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.