OpenNMT / OpenNMT/CTranslate2

Expose per-step decoder cross-attention scores during generate() (for streaming / AlignAtt policies)

Open
#2,059 0 comments 0 reactions 0 assignees View on GitHub

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.

SimulStreaming Issue #10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.