Keyword biasing: getting proper nouns spelled your way
Mrs. Patel comes back as Mrs. Battle, and Pixel 10 as pixel ten. Keyword biasing can tilt decoding toward the spelling you need, but the official B-WER results show why the shortest clean list is often better than the longest one.
One entry per line. The checker removes duplicates, one-character entries and common words, then shows the complete cleaned list. There is no fixed 32-entry cap; compare 100 against 1,000 on held-out audio rather than filling a quota.
What it actually fixes
Whistle's text vocabulary holds 8,192 pieces. Rare proper nouns, the names, places and brands, fall outside the high-probability part of that vocabulary, so the model writes the nearest word it does know. The example the vendor gives is Mrs. Patel arriving as Mrs. Battle, and Pixel 10 as pixel ten or worse. Keyword biasing tilts the decoding search toward the words you supply: the official implementation matches with Aho-Corasick and raises the search weight of every hit.
How to use it
keywords takes a list, and also accepts a single newline-separated string. The language argument is optional, and detection is automatic when it is left out.
import needle
needle.transcribe("clip.wav",
keywords=["Aoife", "Wojciech", "Pixel 10", "Mrs. Patel"],
language="en",
word_timestamps=True)
There is no fixed 32-entry limit
The current API does not publish a fixed 32-item ceiling, so do not truncate a useful list merely to reach that number. The official evaluation gives a more actionable picture. Biased word error rate (B-WER) is 18.43% with no keywords, 4.46% with 100, and 5.04% with 1,000. The second result is better than the third, which means more coverage is not monotonically better.
B-WER by keyword-list size 0 keywords 18.43% 100 keywords 4.46% 1000 keywords 5.04% Measure a held-out set. Do not assume the longest list wins.
Why a longer list can disappoint
Every entry changes the decoding search and competes with the words the model would otherwise choose. A large list increases the chance of ambiguous matches, short or common terms firing in the wrong place, and rare names crowding out other corrections. Start with the terms your audio actually gets wrong, then add entries only when a held-out recording improves.
# Terms that still need text cleanup can be corrected after transcription.
CORRECTIONS = {"mrs battle": "Mrs. Patel", "pixel ten": "Pixel 10"}
def fix(text):
low = text.lower()
for wrong, right in CORRECTIONS.items():
low = low.replace(wrong, right.lower())
return low
What does not belong in the list
Single characters and very short entries fire on everything and pollute results. Common words such as the, and or is gain little and can cost accuracy elsewhere. Phrases longer than a few words are rarely matched whole. The same word in two different capitalisations is redundant because matching is case-insensitive.
What biasing cannot fix
If the audio itself sits in Whistle's weak spot, several people talking over each other on AMI at 26.07%, or non-English audiobooks on MLS at 24.9%, keywords will not rescue it. Change the model or use a cloud service for that kind of audio. The other boundary is that biasing changes the decoding search, not what the acoustic model heard.
Questions people ask
Is there a 32-entry limit?
No fixed 32-entry limit is stated by the current API. The official benchmark tested 0, 100 and 1,000 entries; 100 scored 4.46% B-WER and 1,000 scored 5.04%. Treat list size as something to measure, not a quota to fill.
Does biasing cost accuracy overall?
Yes. Biasing moves probability mass from other words onto the words you name, so those get right and everything outside the list can get worse. Keep the list small and precise: only the proper nouns that are actually misheard.
Can I use keyword biasing for Chinese?
It is not a shortcut for adding Chinese. The stock model covers English, German, French, Spanish, Italian, Dutch and Polish. Keyword biasing changes decoding among supported tokens; it does not add a new writing system or language.
Related
- Whistle long audio: a 30-second model window, not a 30-second file limit
- Measure a baseline before optimising anything
- Check the device can keep up with the cutting
- Whistle vs Whisper base, in full