fix(transcription): suppress whisper non-speech tokens#1
Open
maubrowncow wants to merge 1 commit into
Open
Conversation
7ff9d70 to
743c243
Compare
Set suppress_blank and suppress_nst on whisper.cpp decoder params on both the Windows whisper-rs path and the macOS whisper.cpp bridge so the decoder never emits bracketed sound labels like [cough], [Music], or [applause] in the first place. WhisperKit on Apple Silicon doesn't expose this as a single flag (it takes a token-ID list with a TODO default), so add a backstop rule to the default cleanup prompt to drop any annotations that still leak through there. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
743c243 to
af34f6a
Compare
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
Tell the Whisper decoder not to emit bracketed sound labels like
[cough],[Music],[applause],[♪♪♪],[inaudible]in the first place — by flippingsuppress_blankandsuppress_nston whisper.cpp params. Add a backstop cleanup prompt rule for the WhisperKit path on Apple Silicon, which doesn't expose the same single flag.Motivation
Whisper sometimes emits environmental sound labels into transcripts. The whisper.cpp library has built-in decoder flags (
suppress_blank,suppress_nst) designed for exactly this — they bias the decoder against the specific token IDs used to denote non-speech events, without affecting regular spoken words like "music" or "cough".Changes
native-core/windows/src/model_whisper_cpp.rsset_suppress_blank(true)andset_suppress_nst(true)on whisper-rsFullParamsnative-core/macos/Sources/WhisperCppBridge/WhisperCppBridge.swiftparams.suppress_blank = trueandparams.suppress_nst = trueon whisper.cppwhisper_full_paramsnative-core/shared/prompts/cleanup-default-instructions.mdCoverage
WhisperKit's
DecodingOptions.supressTokenstakes a[Int]of token IDs and the library has a// TODO: implement these as defaultcomment for the non-speech list. Reimplementing OpenAI'snon_speech_tokens()against WhisperKit's tokenizer is ~80 lines accessing internal APIs and is fragile across WhisperKit upgrades, so the prompt backstop is the better trade until WhisperKit ships the default.Caveats
[cough]/[Music]. Cleanup is enabled by default.suppress_nstis a probability bias, not a hard ban — extremely rare leakage is still possible.Test plan
[cough]/[Music]no longer appear.Privacy / Security
No new network calls, no telemetry. Changes are local decoder configuration plus a prompt string.
🤖 Generated with Claude Code