Whisper is OpenAI’s open-source speech recognition model: give it a recording and it writes down what was said, on your own computer, for free. It comes in sizes from tiny to large, and the bigger ones are slower and more accurate. How much more accurate depends on your audio. Here you’ll listen to five real recordings, add noise until they’re hard to follow, read what three sizes of Whisper wrote, and score them the way researchers do. Choose a Whisper size for your worst audio, not your best.
Speech in, text out#
Whisper was released in 2022, with its weights, under the MIT licence. It was trained on 680,000 hours of audio from the web paired with transcripts, which is why it copes with accents, background noise and technical words better than older systems. Inside, it’s a transformer: one half listens to the audio, 30 seconds at a time, and the other writes the text a token at a time, much as a chatbot writes a reply. Longer recordings are cut into 30-second pieces.
We used three sizes of the English-only models: tiny.en (38 million parameters), base.en (73 million) and small.en (242 million). Medium and large versions exist too, and multilingual ones for other languages. The recordings are five short clips from LibriSpeech, a standard test set of volunteers reading public-domain books, each with a reference transcript of what was actually said.
Scoring a transcript#
The standard score is the word error rate (WER): line the transcript up with the reference word by word, count the words that were swapped, dropped or added, and divide by the number of words in the reference. First, both are cleaned up the same way, lowercased and stripped of punctuation, with “Mr.” spelled out as “mister”, because LibriSpeech’s references have no punctuation and Whisper’s transcripts do. Without that step every clip would score badly for the wrong reasons.
Predict first
On the five clean recordings, 88 words in all, how many does small.en get wrong, compared with tiny.en, which is less than a sixth of its size?
On clean audio, most of the errors are names. Every size writes “Layton” for Leighton and “Calico” for Kaliko, and they’re right to hesitate: how should anyone know the spelling from the sound? (The reference spells one character “Brandd”, so every model loses a point for writing “brand”.) The rest are small slips: “a time buzzer” for “the time buzzer”, “middle forest” for “metal forest” from tiny.en and base.en, and base.en’s “grieved doubts”. A word error rate counts all of these the same, so read the errors, not just the score.
Add noise#
Real recordings are rarely this clean. The noise level here is given as a signal-to-noise ratio in decibels: at 20 dB the speech is a hundred times more powerful than the hiss, at 10 dB ten times, and at 0 dB they’re equal. Play a clip at each level: 10 dB is easy for a person, 5 dB is unpleasant but clear, 0 dB is hard work.
Predict first
At 5 dB, noisy but still easy for a person to follow, how do the three sizes do?
Here’s where size pays. At 20 dB nothing much changes for any of them. By 10 dB tiny.en is wrong on 23% of words, base.en 15% and small.en 9%; at 5 dB small.en hasn’t moved and the others have. At 0 dB all three struggle, and the failures change character: instead of mishearing, the models start writing fluent sentences nobody said. tiny.en turns “He has grave doubts” into “He has three goats”, and base.en ends one clip with “with all of the names, with all of the names, with all of the names”. On clean audio the sizes barely differ; noise is where a bigger model earns its keep.
You pay for it in time. On our CPU, tiny.en transcribed 36 seconds of audio in 4 seconds, nearly nine times faster than real time; small.en took 22 seconds, under twice as fast as real time. A GPU, or a faster runtime such as whisper.cpp or faster-whisper, closes most of that gap.
Choosing a size#
- Test on your own audio. Transcribe five minutes of your real recordings by hand, the noisy ones included, and compute the word error rate for two or three sizes. It takes an afternoon and answers the question for your case.
- Start small, then step up. base.en is a good start for clean, close-up speech; reach for small or bigger for phone calls, meetings and outdoor recordings.
- Tell it the names. The original openai-whisper package takes an initial prompt, a bit of text such as a list of names and terms, that nudges Whisper towards those spellings.
- Use the multilingual models for other languages. The “.en” models only do English.
In code#
All three sizes on the second clip, with Hugging Face transformers and jiwer, a common word-error-rate library, free and local (pip install transformers torch librosa jiwer):
import re
import jiwer, librosa
from transformers import pipeline
audio, _ = librosa.load("clip.mp3", sr=16000) # Whisper expects 16 kHz mono
truth = "He has grave doubts whether Sir Frederick Leighton's work is really Greek after all, and can discover in it but little of rocky Ithaca."
def words(text):
"""Lowercase, drop punctuation: the usual clean-up before scoring."""
return " ".join(re.sub(r"[^a-z0-9' ]+", " ", text.lower()).split())
for size in ["tiny.en", "base.en", "small.en"]:
asr = pipeline("automatic-speech-recognition", model=f"openai/whisper-{size}")
text = asr({"raw": audio, "sampling_rate": 16000})["text"].strip()
print(f"{size:>8} WER {jiwer.wer(words(truth), words(text)):.0%} {text}")
# tiny.en WER 4% He has grave doubts whether Sir Frederick Layton's work is really Greek after all, and can discover in it but little of rocky Ithaca.
# base.en WER 8% He has grieved doubts whether Sir Frederick Layton's work is really Greek after all, and can discover in it but little of rocky Ithaca.
# small.en WER 4% He has grave doubts whether Sir Frederick Layton's work is really Greek after all, and can discover in it but little of rocky Ithaca.For recordings longer than 30 seconds, pass chunk_length_s=30 when you create the pipeline and it will cut the audio into pieces and join the text back together.
What to remember
- Whisper turns speech into text on your own machine; bigger sizes are slower and more accurate, and the word error rate measures by how much.
- On clean recordings, tiny.en and small.en were almost equal (6% and 5% of words wrong); at 5 dB of noise, 42% against 9%.
- Test the sizes on your own, noisiest audio, read the errors as well as the score, and watch for fluent sentences nobody said.