Skip to content

feat(contextual_earnings22): add the contextual Earnings-22 benchmark - #6789

Open
pzelasko wants to merge 4 commits into
NVIDIA-NeMo:mainfrom
pzelasko:pr/bench-contextual_earnings22
Open

pzelasko wants to merge 4 commits into
NVIDIA-NeMo:mainfrom
pzelasko:pr/bench-contextual_earnings22

Conversation

@pzelasko

@pzelasko pzelasko commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the contextual_earnings22 benchmark: transcription of the 772 test segments of Contextual Earnings-22 (15-second windows of earnings calls) with no keyword context, with the clip's own keyword list, or with the keyword list of the whole call. It is scored by the audio_eval server (merged in #6249) for corpus WER and keyword precision, recall and F1; the evaluator and metrics modules are two new files that the server finds by name.

Why. Keyword prompting is a common way to bias a speech model toward rare names and terms, and a plain WER hides whether the keywords were actually recovered. This public dataset measures both, in three prompt conditions over the same audio. It is one benchmark per PR in a series of speech and audio benchmarks that reuse the audio_eval server and its profile format.

Related issue: none; a new benchmark.

What changed

  • benchmarks/contextual_earnings22/: config.yaml (agent and environment server wiring), manifest.yaml (domain: asr, licensing: CC-BY-SA-4.0, experimental), profiles.json (three profiles: contextless, local, global), prepare.py, README.md, data/.gitignore.
  • resources_servers/audio_eval/_scoring/evaluation/evaluator/contextual_earnings22.py and metrics/contextual_earnings22_metrics.py: the evaluator (WER with edit-distance alignment, keyword true/false positives and false negatives, basic or open_asr normalization) and its corpus-level metrics. Both are found by name from the profile (++eval_type=contextual_earnings22, METRICS_TYPE: contextual_earnings22); no registry is edited. They are adapted from NeMo Skills (see Provenance).
  • Tests: tests/unit_tests/benchmarks/test_contextual_earnings22_benchmark.py (declaration, profile contract through the server's own lookup, row building per mode, audio checks, prepare() against a synthetic parquet file, offline) and resources_servers/audio_eval/tests/test_scoring_contextual_earnings22.py (alignment, keyword counts, normalization modes, corpus metrics with hand-counted rows).
  • ATTRIBUTIONS.md: one row for the adapted NeMo Skills evaluator and metrics.
  • The README table row and the fern benchmarks bullet will be added by a follow-up docs PR, to avoid conflicting edits between parallel benchmark PRs.

Preparation. prepare() downloads the pinned argmaxinc/contextual-earnings22 test parquet file (357 MB), checks its SHA-256 and its row count (772), and writes each clip as 16 kHz mono 16-bit WAV (about 0.37 GB). It writes three rows per clip by default (2,316 rows); modes narrows the set, and max_samples_per_profile must be a positive integer (booleans, floats, strings, 0 and negative values are rejected before the dataset is read; a capped smoke run still downloads the whole parquet file).

Scoring. Text is normalized with the Open ASR English normalizer (normalization_mode=open_asr, from resources_servers/asr_with_pc) applied to the hypothesis, the cased reference and the keywords. A keyword is a true positive only when its reference occurrence aligns, by minimum edit distance, to identical, contiguous hypothesis tokens. The primary metrics score the original model output: the profiles do not enable generation-loop cleanup, so a repeated word counts as insertions (reference profit rose against profit x20 followed by rose is 19 insertions, 950% WER; a regression test pins it). Auxiliary scores on loop-cleaned text come with the generic audio_eval server option that scores the cleaned text through the same evaluator and publishes it as a separate group; it is enabled per profile with a one-line change once that option lands. Keyword precision, recall and F1 are scored against the clip's own keyword dictionary in every condition (contextless, local and global); the global condition only prompts the model with the call-level list, so a distractor that the model writes is not a false positive. Keyword spellings that normalize to the same tokens (GWENT and Gwent in a call-wide list) are one keyword. An unknown normalization_mode is rejected when the evaluator is constructed.

Relation to the reference implementation. Scoring follows the OpenBench reference implementation (https://github.com/argmaxinc/OpenBench, benchmark earnings22-keywords; keyword precision, recall and F-score in src/openbench/metric/keyword_boosting_metrics/boosting_metrics.py, the keyword list per clip in src/openbench/runner/benchmark.py): keywords are scored against the clip's own list (the dataset dictionary column) in every condition, and the global condition only prompts with the call-level list, including distractors. The context definitions are those of the paper (arXiv:2604.07354). What still differs from OpenBench: this port uses the Open ASR normalizer rather than OpenBench's Whisper normalizers, and its own Levenshtein-based occurrence matching rather than texterrors alignment and windowed n-grams; the pooled-over-corpus aggregation matches. These differences can shift the numbers slightly, and the scores have not been compared with the numbers Argmax published.

Metrics (audio/<profile>/pass@1/*, and per call under audio/<profile>-<call_id>/pass@1/*, where the call is the released file_id without its _chunkNN suffix; the full file_id stays in every row for clip provenance): wer, keyword_precision, keyword_recall, keyword_f1 (percent; a keyword metric is absent when its denominator is zero), success_rate (share of clips with WER below 50%), num_entries, avg_tokens, gen_seconds and no_answer. no_answer is the true share (%) of empty generations (the base counter adds an empty answer to pass@1 once and the value is published as is, with no scaling). A test asserts that the README lists the metric keys that get_metrics() returns. Only one generation per clip is supported (max_k other than 1 raises).

Validation

All run on this branch, on top of upstream/main at 242a9b0137:

  • tests/unit_tests/benchmarks/test_contextual_earnings22_benchmark.py in the core environment without setuptools (as in CI), in a container with a working .git: 14 passed. tests/unit_tests/test_public_api_facades.py (tests import each name from the module that defines it): 1034 passed. tests/unit_tests/benchmarks/test_prepare_hydra_arguments.py (every benchmark's offline prepare() tests with Hydra-typed arguments): 4 passed.
  • Wider core suites, tests/unit_tests/benchmarks, tests/unit_tests/environment, tests/unit_tests/tooling and tests/unit_tests/test_public_api_facades.py, in the container with .git: 4085 passed, 12 skipped, 1 failed (test_environment_validation.py::test_resolve_config_servers_logs_unresolvable_configs[recursive_alias-ConfigError]: a RecursionError from the installed OmegaConf where the test expects ConfigError; it uses a synthetic config, touches nothing of this PR, and comes from the local test environment).
  • gym env test --resources-server audio_eval: 221 passed (the cases of this PR are in test_scoring_contextual_earnings22.py: a prompted word outside the clip dictionary is not a false positive, repeated words as insertions, empty reference and hypothesis, mixed-group aggregation, normalized duplicate keywords, and the README metric-key contract; the open_asr cases run there because the server environment has the normalizer's dependency).
  • gym env validate and a capped real gym eval prepare plus gym env publish were run on the earlier revision (6 rows, 4 verifier cases); this revision does not touch config.yaml or the manifest, and its preparation changes (call grouping, the clip-level keyword list in every condition, cap validation, preparation schema version 4) are covered by the offline prepare() tests against a synthetic parquet file. They were not repeated against the 357 MB real download.
  • gym eval prepare --benchmark contextual_earnings22 +prepare_script_args.max_samples_per_profile=2 against the real dataset (6 rows, 2 clips, audio written and checked), then gym env publish contextual_earnings22 --kind benchmark: succeeded, 4 verifier cases.
  • Mutation checks. Seven deliberate breaks of this revision each make at least one test fail: loop cleanup re-enabled in the profile, global distractors added to the scored keyword list again (the benchmark tests fail), the chunk suffix kept in the metric group, the row cap accepting booleans, the row cap accepting floats, normalized duplicate keywords counted twice, and an empty reference raising. The ten breaks of the earlier revision (open_asr scoring against the uncased reference, non-contiguous alignment accepted, precision denominator, row cap unvalidated, local prompt listing global keywords, parquet hash skipped, unknown normalization mode accepted, basic normalization in the profiles, false positives not counted) are still caught. Files were restored afterwards.
  • True no_answer share. After the change that reports the share as is (no division), re-run: the benchmark test file, test_public_api_facades.py and test_prepare_hydra_arguments.py in the container with .git: 1053 passed; test_scoring_contextual_earnings22.py in the server environment: 18 passed. Mutation: restoring the division makes test_no_answer_is_the_empty_share (one empty of two generations must give 50.0) fail; the file was restored afterwards.
  • Local ruff check and ruff format --check on the changed files, scoped pre-commit run --files ... (ruff, ruff-format, end of files, trailing whitespace, guardwords): passed. The repository's detect-secrets step (repository baseline) on the changed files: exit 0.

Rollouts

What ran

  • Re-scoring after review. The 300 rollouts below were generated by an earlier revision of this PR. Their saved model outputs (the unmodified text; loop cleanup is applied only at scoring time) were re-scored offline with the scorer in this revision: original output, no loop cleanup, keywords scored against the clip's own dictionary in every condition. Generation was not repeated. The re-score reproduces the table the run originally produced exactly (the de-duplication of normalized-identical keywords and the offline re-score change no value at this size), and no output of these 300 triggers the cleanup.
  • Model: the public Nemotron-3.5-Transcribe BF16 checkpoint (nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B), served with
    vLLM 0.32.0 and the NeMo-Speech vLLM plugin on one H100 (the model-card stack, MTP speculative decoding with 2 tokens).
  • Data: the first 100 clips of each of the three contexts (--max-samples-per-profile 100), 300 requests: contextless (a plain
    transcription prompt), local (the prompt lists the keywords of that clip) and global (the prompt lists the call-wide keyword list,
    some of which are not in the clip). Request settings: greedy, thinking off, a 256-token limit.
  • Path: the standard Gym path: gym eval prepare, gym env start (the audio_eval environment with this benchmark's profiles) and
    gym eval run --no-serve --agent contextual_earnings22_simple_agent.

Run health

  • 300 of 300 rollouts completed and were scored: coverage complete: true, 0 masked, 0 failed, 0 request errors. All responses have
    status completed; none is empty and none reached the token limit (45 output tokens on average, 76 at most). no_answer is 0.0
    in every context.

Metrics (audio/contextual-earnings22.<context>/pass@1/*, 100 entries each)

Context wer keyword_recall keyword_precision keyword_f1 success_rate
contextless 13.99 54.29 93.14 68.59 98.0
global 11.63 86.86 93.83 90.21 99.0
local 10.77 95.43 95.43 95.43 99.0

Re-scored offline from the saved outputs. Per-call values (one group per call) are published as well: with the parent-call grouping the 100 clips of each context fall into 32 calls (the earlier revision emitted 100 per-clip groups).

success_rate is the share of clips with WER below 50%.

What the rollouts show

  • The order of recall and WER is the expected one: keyword recall is lowest without context (54.3), higher with the call-wide list (86.9) and highest
    with the clip's own keywords (95.4), and WER falls in the same order (13.99, 11.63, 10.77). Precision stays near 93 to 95 in all three, so the keywords in the prompt are used when present; keywords are scored against the clip's own dictionary, so distractors that the model might write are not counted.
  • Outputs are transcripts of the right kind (cased, punctuated sentences), and the effect of context is visible in single clips: for
    the reference trip com group s ... the local output writes Trip.com group's, while without context the same kind of
    name is spelled by ear (mmtblack in the reference, MMT Black in a contextless output).
  • Numbers are written as words (seventy two thousand for the reference's digits): the scorer's open-ASR normalization maps the two forms
    to the same string, as the benchmark README states.

Limitations

  • The first 100 clips of each context: a smoke result, not comparable to the full benchmark.
  • Whether the three contexts use the same 100 clips was not checked, so the comparison between contexts is between three 100-clip
    selections.
  • success_rate (share of clips with WER below 50%) saturates at 98 to 99 and carries little information at this size.

Commands (generic form)

gym eval prepare --config benchmarks/contextual_earnings22/config.yaml +prepare_script_args.max_samples_per_profile=100
gym env start --config benchmarks/contextual_earnings22/config.yaml \
    --config responses_api_models/vllm_model/configs/vllm_model.yaml --model-type vllm_model \
    --model nvidia/NVIDIA-Nemotron-3.5-Transcribe-30B-A4B --model-url http://<host>:<port>/v1
gym eval run --no-serve --agent contextual_earnings22_simple_agent \
    --input benchmarks/contextual_earnings22/data/contextual_earnings22_benchmark.jsonl --output rollouts.jsonl --concurrency 32

Compatibility and benchmark impact

A new benchmark only: no existing server, benchmark or schema changes behavior. The manifest declares domain: asr (added in #6246). Metric keys are new (audio/contextual-earnings22.<mode>/...). The root pyproject.toml, uv.lock files, .github/ and the root README.md are not touched; the benchmark's dependencies (soundfile for preparation, plus what the server already locks) need no lock change.

Provenance of vendored/adapted code

The evaluator and metrics are adapted from NeMo Skills; the modifications are listed in each file header and in ATTRIBUTIONS.md. prepare.py is written for this repository. The dataset is read at a pinned revision and not copied into the repository.

Source Revision License Use
NVIDIA-NeMo/Skills nemo_skills/evaluation/evaluator/contextual_earnings22.py and nemo_skills/evaluation/metrics/contextual_earnings22_metrics.py da85a881d972e6fec847b90cf553a0bf9bf10638 Apache-2.0 Adapted into the two scorer modules; modifications: scorer-package imports, dataclass instead of nested_dataclass, the open_asr normalization mode, early validation of the mode, keywords that normalize alike scored once, console-display methods removed
argmaxinc/contextual-earnings22 test split 59d7f94771cc197984d8038e494c83abeff87282 CC-BY-SA-4.0 (the dataset card has no license field and says the license is that of Earnings-22, which Rev publishes under CC BY-SA 4.0; the paper, arXiv:2604.07354, is under CC BY-SA 4.0) Audio, references and keyword lists, downloaded by prepare()

Checklist

  • Contributing guidelines read.
  • Focused change: one benchmark, its two scorer modules, tests and one attribution row.
  • Tests added and passing (core and server suites; mutation checks listed above).
  • Documentation added (benchmark README; the README table row and fern bullet follow in a docs PR).
  • Local lint, format, pre-commit and secrets checks pass; copyright-check and the remote guardwords-check are left to CI (the local guardwords hook passed).
  • New source files carry the SPDX header.
  • DCO sign-off on the commit.

🤖 Generated with Claude Code

Adds benchmarks/contextual_earnings22: transcription of the 772 Contextual Earnings-22 test segments with no, local or global keyword context (pinned dataset revision), scored by the audio_eval server for corpus WER and keyword precision, recall and F1 (evaluator and metrics modules adapted from NeMo Skills, discovered by name), with the attribution row.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 25, 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.

],
"expected_answer": sample["norm_text"],
"expected_answer_cased": sample["text"],
"keyword_list": local_keywords,

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.

In global mode the model sees the full call vocabulary, but the scorer only checks the local list for false positives. On 4469291_chunk82, appending the globally prompted, unspoken name Katerina leaves precision at 100%. Including it in the candidate vocabulary gives four true positives and one false positive (80%). Could we score global distractors as well and add this case to the tests? Benchmark keyword-precision definition

"keyword_list": local_keywords,
"local_keywords": local_keywords,
"global_keywords": global_keywords,
"subset_for_metrics": sample["file_id"],

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.

The released file_id includes the _chunkNN suffix. The first 100 rows have 100 distinct file_id values but come from 32 calls, so the documented per-call metrics are emitted per chunk. Could we use the parent call ID for subset_for_metrics and keep the full ID for clip provenance?

if "correct" in agg_metrics:
agg_metrics["success_rate"] = agg_metrics["correct"]
if "no_answer" in agg_metrics:
# The base metrics double-count empty answers; halve as the other audio_eval metrics do.

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.

BaseMetrics increments pass@1 once for an empty answer, and the majority path starts at k=2. This division implements the documented legacy half-rate. Could we correct the comment so future changes to the base counter don’t accidentally change this metric?

…tors and per-call groups

- Profiles no longer enable loop cleanup: the primary WER and keyword metrics score the original
  model output, so repeated words count as insertions (regression: `profit rose` vs `profit` x20
  + `rose` is 19 insertions, 950%).
- In global mode the scored keyword vocabulary includes the prompted call-wide keywords, so a
  prompted but unspoken name written by the model is a false positive; keywords that normalize to
  the same tokens are scored once.
- `subset_for_metrics` is the parent call (the `_chunkNN` suffix is dropped); the full `file_id`
  stays in each row. Preparation schema version 3.
- `max_samples_per_profile` accepts only positive integers (not bool, float, str, 0, negatives),
  validated before any dataset access.
- Describe `no_answer` as the legacy half-rate scaling convention; README lists the metric keys
  that `get_metrics()` returns, asserted by a test. Empty references and hypotheses are tested.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:high Autobot PR risk: high feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers benchmark-onboarding Self-contained benchmark onboarding needs-review PR is ready for code review and waiting on a reviewer labels Nov 30, 2026
pzelasko and others added 2 commits November 30, 2026 09:03
…ent the global scoring rule

Drop the half-rate division of no_answer; the published value is the share
(%) of empty generations. State in the README that the global-mode keyword
rule is this port's interpretation of the paper (arXiv 2604.07354), that the
paper's code was not public, and that the aggregation and normalizer are the
port's own.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
…t in every condition

Follow the OpenBench reference implementation (argmaxinc/OpenBench, earnings22-keywords):
keyword precision, recall and F1 are scored against the clip's own dictionary in the
contextless, local and global conditions; the global condition only prompts the model with
the call-level list, so distractors it writes are not false positives. Remove
candidate_keywords, bump the preparation schema version to 4 so stale prepared data is not
reused, and state in the README what still differs from OpenBench.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Piotr Żelasko <pzelasko@nvidia.com>
@pzelasko

Copy link
Copy Markdown
Contributor Author

Update on keyword scoring: this PR now follows Argmax's OpenBench implementation of Contextual Earnings-22 (earnings22-keywords) as the reference.

What changed (head d23dc02):

  • Keyword precision, recall and F-score are scored against the clip's own keyword list in every condition (contextless, local and global), as in OpenBench (src/openbench/metric/keyword_boosting_metrics/boosting_metrics.py, and src/openbench/runner/benchmark.py, where the scored list is the dataset's metric-keywords column if present and the clip's dictionary otherwise).
  • The global condition still prompts the model with the call-level keyword list, distractors included. Distractors the model writes are not counted as false positives in scoring. This reverts the earlier change that widened the scored vocabulary to the prompted list.
  • The saved 300-rollout run was re-scored offline with this rule: global recall 86.86 / precision 93.83 / F1 90.21, local 95.43 / 95.43 / 95.43, contextless 54.29 / 93.14 / 68.59.

What still differs from OpenBench (also stated in the README): we use the Open ASR normalizer and our own Levenshtein-based occurrence matching instead of OpenBench's Whisper normalizers, texterrors alignment and windowed n-grams. Aggregation is pooled in both. These can shift numbers slightly, and scores have not been compared with Argmax's published numbers. The OpenBench file-keywords (global) configuration could not be verified from its repository, so the global prompt follows the paper's definition (call-level keyword inventory).

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

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers benchmark-onboarding Self-contained benchmark onboarding feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants