Skip to content

fix(diar): keep frames for words not yet tagged - #70

Merged
pskrunner14 merged 2 commits into
mainfrom
fix/diar-tag-compacted-prefix
Oct 16, 2026
Merged

pskrunner14 merged 2 commits into
mainfrom
fix/diar-tag-compacted-prefix

Conversation

@pskrunner14

Copy link
Copy Markdown
Collaborator

Without endpointing, words before the last ~10 min of long inputs all got one speaker (reported in #67). This PR adds a fix that keeps frames until their words are tagged.

AMI ES2002a (21 min) word speaker accuracy: 59.2% -> 99.7%

Fixes #67

- without endpointing, words before the last ~10 min of long inputs
  all got one speaker
- add DiarStream::hold_frames_from; compaction never cuts past it
- RecognitionStream holds from frame 0 and moves the hold after each
  final; standalone diarize and the C API are unchanged
- AMI ES2002a (21 min) word speaker accuracy: 59.2% -> 99.7%

Fixes #67
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Speech.cpp/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 72b79303-de85-4a2a-9ff6-5e4a84167bf2
📥 Commits

Reviewing files that changed from the base of the PR and between 70468ff and dd0b1b9.

📒 Files selected for processing: 1
  • src/asr/recognizer.cpp

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved speaker diarization reliability by retaining the audio frames needed to apply speaker labels to finalized words, including when a stream has not yet reached an endpoint.
    • Updated frame retention after finalization to preserve audio needed for speaker tagging while allowing later speech to continue processing.
    • Speaker labels are now associated with the frame containing the finalized word’s start, helping keep labels aligned with the recognized speech.

Diarization now preserves probability frames from stream start until a final result with words is available. It then advances the hold boundary to the frame containing the last word’s start time. Compaction respects the hold boundary, and resetting the stream rewinds a configured boundary to frame zero.

Changes: Diarization frame retention

Layer / File(s) Summary
Hold boundary and compaction
src/asr/diar/diar_pipeline.h, src/asr/diar/diar_pipeline.cpp
DiarStream adds a frame hold boundary, initialized as unset. Reset rewinds a configured boundary to frame zero. Compaction limits its cut to preserve held frames.
Recognizer hold lifecycle
src/asr/recognizer.cpp
When diarization is enabled, recognition holds frames from frame zero. After a final result with words, it advances the boundary to the frame containing the last word’s start time.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to dd0b1

For the documented diarization presets, the frame-retention change does not establish a speaker-attribution risk. No actionable merge-blocking issue was found, so the PR appears ready for normal validation.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main diarization fix: retaining frames until words receive speaker tags.
Description check Passed The description directly explains the long-input speaker-tagging issue, the implemented fix, the reported accuracy improvement, and the linked issue.
Linked Issues check Passed The changes address issue #67. RecognitionStream holds diarization frames from frame 0 when diarization is enabled. After each final with words, it advances the hold point to the last final word sta…
Out of Scope Changes check Passed The changed files stay within issue #67. The DiarStream::hold_frames_from state, reset handling, compaction limit, and RecognitionStream integration directly support delayed word tagging. The comm…
Full details: Linked Issues check

Explanation

The changes address issue #67. RecognitionStream holds diarization frames from frame 0 when diarization is enabled. After each final with words, it advances the hold point to the last final word start, not to all pushed audio. DiarStream::maybe_compact limits compaction to frames before that hold point. A non-endpointed long input therefore retains frames until its words receive speaker tags. reset() also restores a configured hold to frame 0. Issue #67 has no explicit automated-test coding requirement.

Full details: Out of Scope Changes check

Explanation

The changed files stay within issue #67. The DiarStream::hold_frames_from state, reset handling, compaction limit, and RecognitionStream integration directly support delayed word tagging. The comment updates document this behavior. No unrelated behavior or feature change is demonstrated.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@pskrunner14 pskrunner14 added the bug Something isn't working label Oct 16, 2026
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous buffered-word speaker issue is fixed.

Summary

The PR keeps diarization frames until final words receive speaker tags.

  • Diarization keeps word frames until their speaker tags are ready.

Reviews (2) · Last reviewed commit: "fix(diar): hold from the last tagged wor..." · Reviewed by Greptile

Comment thread src/asr/recognizer.cpp Outdated
@greptile-apps

greptile-apps Bot commented Oct 16, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

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

LGTM. Ok to merge once CI passes.

@pskrunner14
pskrunner14 merged commit caa3f47 into main Oct 16, 2026
19 checks passed
@pskrunner14
pskrunner14 deleted the fix/diar-tag-compacted-prefix branch October 16, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transcribe --diarize assigns wrong speaker tags to the first ~10 min of a 21 min file (standalone diarize on the same file is correct)

2 participants