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:
1 parent
28201bcd17
commit
edb9b332b9
7 files changed
+31
-23
No files matched your search
@@ -8,11 +8,11 @@ interface VocabularyHintProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* Past this many characters the hint likely exceeds Whisper's prompt budget
|
||||
* (223 tokens ≈ 150 English words) and gets cut at the end (D-WS2a) — say so
|
||||
* rather than silently ignoring the tail.
|
||||
* Past this many characters the hint likely exceeds the 120-token prompt
|
||||
* budget (a list of names runs ≈ 2.8 characters per token, measured) and gets
|
||||
* cut at the end (D-WS2a) — say so rather than silently ignoring the tail.
|
||||
*/
|
||||
const LONG_HINT_CHARS = 600;
|
||||
const LONG_HINT_CHARS = 300;
|
||||
|
||||
/**
|
||||
* Optional "Names and terms" vocabulary hint (D-WS2a). Shown for every model;
|
||||
@@ -41,7 +41,7 @@ export function VocabularyHint({ value, onChange, disabled = false }: Vocabulary
|
||||
/>
|
||||
<p id={`${id}-help`} className="vocabulary-hint-help">
|
||||
{long
|
||||
? "That's a long list — only the first part (about 150 words) will be used."
|
||||
? "That's a long list — only the start of it will be used, so put the most important names first."
|
||||
: "Helps spell names, places and special words. Separate them with commas or new lines. Saved in this browser."}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
+7
-3
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user