Skip to content

feat(research): add SpeechLM GSPO research project - #4748

Draft
vmendelev wants to merge 15 commits into
mainfrom
task/speechlm-gspo-main
Draft

vmendelev wants to merge 15 commits into
mainfrom
task/speechlm-gspo-main

Conversation

@vmendelev

@vmendelev vmendelev commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What and why

Adds research/speechlm_gspo, a research project for GSPO ASR training of native NeMo Speech SALM checkpoints (Nemotron 3.5 Transcribe 30B-A4B) with the Automodel policy and vLLM generation. It replaces this PR's earlier in-core recipe, following the split discussed above.

Rebased onto main after #5092 merged as 3a276d5aa (previous head 88ac6da1b). The rebuild follows main's changes: the per-sample cap is now extra_env_info["max_new_tokens_for_sample"], the recipe uses loss_fn.normalization: sequence_mean instead of the removed token_level_loss, and both environments are relocked, which brings the policy environment to main's nixl 1.5.2.

Design:

  • Uses only NeMo RL extension points: an AUTOMODEL_FACTORY entry for model_type: nemo_speechlm, AutoProcessor registration, register_processor/register_env for the asr data processor and reward, and worker_extension_cls_fqn for the policy and generation workers. No core changes; the core options it uses came in with feat(grpo): add full-group std, vLLM per-sample caps, placeholder prompt checks #5092.
  • The policy wrapper expands audio placeholders in forward and returns logits aligned to the text tokens. The audio placeholder id lies outside the vocabulary, so it gets a constant -inf logit column; generic logprob gathering then works without changing model parameters or real-token probabilities.
  • Policy and generation actors run in separately locked environments that pin Speech without touching the root lock:
  • Root changes are limited to the workspace member, a uv workspace exclude for the env directories, and listing the nightly test in tests/test_suites/disabled.txt (it needs an ASR audio Parquet that CI does not provide).
  • No NeMo Skills dependency. Mandarin CER is implemented in the project and matches Skills' evaluate_cer exactly on 3,122 reward pairs; MER uses Speech's mer_tokens.

Usage

cd research/speechlm_gspo
uv run --locked run_speechlm_gspo.py \
  --config configs/recipes/gspo-nemotron-3.5-transcribe-30b-a4b-4n8g-automodel-ep8.yaml

Data format, environment variables and the nightly test are described in research/speechlm_gspo/README.md.

Issues

Related: #5215 (nixl and Torch 2.14).

Convergence / perf / functionality proof

GPU run on 4 nodes × 8 GPUs with 500 ASCEND training examples, on an earlier stack: RL 1fb55b835, Speech 732041d29, vLLM 0.29. Checkpoints were selected on dev.

Metric Seed Step 60 Step 100
ASCEND test MER 19.357% 17.430% 16.454%
ASCEND dev MER 19.410% 18.750% 16.382%
LibriSpeech-clean WER 1.535% 1.482% 1.376%

Not yet rerun on the current stack (vLLM 0.33.0, Torch 2.14.0, Speech ab47d17de).

Local checks on the current head:

  • uv lock --check for the root and both environments, with uv 0.13.6 from docker/Dockerfile.
  • The recipe validates against current core (test_recipe.py), and tests/unit/test_recipes_and_test_suites.py passes.
  • pytest tests/unit in a policy environment without TransformerEngine's torch extension: 30 passed. test_model.py (6), test_alignment.py (5) and test_reward.py (19) pass on their own; in a combined run, one test each from the last two fails once another test has loaded TransformerEngine without its extension.
  • ruff 0.9.9 check and format.
  • At the previous head, whose generation lock resolves the same packages (only the lockfile format and a nemo-toolkit version string changed): in the generation environment, with the Speech plugin loaded, vLLM's has_nixl_ep() probe and import nixl_ep succeed.

Needs upstream changes

