ICML 2021 / ICLR 2022

Perceiver & Perceiver IO

What if you could build one architecture that handles images, audio, video, point clouds, and any combination — without redesigning anything? The Perceiver achieves this with a beautifully simple trick: instead of making the input attend to itself (which is O(N^2) and blows up for large inputs), it uses a small learned latent array to read from the input via cross-attention, then processes that compressed representation cheaply.

CrossAttn(Q=Latent, KV=Input) → SelfAttn(Latent) × L
Cost: O(N * M + M2) instead of O(N2)  where M << N
Jaegle, Gimeno, Brock, Zisserman et al. — DeepMind 2021-2022

Transformers revolutionized NLP with self-attention, but they have a fundamental scaling problem: self-attention costs O(N^2) in sequence length. For text with 512 tokens, that is only 262,144 attention entries — perfectly manageable. But real-world perception operates at a completely different scale. A 224x224 RGB image is 50,176 pixels. Two seconds of audio at 16kHz is 32,000 samples. A 10-second video clip at 224x224 is over 1.5 million tokens. Running self-attention on these inputs would require terabytes of memory and astronomical compute.

Vision Transformers (ViT) found a clever workaround: split images into 16x16 patches, reducing 50K pixels to just 196 tokens. This works brilliantly for images, but it is a modality-specific hack. It throws away per-pixel detail, it does not work for audio, it does not work for video, and it does not work for point clouds. Every new modality needs its own tokenization trick. The Perceiver asks a more fundamental question: can we build one architecture that handles any input size, for any modality, with no modality-specific engineering?

The answer is yes — but it requires rethinking what attention is for. Instead of having the input attend to itself (which scales quadratically with input size), the Perceiver introduces a small learned latent array that reads from the input via cross-attention. This decouples the processing cost from the input size entirely. The input can be 50K pixels, 100K audio samples, or 1M video frames — the processing cost stays the same because it depends only on the small latent array size.

50K
Pixels in a 224x224 image
Standard ViT: 196 patch tokens
2.5B
Attention entries for 50K tokens
Impossible with self-attention
512
Perceiver latent tokens (fixed)
Only 25M attention entries

Did You Know?

The O(N^2) attention cost is not just a theoretical concern — it is the practical reason why most transformer-based models cannot directly process high-resolution images, long audio clips, or video. The memory required to store the attention matrix for 50K tokens at fp32 is ~10 GB just for a single layer and a single attention head. The Perceiver reduces this to ~50 MB by using 512 latent tokens.

The Perceiver's core innovation is elegantly simple: a learned latent array of M tokens (typically 256-1024, often 512) that cross-attends to the input of N tokens. In this cross-attention, the queries come from the small latent arrayand the keys and values come from the large input. This costs O(N * M) instead of O(N^2). Since M is fixed and much smaller than N, the cost is linear in input size.

Think of it like a small committee of experts (the latent array) interviewing a large crowd (the input). Each expert asks their own questions (queries) and listens to everyone in the crowd (keys/values). The committee has 512 members, so you only need 512 sets of questions — regardless of whether the crowd has 50,000 people (image pixels) or 100,000 (audio samples). The cost depends on the committee size, not the crowd size.

Crucially, the latent array is learned from scratch during training — it is not derived from the input. Each latent token starts as a learned embedding and gets populated with information from the input through cross-attention. Over training, these latent tokens learn to “ask” for the information they need: one token might specialize in attending to edges, another to colors, another to spatial relationships. The network discovers what to extract from the input, rather than being told.

Cross-Attention Bottleneck: The Key to Handling Massive Inputs

Standard Transformers compute self-attention over all input tokens. For an image with 50,000 pixels or audio with 100,000 samples, the attention matrix is N x N — that is 2.5 billion entries for images, far too large for any GPU.

Self-Attention Memory: O(N^2)
Text (512 tokens)
2.6e+5
Image (50K pixels)
2.5e+9
Audio (100K samples)
1.0e+10
Video (2M patches)
4.0e+12

