Skip to content

whisper: don't force a timestamp after 16 tokens — truncated every transcription (#698) - #699

Open
Anjielon wants to merge 1 commit into
ROCm:mainfrom
Anjielon:fix/whisper-watchdog-truncation
Open

whisper: don't force a timestamp after 16 tokens — truncated every transcription (#698)#699
Anjielon wants to merge 1 commit into
ROCm:mainfrom
Anjielon:fix/whisper-watchdog-truncation

Conversation

@Anjielon

@Anjielon Anjielon commented Sep 1, 2026

Copy link
Copy Markdown

Fixes #698.

What happens

After 16 content tokens without a timestamp, the decode loop in Whisper::generate() force-samples a timestamp token (watching_dog). Whisper treats that as end-of-segment and emits EOT, so any continuous speech longer than ~4 s comes back cut at ~15 tokens — on Linux the /v1/audio/transcriptions endpoint returned the same 50-character prefix for 3.2 s, 5 s and 7.3 s clips alike, regardless of response_format, language or --ctx-len.

Reproduced on the 1.0.3 Linux release and on a from-source build of main (Ryzen AI MAX+ 395 / NPU2, FW 1.1.2.65, amdxdna 0.6, kernel 7.0.8).

The change

Raise the watchdog from 16 to the decoder maximum (448), so the guard only fires on a genuinely runaway decode. One line plus a comment.

Verified on device with the same 7.3 s Italian clip:

chars text
before 50 Domani alle 9 accendi le luci del soggiorno e ric
after 115 Domani alle 9 accendi le luci del soggiorno e ricordami di comprare il latte e le uova al supermercato e se lunga.

5.0 s per transcription on NPU2, output matches whisper.cpp on GPU for the same clip.

If you'd rather keep a tighter guard, an alternative is to only force a timestamp when the model has produced no content tokens either, or to make the threshold configurable — happy to rework it that way.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEsCw8PTJjca1mUwu6jMzX

… transcription (ROCm#698)

After 16 content tokens without a timestamp, the decode loop force-sampled a
timestamp token; Whisper treats it as end-of-segment and emits EOT, so any
continuous speech longer than ~4 s came back cut at ~15 tokens. Reproduced on
the 1.0.3 Linux release and on a from-source build (Strix Halo / NPU2,
FW 1.1.2.65). Raising the watchdog to the decoder maximum (448) fixes it:
7.3 s Italian clip, 50 -> 115 chars, full sentence, 5.0 s on NPU.

Fixes ROCm#698
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Whisper transcription truncated after ~16 tokens (any clip with >~4s of continuous speech)

1 participant