Sub topic 11
Limitations: hallucinations, silence, accents, and no built-in speaker labels
Whisper is accurate on clean speech, but it fails in specific, predictable ways. This chapter covers those failures so you can detect them, reduce them, and decide when Whisper alone is not enough. It assumes you can run model.transcribe() from the openai-whisper package and read the segments list. It also assumes you know what a 30-second window is and what word error rate (WER) measures.
Why Whisper fails differently from older recognizers
Whisper's decoder is a language model. It predicts the next token given the audio encoding and the text it has already written. That design gives fluent punctuation and good recovery from noise. It also means the decoder can produce plausible text that has no basis in the audio.
Older recognizers tended to output nothing or garbage when the audio was bad. Whisper tends to output confident, well-formed sentences. Errors are therefore harder to spot, because the output looks right.
Hallucinations
A hallucination is text in the transcript that was never spoken. Whisper produces three common kinds.
- Invented phrases on silence or music. Typical outputs are "Thanks for watching!", "Please subscribe", or credits for subtitle authors. These phrases are common in the web-scraped subtitle data the model was trained on. The decoder falls back on them when the audio gives no evidence.
- Repetition loops. The same word or sentence repeats dozens of times. Once the decoder starts repeating, the repeated text makes more repetition likely.
- Wrong script or language. The decoder starts a segment in a different language than the speaker used.
Why hallucinations happen
The model was trained on about 680,000 hours of weakly supervised audio paired with transcripts of mixed quality. Some of those transcripts contained boilerplate that had no link to the sound. The model learned that boilerplate as a likely continuation. Silence gives it nothing to contradict that habit.
The condition_on_previous_text trap
By default, transcribe() feeds the text of earlier windows into the prompt for the next window. This helps keep spelling and style consistent. It also lets one bad window poison every window after it. A single repetition loop can spread across the rest of a file.
Setting condition_on_previous_text=False stops that spread. The cost is that names and formatting may vary between windows.
Built-in safeguards
Whisper's decoding loop has fallback logic. It first decodes with temperature 0. If the result looks bad, it retries at higher temperatures. The checks are these:
| Parameter | Default | Triggers fallback or skip when |
|---|---|---|
| `compression_ratio_threshold` | 2.4 | The text compresses too well (gzip ratio above the value), which indicates repetition |
| `logprob_threshold` | -1.0 | The average token log probability is below the value |
| `no_speech_threshold` | 0.6 | The no-speech probability is above the value and the log probability is also low, so the window is treated as silent |
These defaults catch many failures but not all. A segment can pass every check and still be invented.
Flagging suspicious segments
Each segment in the result carries the numbers you need. This script marks segments that deserve a manual check.
import whisper
model = whisper.load_model("small")
result = model.transcribe(
"meeting.mp3",
fp16=False,
condition_on_previous_text=False,
)
for seg in result["segments"]:
flags = []
if seg["no_speech_prob"] > 0.6:
flags.append("possible silence")
if seg["avg_logprob"] < -1.0:
flags.append("low confidence")
if seg["compression_ratio"] > 2.4:
flags.append("repetitive")
marker = ", ".join(flags) if flags else "ok"
print(f"[{seg['start']:.1f}-{seg['end']:.1f}] ({marker}) {seg['text']}")Treat these flags as a review queue, not a verdict. A quiet but real whisper can have a high no_speech_prob.
Silence and non-speech audio
Silence is the largest single cause of hallucination. Three mitigations work well together.
- Trim silence before transcription. Cutting long pauses with a tool such as ffmpeg's
silenceremovefilter reduces what the decoder can invent. Do this carefully, because trimming also changes timestamps. Keep a mapping if you need original times. - Use voice activity detection (VAD). VAD is a small model that marks which parts of the audio contain speech. The faster-whisper package builds this in.
- Check
no_speech_prob. Drop segments whose value is high and whose text matches known boilerplate phrases.
This example uses faster-whisper's VAD filter.
from faster_whisper import WhisperModel
model = WhisperModel("small", device="cpu", compute_type="int8")
segments, info = model.transcribe(
"call_with_pauses.mp3",
vad_filter=True,
vad_parameters={"min_silence_duration_ms": 500},
condition_on_previous_text=False,
)
for segment in segments:
print(f"[{segment.start:.2f}s -> {segment.end:.2f}s] {segment.text}")Here min_silence_duration_ms sets how long a pause must last before VAD cuts it out. A smaller value removes more silence but may clip the ends of words.
Accents, dialects, and uneven language coverage
Whisper's accuracy depends on how much training data exists for a language and variety. English makes up the largest share. Many other languages have only a few hours or tens of hours. WER for low-resource languages can be several times higher than for English.
Within a single language, performance also varies.
- Accents. Speech from regions under-represented online (many African, South Asian, and regional accents) usually has a higher WER than standard broadcast speech.
- Code-switching. When a speaker mixes two languages in one sentence, Whisper tends to pick one language for the whole window. It may translate or transliterate the other language's words.
- Domain vocabulary. Product names, medical terms, and people's names are often misspelled, because the decoder chooses the most common spelling it knows.
- Audio quality. Far-field microphones, phone-call compression, and background music raise WER for every model size.
Language detection mistakes
When you omit language, Whisper detects the language from the first 30 seconds. A short opening, a music intro, or a speaker with a strong accent can produce the wrong language. The whole file is then decoded in that language, and the output reads like nonsense in the wrong alphabet.
If you know the language, set it.
import whisper
model = whisper.load_model("small")
result = model.transcribe("lecture.mp3", language="de", fp16=False)
print(result["text"])Reducing accent and vocabulary errors
- Use a larger model. WER generally falls as model size rises, and the gap is biggest for non-English and accented speech.
- Pass
initial_promptwith the names and terms you expect, for example"Speakers: Priya Raman, Tomasz Wójcik. Topics: Kubernetes, PostgreSQL.". This biases spelling but does not guarantee it. - Measure on your own audio. Published WER figures use clean benchmarks and may not match your recordings. The previous chapter's
jiwerapproach applies directly.
No built-in speaker labels
Whisper transcribes what was said. It does not decide who said it. A two-person interview comes out as one continuous stream of text. The segment boundaries follow pauses and 30-second windows, not speaker changes, so one segment can contain both speakers.
The task that answers "who spoke when" is called speaker diarization. It is a separate problem with its own models. A common pipeline looks like this.
- Run Whisper to get timestamped text.
- Run a diarization tool (for example pyannote.audio) to get speaker turns, each with a start time, end time, and speaker label.
- Match each text segment to the speaker turn that overlaps it most.
Step 3 is simple enough to write yourself. This function assigns a label to each Whisper segment. It takes the turns as a list of (start, end, speaker) tuples.
def assign_speakers(segments, turns):
"""Label each segment with the speaker whose turn overlaps it most."""
labeled = []
for seg in segments:
best_speaker, best_overlap = "unknown", 0.0
for start, end, speaker in turns:
overlap = min(seg["end"], end) - max(seg["start"], start)
if overlap > best_overlap:
best_speaker, best_overlap = speaker, overlap
labeled.append((best_speaker, seg["text"].strip()))
return labeled
segments = [
{"start": 0.0, "end": 4.0, "text": " Hello, thanks for joining."},
{"start": 4.0, "end": 8.0, "text": " Happy to be here."},
]
turns = [(0.0, 4.2, "SPEAKER_00"), (4.2, 9.0, "SPEAKER_01")]
for speaker, text in assign_speakers(segments, turns):
print(f"{speaker}: {text}")This prints SPEAKER_00: Hello, thanks for joining. followed by SPEAKER_01: Happy to be here.
Gotchas when combining the two
- Segments that span a speaker change. Segment-level matching gives the whole segment to one speaker. Word timestamps let you split at the actual change, but word timing is itself approximate.
- Overlapping speech. When two people talk at once, Whisper usually transcribes one of them and drops the other. Diarization cannot restore the lost words.
- Speaker count. Diarization tools may merge two similar voices or split one voice into two. Giving the tool the correct speaker count, when you know it, helps.
- Timestamp drift. If you trimmed silence or resampled, the two tools must see the same time axis.
Other limits worth knowing
- Timestamps are approximate. Segment times come from timestamp tokens the decoder predicts. They can be off by a fraction of a second, and they degrade around hallucinated text.
- Not streaming. The model works on 30-second windows. Real-time use requires chunking tricks, which add latency and edge-of-window errors.
- Truncation of the tail. Very short final audio is padded to 30 seconds, and the last words are sometimes lost or invented.
- Numbers and formatting. Whisper may write "twenty twenty-six" or "2026" depending on context. Normalize both reference and hypothesis text before computing WER, or the score will punish formatting differences.
- Translation quality. The
translatetask targets English only and is weaker than thetranscribetask for low-resource languages.
A practical checklist
- Set
languagewhen you know it. - Set
condition_on_previous_text=Falsefor long or noisy files. - Use VAD or trim silence, and keep a record of any time offsets.
- Flag segments by
no_speech_prob,avg_logprob, andcompression_ratio. - Use
initial_promptfor names and jargon, and verify the result. - Add a diarization step when you need speaker labels.
- Measure WER on a sample of your own audio before choosing a model size.
Exercise
A one-hour recording has long quiet stretches. The transcript is good at first, but from minute 20 onward the same sentence repeats hundreds of times. Name the likely cause, then give two changes that reduce the problem.
Show answer
The likely cause is a repetition loop that spread because condition_on_previous_text is True by default, so one bad window's text was fed into every later window. Changes: set condition_on_previous_text=False, and remove silence with VAD (for example vad_filter=True in faster-whisper) or by trimming it first. Checking compression_ratio per segment to find and re-run the bad region also helps.
Exercise
You run Whisper on a two-person interview. The text is accurate, but you need to know who said each line. Why can't Whisper provide this, and what do you add to the pipeline?
Show answer
Whisper is trained to predict text from audio, not to identify voices, so its segments follow pauses and 30-second windows rather than speaker changes. Add a speaker diarization tool such as pyannote.audio to produce speaker turns with start and end times, then assign each Whisper segment to the turn with the largest time overlap.