TL;DR
PixelSNAIL is a generative model that achieves state-of-the-art results in image density estimation by combining the local processing power of causal convolutions with the long-range "memory" of self-attention. By interleaving these two architectures, the model overcomes the finite receptive field limitations of previous models like PixelCNN, allowing it to better capture global structure in high-dimensional data.
What Problem Does This Paper Address?
Autoregressive generative models work by predicting the next element in a sequence (like a pixel in an image) based on all previous elements. While highly effective, their performance is fundamentally limited by how well the underlying neural network can "remember" and access information from earlier in the sequence.
Previous approaches had distinct trade-offs:
- RNNs (LSTMs/GRUs): These process information linearly, which often leads to a "bottleneck" where distant information is forgotten or diluted.
- Causal Convolutions (e.g., PixelCNN): These offer high-bandwidth access to local data, but they have a finite "receptive field." To see the whole image, you need an extremely deep stack of layers, and even then, signal attenuation occurs for distant pixels.
- Self-Attention: This allows for an "unbounded" receptive field—the model can look back at any previous pixel with equal ease. However, attention typically provides "pinpoint" access to specific pixels and can struggle to aggregate dense local context efficiently.
Methods
The authors introduce PixelSNAIL, an architecture that interleaves two primary building blocks to get the "best of both worlds":
- Residual Blocks: These utilize masked 2D convolutions. The masking ensures causality (a pixel can only "see" pixels above and to the left of it). These blocks are excellent at aggregating local neighborhood information.
- Attention Blocks: These perform a single key-value lookup (similar to the Transformer architecture). Because attention doesn't care about distance, it allows the model to query any previously generated part of the image, regardless of how far away it is spatially or temporally.
The model consists of multiple combined blocks. By using convolutions to build a rich local context and then using attention to look across those contexts globally, PixelSNAIL can model complex, long-range dependencies more effectively than models relying on only one of these techniques.
Datasets
The model was evaluated on three standard benchmarks for image density estimation:
- CIFAR-10: A dataset of 60,000 32x32 color images.
- 32 × 32 ImageNet: A downsampled version of the massive ImageNet dataset.
- 64 × 64 ImageNet: A higher-resolution downsampled version of ImageNet.
Key Insights and Ideas
- The Power of Interleaving: The core "aha moment" is that convolutions and attention are complementary. Convolutions are great at "what is happening right here," while attention is great at "how does this relate to what happened way over there."
- Cross-Domain Inspiration: The architecture is adapted from SNAIL (Simple Neural Attentive Learner), a model originally designed for meta-reinforcement learning. This highlights how breakthroughs in sequence modeling for RL can be directly applied to generative modeling.
- High-Bandwidth vs. Unbounded Access: The paper frames the design choice as a balance between high-bandwidth local access (convolutions) and undeteriorated global access (attention).
Key Results
PixelSNAIL set new state-of-the-art benchmarks for log-likelihood (measured in bits per dimension, where lower is better) at the time of its publication:
| Dataset | PixelSNAIL (Ours) | Previous Best (e.g., PixelCNN++, Image Transformer) |
|---|---|---|
| CIFAR-10 | 2.85 | 2.90 (Block Sparse PixelCNN++) |
| 32 × 32 ImageNet | 3.80 | 3.81 (Image Transformer) |
| 64 × 64 ImageNet | 3.52 | 3.57 (Gated PixelCNN) |
The results demonstrate that combining these two architectural motifs consistently outperforms using either one in isolation, leading to highly coherent generated image samples.
Limitations and Future Work
The primary drawback of PixelSNAIL—and autoregressive models in general—is sampling speed. Because the model must generate pixels one by one, sequentially, it is significantly slower at generating images than non-autoregressive models like GANs (Generative Adversarial Networks) or VAEs (Variational Autoencoders).
The authors acknowledge that while PixelSNAIL improves the quality of the model (better log-likelihood), it does not solve the inherent efficiency problem of sequential sampling. Finding ways to speed up this process without sacrificing the performance gains of the SNAIL architecture remains an open challenge.
Summary updated