Flamingo is a family of few-shot learning capable vision-language models (VLMs) developed by DeepMind that processes interleaved sequences of images, videos, and text. Its core innovation is a perceiver-resampler architecture, which converts a variable number of visual features from a frozen image encoder into a fixed set of visual tokens. These tokens are then interleaved with text tokens and fed into a large, frozen language model, enabling in-context, multi-modal reasoning without extensive task-specific fine-tuning.
Glossary
Flamingo

What is Flamingo?
Flamingo is a pioneering family of vision-language models from DeepMind, notable for its few-shot learning capabilities and its novel architecture for processing mixed visual and textual data.
The model's design decouples visual feature extraction from language modeling, allowing it to leverage powerful pre-trained components efficiently. By demonstrating strong few-shot and zero-shot performance on tasks like visual question answering and captioning, Flamingo established a key architectural pattern for combining large language models with visual understanding. It is a direct precursor to modern multi-modal systems used in retrieval-augmented generation (RAG) that ground responses in both textual and visual data.
Key Architectural Features
Flamingo is a family of few-shot learning capable vision-language models from DeepMind that processes interleaved sequences of visual and textual data using a novel perceiver-resampler architecture.
Perceiver-Resampler Architecture
The core innovation enabling Flamingo's few-shot learning. A fixed, pre-trained Perceiver Resampler module ingests a variable number of image or video frames and outputs a fixed, small number of visual tokens. This acts as a learned bottleneck, converting high-dimensional pixel data into a manageable sequence that a frozen, pre-trained Large Language Model (LLM) can process alongside text tokens. This design allows the LLM's powerful text-based reasoning to be applied to visual inputs without expensive end-to-end retraining.
Frozen Language Model Backbone
Flamingo leverages a massive, pre-trained language model (e.g., Chinchilla) that remains frozen during vision-language training. Only the newly added components—the Perceiver Resampler and cross-attention layers—are trained. This is a form of parameter-efficient tuning, preserving the LLM's world knowledge, reasoning, and few-shot abilities while economically adding visual understanding. The model generates text autoregressively based on the fused visual-textual context.
Cross-Attention Dense Fusion
To deeply integrate visual and textual information, Flamingo inserts gated cross-attention dense (GCD) layers between the layers of the frozen LLM. At each decoder layer, these modules allow text representations to attend to all visual tokens from the resampler output. This creates a tight, iterative fusion where language generation is continuously grounded in the visual context, enabling detailed visual question answering and captioning.
Interleaved Visual-Textual Inputs
Flamingo is trained on and natively supports arbitrarily interleaved sequences of images/videos and text. This mirrors how humans process multimodal information (e.g., a textbook with diagrams and paragraphs). The model architecture treats this interleaved sequence as a unified input stream, allowing it to handle complex tasks like:
- Visual dialogue (multiple turns about an image)
- Contextual few-shot learning (interleaved examples)
- Story understanding from image sequences
Few-Shot In-Context Learning
A defining capability inherited from its large language model backbone. Flamingo can perform new tasks with zero or few examples provided in the prompt, without gradient updates. For example, given an interleaved prompt containing an image, a question, and an answer (as a demonstration), it can answer a new question about a different image. This makes it highly flexible and reduces the need for extensive task-specific fine-tuning.
Training on Massive Web Data
Flamingo was trained on a colossal, diverse dataset of interleaved image-text sequences scraped from the web, including pages from social media and encyclopedias. This large-scale, noisy pre-training is crucial for developing robust cross-modal representations. The training objective combines standard language modeling loss on text tokens with the novel integration of visual data through the perceiver-resampler and cross-attention mechanisms.
How the Flamingo Architecture Works
Flamingo is a family of vision-language models from DeepMind designed for few-shot learning on tasks involving both images and text.
The Flamingo architecture processes interleaved sequences of visual and textual data using a novel perceiver-resampler module. This component converts a variable number of image features from a frozen vision encoder into a fixed number of visual tokens. These tokens are then seamlessly integrated into a large, frozen language model, enabling the system to handle arbitrary sequences of images and text for in-context learning.
Key to its design is the gated cross-attention mechanism, which allows the frozen language model to condition its text generation on the processed visual tokens. By keeping the core vision and language backbones frozen and training only the connecting components, Flamingo achieves strong few-shot and zero-shot performance on multimodal benchmarks without full model fine-tuning, establishing a template for efficient large-scale multimodal model development.
Capabilities and Use Cases
Flamingo's novel perceiver-resampler architecture enables it to process arbitrary sequences of images and text for few-shot learning, setting a foundation for modern multimodal reasoning.
Few-Shot In-Context Learning
Flamingo's core capability is few-shot learning from interleaved image-text examples. Unlike models requiring extensive fine-tuning, Flamingo can perform new tasks by conditioning on just a few examples provided in its input context. This is enabled by its cross-attention layers that bridge the frozen vision and language models, allowing the language model to learn from visual demonstrations without updating its weights.
- Example: Provide 2-3 examples of 'image → caption' or 'image, question → answer' to solve novel visual question answering tasks.
- Mechanism: The perceiver-resampler converts variable-sized images into a fixed set of visual tokens, which are seamlessly integrated into the language model's sequence.
The Perceiver-Resampler Architecture
This is Flamingo's key innovation for handling variable visual inputs. The perceiver-resampler is a transformer-based module that sits between the frozen vision encoder and the frozen language model.
- Function: It takes the high-dimensional visual features from the vision encoder (e.g., a NFNet) and resamples them into a fixed, manageable number of visual tokens.
- Purpose: This allows the model to process any number of input images or video frames and present a consistent number of tokens to the language model's cross-attention layers.
- Benefit: Enables efficient processing of long, interleaved sequences of images and text, which is critical for conversational and reasoning tasks.
Open-Domain Visual Dialogue
Flamingo excels at open-ended dialogue about images and videos. By processing an interleaved history of user messages and images, it can conduct coherent, multi-turn conversations grounded in visual content.
- Use Case: A user can upload an image and ask follow-up questions (e.g., "What is this device?" → "How does its mechanism work based on the visible components?").
- Technical Basis: The model's training on massive web-scale alt-text data allows it to handle a vast array of subjects and infer context not explicitly stated in the prompt.
- Distinction: This goes beyond simple captioning to include explanation, comparison, and hypothetical reasoning about visual scenes.
Video Understanding and Reasoning
The architecture naturally extends to video processing by treating a video as a sequence of frames. Flamingo can reason across temporal events, making it suitable for complex video understanding tasks.
- Capability: Answer questions about actions, causality, and sequences of events within a video clip.
- Implementation: Multiple frames are encoded and passed through the perceiver-resampler, creating a temporal sequence of visual tokens for the language model to attend to.
- Benchmark Performance: Achieved state-of-the-art results on benchmarks like VQAv2, OK-VQA, and TVQA at the time of its release, demonstrating strong few-shot performance.
Interleaved Text-Image Generation
While primarily a discriminative model (for understanding), Flamingo's decoder-only language model backbone allows it to perform generative tasks. It can create coherent text that references previously shown images in a sequence.
- Example Task: Given an image and a text prompt ("Write a story about this scene:"), Flamingo can generate a narrative.
- Connection to Modern VLMs: This generative capability directly influenced later autoregressive vision-language models like GPT-4V, which use similar principles for interleaved generation.
- Limitation: As a model from its era, it does not generate images; it generates text conditioned on input images.
Foundation for Modern Multimodal RAG
Flamingo's design principles are foundational for Multi-Modal Retrieval-Augmented Generation (RAG). Its ability to ground language generation in visual context is the conceptual precursor to retrieving and fusing multimodal documents.
- Architectural Blueprint: The use of a frozen pretrained language model augmented with visual inputs is a standard pattern for efficiency.
- Retrieval Analogy: The perceiver-resampler acts like a dynamic, learned retriever, condensing vast visual information into key tokens relevant for the language model's query (the text prompt).
- Legacy: Techniques like cross-attention for modality fusion and few-shot in-context learning are now standard in systems that answer questions using retrieved images, charts, and diagrams.
Flamingo Model Variants and Scale
A comparison of the primary Flamingo model variants, detailing their architectural scale, training data, and few-shot learning capabilities.
| Architectural Feature | Flamingo-3B | Flamingo-9B | Flamingo-80B |
|---|---|---|---|
Total Parameters | 3 Billion | 9 Billion | 80 Billion |
Vision Encoder Backbone | NFNet-F6 | NFNet-F6 | NFNet-F6 |
Language Model Backbone | Chinchilla-70M | Chinchilla-400M | Chinchilla-70B |
Perceiver Resampler Layers | 4 | 4 | 4 |
Cross-Attention Densities | Sparse | Sparse | Sparse |
Pre-training Data (Image-Text Pairs) | ~3B | ~3B | ~3B |
Interleaved Vision-Language Data | |||
Few-Shot Learning Capability | |||
Reported VQA Accuracy (Zero-Shot) | ~45% | ~52% | ~65% |
Reported VQA Accuracy (4-Shot) | ~52% | ~58% | ~70% |
Frequently Asked Questions
Flamingo is a pioneering family of vision-language models from DeepMind. These technical FAQs address its core architecture, capabilities, and its foundational role in modern multi-modal AI systems.
Flamingo is a family of few-shot learning capable vision-language models (VLMs) from DeepMind that processes interleaved sequences of visual and textual data using a novel perceiver-resampler architecture. It works by first encoding images and videos with a frozen, pre-trained vision encoder (like a CNN or Vision Transformer). These visual features are then processed by a key innovation: the Perceiver Resampler. This module acts as a learned, fixed-length bottleneck, converting a variable number of image patches into a fixed, smaller set of visual tokens. These visual tokens are then interleaved with text tokens and fed into a frozen, large language model (LM). The LM, conditioned on these visual tokens, generates the final textual output. Crucially, only the parameters of the Perceiver Resampler and some cross-attention layers are trained, making the model highly parameter-efficient.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Flamingo's architecture introduced key innovations for few-shot vision-language learning. These related concepts define the components and paradigms that enable its multimodal capabilities.
Perceiver-Resampler
The Perceiver-Resampler is Flamingo's core architectural innovation for processing visual data. It acts as a latent bottleneck that converts a variable number of image patches or video frames into a fixed, small number of visual tokens.
- Function: It projects high-dimensional visual features from a frozen vision encoder (like a Normalizer-Free ResNet or Vision Transformer) into a manageable sequence length for the language model.
- Purpose: This enables the language model to efficiently attend to visual context without being overwhelmed by long sequences, crucial for few-shot in-context learning.
- Mechanism: It uses cross-attention layers where a set of learned latent queries attend to the visual features, producing a compact, information-rich visual representation.
Gated Cross-Attention
Gated Cross-Attention (GATED XATTN-DENSE) is the mechanism Flamingo uses to fuse visual information into its language model backbone. It is a modified cross-attention layer inserted between the standard self-attention and feed-forward layers of a frozen, pre-trained language model.
- Architecture: It allows visual tokens from the Perceiver-Resampler to key and value the language model's textual representations, which act as the queries.
- Gating Parameter: A learned, per-layer zero-initialized gating parameter controls how much the visual signal influences the text stream. This allows the model to gradually integrate multimodal capabilities without catastrophically forgetting its pre-trained linguistic knowledge.
- Result: This design enables few-shot learning by conditioning text generation on interleaved visual and textual examples provided in the context.
Interleaved Sequences
Interleaved sequences refer to the training and inference format where visual data (images, video frames) and textual data are mixed in a single, sequential input to the model. This is fundamental to Flamingo's few-shot learning capability.
- Format: A sequence might be:
[Image A], "Caption: A cat on a mat.", [Image B], "Question: What is on the mat? Answer:" - Purpose: By training on such sequences scraped from the web, the model learns the associative structure between modalities, allowing it to perform tasks when presented with similar interleaved examples at inference time.
- Few-Shot Prompting: At inference, a user can provide a few interleaved example pairs (e.g., image-question-answer) followed by a new image and question, and the model generates the answer by analogy.
Frozen Backbones
The frozen backbones strategy refers to Flamingo's use of large, pre-trained models for vision and language that are kept static (their weights are not updated) during multimodal training.
- Vision Encoder: A pre-trained model like NF-ResNet or ViT processes images. Its parameters are frozen, providing strong, general visual features.
- Language Model: A large, pre-trained Chinchilla model (a dense transformer) serves as the core reasoning and generation engine. Its parameters are also frozen.
- Advantage: This approach is highly parameter-efficient. Only the new components—the Perceiver-Resampler, Gated Cross-Attention layers, and modality projection layers—are trained from scratch. It leverages the world knowledge and linguistic prowess of massive pre-trained models without the cost of full fine-tuning.
Few-Shot In-Context Learning
Few-shot in-context learning (ICL) is the primary operating mode for Flamingo, where the model performs a new task by conditioning on a small number of input-output examples provided in its prompt, without any gradient-based updates.
- Mechanism: Given a prompt containing interleaved visual-textual examples (e.g.,
image1, question1, answer1, image2, question2, answer2, image3, question3), the model autoregressively generates the answer for the final example. - Multimodal Extension: Flamingo extended the text-only ICL capability of models like GPT-3 to the visual domain. It learns the mapping between vision and language from billions of web-scraped image-text pairs, enabling this emergent behavior.
- Significance: This allows the model to rapidly adapt to new visual tasks—like VQA, captioning, or classification—solely through prompting, mimicking a form of instant learning.
Massive Multimodal Pre-training
Massive multimodal pre-training describes the scale of data used to train Flamingo, which is essential for its strong few-shot capabilities. The model was trained on a custom dataset of interleaved image-text and video-text sequences sourced from the web.
- Dataset Composition: It included:
- M3W: A filtered subset of 43 million web pages with interleaved images and text.
- ALT-Text: 1.8 billion image-text pairs.
- VTP: 27 million short video-text pairs.
- Objective: The training objective was a standard causal language modeling loss, predicting the next token in a sequence containing both text and the special visual tokens output by the Perceiver-Resampler.
- Outcome: This scale of training on noisy, real-world data taught the model the statistical relationships between vision and language necessary for robust in-context learning across diverse tasks.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us