Repository navigation
Description
Proposal
Add a WhisperArchitectureAdapter so that WhisperForConditionalGeneration checkpoints load
through TransformerBridge.boot_transformers, with hooks throughout the audio encoder and the
text decoder. That covers openai/whisper-tiny to large-v3, large-v3-turbo and
distil-whisper.
Motivation
#710 asked for Whisper, and its last comment asks for one issue per model. This is that issue.
Today the bridge covers audio in two ways:
- encoder-only models (HuBERT, wav2vec2, AST);
- audio-text LMs (Qwen2-Audio, GLM-ASR, Audio Flamingo 3), whose Whisper-style encoders are wrapped opaquely, with
hook_inandhook_outonly.
No audio encoder-decoder is supported, and nothing exposes the inside of a Whisper encoder. Yet
Whisper is one of the most-studied speech model.
Pitch
The adapter is a BART-family member. Whisper's layers have exactly BART's module names
(self_attn, self_attn_layer_norm, fc1, fc2, final_layer_norm, plus encoder_attn and
encoder_attn_layer_norm in the decoder), with pre-LN and a final layer_norm per stack. So the
adapter subclasses BartFamilyArchitectureAdapter, with these differences:
- Encoder front end. Hooks on
conv1,conv2and the fixed sinusoidalembed_positions,
in place of token embeddings.encoder_blocks.{i}.hook_outis then[batch, 1500, d_model],
one frame per 20 ms of a 30 s window. - Unembedding.
proj_out, tied to the decoder'sembed_tokens, with nofinal_logits_bias. - Asymmetric stacks.
large-v3-turbohas 32 encoder and 4 decoder layers, and
distil-large-v3 has 2 decoder layers, son_layersfollows the decoder, as in Blenderbot.
Changes outside the adapter (the part to agree on first):
- Route Whisper to
AutoModelForSpeechSeq2Seqinutilities/architectures.py. - Keep the tokenizer for audio encoder-decoders.
skip_tokenizer_for_modalitydrops it for
audio models, but the decoder reads text. LoadWhisperProcessorasbridge.processor. - In
forward, the audio branch passesinputasinput_values, but Whisper takes
input_features(log-mel,[batch, n_mels, 3000]) plus a decoder input. The adapter would
declare its audio input name, and an audio encoder-decoder would requiredecoder_input. The
automatic shift frominput_idsdoesn't apply to audio.
Usage: bridge(features, decoder_input=prompt) returns decoder logits under teacher forcing,
and run_with_cache returns encoder and decoder hooks.
Out of scope for the first PR:
generate. Whisper's generation adds language detection, timestamps and long-form decoding,
while patching and probing only need the forward pass.- Weight processing such as
fold_ln, which is off for the BART family.
Tests: unit tests on a tiny random config; an integration test of logit parity with HF on
openai/whisper-tiny (39M) on synthetic audio; and a verify_models run.
Alternatives
- Keep Whisper opaque, as in the Qwen2-Audio adapter. That gives no hooks inside the encoder.
- Use separate tooling, such as WhisperLens, linked in [Proposal] Add MVP Support For 1-2 Models Per-Modality #710. That leaves out the bridge's
analysis tools (patching, interchange, probes, logit lens).
Additional context
With my multi-position proposal, interchange interventions will work on encoder frames. A
word spans many frames and the number differs by speaker, so frame-level causal work needs either
aligned positions or pooled spans. Once this lands, the same encoder mapping could also give
Qwen2-Audio's audio tower full hooks, in a later PR.
References:
Glazer, Segal-Feldman, Segev, Shamsian, Buchnick, Hetz, Fetaya, Keshet and Navon (2025), "Beyond Transcription: Mechanistic Interpretability in ASR", arXiv:2508.15882;
Radford, Kim, Xu, Brockman, McLeavey and Sutskever (2023), "Robust Speech Recognition via Large-Scale Weak Supervision", ICML.
Checklist
- I have checked that there is no similar issue in the repo (required)
Activity
jlarson4 commentedon Oct 22, 2026
This is approved for development @dipo101! The BART-family mapping is the right base (Blenderbot already sets the asymmetric-stack precedent you'll need for turbo/distil). One note: Whisper's
k_projhas no bias whileq/v/outdo, so please note that in the adapter docstring and let the whisper-tiny parity test pin it. On the three shared changes, which you identified as the first items to settle:AUDIO_TEXT_ARCHITECTURESinput_featuresas its input name withdecoder_inputrequired, rather than reusing theinput_valuesbranch.Leaving generate and weight processing out of the first PR is fine, we will want this as the next follow up.
feat(bridge): Whisper adapter
Whisper adapter (#1944)
feat(bridge): generate() for Whisper (#1970)
feat(bridge): weight processing for Whisper (#1972)