Repository navigation
feat(inkling2): Inkling 2 Small and Mini GRPO with Automodel and SGLang or vLLM - #5238
snowmanwwg wants to merge 15 commits into
Conversation
… 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]>
1823cf8 to
6dbdafd
Compare
… 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]>
❌ Submodule Fast-Forward Check FailedCheck based on commit: 6dbdafd (PR #5238 from ❌ Submodules that need attention:Automodel: ❌ Commits have DIVERGED from a common ancestor Please ensure all submodule commits are fast-forwards of the main branch before merging. |
❌ Submodule Fast-Forward Check FailedCheck based on commit: 564575e (PR #5238 from ❌ Submodules that need attention:Automodel: ❌ Commits have DIVERGED from a common ancestor 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]>
❌ Submodule Fast-Forward Check FailedCheck based on commit: f952a3f (PR #5238 from ❌ Submodules that need attention:Automodel: ❌ Commits have DIVERGED from a common ancestor 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]>
❌ Submodule Fast-Forward Check FailedCheck based on commit: 5508253 (PR #5238 from ❌ Submodules that need attention:Automodel: ❌ Commits have DIVERGED from a common ancestor Please ensure all submodule commits are fast-forwards of the main branch before merging. |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Wenwen Gao <[email protected]>
❌ Submodule Fast-Forward Check FailedCheck based on commit: ae7ed6d (PR #5238 from ❌ Submodules that need attention:Automodel: ❌ Commits have DIVERGED from a common ancestor 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]>
❌ Submodule Fast-Forward Check FailedCheck based on commit: e1d9b9d (PR #5238 from ❌ Submodules that need attention:Automodel: ❌ Commits have DIVERGED from a common ancestor 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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Wenwen Gao <[email protected]>
…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]>
…odel#4861 Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: Wenwen Gao <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: Wenwen Gao <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: Wenwen Gao <[email protected]>
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]>
What
GRPO for Inkling 2 Small (48-layer, 384-expert MoE) with an Automodel policy on GB200 and two generation backends:
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 isdocs/guides/models/inkling/inkling2-mini.md.grpo-inkling2-mini-2n4g-automodel-sglang.yaml(reference experiment) andgrpo-inkling2-mini-smoke-1n4g-automodel-sglang.yaml(1-node, 3 steps).miniandmini-smoke, plusSGLANG_OVERRIDE(mount another SGLang package over the container's) andNODES_OVERRIDE.tools/inkling2/stage_mini_sglang.py: stages the SGLang source shipped in the Mini checkpoint (sglang.zip): writes_version.pyand relaxes a looped-config check that otherwise kills SGLang at startup.automodel_policy_worker.py:inkling2_looptakes the synchronous checkpoint path likeinkling2_model, and Mini's cross-pass queries (middle_cycle_cross_pass_queries,middle_cycle_cross_pass_kv_queries) stay FP32 through refit.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.results/adds Mini-vs-Small plots (inkling2-mini-vs-small-*), the data file, and the plot and data-build scripts.Dependencies (Inkling 2 Small)
NVIDIA-NeMo/Automodelmain (3ef55b8). It includes native Inkling2 training with HybridEP (feat(inkling2): add native text and image training support Automodel#4755).sglangextra → [Feat] inkling2: Support Inkling-2-Small sgl-project/sglang#50186 (Inkling 2 Small support, headea37428), with torch 2.14.1, sglang-kernel 0.4.11 and flashinfer 0.7.4.uv.lockwas refreshed with uv 0.13.6.vllmextra is unchanged, so the vLLM recipes need a container with that build.Automodel worker (
automodel_policy_worker.py,checkpoint.py)convert_single_tensor_to_hf(fqn, tensor)withoutexclude_key_regex/quantization, because the adapter rejects unknown options. Drops_extra_statetensors 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.expert_refit_chunk_size): expert stacks are broadcast a chunk at a time instead of callingfull_tensor()on every rank. A full-layer gather is 30 GiB forgate_and_upin BF16.copy_() on an invalid python storage. On resume, cuBLAS handles are created before the optimizer state loads; otherwise the first backward pass hitsCUBLAS_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
finish_generation(). The generation is now marked stale after validation, so it is refit before the next rollout.load_weightsin SGLang's Inkling2 model is patched to accept bucketed and chunked refits. The patch targets the first candidate file that definesload_weights(srt/models/inkling2.pyortml/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
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.inkling2config 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.pyfalls back topolicy.model_namewhen it is unset.Recipes (
examples/configs/recipes/llm/grpo-inkling2-*)cluster.segment_size=16), plus checkpointing with a timed save before the job limit.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_fractionis 0.97, which leaves enough GPU headroom for the first backward after a resume./path/to/...placeholders.tools/inkling2launch_slurm.sh) with SGLang modes (job names end in-sglang) andvllm-tiny,vllm-fullandvllm-asyncmodes.make_vllm_mxfp8_views.py(vLLM and policy views of the release) andmake_tiny_mxfp8_view.py(the tiny smoke-test checkpoint).Docs (
docs/guides/models/inkling/)results/holds the selected W&B metrics (inkling2-small.json),plot.pyand 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.
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
sglangpin and the vLLM container requirement will need updating once they merge.cargoto find its Rust extensions. SetSGLANG_BUILD_RUST_EXTS=nonewhere Rust is unavailable; locking with uv also needs this.🤖 Generated with Claude Code