Which modern LLM architecture uses cross-attention?
T5 and BART, the encoder decoder family, use cross-attention in the decoder. Decoder-only LLMs like GPT, Llama, and Mistral have no encoder, so they use self-attention only.
Think of two ways to write. The first is jotting in a notebook: you only ever look at what you've already written, one stream, one author. That's self-attention. The second is a translator at a desk with a foreign manuscript on one side and a blank page on the other. While drafting on the blank page, the translator keeps glancing across to the source. That cross-referencing between two separate documents is cross-attention. Decoder-only LLMs like GPT and Llama are the notebook writer, only one stream. T5 and BART are the translator at the desk, with a separate encoder stream to glance over.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define the Q/K/V routing distinction, walk the three architectural families with canonical examples, explain why the field moved to decoder-only for general LLMs, and show where cross-attention is still essential today (multimodal, speech).
| Architecture | Attention types used | Cross-attention | Examples |
|---|---|---|---|
| Encoder decoder | Bidirectional self + causal self + cross | Yes, decoder side | T5, BART, Whisper, original Transformer |
| Encoder-only | Bidirectional self | No | BERT, RoBERTa, DeBERTa |
| Decoder-only | Causal self | No | GPT-5.5, Claude Opus 4.7, Llama 4 Maverick, Gemini 3.1 Pro |
Real products, models, and research that use this idea.
- T5: every decoder block has causal self-attention, then cross-attention to the encoder output, then MLP.
- BART: denoising encoder decoder used for summarization and structured generation.
- Whisper: encoder decoder for speech to text; the text decoder cross-attends to the audio encoder's mel spectrogram representation.
- Flamingo: gated cross-attention layers injected into a frozen LM to bring in vision features without retraining the language backbone.
- GPT-5.5, Claude Opus 4.7, Llama 4 Maverick, Gemini 3.1 Pro, DeepSeek V4: all decoder-only with no cross-attention anywhere in the stack.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy did the field shift from encoder decoder to decoder-only for general LLMs?
QHow does Flamingo's gated cross-attention work and why is gating necessary?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming every transformer has cross-attention because the original 2017 paper did. Decoder-only architectures dominate modern LLMs and never use it.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.