# Flamingo (2022)

> Bridged a frozen vision encoder and a frozen LLM with gated cross-attention so one model learns new visual tasks from a few examples in the prompt.

Page: https://mralbu.github.io/ai-datasets/p/flamingo

## Key facts

- Title: Flamingo: a Visual Language Model for Few-Shot Learning
- Authors: Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, Roman Ring, Eliza Rutherford, et al.
- Venue: NeurIPS 2022
- Category: Vision
- Paper: https://www.alphaxiv.org/abs/2204.14198

## Why it matters

CLIP aligned images with short captions, but could not generate text or hold a multi-image conversation. Flamingo brought GPT-3's in-context few-shot prompting to vision and video, proving that pretrained vision and language backbones could be stitched together into a single generalist visual language model.

## The idea

Take a contrastively pretrained vision encoder and a large language model (Chinchilla) and keep both frozen. A Perceiver Resampler compresses variable numbers of image or video features into a fixed set of visual tokens, and freshly initialized gated cross-attention layers—starting at zero so the language model stays intact at step one—are interleaved between the frozen LLM blocks and trained on web pages with mixed images and text.

## The result

Flamingo-80B reached 56.3% zero-shot and 67.6% 32-shot on VQA v2, 113.8 CIDEr on COCO captions and 37.9% 32-shot on TextVQA without OCR—and when fine-tuned set a new state of the art of 82.0% on VQA v2.

## The data

- [VQA v2 (2017)](https://mralbu.github.io/ai-datasets/d/vqa-v2.md): 1.1 million questions about COCO photos, each answered by ten people.
- [MS COCO (2014)](https://mralbu.github.io/ai-datasets/d/coco.md): 330k everyday scenes with 1.5M labeled objects in 80 categories.
- [Flickr30k (2014)](https://mralbu.github.io/ai-datasets/d/flickr30k.md): 31,000 Flickr photos of people and everyday scenes, each with five written captions.
- [TextVQA (2019)](https://mralbu.github.io/ai-datasets/d/textvqa.md): 45,000 questions about signs, labels, clocks and book covers in everyday photos, each answered by ten people.
- [ImageNet (ILSVRC) (2009)](https://mralbu.github.io/ai-datasets/d/imagenet.md): 1.28 million photos across 1,000 classes, the dataset behind the deep learning boom.

## Builds on

- [CLIP (2021)](https://mralbu.github.io/ai-datasets/p/clip.md)
- [GPT-3 (2020)](https://mralbu.github.io/ai-datasets/p/gpt-3.md)

## Led to

- [BLIP-2 (2023)](https://mralbu.github.io/ai-datasets/p/blip-2.md)

## Part of

- [Modern VLMs](https://mralbu.github.io/ai-datasets/t/modern-vlms.md) (step 2 of 8)
