New Tool Radar

Local AI

How to Reduce Hallucinations with the whisper.cpp Entropy Threshold

Set whisper.cpp --entropy-thold to cut repeated or invented text in long transcriptions.

Schematic illustration with three step boxes: Find a clip that hallucinates; Run with the default; Raise the threshold.

Whisper sometimes repeats a phrase or invents text during long silences, a problem called hallucination. whisper.cpp has an –entropy-thold setting that rejects decoded segments whose entropy is too high, which is a sign the model is guessing. This guide tests the threshold on a clip that hallucinates.

Before you start

  • whisper.cpp built, with whisper-cli on your PATH, and a model file such as ggml-base.en.bin.
  • An audio clip with a long silence or background noise where the model invents text.
  • A terminal.

Find a clip that hallucinates

Use a clip with at least 10 seconds of silence or steady background noise. Transcribe it with the defaults first and look for repeated phrases or sentences that nobody said. Note the exact invented text.

Run with the default threshold

Run the transcription and save the output:

./build/bin/whisper-cli -m models/ggml-base.en.bin -f clip.wav

The default entropy threshold is 2.4. Count the invented lines in the output.

Raise the threshold and compare

Run the same clip with a lower threshold, which is stricter:

./build/bin/whisper-cli -m models/ggml-base.en.bin -f clip.wav --entropy-thold 2.0

Compare the two transcripts. The stricter run should have fewer invented lines, and the real speech should still be present.

Worked example

Worked example: a clip with 15 seconds of room noise at the end. With the default threshold the output may add three repeated lines such as “Thank you for watching.” after the speech ends; with –entropy-thold 2.0 those lines should be gone, while the real sentences before the noise stay the same.

Expected result

UNTESTED in this guide: no transcription was run while writing it. The expected result is that the stricter threshold removes the invented lines while keeping the real speech.

Limitations

A threshold that is too strict can drop real speech in noisy recordings, so lower it in small steps. The threshold works alongside the temperature fallback, not instead of it.

Sources

See all