Self-attention on raw pixels is impossible — the attention matrix would be larger than GPU memory. This is why Vision Transformers use patches!

The Cross-Attention Insight

The Perceiver decouples input size from processing cost. No matter how large the input, the bottleneck compresses it to a fixed number of latent tokens. All the expensive self-attention happens in the small latent space, making it practical to process images, audio, video, and multimodal data with the same architecture.

Standard Self-Attention

Q, K, V all from: Input (N tokens)
Attention matrix: N x N
Cost: O(N^2) — quadratic in input size
For 50K tokens: ~2.5 billion entries

Perceiver Cross-Attention

Q from: Latent array (M tokens)
K, V from: Input (N tokens)
Attention matrix: M x N
For 50K tokens: ~25 million entries (100x smaller)

The full Perceiver architecture has three conceptual stages, and their simplicity is what makes the model so powerful. Stage 1: Cross-attention from latent to input — this is where the small latent array reads information from the large input. Stage 2: Self-attention among latent tokens — standard transformer blocks that process the compressed information, repeated L times. Stage 3: a task-specific output head (e.g., a linear classifier for classification tasks).

The key insight is that all the expensive processing happens in the latent space, which is small and fixed-size. The only place where the full input appears is in the cross-attention step, which is linear in input size. After cross-attention compresses the input into M latent tokens, all subsequent self-attention layers operate on just M tokens. Since M is typically 512, you can stack 6-8 self-attention blocks without any memory or compute issues, even for inputs with 50K+ tokens. The total cost is O(N * M + L * M^2) — linear in input size N, quadratic only in the small latent size M.

Input (N tokens, any modality)
Cross-Attention (encode)
Q from latent, K/V from input — O(N*M)
Latent Self-Attention (x L layers)
Standard transformer blocks — O(M^2), independent of N
Output (task-specific)

Why This Works: The Bottleneck Analogy

The latent array acts as a compressed representation of the input — think of it like a summary. Cross-attention reads from the input; self-attention processes this summary. Since M is small (512), the self-attention layers can be deep (6-8 blocks) without excessive cost. This is similar to how a human might scan a long document (cross-attention to input), form a mental model (latent representation), and then reason about that mental model (self-attention on latents) rather than re-reading the entire document for every thought.

Did You Know?

The Perceiver's bottleneck concept has deep connections to information theory. By compressing N input tokens into M latent tokens (where M is much smaller than N), the model is forced to learn which information is most relevant for the downstream task — a form of the Information Bottleneck principle (Tishby et al., 2000). This compression acts as a powerful regularizer, preventing the model from overfitting to noise in the high-dimensional input.

The Perceiver treats all modalities the same way: flatten the input into a 1D sequence of tokens, add position encodings that describe the spatial/temporal structure, and feed it through cross-attention. Images, audio, video, point clouds, and even combinations are all just differently-shaped sequences of feature vectors. The architecture does not need to know or care what modality it is processing.

This is a radical departure from how most architectures work. CNNs are designed specifically for 2D grid data (images). RNNs are designed for sequential data (text, audio). Graph neural networks are designed for graph-structured data. Each modality gets its own specialized architecture with its own inductive biases. The Perceiver throws all of this away and says: every modality is just a bag of tokens with position information.

For images, each pixel becomes a token with (R, G, B) features and (x, y) position encoding. For audio, each time step becomes a token with amplitude features and (t) position encoding. For video, each pixel in each frame becomes a token with (R, G, B) features and (x, y, t) position encoding. For multimodal data (e.g., image + audio), just concatenate the token sequences with their respective position encodings. The architecture handles it all identically.

Modality-Agnostic: One Architecture for All Data Types

Images
Input representation
Each pixel is a token with position + RGB features
Typical size
224x224 = 50,176 tokens
Position encoding
2D position (x, y) + Fourier features
Example task
ImageNet classification, detection
Raw Input
Flatten + Position Encoding
...
Unified token sequence: position + features
True Modality-Agnosticism

The Perceiver treats all modalities as byte arrays — sequences of tokens with position encodings. Images, audio, video, point clouds, and even combinations are all just differently-shaped sequences. The same architecture processes them all.

Advantages of Modality Agnosticism
No redesign needed: Same architecture for any new modality
Multimodal for free: Just concatenate token sequences
Transfer learning: Pre-trained latents may transfer across modalities
Simplicity: One codebase, one training recipe, one set of hyperparameters
The Trade-off
No locality bias: Cannot exploit spatial structure like CNNs do
No temporal bias: Cannot exploit sequential structure like RNNs do
Result: Needs more data/compute to learn patterns that specialized architectures get for free
But: No wrong inductive biases for unusual modalities

A single cross-attention pass may not capture all the information in the input. Consider a complex image: one pass might capture the coarse structure (large objects, overall layout), but miss fine details (textures, small objects, spatial relationships). The Perceiver addresses this by repeating the cross-attention step multiple times, allowing the latent array to iteratively refine its representation — attending to different aspects of the input at each iteration.

The typical pattern is: cross-attend to input, do some self-attention, cross-attend to input again, do more self-attention, and so on. Each cross-attention pass has the opportunity to extract new information from the input based on what the latent array has already learned. Crucially, the cross-attention weights can be shared across iterations, keeping the total parameter count low. This is similar to how recurrent networks reuse weights across time steps — more computation without more parameters.

Without Iteration

One cross-attention pass. The latent array gets a single chance to read from the input. May miss important details or fail to integrate distant information. Like reading a complex document once — you get the gist but miss nuances.

With Iteration (x2-8)

Multiple cross-attention passes. Each pass can attend to different aspects of the input based on what was learned previously. Shared weights keep cost low. Like re-reading a document with specific questions in mind — each pass extracts new information.

Weight Sharing: More Computation, Same Parameters

The cross-attention weights can be shared across all iterations. This means doubling the iterations doesn't double the parameters. The model gets more computation (and better accuracy) without increased overfitting risk. In practice, 2-8 iterations work well. The paper found that weight-sharing barely affects accuracy compared to independent weights, while dramatically reducing model size. This economy of parameters is one of the Perceiver's most elegant features.

Did You Know?

Iterative cross-attention is conceptually related to the EM algorithm in statistics. The latent array represents a “hypothesis” about the input, and each cross-attention iteration refines that hypothesis by reading more information from the data. This expectation-maximization style loop is a recurring pattern in machine learning — the Perceiver simply implements it with attention mechanisms.

The original Perceiver had a limitation: it could only produce fixed-size outputs (like a classification vector). But many tasks need structured, variable-size outputs — per-pixel segmentation maps, token-by-token language model outputs, per-point classifications. Perceiver IO solves this with a beautiful symmetric extension: output queries that cross-attend to the latent array.

The idea mirrors the input cross-attention but in reverse. For input, the latent array queries the input (latent queries, input keys/values). For output, a set of output query tokens query the latent array (output queries, latent keys/values). The number of output queries determines the output shape. For classification: 1 query that asks “what class is this?” For dense segmentation: H x W queries, one per pixel. For language modeling: seq_len queries, one per token position. This makes the architecture truly general-purpose for any input-output mapping.

Perceiver IO: Flexible Output Decoding

Perceiver IO extends the original Perceiver with a flexible output decoder. Instead of a fixed output, it uses output queriesthat cross-attend to the latent array. Different queries produce different outputs.

Input Byte Array
Perceiver Encoder
Cross-Attn + Latent Self-Attn (x6)
Latent Array (512 x D)
Output Queries
Cross-Attend to Latent
Output: Single class label
Output Query

1 learned task query

Shape: 1 x num_classes
Decoder

Single query cross-attends to latent array, followed by linear classifier

The Power of Output Queries

Perceiver IO's decoder is a single cross-attention from output queries to the latent array. By designing different queries, the same model can do classification (1 query), dense prediction (H*W queries), language modeling (seq_len queries), or any other task. The architecture is truly universal.

Classification

1 output query → 1 class logit vector. The single query asks the latent array to summarize everything into a class prediction.

Dense Prediction

H x W output queries → per-pixel labels. Each query carries a position encoding indicating which pixel it corresponds to.

Language Modeling

seq_len output queries → per-token predictions. Each query has a position encoding indicating which token position to predict.

The Symmetry of Perceiver IO

Perceiver IO has a beautiful symmetry: both input encoding and output decoding use the same mechanism (cross-attention), just in opposite directions. Input cross-attention compresses N input tokens into M latent tokens. Output cross-attention expands M latent tokens into K output tokens. The latent space serves as a universal intermediate representation — like a lingua franca that both the input and output sides can speak.

The Perceiver achieves competitive results across multiple modalities with the same architecture — no modality-specific components, no specialized preprocessing (beyond basic tokenization), and the same training recipe. This is remarkable because specialized architectures have had years of tuning for their specific modalities, while the Perceiver uses a single general-purpose design.

On ImageNet, the Perceiver achieves 79.0% top-1 accuracy processing raw pixels — competitive with specialized vision models, though not quite matching the best ViT variants that benefit from patch-based inductive biases. When combined with a small convolutional preprocessor (Conv + Perceiver), accuracy jumps to 84.5%. On AudioSet, processing raw audio waveforms, it achieves 38.4 mAP — outperforming many audio-specific architectures. On ModelNet40 point clouds, it reaches 85.7% accuracy. The Perceiver proves that generality and competitiveness are not mutually exclusive.

Perceiver Results

ImageNet (top-1): 79.0% (raw pixels) / 84.5% (with convolutions)
AudioSet (mAP): 38.4 (from raw audio)
ModelNet40: 85.7% (3D point clouds)
Kinetics-700: Competitive with specialized models
StarCraft: Multi-modal (images + text + scalars)

Key Insight

A single architecture achieves reasonable performance on images, audio, video, and 3D data — without any modality-specific components. While specialized models still win on individual benchmarks, the Perceiver shows that generality doesn't require sacrificing too much performance. The gap to specialized models is typically only 2-5%, which is remarkable for an architecture with zero domain-specific inductive biases.

Did You Know?

Perceiver IO achieved state-of-the-art results on the Sintel optical flow benchmark — a task that traditionally requires very specialized architectures like RAFT. It also matched or beat BERT-style models on GLUE language understanding benchmarks, demonstrating that the architecture works for text just as well as perception tasks. This breadth of capability from a single architecture had never been demonstrated before.

Since the Perceiver treats all inputs as 1D sequences of tokens, it needs a way to tell tokens apart based on their original position in the input structure. This is where Fourier position encodings come in — sinusoidal functions at different frequencies applied to each coordinate dimension. For images: (x, y). For audio: (t). For video: (x, y, t). These are concatenated with the token features before cross-attention.

Why Fourier features instead of learned positional embeddings (like in BERT or ViT)? Because learned embeddings are fixed to the training resolution. A ViT trained on 224x224 images with 196 patch tokens has exactly 196 learned position embeddings. If you try to use it on a 384x384 image (529 tokens), the learned embeddings cannot generalize. Fourier features, on the other hand, are defined by a continuous function — you can evaluate them at any resolution, making the Perceiver naturally resolution-agnostic.

1D (Audio)
PE(t) = [sin(f_1*t), cos(f_1*t), ...]
Time position only — captures temporal structure
2D (Image)
PE(x,y) = [PE(x), PE(y)]
Spatial position — captures 2D layout
3D (Video)
PE(x,y,t) = [PE(x), PE(y), PE(t)]
Spatial + temporal — captures motion

Fourier Features vs Learned Embeddings

The Fourier encoding uses a bank of sinusoidal functions at logarithmically-spaced frequencies: [sin(2^0 * pi * x), cos(2^0 * pi * x), sin(2^1 * pi * x), ...]. Low frequencies capture coarse position (left vs right), while high frequencies capture fine position (adjacent pixels). This is the same principle as NeRF's positional encoding and the original Transformer's sinusoidal position embeddings — a universal technique for encoding position without learning.

