Skip to content

feat(speechlm): support native RL checkpoints and frozen CTC export - #16387

Merged
vmendelev merged 19 commits into
mainfrom
task/speechlm-rl-main
Oct 27, 2026
Merged

vmendelev merged 19 commits into
mainfrom
task/speechlm-rl-main

Conversation

@vmendelev

@vmendelev vmendelev commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Enable native SpeechLM RL loading, selected refits and canonical HF export while preserving optional frozen CTC timestamp artifacts and model-declared parameter precision.

Collection: SpeechLM2.

Changelog

  • Accept Automodel FreezeConfig policies for the backbone (automodel_freeze_config) and perception (perception_freeze_config), applied before checkpoint loading and perception activation-checkpoint wrapping. torch_dtype sets trainable storage; FSDP2 mixed precision sets compute. An explicit backbone policy keeps MoE routers frozen unless selected. Frozen frontend and native MTP state are retained.
  • Register and freeze bundled CTC decoder/tokenizer state. Preserve its original storage and metadata through strict HF loading, native checkpoint resume and HF export.
  • Add strict native NeMo-RL checkpoint loading and validated partial perception refits, with optional bounded refit verification.
  • Extend the canonical exporter with checkpoint_format=nemo_rl, intrinsic-dtype preservation and atomic publication. Omit training-only freeze policies from exported configs. Write Nemotron-H layer types with their original names (mamba, attention) so exports load in serving runtimes on either side of the Transformers 5.15 rename. Add a helper that derives the export configuration from the original HF seed.
  • Preserve namespace co-imports and current Transformers config serialization; document the native RL workflow.

Usage

Prepare the export configuration from the original full HF seed:

python examples/speechlm2/prepare_rl_export_config.py \
  --seed /shared/models/speechlm-seed --output /shared/results/export-config.json

Then run the canonical converter in an eight-GPU allocation with the prepared environment:

python -m torch.distributed.run --standalone --nproc-per-node=8 \
  examples/speechlm2/to_hf.py \
  class_path=nemo.collections.speechlm2.models.SALMAutomodel \
  checkpoint_format=nemo_rl \
  ckpt_path=/shared/results/gspo/checkpoints/step_400/policy/weights/model \
  ckpt_config=/shared/results/export-config.json output_dir=/shared/results/export

Validation and GitHub Actions CI

  • CI assertion follow-up (5bc0c79e15): exact BF16 safetensors round trips with the test's assertion passed on CPU and CUDA; the original assertion reproduced the CPU/CUDA mismatch. pre-commit run and pre-commit run --from-ref origin/main --to-ref HEAD passed; git diff --check passed; all 19 published commits have author-matching DCO sign-offs. Local python -m pytest --cpu tests/collections/speechlm2/test_native_export.py -q could not run because the available environment lacks required dependencies (fails in pytest setup on missing hydra; Automodel is also absent). No documentation update is needed for this test-only assertion correction.
  • Focused CPU tests (pytest --cpu tests/collections/speechlm2): 48 passed for the FreezeConfig migration, plus the 5 export tests after the export fix. Branch pre-commit and diff checks passed.
  • Full nvidia/Nemotron-3.5-Transcribe-30B-A4B policy on 8 GPUs, one controlled update compared with the previous revision: identical initial parameters and response log-probabilities; the same 269 FP32 trainable tensors update; frozen parameters and CTC weights are unchanged; DCP save and reload is exact.
  • Canonical export: all 1,307 numeric tensors match the native checkpoint after the expected dtype conversions, and the 38 CTC entries are byte-identical to the seed.
  • 40-update GSPO run on four 8-GPU nodes with the companion RL recipe: canonical exports at steps 20 and 40 evaluated with FullHF WER 4.317% and 4.223% (seed 4.374%), with complete evaluation coverage.
  • Not a convergence run. Frozen CTC preservation does not establish unchanged timestamp accuracy after encoder updates.

Before your PR is "Ready for review"

  • Contributor guidelines and author-matching DCO signoffs.
  • Strict loading, precision, CTC, refit and export regression tests.
  • Updated SpeechLM training/export documentation.
  • Optional Automodel/vLLM components are affected; existing optional import boundaries are retained.

PR Type: New feature, bugfix, documentation.

Additional Information

Depends on the FreezeConfig exact parameter selectors merged in NVIDIA-NeMo/Automodel#4377; tests that need them skip on the currently pinned Automodel. The companion NeMo-RL recipe consumes these loading/refit/export APIs. No existing issue is closed.

Companion PRs

…-main-20261015

Signed-off-by: Valentin Mendelev <[email protected]>

# Conflicts:
#	nemo/collections/speechlm2/models/salm_automodel.py
#	nemo/collections/speechlm2/parts/hf_hub.py
@copy-pr-bot

copy-pr-bot Bot commented Oct 15, 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.

@vmendelev

Copy link
Copy Markdown
Collaborator Author

/ok to test 1a996c5

Set parameter_config on the bare SALMAutomodel used by the MTP tests, and
compare checkpoint round-trips against CPU copies of the source tensors,
since other speechlm2 modules make CUDA the default device on GPU runners.

Signed-off-by: Valentin Mendelev <[email protected]>
@vmendelev

Copy link
Copy Markdown
Collaborator Author

/ok to test a8165e7

@github-actions

Copy link
Copy Markdown
Contributor

[🤖]: Hi @vmendelev 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully.

So it might be time to merge this PR or get some approvals.

@vmendelev

Copy link
Copy Markdown
Collaborator Author

/ok to test 8a1b217

@pzelasko

Copy link
Copy Markdown
Collaborator

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review complete. Accounted for all 22 changed files, verified the five prior findings, and checked subsequent changes and directly affected paths.

The earlier findings are resolved:

No unresolved prior finding or new regression meeting the follow-up impact threshold was established. Updated tests and documentation were assessed within that scope.

Static inspection only: no tests, GPU jobs, or distributed export/refit runs were executed. Automodel internals were unavailable in the mounted trees; exact-selector tests explicitly skip on older Automodel versions.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

@pzelasko

Copy link
Copy Markdown
Collaborator

/ok to test b3567d0

@pzelasko
pzelasko enabled auto-merge (squash) October 26, 2026 22:16
pzelasko
pzelasko previously approved these changes Oct 26, 2026

Copy link
Copy Markdown
Collaborator

/ok to test 5bc0c79

@vmendelev
vmendelev enabled auto-merge (squash) October 27, 2026 18:27
@github-actions

Copy link
Copy Markdown
Contributor

[🤖]: Hi @vmendelev 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully.

So it might be time to merge this PR or get some approvals.

@vmendelev
vmendelev merged commit 9349a49 into main Oct 27, 2026
161 of 163 checks passed
@vmendelev
vmendelev deleted the task/speechlm-rl-main branch October 27, 2026 22:05

This branch was previously deployed

2 inactive deployments
public — 5bc0c79e Deployed Oct 27, 2026 by copy-pr-bot[bot] via release / finalize / notify #1814
test — 5bc0c79e Deployed Oct 27, 2026 by copy-pr-bot[bot] via cicd-wait-in-queue #21449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants