Add section on suppressed tokens for digits
This commit is contained in:
@@ -88,6 +88,50 @@ WHISPER_URL=http://minerva.lan:9001
|
|||||||
|
|
||||||
No other change. The Axum server speaks ahmetoner's interface; we mirror it.
|
No other change. The Axum server speaks ahmetoner's interface; we mirror it.
|
||||||
|
|
||||||
|
## Investigated and rejected
|
||||||
|
|
||||||
|
### `suppress_tokens` for digit-sequence preservation (2026-04-28)
|
||||||
|
|
||||||
|
Goal: when a dictator says individual digits ("eins null null"), have Whisper
|
||||||
|
emit them as words instead of collapsing them to a number ("100"). The
|
||||||
|
collapse is irreversible downstream — there is no way for the LLM to
|
||||||
|
distinguish "hunderteins" (101 as a number) from "eins null eins" (a 1-0-1
|
||||||
|
sequence) once both have become `101` in the transcript.
|
||||||
|
|
||||||
|
The standard advice
|
||||||
|
([openai/whisper Discussion #1041](https://github.com/openai/whisper/discussions/1041))
|
||||||
|
is to set `suppress_tokens` to every numeric token in the vocabulary so the
|
||||||
|
decoder is forced onto word tokens. We added a `suppress_numerics` form
|
||||||
|
field, threaded it through the Axum server and the experiments sandbox,
|
||||||
|
and tested it against a real cardiology dictation.
|
||||||
|
|
||||||
|
**Two filter widths, both pathological:**
|
||||||
|
|
||||||
|
1. **Jongwook's exact recipe** (`\d+` filter, ~426 tokens, faithful 1:1
|
||||||
|
reproduction with `eot` bound and `removeprefix(" ")` filter):
|
||||||
|
- Massive end-of-audio repetition loop ("Enoxaparin, das heißt
|
||||||
|
Enoxaparin, das heißt Enoxaparin, …" 20+ times). The fixed
|
||||||
|
`compression_ratio_threshold=2.4` did not catch it.
|
||||||
|
- Numbers also disappear: `40 mg Thorazemit` → `Milligramm Thorazemit`
|
||||||
|
(the `40` is dropped, not converted to a word).
|
||||||
|
2. **Single-digit only** (`\d` filter, 20 tokens — `0`-`9` with and without
|
||||||
|
leading space):
|
||||||
|
- Repetition loop is gone (small enough list to keep beam search stable).
|
||||||
|
- But dictated sequences disappear entirely: `5mg 100` and `5mg 101`
|
||||||
|
become just `Visoprolol` and `Ramipriel` (no dosing schema in any form).
|
||||||
|
- Collateral damage on natural numbers: `12,5 mg` → `12,25 mg` (the ` 5`
|
||||||
|
token was suppressed; the decoder built the value from multi-digit
|
||||||
|
tokens and duplicated a digit).
|
||||||
|
|
||||||
|
There is no usable middle ground between the two widths for our setup
|
||||||
|
(`large-v3` + faster-whisper 1.2.1 + medical German dictation). The status
|
||||||
|
quo (`100`/`101` in the transcript, doctor corrects manually) stays.
|
||||||
|
|
||||||
|
Don't reattempt without changing the underlying ASR (different model,
|
||||||
|
different backend, or model-internal training to preserve digit-form
|
||||||
|
acoustic information). Memory entry:
|
||||||
|
`project_whisper_suppress_tokens_dead_end.md`.
|
||||||
|
|
||||||
## Offline mode
|
## Offline mode
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user