n best beam search - #48
Open
Niduank wants to merge 2 commits into
Open
Conversation
- Add n_best parameter to Beam dataclass (default: 1) - Add NBestHypothesis dataclass to store hypothesis info (text, score, confidence) - Modify decode_beam() to return N best hypotheses sorted by normalized score - Add hypotheses attribute to AlignedResult to store N-best results - Update ParakeetTDT and ParakeetRNNT generate() methods to populate hypotheses - Update streaming code to handle new decode() return signature
- Fix typo in beam decoding example (decoding -> Beam) - Add N-best hypotheses usage example - Document NBestHypothesis in Timestamp Result section
senstella
self-requested a review
January 25, 2026 04:14
senstella
reviewed
Jan 25, 2026
senstella
left a comment
Owner
There was a problem hiding this comment.
Thank you for taking the time to put this PR! I really appreciate the contribution. I had a few thoughts on the interface design that might help make things easier to maintain in future. Please let me know if you have other ideas!
| class NBestHypothesis: | ||
| """Represents a single hypothesis from N-best beam search decoding.""" | ||
|
|
||
| text: str |
Owner
There was a problem hiding this comment.
I think implementing this as other dataclass is a bit redundant. Perhaps we can have list[AlignedSentence] instead?
| ) | ||
| results_nbest.append(n_best_hyps) | ||
|
|
||
| return results, results_nbest, results_hidden |
Owner
There was a problem hiding this comment.
I wonder if we could have an interface other than result, results_nbest, results_hidden. Perhaps we need to make something like DecodingOutput / DecodingResult so that we can extend that if there's any other modifications or improvements would happen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
Usage