PR commands and CI
  • CI label, exactly one:
    • CI:Lfast: the default for most PRs. Runs a fast test subset.
    • CI:L1: dependency or container changes (pyproject.toml, uv.lock, Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.
    • CI:docs: docs-only changes. Runs doc tests only.
  • /ok to test <full-commit-sha>: start CI for that commit. Post again after each push.
  • /review: automated review comments. Add mode=strict for a stricter review, reset=true for a fresh full review.
  • /resolve-conflict: Autobot merges main into this PR and resolves the conflicts. PRs from forks must allow edits by maintainers.
  • Locally: /review-pr-team <pr-number> for a team review before you ask for human review.
  • Contributor guidelines

@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.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Oct 15, 2026
@vmendelev vmendelev added the CI:L2 Run doctests, unit tests, functional tests, and convergence tests label Oct 15, 2026
@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test 8515281

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test d7ae2d3

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test e2c6509

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test 8d48554

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test fae61a7

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test 711a05e

@terrykong terrykong left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vmendelev could you self review the PR(post it and show resolution) before someone reviews. it helps catch a lot of gotchas.

@sharonyu-115 could you help review this PR after self-review?

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test f6b8442

@vmendelev vmendelev left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This PR has merge conflicts with main. GitHub reports it as CONFLICTING. Please rebase on main and resolve the conflicts.

The native SpeechLM path is well contained. It has a thin SpeechLMPolicyWorker subclass, Speech imports that load lazily and only when native_model is set, setup-time guards for packing, TP and CP, an explicit contract on trainable names and tensor/scalar counts, and loud checks in response_logprobs that the native targets match the text response tokens. Thank you also for the WER trajectory and the reproduction table in the description and the guide.

  1. (C1) The two NeMo Speech test files have no automodel mark and never run in CI, so SpeechLMPolicy has no test coverage. A follow-up issue is needed for a CI lane that installs NeMo Speech.
  2. (C2) full_group_std is accepted for every estimator but only GRPO reads it. Add a validator that rejects it for other estimators.
  3. (C3) asr_environment.py is missing from pyrefly's project-includes, so it is never type-checked.
  4. (C4) output_limits.py has a 2025 copyright header. New files must use 2026.
  5. (C5) Low priority: the "import cycle" comment in speechlm.py is wrong, and SpeechLMNativeConfig is imported three times.

Scope: this review only read the code. No tests, linters or pyrefly ran in the review environment, which had no uv, torch or NeMo Speech. All findings come from reading the code.

This review was produced by 7 agents: rl-expert, bug-finder, test-agent, design-reviewer, comment-reviewer, devil-advocate and comment-editor.

Generated by Claude Code

Comment thread pyrefly.toml Resolved
Comment thread nemo_rl/models/automodel/speechlm.py Resolved
@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test 7b11771

@vmendelev

Copy link
Copy Markdown
Contributor Author

Self-review posted above; all five findings are fixed in 7b11771 and their threads are resolved. main is merged in, and the PR has no conflicts. @sharonyu-115 it's ready for your review, thanks!

@sharonyu-115

Copy link
Copy Markdown
Contributor

Hi @yuekaizhang, asking for your review as well since you have the speech background. Thanks!

@yuekaizhang

Copy link
Copy Markdown
Contributor

Nice job! Before a more detailed review, two high-level asks:

  1. Reproducible results on a public dataset. Could you provide a result that users can verify or reproduce on a public dataset — e.g., train on LibriSpeech and report the WER improvement before vs. after GSPO? The current evidence (internal 20k-recording dataset, internal FullHF/ML7/SOT/Monsoon evaluation manifests) can't be independently reproduced. A public-data result would also let us add a nightly test based on it, so the recipe doesn't silently break as NeMo RL evolves.

  2. Seed model accessibility. nvidia/Nemotron-3.5-Transcribe-30B-A4B currently isn't accessible on the Hub (anonymous requests return 401, same as a nonexistent repo). If it will be open-sourced later, that's fine — otherwise we may need to consider a model that users can actually access for this recipe.

@vmendelev

Copy link
Copy Markdown
Contributor Author

Thanks @yuekaizhang, both points make sense.

  1. Public, reproducible result: we've published an RL fine-tuning skill with example results on the public ASCEND dataset: Add audio RL fine-tuning skill and ASCEND example Speech#16480.
  2. Seed model: the seed model is now public on Hugging Face.

@vmendelev
vmendelev force-pushed the task/speechlm-gspo-main branch from 7b11771 to e40dc74 Compare October 31, 2026 13:00
@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test e40dc74

@yuekaizhang

Copy link
Copy Markdown
Contributor

Thanks for the updates — the seed model is public now and the ASCEND example is a good step.

I'd like to raise a structural question and get opinions from @yuki-97 @terrykong as well as @vmendelev:

Would this contribution fit better under research/? My reasoning:

  • This model architecture is natively supported by neither Automodel nor vLLM. Both the training path and the rollout path depend on bridge code living in the NeMo-Speech repo (SALMAutomodel on top of the Automodel backend for training, and the nemo_speechlm vLLM plugin for generation), plus the adapter layer in this PR.
  • Version management: the recipe requires unpinned main source checkouts of Speech/Automodel/Skills that contain specific companion PRs, and core CI doesn't install any of them — so a future upgrade of those repos (or of vLLM) could silently break this recipe without anything catching it. A self-contained research project with its own pyproject.toml pinning the validated commits would make the compatibility contract explicit. If this stays in core, how do you see maintenance working across future version upgrades?

Separately, @vmendelev:

  1. Like research/flow_grpo#results, could you provide a recipe that users can actually run and reproduce (public data, documented results), plus a nightly test based on it so the recipe doesn't rot as NeMo RL evolves?
  2. The ASCEND example currently lives as a skill in the Speech repo and depends on MER support that isn't part of this PR — could it be converted into a working recipe config YAML here?

To be clear, the generic improvements in this PR (full-group std estimator, per-row output limits, rollout prompt validation, the shared vLLM fixes) look like good core contributions regardless — a possible split is landing those in core while the SpeechLM-specific integration moves to research/.

@vmendelev

Copy link
Copy Markdown
Contributor Author

Thanks @yuekaizhang, agreed on the split. The plan:

  1. Core: the generic pieces (full-group std estimator, per-row output limits, rollout prompt validation, shared vLLM fixes) go into a separate core PR. I'll link it here.
  2. research/: the Transcribe-specific integration moves into a research project. It gets its own pyproject.toml pinning the validated Speech commit, a recipe reproducible on public data with documented results, and a nightly test.

One question before I restructure, also for @yuki-97 and @terrykong: which Automodel version should the research project use?

  • The recipe needs FreezeConfig.freeze_parameters / unfreeze_parameters from feat(freezing): select exact parameters with FreezeConfig Automodel#4377, merged to Automodel main on Oct 23.
  • Core pins Automodel through the 3rdparty/Automodel-workspace/Automodel submodule at b916107a5 (r0.6.0), which has no FreezeConfig at all. r0.7.0 has FreezeConfig but not these two fields, so no Automodel release branch includes them yet.
  • Research projects share the root uv.lock, and nemo-automodel resolves from the core submodule path. As far as I can tell, a research project can't pin a newer Automodel on its own.

Which path do you prefer?

  • (a) Wait for core to bump Automodel to a commit or release that includes Automodel#4377. Is a bump planned, and roughly when?
  • (b) Is there a supported way for a research project to pin its own Automodel commit?
  • (c) Something else?

@vmendelev

Copy link
Copy Markdown
Contributor Author

Update on the split:

  1. Core PR: feat(grpo): add full-group std, vLLM per-sample caps, placeholder prompt checks #5092 contains the generic pieces: full-group std estimator, per-sample vLLM output caps, placeholder-aware rollout prompt validation, and the shared vLLM fixes. All are opt-in, and the defaults keep current behavior.

  2. Correction to my Automodel question above. I wrote that a research project can't pin its own Automodel. That's wrong. A research project can't do it inside the shared root uv.lock, but it can own a separate locked environment for its actors:

    • A nested uv project, for example research/<project>/envs/policy/, that is not a workspace member and has its own uv.lock.
    • That lock pins Automodel at a commit with feat(freezing): select exact parameters with FreezeConfig Automodel#4377 and pins Speech at a commit. It lifts nemo-rl's transformers cap with [tool.uv] override-dependencies, which only applies inside that lock.
    • The research worker classes point at it through ACTOR_ENVIRONMENT_REGISTRY (uv run --locked --directory ...), the same way research/flow_grpo selects its worker environment.
    • Core's pyproject.toml and uv.lock stay unchanged, so no Automodel or transformers bump is needed for this recipe.

    I checked the uv mechanics on a toy workspace (uv 0.13.7): the nested project locks and runs with the overridden version, the root lock is unaffected, and no workspace exclude entry is needed.

    The trade-offs:

    • The research project maintains its own lockfile.
    • Core CI doesn't exercise core's Automodel worker code against that Automodel/transformers combination, so breakage there is the research project's responsibility.
    • It departs from the README's "share the root lock" guidance.

    @yuekaizhang @yuki-97 @terrykong, is this acceptable for this project? If not, I'll fall back to waiting for a core Automodel bump.

  3. Research project: I'm building it on existing core extension points:

    • policy.worker_extension_cls_fqn for the SpeechLM policy worker
    • register_env / register_processor for the ASR environment and data
    • AUTOMODEL_FACTORY registration for the model class
    • Speech's vllm.general_plugins entry point for generation

    The speech-specific branches currently in core files would then go away. Where a generic hook is unavoidable, for example model-provided logprobs (the model expands the audio placeholder inside its forward, so its logits don't line up with input_ids), it will go in a small separate core PR with toy-model tests. Once the research project runs end to end, I'll restructure this PR into it.

@terrykong terrykong removed the CI:L2 Run doctests, unit tests, functional tests, and convergence tests label Nov 5, 2026
@vmendelev

Copy link
Copy Markdown
Contributor Author

Restructured as planned above: this PR now adds the research project research/speechlm_gspo with its own locked policy/generation environments, stacked on #5092. The previous in-core recipe is kept at task/speechlm-gspo-main-old. The description has the design, prerequisites (#5092, NVIDIA-NeMo/Speech#16588) and GPU validation. It stays a draft until those merge. @yuekaizhang @terrykong

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test 99e288f

@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test 88ac6da

@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026
Base automatically changed from task/grpo-full-group-std-vllm-fixes to main December 1, 2026 05:32
Train native NeMo Speech SALM checkpoints with GSPO ASR rewards through
NeMo RL extension points: an AUTOMODEL_FACTORY model returning text-aligned
logits, AutoProcessor registration, registered ASR data and reward
environment, and worker extensions running in separately locked policy and
generation environments.

Relocking the root workspace also collapses the duplicate boto3/botocore
resolutions to one version.

Signed-off-by: Valentin Mendelev <[email protected]>
Speech 732041d29 (NVIDIA-NeMo/Speech#16588) adds vLLM 0.29's multimodal
processor hook and keeps refit vocabulary padding on the weight's device.
Both environments use the same Speech commit; the lock changes are limited
to nemo-toolkit.

Signed-off-by: Valentin Mendelev <[email protected]>
Mandarin ordinary_asr rewards now compute the han_adjacent CER locally:
Whisper English normalization, whitespace next to Han characters removed,
and a character edit distance. Rewards equal NeMo Skills 5ea1990a's
evaluate_cer exactly on 3,122 pairs, including 784 ASCEND
reference/prediction pairs. The policy lock drops nemo-skills, jiwer and
rapidfuzz.

Signed-off-by: Valentin Mendelev <[email protected]>
Speech main now carries the vLLM 0.33 plugin fixes (#16505, #16666, #16667). nixl 1.5.2 replaces 1.3.0, whose nixl_ep fails to load with Torch 2.14 once the Speech plugin has loaded (#5215). The relock also follows core's current pins (ai-dynamo 1.8, nccl-extensions 0.1.0).

Signed-off-by: Valentin Mendelev <[email protected]>
@vmendelev
vmendelev force-pushed the task/speechlm-gspo-main branch from 88ac6da to 292672f Compare December 2, 2026 18:01
@vmendelev

Copy link
Copy Markdown
Contributor Author

/ok to test 292672f

@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify) labels Dec 2, 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 complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:high Likely to change training results. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:perf Needs performance proof. Set by Autobot PR classify (skills/pr-classify)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants