Flamingo · multimodal model

On this page 7

Flamingo is a visual language multimodal model introduced by DeepMind in 2022 that reads interleaved sequences of images, video and text and generates free-form text in response. In multimodal AI, it is best known for showing that a single pretrained model can perform new vision-language tasks through few-shot in-context learning, using only a handful of examples placed in the prompt instead of task-specific fine-tuning.

Its design keeps a pretrained vision encoder and a pretrained language model frozen and trains only a small set of new connecting layers. This approach preserved the knowledge of both components, reduced training cost and made Flamingo a reference architecture for later vision-language models in the field of artificial intelligence.

How the Flamingo architecture connects vision and language

Flamingo combines three building blocks: a frozen vision encoder, a trainable Perceiver Resampler and a frozen decoder-only language model augmented with gated cross-attention layers. Images pass through the encoder, the resampler compresses the resulting features into a fixed number of visual tokens, and the language model attends to those tokens while it predicts the next text token.

The original vision encoder is a Normalizer-Free ResNet (NFNet-F6) pretrained with a contrastive image-text objective similar to CLIP. The language backbone comes from the Chinchilla family, and both remain frozen during Flamingo training, which protects the language model from catastrophic forgetting of its text abilities.

The following table summarizes what each component does and whether its weights change during training.

ComponentRoleTrained during Flamingo training
Vision encoderTurns each image or video frame into spatial feature mapsNo, frozen after contrastive pretraining
Perceiver ResamplerMaps a variable number of features to 64 visual tokensYes
Gated cross-attention layersLet text tokens attend to visual tokensYes
Language model layersModel text and generate the outputNo, frozen
Text embeddings for special tokensMark image positions and chunk boundariesYes, for the new tokens only
Main components of the Flamingo architecture

Perceiver Resampler and gated cross-attention

The Perceiver Resampler solves the problem of variable input size. It uses a small set of learned latent queries that attend to all spatial and temporal features of an image or video, and it always outputs 64 visual tokens. This keeps the cost of cross-attention constant whether the input is one image or a clip with many frames.

The gated cross-attention dense blocks are inserted between the frozen language model layers. Each block applies cross-attention from text to visual tokens, followed by a feed-forward layer, and multiplies the result by a tanh gate initialized at zero. At the start of training the model therefore behaves exactly like the original language model, and visual information is blended in gradually as the gates open.

Flamingo also uses image-causal masking: each text token attends only to the visual tokens of the image that immediately precedes it in the sequence. Earlier images still influence the output indirectly through the language model’s self-attention, which lets the model handle arbitrarily interleaved inputs with many images.

The table below lists the three published model sizes and their language backbones.

ModelFrozen language backboneTotal parameters
Flamingo-3BChinchilla 1.4BAbout 3 billion
Flamingo-9BChinchilla 7BAbout 9 billion
Flamingo-80BChinchilla 70BAbout 80 billion
Flamingo model sizes

Training data and multimodal in-context learning

Flamingo was trained on a mixture of web-scale datasets rather than on curated task data. The key ingredient is interleaved image-text data, collected from web pages where pictures and paragraphs appear in their natural order, because this format teaches the model to relate several images to surrounding text, which is exactly what a few-shot prompt looks like.

The training mixture, as described in the original work, combined the following sources.

DatasetContentContribution
M3W (MultiModal MassiveWeb)About 43 million web pages with interleaved images and textTeaches handling of multiple images in context
ALIGNAbout 1.8 billion noisy image and alt-text pairsBroad visual concept coverage
LTIPAbout 312 million longer image-text pairsHigher-quality descriptive captions
VTPAbout 27 million short video-text pairsVideo understanding
Datasets in the Flamingo training mixture

At inference, a user builds a prompt such as image, question, answer, image, question, answer, followed by a new image and question. Flamingo completes the pattern. This multimodal in-context learning allowed the 80B model to set a new few-shot state of the art on many benchmarks and, with 32 examples, to exceed fine-tuned models on six of sixteen tasks reported in the original evaluation.

Flamingo sits between contrastive models such as CLIP, which embed images and text but do not generate language, and later multimodal large language models that use a simple projector and visual instruction tuning. The comparison below shows where it differs.

ApproachHow vision reaches the language modelTypical adaptation
CLIPNo generation; shared embedding spaceZero-shot classification and retrieval
FlamingoGated cross-attention to resampled visual tokensFew-shot prompting with interleaved examples
BLIP-2Querying transformer feeding soft promptsInstruction tuning or fine-tuning
LLaVA-style modelsLinear or MLP projector into the input sequenceVisual instruction tuning
Natively multimodal modelsImages tokenized and trained jointly from the startPrompting and instruction following
Flamingo compared with neighboring approaches

The main architectural distinction is cross-attention fusion versus input-sequence fusion. Flamingo keeps visual tokens outside the language model’s context window, so many images add little sequence length, whereas projector-based models place visual tokens directly in the prompt and consume context budget for every image.

Limitations and legacy

Flamingo was never released as open weights, so practical work relies on open reproductions such as OpenFlamingo and IDEFICS, which follow the same design with publicly available components. Its known weaknesses are typical of early vision-language models:

  • Multimodal hallucination, where the model describes objects or details that are not in the image.
  • Sensitivity to prompt examples, so the choice and order of few-shot demonstrations change results noticeably.
  • Weaker performance on fine-grained tasks such as reading small text, counting or precise spatial reasoning.
  • High inference cost for the 80B variant and limited image resolution in the original setup.
  • Inherited biases from uncurated web data in both the encoder and the language model.

Despite these limits, Flamingo established several ideas that remain standard: reusing frozen unimodal backbones, compressing visual features into a fixed token budget, and training on interleaved web documents to unlock in-context learning across modalities.

A plain-language summary

Flamingo is an AI system that can look at pictures and short videos and then write about them. It was built by joining two existing models. One model already understood images. The other already understood language.

The builders did not retrain those two models. Instead, they added small connecting layers between them. These layers act like an interpreter that passes what the eyes see to the part that writes. The key idea is that Flamingo learns a new task from a few examples shown in the request, much as a person learns a card game by watching a few rounds.

An example from practice

A research team at a museum wants short descriptions for thousands of digitized artworks but has no labeled training set. Using an open Flamingo-style model, the team writes a prompt with four example images, each followed by a description in the house style: object type, material, period and one notable visual detail.

For each new artwork, the team appends the image and the words “Description:” and lets the model complete the text. Curators then review the drafts. The team reports that most drafts need only light editing, while drafts for small inscriptions and damaged objects need full rewrites because the model sometimes invents details. The result is a faster cataloging workflow without collecting a dedicated training dataset.