Skip to content

[NNX] Delete Linen 3/5: collapse dispatch in inference (maxengine, kvcache, vLLM, LoRA) - #4359

Merged
copybara-service[bot] merged 1 commit into
mainfrom
feat/nnx-del-linen-3-inference
Sep 9, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
feat/nnx-del-linen-3-inference

Conversation

@ecnal-cienet

Copy link
Copy Markdown
Collaborator

NNX Migration Route Map

  1. ✅ Add NNX scaffolding: pure_nnx flag, init_state_fn, TrainStateNNX, NNX utils. Linen workflow unchanged. (PR NNX migration prep (1/N): pure_nnx flag and init_state_fn scaffolding #3427)
  2. ✅ NNX sharding utilities: 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)
  3. ✅ NNX fully supported end-to-end: 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)
  4. ✅ Sharding diagnostics on NNX, plus post-training bugfixes that surfaced once the NNX path got exercised end-to-end. (PR [NNX] NNX migration prep (4/N): sharding tools and post-training fixes #3652)
  5. ✅ NNX correctness fixes, feature enablements, and vocab tiling on NNX.
  6. ✅ NNX-native DPO.
  7. ✅ NNX-native MaxEngine inference. (PR [NNX] NNX migration prep (7/N): NNX-native MaxEngine inference #3821)
  8. ✅ NNX-native LoRA + GRPO. (PR [NNX] NNX migration prep (8/N): NNX native lora grpo #3824)
  9. ✅ NNX-aware QK-Clip + remaining checkpoint utilities. (PR [NNX] NNX migration prep (9/N): NNX-aware QK-Clip + checkpoint utilities #3836)
    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)
  10. ✅ Vocab tiling custom_vjp for NNX.
  11. ✅ Set NNX defaults to True; regenerate sharding goldens; flip back integration-test pure_nnx=False annotations. (PR [NNX] NNX migration (11/N): set pure_nnx / enable_nnx / pure_nnx_decoder defaults to True #3526)
  12. Delete Linen-specific code paths and NNX compatibility flags — delivered as 5 stacked PRs (12.1–12.5):
    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. 🔄 [This PR] Collapse Linen dispatch in inference / serving — maxengine.py, kvcache.py, vllm_decode.py, lora_utils.py + tests. Also drops the enable_nnx / pure_nnx_decoder entries vllm_decode.py forwarded into the nested vLLM maxtext_config. Stacks on 12.2.
    12.4. ❌ Delete the Linen decoder/attention/embedding layers + *_as_linen model wrappers.
    12.5. ❌ Remove the pure_nnx / enable_nnx / pure_nnx_decoder config flags.

Description

Third of the stacked "Delete Linen" series (see 1/5). Collapses the Linen dispatch in the inference and serving path: maxengine.py, kvcache.py, vllm_decode.py, and lora_utils.py, with their tests updated. This also drops the enable_nnx / pure_nnx_decoder entries that vllm_decode.py forwarded into the nested vLLM maxtext_config, since that nested MaxText now defaults to NNX.

Serving already ran the NNX path by default, so this is dead-branch removal with no behavior change. Base branch is feat/nnx-del-linen-2-trainers. ~8 files, +189 / −648.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov

codecov Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/maxtext/utils/lora_utils.py 0.00% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-3-inference branch 2 times, most recently from cb9c0d0 to fbe1484 Compare July 7, 2026 21:00
@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-3-inference branch 7 times, most recently from b514961 to 6a2b270 Compare July 21, 2026 18:55
@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-3-inference branch 6 times, most recently from 2a26f98 to e1a43f7 Compare July 29, 2026 14:48
@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-3-inference branch 4 times, most recently from dab8d49 to 5890a05 Compare August 20, 2026 21:38
@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-3-inference branch 4 times, most recently from 527888e to 9306d86 Compare August 31, 2026 21:18
@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-3-inference branch 2 times, most recently from 5c100eb to 3e451bd Compare September 8, 2026 22:19
@ecnal-cienet
ecnal-cienet changed the base branch from main to feat/nnx-del-linen-2-trainers September 8, 2026 23:06
@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-2-trainers branch from 6d7511d to 9ef95e4 Compare September 8, 2026 23:10
Base automatically changed from feat/nnx-del-linen-2-trainers to main September 9, 2026 19:41
@ecnal-cienet
ecnal-cienet force-pushed the feat/nnx-del-linen-3-inference branch from e60b030 to 9208fbd Compare September 9, 2026 19:43
@copybara-service
copybara-service Bot merged commit 0206cf4 into main Sep 9, 2026
125 of 130 checks passed
@copybara-service
copybara-service Bot deleted the feat/nnx-del-linen-3-inference branch September 9, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants