Skip to content

feat(inkling2): Inkling 2 Small and Mini GRPO with Automodel and SGLang or vLLM - #5238

Draft
snowmanwwg wants to merge 15 commits into
mainfrom
inkling2-small
Draft

snowmanwwg wants to merge 15 commits into
mainfrom
inkling2-small

Conversation

@snowmanwwg

@snowmanwwg snowmanwwg commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What

GRPO for Inkling 2 Small (48-layer, 384-expert MoE) with an Automodel policy on GB200 and two generation backends:

  • SGLang BF16, synchronous: colocated SGLang generation that serves BF16 experts.
  • vLLM MXFP8, asynchronous: non-colocated vLLM generation that serves MXFP8 experts, re-quantized from the BF16 policy on every refit, with async GRPO.

The model guide (docs/guides/models/inkling/inkling2-small.md) covers setup, recipes and reference results for both.

Inkling 2 Mini (added in 59b1658)

GRPO for the looped Inkling 2 Mini (model_type: inkling2_loop; 24 stored layers with layers 6–17 run three times, 128 experts, about 27B parameters) with an Automodel policy and synchronous SGLang BF16 generation, colocated on 2 GB200 nodes (EP8, two TP4/EP4 engines). The model guide is docs/guides/models/inkling/inkling2-mini.md.

  • Recipes: grpo-inkling2-mini-2n4g-automodel-sglang.yaml (reference experiment) and grpo-inkling2-mini-smoke-1n4g-automodel-sglang.yaml (1-node, 3 steps).
  • Launcher: modes mini and mini-smoke, plus SGLANG_OVERRIDE (mount another SGLang package over the container's) and NODES_OVERRIDE.
  • tools/inkling2/stage_mini_sglang.py: stages the SGLang source shipped in the Mini checkpoint (sglang.zip): writes _version.py and relaxes a looped-config check that otherwise kills SGLang at startup.
  • automodel_policy_worker.py: inkling2_loop takes the synchronous checkpoint path like inkling2_model, and Mini's cross-pass queries (middle_cycle_cross_pass_queries, middle_cycle_cross_pass_kv_queries) stay FP32 through refit.
  • Dependencies: Mini needs the looped-Inkling2 Automodel support in HuiyingLi/Automodel-day0#13, mounted with AM_OVERRIDE; the Automodel submodule pin in this PR is unchanged. The Inkling 2 Small SGLang container is reused, since Mini's SGLang drop pins the same torch, sglang-kernel, FlashInfer and Transformers versions.
  • Docs: results/ adds Mini-vs-Small plots (inkling2-mini-vs-small-*), the data file, and the plot and data-build scripts.

Dependencies (Inkling 2 Small)

Automodel worker (automodel_policy_worker.py, checkpoint.py)

  • Inkling2 adapter: calls convert_single_tensor_to_hf(fqn, tensor) without exclude_key_regex/quantization, because the adapter rejects unknown options. Drops _extra_state tensors in NeMo RL. Keeps the attention-residual queries, the output query and the router bias in FP32 on refit. The policy exports BF16 weights; checkpoint-precision export is rejected.
  • Chunked routed-expert refit (expert_refit_chunk_size): expert stacks are broadcast a chunk at a time instead of calling full_tensor() on every rank. A full-layer gather is 30 GiB for gate_and_up in BF16.
  • Refit fixes: 1-byte dtypes are kept. The model is moved back to the GPU before a refit if an earlier offload left it on the CPU.
  • Checkpointing: Inkling2 checkpoints are saved synchronously, because async DCP staging failed with copy_() on an invalid python storage. On resume, cuBLAS handles are created before the optimizer state loads; otherwise the first backward pass hits CUBLAS_STATUS_ALLOC_FAILED.
  • automodel_cfg.checkpoint.resume_on_cpu: stages the resumed model and optimizer state in CPU memory, because Inkling2's FP32 optimizer load does not fit on the GPU next to the model. Saves stay on the GPU.

GRPO / SGLang

  • Colocated SGLang without a CPU weight backup loses its weights on finish_generation(). The generation is now marked stale after validation, so it is refit before the next rollout.
  • load_weights in SGLang's Inkling2 model is patched to accept bucketed and chunked refits. The patch targets the first candidate file that defines load_weights (srt/models/inkling2.py or tml/model.py, depending on the build of [Feat] inkling2: Support Inkling-2-Small sgl-project/sglang#50186). The SafeUnpickler allowlist patch also handles the newer (module, name) pair format.

GRPO / vLLM

  • MXFP8 refit (nemo_rl/models/generation/vllm/inkling2_mxfp8_refit.py): installed as a vLLM worker extension before the model is built. It quantizes the BF16 routed experts from the policy to MXFP8 on every refit and keeps the FP32 attention-residual queries and router bias in FP32.
  • Config registration: the vLLM worker registers vLLM's inkling2 config with transformers' AutoConfig, because only vLLM knows that model type.
  • policy.generation.model_name: a recipe can point generation at its own view of the policy checkpoint (same weights and tokenizer, backend-specific config). grpo.py falls back to policy.model_name when it is unset.
  • The Nemotron-VL final LayerNorm source patch warns instead of raising when the vLLM 0.33 source is not found, so other models still start on vLLM builds whose source differs.

Recipes (examples/configs/recipes/llm/grpo-inkling2-*)

  • SGLang BF16: 1-node and 4-node real-format proxies, 8-node GB300, and 16-node and 32-node GB200. The 32-node recipe uses EP64 + HybridEP inside 16-node rack segments (cluster.segment_size=16), plus checkpointing with a timed save before the job limit.
  • vLLM MXFP8: a tiny 1-node smoke test on a random-weight checkpoint, and the 24-node GB200 async recipe (16 training + 8 generation nodes) used for the reference run. The async recipe inherits from grpo-inkling2-16n4g-automodel-vllm-mxfp8.yaml, which holds the shared vLLM settings; that 16-node colocated configuration has not completed a run. per_process_memory_fraction is 0.97, which leaves enough GPU headroom for the first backward after a resume.
  • Model paths are /path/to/... placeholders.

tools/inkling2

  • A generic Slurm launcher (launch_slurm.sh) with SGLang modes (job names end in -sglang) and vllm-tiny, vllm-full and vllm-async modes.
  • A proxy-checkpoint slicer and checkpoint-view helpers, including make_vllm_mxfp8_views.py (vLLM and policy views of the release) and make_tiny_mxfp8_view.py (the tiny smoke-test checkpoint).

Docs (docs/guides/models/inkling/)

  • The Inkling 2 Small guide, linked from the model-guides hub: support status, build environment, weights and data, recipes, launch commands and known issues.
  • Reference results for both modes: W&B run links, a nine-panel comparison and a step-timing figure. results/ holds the selected W&B metrics (inkling2-small.json), plot.py and the rendered PNG/SVG.

Testing

Both reference experiments ran this branch's NeMo RL code with Automodel main on GB200, starting from the original weights. Each continued across 2 h jobs through timed checkpoint save and resume.

SGLang BF16, sync (32 nodes) vLLM MXFP8, async (24 nodes)
GRPO steps 71 70
AIME 2024 accuracy, step 0 → step 70 39.06% → 83.20% 40.23% → 78.52%
Generation KL error, median 0.0011 0.0022
Step time, median 224 s 214 s

Inkling 2 Mini results

SGLang BF16 sync, 2 GB200 nodes, same recipe settings as Small (DAPO-Math-17k, 32 × 8 rollouts, LR 1e-6), 70 GRPO steps across four 2 h jobs with timed checkpoint save and resume. AIME 2024 accuracy 28.9% at step 10 → 61.3% at step 70 (no step-0 evaluation); generation KL median 0.0009; step time median 312 s on 8 GPUs. Policy KL has early spikes (steps 5, 6, 9) and one at step 62 whose cause has not been isolated. A 2-node EP4 layout fails in the first backward pass, so the recipe uses EP8. Mini ran on the container's SGLang drop and Automodel PR 13 mounted over it, not on this branch's pins.

Notes

  • sglang#50186 and vllm#67325 are both still open, so the sglang pin and the vLLM container requirement will need updating once they merge.
  • Building SGLang from source runs cargo to find its Rust extensions. Set SGLANG_BUILD_RUST_EXTS=none where Rust is unavailable; locking with uv also needs this.

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

… rollouts

Runs Inkling 2 Small (48-layer, 384-expert MoE) GRPO with an Automodel
policy and colocated SGLang generation serving BF16 experts.

Dependencies
- Automodel submodule -> NVIDIA-NeMo/Automodel main, which includes
  native Inkling2 training with HybridEP (NVIDIA-NeMo/Automodel#4755).
- sglang extra -> sgl-project/sglang#50186 (Inkling 2 Small support),
  torch 2.14.1, sglang-kernel 0.4.11, flashinfer 0.7.4; uv.lock refreshed.

Automodel worker
- Inkling2 adapter: call convert_single_tensor_to_hf without
  exclude_key_regex/quantization (closed option set), drop _extra_state
  tensors in NeMo RL, keep attention-residual queries, output query and
  router bias in FP32 on refit; BF16 serving only.
- Chunked routed-expert refit (expert_refit_chunk_size): broadcast expert
  stacks a chunk at a time instead of full_tensor() on every rank.
- Refit keeps 1-byte dtypes; onload the model before refit if an earlier
  offload left it on CPU.
- Save Inkling2 checkpoints synchronously (async DCP staging failed).
- On resume, create cuBLAS handles before optimizer state is loaded.

GRPO / SGLang
- Colocated SGLang without a CPU weight backup loses its weights on
  finish_generation(); mark generation stale after validation and refit.
- Patch SGLang's Inkling2 load_weights for bucketed and chunked refits and
  its SafeUnpickler allowlist for (module, name) pairs.

Recipes (examples/configs/recipes/llm/grpo-inkling2-*)
- 1-node and 4-node real-format proxies, 8-node GB300, 16- and 32-node
  GB200. 32 nodes: EP64 + HybridEP inside 16-node rack segments
  (cluster.segment_size=16), checkpointing with timed save before the
  job limit. Model paths are placeholders.

tools/inkling2: generic Slurm launcher (launch_slurm.sh), proxy slicer and
checkpoint-view helpers.

Validated on 32 GB200 nodes with the earlier Automodel snapshot: resume
across 2 h jobs, validation accuracy 0.39 (step 0) -> 0.80 (step 40+).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
… 2 Small

- Serve Inkling2 with vLLM (vllm-project/vllm#67325): routed experts as
  MXFP8, re-quantized from the BF16 policy on every refit
  (inkling2_mxfp8_refit.py); register vLLM's inkling2 config with
  transformers; let a recipe point generation at its own checkpoint view
  (policy.generation.model_name).
- The Nemotron-VL final LayerNorm source patch warns instead of raising
  when the vLLM 0.33 source is not found, so other models start on vLLM
  builds whose source differs (the Inkling2 one).
- automodel_cfg.checkpoint.resume_on_cpu: stage resumed model and
  optimizer state in CPU memory (Inkling2's FP32 optimizer load does not
  fit on the GPU next to the model). Saves stay on the GPU.
- Recipes: tiny 1n4g smoke test, 16n4g colocated, 24n4g async (16
  training + 8 generation nodes); launch_slurm.sh gains vllm-tiny,
  vllm-full and vllm-async modes; view builders for the release and the
  tiny checkpoint.

Refit keeps the FP32 attention-residual queries and router bias in FP32
(_refit_tensor_dtype), as for SGLang.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
@github-actions

Copy link
Copy Markdown

❌ Submodule Fast-Forward Check Failed

Check based on commit: 6dbdafd (PR #5238 from inkling2-small)

❌ Submodules that need attention:

Automodel: ❌ Commits have DIVERGED from a common ancestor
TARGET (main branch): https://github.com/NVIDIA-NeMo/Automodel/commits/b916107a5ce8e77a3f18682f8b0eaa46a4b54389/
CURRENT (PR #5238 from inkling2-small): https://github.com/NVIDIA-NeMo/Automodel/commits/3ef55b85bdf191b520f1383155652edd32f35f6a/

Please ensure all submodule commits are fast-forwards of the main branch before merging.

@github-actions

Copy link
Copy Markdown

❌ Submodule Fast-Forward Check Failed

Check based on commit: 564575e (PR #5238 from inkling2-small)

❌ Submodules that need attention:

Automodel: ❌ Commits have DIVERGED from a common ancestor
TARGET (main branch): https://github.com/NVIDIA-NeMo/Automodel/commits/b916107a5ce8e77a3f18682f8b0eaa46a4b54389/
CURRENT (PR #5238 from inkling2-small): https://github.com/NVIDIA-NeMo/Automodel/commits/3ef55b85bdf191b520f1383155652edd32f35f6a/

Please ensure all submodule commits are fast-forwards of the main branch before merging.

Adds docs/guides/models/inkling (family index + Inkling 2 Small guide) and
links it from the model-guides hub. The guide covers the SGLang BF16
synchronous recipes in this branch and compares two reference experiments
on the same nine panels: SGLang BF16 sync (32 GB200 nodes, colocated) and
vLLM MXFP8 async (24 GB200 nodes, non-colocated). It notes that the two runs also differ in optimizer, loss
normalization, TIS ratio, MoE dispatcher and placement.

results/ holds the selected W&B metrics (inkling2-small.json), plot.py,
and the rendered PNG/SVG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Nov 16, 2026
@github-actions

Copy link
Copy Markdown

❌ Submodule Fast-Forward Check Failed

Check based on commit: f952a3f (PR #5238 from inkling2-small)

❌ Submodules that need attention:

Automodel: ❌ Commits have DIVERGED from a common ancestor
TARGET (main branch): https://github.com/NVIDIA-NeMo/Automodel/commits/b916107a5ce8e77a3f18682f8b0eaa46a4b54389/
CURRENT (PR #5238 from inkling2-small): https://github.com/NVIDIA-NeMo/Automodel/commits/3ef55b85bdf191b520f1383155652edd32f35f6a/

Please ensure all submodule commits are fast-forwards of the main branch before merging.

…ng job names

- Some Inkling2 SGLang builds keep a thin srt/models/inkling2.py that only
  re-exports tml/model.py. The bucketed/chunked refit patch picked the first
  existing candidate and failed with "anchor not found"; it now patches the
  first candidate that defines load_weights with the completeness check.
- launch_slurm.sh: SGLang modes are named inkling2-<mode>-gb200-sglang again;
  vllm-* modes keep inkling2-<mode>-gb200.

Validated on 32 GB200 nodes (full32): the patch applies and training runs
(steps 1-9, generation KL error ~0.001, refit ~19.5 s).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
@github-actions

Copy link
Copy Markdown

❌ Submodule Fast-Forward Check Failed

Check based on commit: 5508253 (PR #5238 from inkling2-small)

❌ Submodules that need attention:

Automodel: ❌ Commits have DIVERGED from a common ancestor
TARGET (main branch): https://github.com/NVIDIA-NeMo/Automodel/commits/b916107a5ce8e77a3f18682f8b0eaa46a4b54389/
CURRENT (PR #5238 from inkling2-small): https://github.com/NVIDIA-NeMo/Automodel/commits/3ef55b85bdf191b520f1383155652edd32f35f6a/

Please ensure all submodule commits are fast-forwards of the main branch before merging.

@github-actions

Copy link
Copy Markdown

❌ Submodule Fast-Forward Check Failed

Check based on commit: ae7ed6d (PR #5238 from inkling2-small)

❌ Submodules that need attention:

Automodel: ❌ Commits have DIVERGED from a common ancestor
TARGET (main branch): https://github.com/NVIDIA-NeMo/Automodel/commits/b916107a5ce8e77a3f18682f8b0eaa46a4b54389/
CURRENT (PR #5238 from inkling2-small): https://github.com/NVIDIA-NeMo/Automodel/commits/3ef55b85bdf191b520f1383155652edd32f35f6a/

Please ensure all submodule commits are fast-forwards of the main branch before merging.

…ing step

A resumed run reaches its first backward with the optimizer state already
on the GPU, so the allocations the PyTorch cache cannot serve (lazily
loaded kernels, NCCL buffers) find tens of MB free: step 25 after a resume
failed with "CUDA error: out of memory", and with per_process_memory_fraction
0.99 (~1.8 GiB headroom) an EP all-reduce in backward failed in a CUDA call.
0.97 (~5.5 GiB) gets the resume through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
@github-actions

Copy link
Copy Markdown

❌ Submodule Fast-Forward Check Failed

Check based on commit: e1d9b9d (PR #5238 from inkling2-small)

❌ Submodules that need attention:

Automodel: ❌ Commits have DIVERGED from a common ancestor
TARGET (main branch): https://github.com/NVIDIA-NeMo/Automodel/commits/b916107a5ce8e77a3f18682f8b0eaa46a4b54389/
CURRENT (PR #5238 from inkling2-small): https://github.com/NVIDIA-NeMo/Automodel/commits/3ef55b85bdf191b520f1383155652edd32f35f6a/

Please ensure all submodule commits are fast-forwards of the main branch before merging.

…sults

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
@snowmanwwg snowmanwwg mentioned this pull request Nov 17, 2026
3 tasks done
@snowmanwwg snowmanwwg changed the title feat(inkling2): Inkling 2 Small GRPO with Automodel policy and SGLang rollouts feat(inkling2): Inkling 2 Small GRPO with Automodel policy and SGLang or vLLM rollouts Nov 18, 2026
snowmanwwg and others added 2 commits November 18, 2026 16:31
…larify the SGLang build

The 16-node colocated vLLM MXFP8 layout never completed a run; it stays as
the base config that the 24-node async recipe inherits. The SGLang reference
run served with a pre-release Inkling2 SGLang source drop in its container.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
…BF16 rollouts

Adds looped Inkling 2 Mini (model_type inkling2_loop) on top of the Inkling 2
Small support: a 2-node GB200 recipe (EP8, two TP4/EP4 SGLang engines) and a
1-node smoke recipe, launcher modes `mini` and `mini-smoke` with
SGLANG_OVERRIDE and NODES_OVERRIDE, a tool that stages the SGLang source
shipped with the checkpoint, and a model guide with reference results next to
Inkling 2 Small. The Automodel policy worker takes the synchronous checkpoint
path for inkling2_loop and keeps Mini's cross-pass queries FP32 through refit.

Mini needs the looped-Inkling2 Automodel support
(HuiyingLi/Automodel-day0#13) mounted with AM_OVERRIDE; the Automodel
submodule pin is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
@snowmanwwg snowmanwwg changed the title feat(inkling2): Inkling 2 Small GRPO with Automodel policy and SGLang or vLLM rollouts feat(inkling2): Inkling 2 Small and Mini GRPO with Automodel policy and SGLang or vLLM rollouts Nov 21, 2026
@snowmanwwg snowmanwwg mentioned this pull request Nov 21, 2026
3 tasks done
@snowmanwwg snowmanwwg changed the title feat(inkling2): Inkling 2 Small and Mini GRPO with Automodel policy and SGLang or vLLM rollouts feat(inkling2): Inkling 2 Small and Mini GRPO with Automodel and SGLang or vLLM Nov 21, 2026
@github-actions github-actions Bot added the CI:L1 Run doctests, unit tests, and functional tests label Nov 21, 2026
snowmanwwg and others added 3 commits November 21, 2026 12:56
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
… plots

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Wenwen Gao <[email protected]>
@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants