Preprint
Machine Learning

Flamingo

April 1, 2022

0

Citations

0

Influential Citations

Venue

2022

Year

Abstract

Visual Language Models enabling seamless handling of interleaved visual and textual data, and facilitating few-shot learning on large-scale web corpora.

Analysis

Why This Paper Matters

Flamingo represents a paradigm shift in how we approach vision-language tasks. Instead of fine-tuning massive models on thousands of labeled examples for each new task, Flamingo shows that a single model can adapt to a wide range of tasks with just a handful of examples—no weight updates needed. This is a huge step toward more practical and scalable AI systems that can generalize from minimal supervision.

How It Works

Flamingo’s architecture is a masterclass in modular design. It takes a frozen pretrained vision encoder (NFNet-F6) and a frozen language model (Chinchilla), and bridges them with two key trainable components: the Perceiver Resampler and GATED XATTN-DENSE layers.

Figure 1

The Perceiver Resampler takes spatio-temporal features from the vision encoder—which can vary in size depending on the input image or video—and compresses them into a fixed set of 64 visual tokens. This is crucial for keeping the cross-attention computation manageable.

Flamingo architecture overview

These visual tokens are then fed into the frozen language model via newly inserted GATED XATTN-DENSE layers. These layers are interleaved between the original frozen LM layers and are trained from scratch. A clever tanh-gating mechanism ensures that at initialization, the model behaves exactly like the original LM, which stabilizes training and preserves the pretrained knowledge.

GATED XATTN-DENSE layers.

A key innovation is the per-image attention masking. For each text token, the model only attends to the visual tokens of the image that immediately preceded it in the interleaved sequence. This design allows Flamingo to handle any number of images or videos seamlessly, even if the model was trained with a fixed maximum.

Results

Flamingo’s results are striking. With just 4 examples, it outperforms all previous zero- and few-shot methods on a wide range of image and video understanding tasks. With 32 examples, it surpasses models that were fine-tuned on thousands of examples on 7 tasks. When fine-tuned itself, Flamingo sets new state-of-the-art on 5 out of 9 tasks.

Comparison to the state of the art.

Ablation studies confirm the importance of each component: the Perceiver Resampler, the gating mechanism, and the interleaved training data all contribute significantly to performance.

Ablation studies

Significance

Flamingo’s impact extends beyond its impressive numbers. It shows that in-context few-shot learning—a capability long associated with large language models—can be effectively transferred to multimodal settings. This opens the door to models that can be deployed without task-specific fine-tuning, reducing the need for labeled data and compute. The architectural choices, especially the use of frozen backbones and gated cross-attention, provide a blueprint for future multimodal systems that are both powerful and efficient.