Improved Transformer for High-Resolution GANs

Long Zhao, Zizhao Zhang, Ting Chen, Dimitris N. Metaxas, Han Zhang

Introduction

Generative Adversarial Networks (GANs) have traditionally been dominated by Convolutional Neural Networks (CNNs) due to their inherent inductive biases for image data, such as locality and translation invariance. While Transformers have revolutionized natural language processing and discriminative vision tasks, they face significant challenges in high-resolution image generation. Specifically, the quadratic computational complexity of standard self-attention and the difficulty in maintaining global spatial coherency across millions of pixels have hindered their adoption in this domain.

HiT (High-resolution Transformer) addresses these hurdles by introducing a novel, convolution-free generator architecture that scales efficiently to $1024 \times 1024$ synthesis. By rethinking the application of attention across different scales, HiT achieves state-of-the-art performance for Transformer-based GANs while maintaining computational throughput comparable to highly optimized CNN models like StyleGAN2.

Methods

The HiT generator employs a hierarchical approach, dividing the image synthesis process into two distinct phases: structural layout and texture rendering.

The HiT architecture utilizes a hierarchical design with Multi-Axis Nested Transformers for low-resolution structure and Implicit Functions (MLPs) for high-resolution details.

Low-Resolution Stages: Structural Layout

In the initial stages (from $8 \times 8$ to $64 \times 64$ resolution), the model focuses on establishing the global structure and layout of the image. To overcome the quadratic bottleneck, HiT introduces Multi-Axis Blocked Self-Attention. The feature map is divided into non-overlapping blocks, and attention heads are split: half perform regional attention (capturing local dependencies within a block) and the other half perform dilated attention (capturing global dependencies across blocks). This strategy reduces complexity from $O(N^2)$ to $O(N\sqrt{N})$, re-introducing a form of spatial locality that aids the Transformer in learning image structures.

High-Resolution Stages: Texture Synthesis

For resolutions exceeding $64 \times 64$, HiT transitions to pure Multi-Layer Perceptrons (MLPs). The authors observe that once the global layout is established, self-attention becomes redundant for high-frequency details. By treating the generator as an Implicit Neural Function, the MLPs predict pixel values based on local features and coordinates. This phase operates with linear $O(N)$ complexity, allowing the model to scale to ultra-high resolutions without the memory overhead of global attention.

Cross-Attention for Self-Modulation

To guide the generation process, HiT replaces traditional style modulation techniques (like AdaIN) with a cross-attention module at every stage. Intermediate features act as the "query," while a projection of the input latent code $z$ provides the "key" and "value." This mechanism allows the global latent intent to modulate features at every scale more naturally within a Transformer framework.

Key Results

HiT was evaluated on several high-resolution benchmarks, including ImageNet ($128 \times 128$), FFHQ ($256 \times 256$ and $1024 \times 1024$), and CelebA-HQ ($1024 \times 1024$).

Quantitative comparison showing HiT (Ours) achieving superior FID and Inception Scores compared to previous GAN architectures.

The model represents a significant milestone for convolution-free generators:

  • State-of-the-Art Performance: On FFHQ $256 \times 256$, HiT achieved an FID score of 2.95, matching top-tier CNN models.
  • Scaling to 1K: It is the first pure Transformer-based GAN to successfully generate $1024 \times 1024$ images with competitive results, such as an FID of 8.83 on CelebA-HQ.
  • Efficiency: The HiT-S variant achieves a throughput of approximately 86 images/sec, nearly matching the 95 images/sec of StyleGAN2.

Conclusion and Future Work

HiT demonstrates that Transformers can be highly effective image generators when their architecture is tailored to the hierarchical nature of visual data. By using attention for layout and MLPs for pixels, the model balances global coordination with local detail efficiency. Future work remains in closing the performance gap at extreme resolutions and exploring "pure" Transformer GANs that utilize Transformer-based discriminators.

Summary updated

BibTeX
@inproceedings{zhao2021improved,
  author = {Long Zhao and Zizhao Zhang and Ting Chen and Dimitris N. Metaxas and Han Zhang},
  title = {{Improved Transformer for High-Resolution GANs}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=zmbiQmdtg9},
}
Figure