Cap the hint prompt at 120 tokens: a full 223-token prompt garbles small models

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-29 23:51:47 +01:00
1 parent 28201bcd17
commit edb9b332b9
7 files changed
+31 -23

No files matched your search

+7 -3
View File
@@ -22,10 +22,14 @@ export const HINT_STORAGE_KEY = "whisper-vocabulary-hint";
export const HINT_MAX_CHARS = 1000;
/**
* Whisper's prompt budget: half its 448 decoder positions, minus one for
* `<|startofprev|>` — the cap openai-whisper and faster-whisper use too.
* Prompt budget in tokens (without `<|startofprev|>`). Whisper itself allows
* 223 (half its 448 decoder positions, minus one — the openai-whisper and
* faster-whisper cap), but measured on en_alien a prompt that long garbles
* small models: base.en WER 0.339 → 0.476 with a realistic 218-token list and
* → 1.05 with a synthetic one, while ≤ 120 tokens stays at or below the
* no-hint WER (D-WS2a).
*/
export const PROMPT_TOKEN_BUDGET = 223;
export const PROMPT_TOKEN_BUDGET = 120;
/** C0 controls + DEL, except \n and \r (line separators, handled below). Tab stays whitespace. */
const CONTROL_CHARS = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g;