Skip to content

Add LibriSpeech-PC benchmark, asr_with_pc resource server, and audio sidechannel in vllm_model - #1144

Merged
gwarmstrong merged 16 commits into
NVIDIA-NeMo:mainfrom
gwarmstrong:georgea/migrate-gym-librispeech_pc
Apr 28, 2026
Merged

gwarmstrong merged 16 commits into
NVIDIA-NeMo:mainfrom
gwarmstrong:georgea/migrate-gym-librispeech_pc

Conversation

@gwarmstrong

Copy link
Copy Markdown
Contributor

Add LibriSpeech-PC benchmark, asr_with_pc resource server, and audio sidechannel in vllm_model

Adds the LibriSpeech-PC ASR benchmark, a
generic asr_with_pc resource server that scores Word Error Rate (full WER +
WER_C + WER_PC + PER for ASR-PC; standard WER only for plain ASR), and a
small audio sidechannel inside vllm_model so audio benchmarks can carry
audio data over the Responses API.

The Responses API content union (Union[ResponseInputTextParam, ResponseInputImageParam, ResponseInputFileParam]) has no audio variant —
ResponseInputAudioParam exists in the openai SDK as an orphan type but
isn't a member of any input union, so audio content blocks in
responses_create_params.input.content are rejected by simple_agent's
Pydantic validator before reaching the model. The sidechannel rides over
responses_create_params.metadata.audio_url (Dict[str, str], opaque to
the validator); vllm_model._preprocess_chat_completion_create_params
strips it and prepends an audio_url content block to the most recent user
message before forwarding to vLLM Chat Completions, which natively accepts
audio content. The splice short-circuits when no audio_url is present, so
non-audio benchmarks see no behavior change.

Includes

  • responses_api_models/vllm_model/ — audio sidechannel splice added to
    the existing vllm_model

    • Audio is placed BEFORE text in the content list (some audio models care)
    • Defensive cases: empty/None content lists, multi-turn user messages,
      no user message at all
  • resources_servers/asr_with_pc/ — generic ASR / ASR-PC scoring server,
    reusable across audio-WER benchmarks

    • task_type config dispatches per-row in verify() between ASR-PC
      (full WER + WER_C + WER_PC + PER) and ASR (Whisper-normalized
      standard WER only). Per-row override via the verify request body.
    • compute_metrics() aggregates non-uniformly: corpus-level
      jiwer.wer(refs, hyps) for the headline wer; mean-of-per-sample
      for wer_c, wer_pc, per
  • benchmarks/librispeech_pc/ — benchmark config + prepare script

    • Data source: OpenSLR-145 manifests + OpenSLR-12 audio. Default split
      is test-clean (~2,417 utterances).
    • prepare.py downloads + base64-encodes the audio, writes one row per
      utterance with responses_create_params.metadata.audio_url carrying
      the data-URI. responses_create_params.input is left empty —
      prompt_config materializes the system+user messages at rollout time
      from benchmarks/librispeech_pc/prompts/default.yaml.
    • Wires librispeech_pc_asr_with_pc_simple_agent →
      librispeech_pc_asr_with_pc_resources_server.

Validated

Qwen/Qwen2-Audio-7B-Instruct, 4 seeds × 2,417 utterances, T=1.0 /
top_p=0.95 / max_tokens=4096, on test-clean. Reference numbers come
from a parallel run that reads the same JSONLs but goes through a
different ASR scorer (one outside this PR); (sample_id, expected_answer)
pairs hash bit-identical between the two runs.

=================================================================================
asr_with_pc | 4 rollouts/task | T=1.0 | Qwen/Qwen2-Audio-7B-Instruct
=================================================================================
Metric                            Reference   Gym       Delta
-------------------------------------------------------------
wer (corpus)                      30.89%    30.42%      -0.47%
wer_c (sample-mean)               56.41%    54.09%      -2.32%
wer_pc (sample-mean)              65.41%    65.65%      +0.24%
per (sample-mean)                 52.42%    53.23%      +0.81%
pass@1[avg-of-4]/accuracy         53.67%    52.24%      -1.43%
pass@4/accuracy                   77.45%    77.37%      -0.08%
no_answer                         0.00%      0.00%      +0.00%

Implementation notes

  • Why fold the splice into vllm_model rather than a new model type.
    The audio sidechannel is ~30 lines and gates entirely on the presence
    of metadata.audio_url. Folding it into the existing vllm_model
    avoids a parallel vllm_audio_model directory while keeping the
    path-of-least-resistance for audio benchmarks.

  • Generic server name. asr_with_pc (not librispeech_pc) so future
    audio-WER benchmarks (asr-leaderboard, numb3rs, audiobench) can
    inherit from it. The task_type dispatch lets benchmarks that score
    standard WER only (asr-leaderboard) reuse the server without a fork.

gwarmstrong and others added 14 commits April 27, 2026 10:00
Migrates Skills' nemo_skills/dataset/librispeech-pc/ to Gym, with audio
base64-inlined into responses_create_params.input at prepare time
(circle_click pattern). Resource server lifts WER computation directly
from nemo_skills/evaluation/evaluator/audio.py::evaluate_asr_pc with
matching corpus-level aggregation in compute_metrics so headline numbers
align with Skills' AudioMetrics output.

Per-rollout: wer/wer_c/wer_pc/per/is_correct (wer_pc<0.5).
Corpus-level: corpus_wer{,_c,_pc}@k=N via jiwer.wer(refs, hyps).
Signed-off-by: gwarmstrong <[email protected]>
…sion with source

_inherit_from with the same source/destination name was self-referencing, so
the benchmark's resources_server reference 'librispeech_pc' couldn't be
resolved (only librispeech_pc_resources_server existed in the merged config).
Aime26 disambiguates by prefix; we use _bench_ since librispeech_pc the
server name and librispeech_pc the benchmark name would otherwise collide.

Signed-off-by: gwarmstrong <[email protected]>
BenchmarkDatasetConfig.prompt_config is Optional[Path] without a default,
so the field must be present in the YAML (allowed value: null). The audio
is already base64-baked into responses_create_params.input by prepare.py,
so rollout-time prompt materialization is a no-op.

Signed-off-by: gwarmstrong <[email protected]>
Skills' VLLMMultimodalModel.make_audio_content_block defaults to
audio_format='audio_url' for self-hosted vLLM. Match that exactly so the
content block byte-shape Gym sends to vLLM is identical to Skills'.

Signed-off-by: gwarmstrong <[email protected]>
Option A unblock for audio benchmarks: openai's Responses-API content
union has no audio variant, so audio content blocks in
responses_create_params.input.content are rejected by simple_agent's
Pydantic validator before reaching the model server. vllm_audio_model
sidesteps this at the model layer:

  - Audio data-URI rides on responses_create_params.metadata.audio_url
    (Dict[str, str], opaque to the agent validator)
  - vllm_audio_model._preprocess_chat_completion_create_params reads
    metadata.audio_url, strips it, and prepends an audio_url block to
    the most recent user message before forwarding to vLLM Chat Completions

Mirrors NeMo-Skills' VLLMMultimodalModel.content_text_to_list pattern.
prepare.py + example data generator updated to emit the sidechannel
shape. Once openai extends ResponseInputContentParam (or Gym adopts a
local extension — Option B), this wrapper can be deprecated.

Signed-off-by: gwarmstrong <[email protected]>
…gation

Two parity fixes for the Skills↔Gym comparison:

1) prepare.py defaults to test-clean only (Skills' EVAL_SPLIT). Test-other
   can be added via --splits, but the default JSONL now matches what
   Skills' ns eval librispeech-pc:N processes.

2) compute_metrics aggregates wer_c, wer_pc, and per as mean-of-per-sample
   (matching nemo_skills/evaluation/metrics/audio_metrics.py:311-318),
   while keeping standard wer corpus-level (matching the same file's
   line 301-303). Previously all four were corpus-level, which produced
   ~20pp deltas vs Skills on wer_c and wer_pc despite identical per-sample
   values. get_key_metrics now exposes wer/wer_c/wer_pc/per under the
   Skills-aligned headline names.

Signed-off-by: gwarmstrong <[email protected]>
Generated by ng_prepare_data (+mode=example_validation), ng_collect_rollouts,
and ng_reward_profile against the resource servers example.jsonl with
Qwen2-Audio-7B-Instruct on aws-iad. Mirrors the artifact set committed
under other Gym resource servers (e.g. circle_click).

Signed-off-by: George Armstrong <[email protected]>
The 'audio is base64-baked into responses_create_params.input' comment
was true before the Option A pivot but is no longer accurate (audio now
rides on metadata.audio_url, not in input.content). Remove rather than
update — per migrate-benchmark §B2, YAML configs should be terse and
let the README/skill carry the explanation.

Signed-off-by: gwarmstrong <[email protected]>
…per-split datasets

Three reusability/idiomaticity refactors landed together:

1. resources_servers/librispeech_pc -> resources_servers/asr_with_pc.
   The WER scoring infrastructure is generic across audio benchmarks
   (LibriSpeech-PC, asr-leaderboard, numb3rs, audiobench), so the server
   should name the verification method, not the benchmark — mirroring the
   math_with_judge / mcqa naming pattern. verify() now dispatches per-row
   on task_type (server-level default ASR-PC; ASR mode added for
   benchmarks that score standard WER only).

2. Built-in prompt_config. prepare.py emits raw rows without
   responses_create_params.input; benchmarks/librispeech_pc/prompts/default.yaml
   carries the system+user templates; prompt_config materializes them at
   rollout time. metadata.audio_url survives the materialization
   (apply_prompt_to_row preserves other responses_create_params fields)
   so vllm_audio_model still finds the audio sidechannel.

3. Per-split JSONLs. prepare.py writes
   librispeech_pc_test_clean.jsonl and librispeech_pc_test_other.jsonl
   separately. Benchmark config.yaml exposes two datasets entries
   (test_clean / test_other); ng_collect_rollouts +dataset_name=test_clean
   selects which split is used at rollout time.

Recipe scripts + READMEs + example_data generator all updated to match.
Tests: 25 -> 28 (added evaluate_asr + task_type dispatch coverage).