The Perceiver makes a fundamental trade-off: it gains modality agnosticism and linear scaling, but it gives up the inductive biases that help specialized architectures learn efficiently. A CNN “knows” that nearby pixels are related (locality) and that features can appear anywhere in an image (translation equivariance). The Perceiver knows none of this — it must learn these patterns from data alone, which typically requires more training data and compute.

The latent bottleneck is both a strength and a limitation. It enables linear scaling, but it also means the model must compress all relevant information into M tokens. For tasks requiring fine-grained spatial detail (like dense segmentation or super-resolution), 512 latent tokens may not be enough to preserve all the necessary information. Increasing M helps but increases the self-attention cost quadratically.

Limitations
Lower peak accuracy: Specialized models still outperform on individual modalities
No local inductive bias: Lacks convolution-like priors that help on vision tasks
Latent bottleneck: Information compression may lose fine-grained details
Training cost: Still expensive for very large inputs
Not yet dominant: Specialized models preferred when maximum accuracy is needed
Impact
Multimodal architectures: Inspired Gato, Flamingo, and other generalist models
Cross-attention paradigm: Widely adopted for bridging modalities
Latent bottleneck: Used in robotics (RT-2), video models, and more
General perception: Proved one architecture can handle many modalities
Design influence: Shaped how researchers think about scalable attention

The Perceiver demonstrated something that many researchers doubted: a single, general-purpose architecture can handle diverse modalities without task-specific engineering. This was not just a technical contribution — it was a philosophical statement about the nature of perception. The paper argued that all perception is fundamentally the same problem: extracting relevant information from high-dimensional input. The modality is incidental; the architecture should be universal.

The cross-attention bottleneck became a standard architectural patternin multimodal AI. DeepMind's Flamingo uses Perceiver-style cross-attention to condition a language model on visual inputs. Gato, DeepMind's generalist agent, uses a Perceiver-like architecture to handle text, images, and robot actions with a single model. Google's RT-2 uses cross-attention to ground language instructions in robot visual observations. The pattern of “compress large input via cross-attention, then process cheaply” has become ubiquitous.

Perhaps most importantly, the Perceiver paved the way for today's generalist AI systems. The idea that one architecture can perceive any modality — that vision, audition, and language are just different flavors of the same underlying problem — is a cornerstone of the path toward artificial general intelligence. While we are still far from that goal, the Perceiver showed that modality-specific architectures are not a fundamental requirement, just a historical convenience.

Direct Descendants
Flamingo: Cross-attention bridges vision and language
Gato: Generalist agent across 600+ tasks
RT-2: Robot policies from vision-language models
Perceiver AR: Autoregressive variant for sequence generation
Broader Influence
Cross-attention everywhere: Standard pattern in multimodal models
Latent bottleneck: Adopted in diffusion models, video understanding
General perception: Shifted research toward universal architectures
Scalable attention: Influenced Mamba, RWKV, and other linear attention work

The Perceiver's Legacy

The Perceiver's deepest contribution is not its specific architecture but its proof of concept: general-purpose perception is possible without modality-specific engineering. This idea — that the right bottleneck can make any input tractable — has become a guiding principle for the next generation of AI systems. Every time you see a model that processes multiple modalities through a shared latent space, you are seeing the Perceiver's influence at work.

Perceiver Deep-Dive Quiz

Question 1 of 10

What is the main problem the Perceiver solves?

You now understand how the Perceiver processes any modality with one architecture.

From the cross-attention bottleneck that decouples input size from processing cost, to the learned latent arrays that compress information, to iterative refinement that progressively deepens understanding, to Perceiver IO's flexible output queries — you have explored the architecture behind truly general-purpose perception and its far-reaching influence on modern multimodal AI.

O(N*M)
Linear in input size
512
Latent tokens (fixed)
5+
Modalities handled
1
Architecture for all
Next up: AlphaGo Zero — how self-play and MCTS discovered superhuman Go strategies without any human knowledge.