From d7d3deae72ec166d6b80232342cfe54aafff6bc4 Mon Sep 17 00:00:00 2001 From: monai Date: Fri, 28 Aug 2026 13:33:39 +0000 Subject: [PATCH] Fix: require low avg_logprob before skipping fallback on no-speech decode_with_fallback skipped the temperature-ladder fallback as soon as no_speech_prob exceeded no_speech_threshold, treating the segment as silence. This let genuine (low-confidence) speech get dropped whenever the no-speech probability happened to be high, even when the decoded text was otherwise plausible. Require both no_speech_prob > no_speech_threshold AND avg_logprob < logprob_threshold before treating the result as silence and skipping fallback, matching openai-whisper and Hugging Face transformers' generation_whisper.py, which both gate on this same conjunction. --- mlx_audio/stt/models/whisper/whisper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mlx_audio/stt/models/whisper/whisper.py b/mlx_audio/stt/models/whisper/whisper.py index 24c2b7686..34dbcb3d1 100644 --- a/mlx_audio/stt/models/whisper/whisper.py +++ b/mlx_audio/stt/models/whisper/whisper.py @@ -987,6 +987,8 @@ def decode_with_fallback(segment: mx.array) -> DecodingResult: if ( no_speech_threshold is not None and decode_result.no_speech_prob > no_speech_threshold + and logprob_threshold is not None + and decode_result.avg_logprob < logprob_threshold ): needs_fallback = False # silence if not needs_fallback: