Repository navigation
Reuse shared host CTC decoding across ASR models - #1214
Merged
Merged
Conversation
0xShug0
pushed a commit
that referenced
this pull request
Nov 8, 2026
* sense_asr: return word timestamps from CTC emission frames SenseVoice decodes with greedy CTC, and since #1214 its decoding goes through CtcHostDecoder, which already reports each token's frame span. Those spans were dropped after text decoding. Keep them and, when the request sets return_timestamps (or the CLI gets --words-out), return them as word timestamps. - Encoder output frames start with the query-token prefix (language, event, emotion, ITN); drop it, then convert at one LFR frame (frame_shift_ms * lfr_n = 60 ms) to the input's sample rate. - Chinese, Japanese kana and Thai give one entry per character; other scripts join SentencePiece pieces into words at the boundary marker. Punctuation joins the preceding word without extending its time; language/event/emotion tags are skipped. - Chunked offline runs and streaming windows shift times to the whole input. - Times are token emission frames, as for GigaAM and Granite, not a forced alignment: starts track onsets, ends fall at the last emission. The default path is unchanged: without return_timestamps no words are built and transcripts are identical. The spec gains the word_timestamps capability and the return_timestamps request option, so the C API's audiocpp_model_supports_timestamps() now reports 1 for sense_asr; no C ABI declarations change. Grouping and frame conversion live in sense_asr/word_timestamps.h, covered by the new sense_asr_word_timestamps_test. Co-Authored-By: Claude Opus 5.5 <[email protected]> * sense_asr: append only new words per streaming window Streaming windows are final once decoded, but each window republished the whole word list through publish_transcript(), so every stream event carried all words so far. On a 167 s clip with 2 s windows the events held 19,857 words for a 479-word transcript, growing quadratically with stream length, and a caller appending event words got duplicates. Use append_transcript() with only the window's text delta and words, as other finalized-segment streams do. The transcript is joined exactly as before, and the session no longer keeps its own copy of the words. Also make the word-boundary marker a constexpr string_view. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
OWSM-CTC, GigaAM CTC, SenseVoice and Granite5-ASR duplicate CTC best-path decoding. Reuse the existing
CtcHostDecoderfor blank/repeat collapse and frame spans, and for SenseVoice's host argmax. Production code is reduced by 29 lines.No neural graph, backend kernel, weight, spec, public option or loading changes.
Validation
Debug builds with eight host threads; model runs performed sequentially on CPU, CUDA and Vulkan against main
28783225.SenseVoice automatic VAD was tested with native 16 kHz input; 24 kHz recordings used explicit fixed chunking, matching the existing VAD input-rate requirement.
Performance
Counterbalanced A-B-B-A sessions: short warmup, two different long recordings (167 and 328 seconds), then a short request. RTF excludes warmup. All outputs match across all four legs.
These small differences do not establish speedups. No sustained performance regression was observed in the counterbalanced checks; all other backend combinations passed the full correctness matrix.