Skip to content

Populate ys_probs in the online NeMo transducer greedy search decoders - #3893

Merged
csukuangfj merged 1 commit into
k2-fsa:masterfrom
josephomills:online-nemo-ys-probs
Aug 31, 2026
Merged

csukuangfj merged 1 commit into
k2-fsa:masterfrom
josephomills:online-nemo-ys-probs

Conversation

@josephomills

@josephomills josephomills commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3181

What this PR does

The online NeMo transducer greedy search decoder never fills ys_probs, so streaming NeMo results always report "ys_probs": [] and applications cannot access per-token confidence. The offline path was fixed in #3105; this applies the same approach to the online decoders:

  • after the argmax, apply LogSoftmax to the joiner output and push the selected token's log-probability alongside the token (only when a non-blank is emitted, so ys_probs.size() == tokens.size()).

LogSoftmax runs after the token has been selected, so decoding output is unchanged.

The same gap existed in the parakeet-unified online decoder; it gets the identical fix. The multilingual language-tag filter (FilterLanguageTags in online-recognizer-transducer-nemo-impl.h) already filters ys_probs index-aligned with tokens whenever the sizes match, so tag-filtered results stay aligned with no further changes.

Downstream context: FreeShow, an open-source church presentation app with an AI scripture feature under review (ChurchApps/FreeShow#3579), runs streaming Nemotron via sherpa-onnx-node and uses these per-token log-probs for confidence gating on live transcripts.

Changes

Verification output

Streaming Nemotron 3.5 1120 ms int8 on macOS arm64, greedy_search, exercised through the node addon:

tokens: 48, ys_probs: 48        (lengths match; was ys_probs: 0 before)
all <= 0: true
min: -0.6439, max: -0.0001, mean: -0.1096
text unchanged vs pre-patch baseline: true
sample token/logprob pairs:
  " A"   -0.1219
  "ft"   -0.0010
  "er"   -0.1261

Notes

  • Backward compatible: ys_probs already exists in the result struct and JSON — it just goes from always-empty to populated for these decoders.
  • No temperature scaling, matching feat: Add ys_log_probs to NeMo transducer greedy search decoder #3105 (these decoders take no temperature_scale, unlike the standard online greedy decoder).
  • ./scripts/check_style_cpplint.sh 1 passes. Built with the test-nodejs-addon-api.yaml cmake flags. The related CI workflows do not run on pull requests; verification above is local.

Summary by CodeRabbit

  • Enhancements
    • Added log-probability scores for tokens emitted during online speech recognition.
    • Improved decoding output by associating each recognized token with its confidence-related score.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 24, 2026
@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 16c22147-aebd-4120-82b5-fdc4ad1c1faa

📥 Commits

Reviewing files that changed from the base of the PR and between d33f87c and 0927f7e.

📒 Files selected for processing (2)
  • sherpa-onnx/csrc/online-transducer-greedy-search-nemo-decoder.cc
  • sherpa-onnx/csrc/online-transducer-greedy-search-nemo-parakeet-unified-decoder.cc

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Online NeMo greedy decoders now apply LogSoftmax to joiner logits and store the selected non-blank token's log probability in ys_probs.

Changes

NeMo decoder probability recording

Layer / File(s) Summary
Record emitted-token log probabilities
sherpa-onnx/csrc/online-transducer-greedy-search-nemo-decoder.cc, sherpa-onnx/csrc/online-transducer-greedy-search-nemo-parakeet-unified-decoder.cc
Both DecodeOne implementations apply LogSoftmax to joiner logits and append the selected token's log probability to ys_probs when a non-blank token is emitted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 0927f

This change populates per-token log-probabilities for two online decoders without changing decoded tokens; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: csukuangfj

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: populating ys_probs in the online NeMo transducer greedy search decoders.
Linked Issues check ✅ Passed The changes satisfy issue #3181 by applying LogSoftmax to joiner logits and storing the selected token log-probability in ys_probs for the online NeMo decoder. The parakeet-unified decoder is also upd…
Out of Scope Changes check ✅ Passed All changes are related to populating ys_probs for the specified online NeMo transducer greedy search decoders. No unrelated code changes are identified.
Full details: Linked Issues check

Explanation

The changes satisfy issue #3181 by applying LogSoftmax to joiner logits and storing the selected token log-probability in ys_probs for the online NeMo decoder. The parakeet-unified decoder is also updated as stated in the PR objectives.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (redundant_comments). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

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

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing ys_probs in online NeMo transducer greedy search decoder

2 participants