Flamingo

Flamingo connects frozen vision and language backbones with a visual resampler and gated cross-attention so a language model can consume interleaved images, videos, and text in-context.

Metadata

FieldValue
PaperFlamingo: a Visual Language Model for Few-Shot Learning
AuthorsJean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, Roman Ring, Eliza Rutherford, Serkan Cabi, Tengda Han, Zhitao Gong, Sina Samangooei, Marianne Monteiro, Jacob L. Menick, Sebastian Borgeaud, Andy Brock, Aida Nematzadeh, Sahand Sharifzadeh, Mikolaj Binkowski, Ricardo Barreira, Oriol Vinyals, Andrew Zisserman, Karen Simonyan
Year2022
VenueNeurIPS 2022
arXiv2204.14198
ProceedingsNeurIPS 2022
Statusseed note started

One-Line Takeaway

Flamingo is an early canonical visual language model architecture for few-shot multimodal prompting: keep strong unimodal models, compress visual inputs into a small token set, and let a causal language model attend to those visual tokens through gated cross-attention.

Question

CLIP aligns images and text in a shared embedding space:

That is useful for retrieval and zero-shot classification, but not enough for open-ended generation:

Large language models already perform in-context learning over text examples:

Flamingo asks:

Can a language model perform the same few-shot prompting pattern when the context contains images or videos interleaved with text?

Architecture Contract

ComponentInputOutputRole
frozen vision encoderimage or video framesdense visual featuresreusable visual representation
Perceiver resamplervisual features plus learned latentsfixed number of visual tokenscompress variable visual input
frozen language modelprevious text tokenscausal hidden stateslanguage generation prior
gated cross-attention layerstext hidden states query visual tokensvisual-conditioned text statesinject visual evidence without rewriting the LM
autoregressive objectiveinterleaved multimodal sequencenext text token losstrain the connector for prompted generation

The model changes the VLM interface from:

to:

Perceiver Resampler

The vision encoder produces many visual features:

For images, can be the number of visual patches. For videos, it can grow with frames and patches. Directly cross-attending to all features at every language layer is expensive, so Flamingo uses a fixed set of learned latent queries:

The resampler repeatedly updates the latent tokens by attending to visual features:

The output:

is a compact visual memory. This is the key architecture move: variable-size image/video evidence becomes a fixed-size set of tokens that a language model can query.

Gated Cross-Attention

A frozen causal language model maintains hidden states:

Flamingo inserts cross-attention blocks between LM layers. A simplified block is:

followed by the usual language-model feed-forward and self-attention updates.

The learned scalar or vector gate starts near zero:

This makes multimodal training less destructive because the pretrained language pathway is initially preserved. As training proceeds, the model learns where visual evidence should influence text generation.

Interleaved Multimodal Context

The input is not limited to one image and one caption. A prompt can be:

and the language model generates:

This makes few-shot visual prompting possible:

Prompt PartFunction
image-text examplesdefine task behavior
query image/videoprovides new visual evidence
question or instructionspecifies output format
generated textanswer, caption, or multiple-choice response

The architecture contribution is therefore not only a better image-text encoder. It defines a promptable multimodal sequence interface.

Training Objective

Flamingo is trained autoregressively on text tokens conditioned on previous text and visual inputs:

Only text tokens are predicted. Images and videos provide conditioning context.

The important separation is:

This is a reusable architecture pattern for adapting a language model to non-text evidence.

Why It Matters

Flamingo marks a shift from contrastive image-text representation learning to generative multimodal foundation models.

BeforeFlamingo-style move
image-text similaritytext generation conditioned on visual input
fixed downstream headsprompted few-shot task interface
one image-caption pairarbitrarily interleaved visual and text context
end-to-end multimodal model from scratchconnect strong frozen unimodal backbones

Later visual instruction models reuse the same broad idea:

BLIP-2 is a cleaner follow-up pattern with a Querying Transformer bridge.

What To Watch

  • The reported capability comes from architecture, web-scale multimodal data, prompt design, and model scale together.
  • Gated cross-attention makes the LM visually conditioned, but it does not guarantee faithful visual grounding.
  • Few-shot visual prompting can be sensitive to example order, answer format, and prompt wording.
  • Frozen-backbone reuse improves efficiency, but the connector still needs enough data to learn alignment.
  • Evaluation should distinguish captioning, VQA, retrieval, multiple-choice QA, and instruction following.