TL;DR
SAGAN introduces a self-attention mechanism to Generative Adversarial Networks, allowing the model to coordinate fine details across distant image regions for better global structural consistency. By combining this architecture with spectral normalization in the generator, the authors achieved a new state-of-the-art on ImageNet, significantly boosting the Inception Score from 36.8 to 52.52.
What Problem Does This Paper Address?
Traditional Generative Adversarial Networks (GANs) rely almost exclusively on convolutional layers. While convolutions are excellent at capturing local patterns (like the texture of fur or the edge of a leaf), they have a fundamental weakness: a limited receptive field.
To model long-range dependencies—such as ensuring that all four legs of a dog are anatomically consistent or that the symmetry of a face is maintained—a purely convolutional network must pass information through many layers. This makes it difficult for the model to learn global constraints, often resulting in "broken" geometries where local textures are realistic but the overall structure is nonsensical. The authors sought a way to let the network "look" at the entire image simultaneously when generating or evaluating any single pixel.
Methods
The core contribution is the Self-Attention Generative Adversarial Network (SAGAN). The authors introduce a self-attention module (illustrated in Figure 2) that calculates the response at a specific position as a weighted sum of features at all positions in the image.
Key technical components include:
- Self-Attention Module: Features from the previous layer are transformed into three spaces: query ($f$), key ($g$), and value ($h$). The attention map is calculated by the dot product of $f$ and $g$, determining how much "attention" each pixel pays to every other pixel.
- Spectral Normalization (SN) in the Generator: While SN was previously used to stabilize the Discriminator, the authors apply it to the Generator as well. This prevents parameter escalation and improves training dynamics, allowing for a 1:1 update ratio between the Generator and Discriminator.
- Two-Timescale Update Rule (TTUR): The authors use different learning rates for the Generator (0.0001) and Discriminator (0.0004) to compensate for the slow learning often seen in regularized discriminators.
Datasets
The models were trained and evaluated on the LSVRC2012 (ImageNet) dataset, specifically generating images at a 128x128 resolution. This is a standard but highly challenging benchmark due to its 1,000 diverse object classes.
Key Insights and Ideas
- Attention is Complementary to Convolution: The authors found that self-attention works best when applied to feature maps with higher resolutions (e.g., $32 \times 32$ or $64 \times 64$). In these layers, the attention mechanism has the freedom to coordinate global shapes, while earlier, smaller layers still benefit from the local efficiency of standard convolutions.
- Beyond Spatial Adjacency: Visualization of the attention maps (Figure 1 and 5) reveals that the model doesn't just look at nearby pixels. Instead, it learns to attend to semantically related regions. For example, when generating a dog's leg, the model attends to the other legs, regardless of their spatial distance.
- Stability via Normalization: Applying Spectral Normalization to the Generator was a crucial "aha moment." It significantly stabilized training, eliminating the need for the common (and computationally expensive) trick of updating the Discriminator five times for every one Generator update.
Key Results
SAGAN delivered a massive quantitative leap over previous state-of-the-art models like SNGAN-projection:
- Inception Score (IS): Increased from 36.8 to 52.52.
- Fréchet Inception Distance (FID): Reduced from 27.62 to 18.65.
Qualitatively, the improvement is most visible in classes with complex geometric structures. As shown in Figure 6, SAGAN produces much more coherent animals (like the Saint Bernard) and intricate objects compared to previous methods, which often struggled with limb placement and global symmetry.
Limitations and Future Work
The authors note that for classes characterized primarily by texture rather than geometry (like "stone wall" or "coral fungus"), the self-attention mechanism provides less of an advantage over standard convolutional GANs. This suggests that the "local" bias of convolutions is actually beneficial for simple textures.
Future work could explore more memory-efficient versions of self-attention to allow for even higher-resolution image generation (e.g., 512x512 or 1024x1024), as the memory cost of the attention matrix scales quadratically with the number of pixels.
Summary updated