Expose per-step decoder cross-attention scores during generate() (for streaming / AlignAtt policies)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 536
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 4
Description
The Whisper generate() result (WhisperGenerationResult) exposes sequences, scores, logits and no_speech_prob, but not the decoder cross-attention. Attention is only available via the separate align() method, and return_attention exists for the Translator path (see #1716).
This blocks streaming policies like AlignAtt (used by SimulStreaming), which decide token-by-token whether a token is "safe" to emit based on where attention is focused in the audio. Because per-step cross-attention isn't exposed during generate(), projects built on faster-whisper / CTranslate2 can't implement AlignAtt and fall back to the slower torch backend.
Reference: ufal/SimulStreaming#10 — the maintainer confirms faster-whisper can't be used precisely because it doesn't expose attention.
Would it be possible to add a return_attention=True option to Whisper generate() that returns per-step cross-attention scores? The existing align() implementation and the Translator's return_attention suggest the underlying data and mechanism are already available.
Related: #1716, #1855.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing Whisper align() implementation and the Translator path described in #1716, focusing on how return_attention is handled. Trace how Whisper generate() produces WhisperGenerationResult values. Done means generate() accepts return_attention=True and exposes per-step decoder cross-attention scores for streaming policies such as AlignAtt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100