Signed-off-by: gwarmstrong <[email protected]>
…requires 1)

ng_prepare_benchmark asserts len(datasets) == 1 per agent. Reverted the
two-datasets-per-agent design from the previous commit. test_other
support is documented as a follow-up: either a sibling benchmark dir
(idiomatic, mirrors aime24/aime25/aime26) or a custom config pointing at
the librispeech_pc_test_other.jsonl that prepare.py --splits test-other
emits.

Signed-off-by: gwarmstrong <[email protected]>
…ename

Re-generated against the new responses_create_params.metadata.audio_url
sidechannel shape (the prior copies still referenced
resources_servers/librispeech_pc/data/...). Sub-1pp drift on the per-rollout
WER aggregates and reward_profiling pass rates, well within Qwen2-Audio T=1.0
sample-to-sample variance.

Signed-off-by: George Armstrong <[email protected]>
…lm_audio_model

Per upstream review feedback: a 30-line metadata-audio-url splice doesn't
need its own model type. Moved the splice (and its 6 unit tests) into
vllm_model._preprocess_chat_completion_create_params. The splice
short-circuits when responses_create_params.metadata.audio_url is absent,
so non-audio benchmarks see no behavior change.

Removed:
- responses_api_models/vllm_audio_model/ (the entire dir)

Updated:
- responses_api_models/vllm_model/app.py: splice logic appended to the
  existing _preprocess_chat_completion_create_params override path.
- responses_api_models/vllm_model/tests/test_app.py: added
  TestAudioSidechannelSplice with the 6 cases from vllm_audio_model.
- benchmarks/librispeech_pc/{config.yaml is unchanged} +
  recipe scripts + Gym-side READMEs all reference vllm_model directly.

Signed-off-by: gwarmstrong <[email protected]>
Drops editorial/explanatory references to the upstream source repo
(NeMo-Skills) and module paths from docstrings, comments, READMEs, and
the test file. Keeps the technical content: WER definitions, aggregation
rules, schema gotchas, and the metadata-sidechannel rationale all stand
on their own.

No functional change.

Signed-off-by: gwarmstrong <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Apr 28, 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.

bxyu-nvidia
bxyu-nvidia previously approved these changes Apr 28, 2026
Matches the convention used by the other api_key='dummy_key' lines in
this file (and across responses_api_models/) so detect-secrets stops
flagging the new audio-splice test fixture.

Signed-off-by: gwarmstrong <[email protected]>
@gwarmstrong
gwarmstrong enabled auto-merge (squash) April 28, 2026 00:43
@gwarmstrong
gwarmstrong merged commit 75175b0 into NVIDIA-NeMo:main Apr 28, 2026
6 checks passed
bxyu-nvidia pushed a commit that referenced this pull request May 8, 2026
## Summary

- Adds the HuggingFace Open ASR Leaderboard (8 ESB subsets:
librispeech-clean/other, voxpopuli, tedlium, gigaspeech, spgispeech,
earnings22, ami) as a data-only benchmark.
- Reuses the existing `asr_with_pc` resource server in `task_type=ASR`
mode (Whisper-normalized WER, added in #1144) — no new server logic.
- Audio is referenced via `responses_create_params.metadata.audio_path`
(#1170) so the multi-GB FLAC corpus stays on disk instead of being
inlined as base64 in every JSONL row.

## Why

ASR-Leaderboard is the standard cross-domain WER benchmark suite for
English ASR systems. Migrating it as data-only — no new server logic —
extends Gym's audio coverage with zero verification risk. Both the
prompt template (system + user messages) and the minimum-duration /
empty-reference filtering match the upstream NeMo-Skills implementation
exactly, so a data-only parity check (row count, `expected_answer`,
audio path) is sufficient.

## Files

- `benchmarks/asr_leaderboard/__init__.py`
- `benchmarks/asr_leaderboard/config.yaml` — chains to
`asr_with_pc.yaml` and pins `task_type: ASR`.
- `benchmarks/asr_leaderboard/prepare.py` — downloads
`hf-audio/esb-datasets-test-only-sorted`, saves FLACs to
`<work_dir>/<dataset>/<id>.flac`, writes the combined
`asr_leaderboard_benchmark.jsonl`.
- `benchmarks/asr_leaderboard/prompts/default.yaml` — `"You are a
helpful assistant. /no_think"` + `"Transcribe the following audio."`
- `benchmarks/asr_leaderboard/README.md`
- `benchmarks/asr_leaderboard/data/.gitignore`

## Test plan

- [x] Smoke-tested `_format_row` and `_audio_filename` on synthetic
dataset entries (empty-text skip, sub-0.1s skip, slash-in-id rewriting,
AMI-style `id/name.suffix` stem extraction).
- [ ] Skills-vs-Gym data-parity check (row count exact,
`expected_answer` 100% agreement, audio paths 100% agreement) — runs in
the migration recipe after merge once both prepare jobs have downloaded
the corpus.

---------

Signed-off-by: gwarmstrong <[email protected]>
Co-authored-by: gwarmstrong <[email protected]>
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.

2 participants