summaries: The paper proposes a transformer based generative model which shows competitive results on multiple image generation benchmarks. It combines existing techniques of blocked and axial attention to reduce the computational complexity of self-attention mechanism. To further reduce the complexity, the proposed attention mechanism is only used at lower resolution blocks. The paper also employs technique similar to self-modulation to condition image generation process on the input latent code at all levels.   This paper has presented HiT, a Transformer-based generator for high-resolution image synthesis based on GANs. Instead of using full attention, this paper has proposed the multi-axis blocked self-attention, which captures local and global dependencies within non-overlapping image blocks in parallel. In addition, HiT introduces the cross-attention mechanism to integrate noise information into multi-stages of the generator. Extensive experiments demonstrate the superiority of the proposed method. To address the quadratic complexity of the self-attention operation, this paper proposes a new Transformer-based generator for high-resolution image generation based on GANs, denoted as HiT. In the low-resolution stage, the authors propose a multi-axis blocked self-attention. In the high-resolution stage, they keep multi-layer perceptrons reminiscent of the implicit neural function. Extensive experiments demonstrate the effectiveness of the proposed method.  This paper proposes a new transformer-based generator for high-resolution image generation. It addresses the quadratic scaling problem of the attention operator with multi-axis blocked self-attention which considering the within blocks and across blocks attention. The proposed cross-attention for input and intermediate features is also novel. The evaluation is done in ImageNet and FFHQ datasets.  Promising results are provided.  The paper describes a purely attention-based GAN generator architecture where low-resolution deeper layers feature larger-scale (more distant) communication and higher-resolution layers synthesize locally using MLPs,  but still conditioned (indirectly) on the initial latent code.  State-of-the-art results are claimed for 128^2 unconditional ImageNet synthesis (but I believe this claim to be false, see below). In addition, results are shown for CelebA-HQ and FFHQ. While the architecture have some similarities to the near-concurrent work of Hudson and Zitnick (ICML 2021), lack of comparisons should not be held against this paper.  I remain unconvinced by the argumentation and how the results support them. Visually high-quality results are only shown for the simple face image datasets, for which attention mechanisms do not appear to be as necessary as for more complex ones that feature scene compositions. I feel I do not walk away feeling that I learned something.
abstractText: Attention-based models, exemplified by the Transformer, can effectively model long range dependency, but suffer from the quadratic complexity of self-attention operation, making them difficult to be adopted for high-resolution image generation based on Generative Adversarial Networks (GANs). In this paper, we introduce two key ingredients to Transformer to address this challenge. First, in low-resolution stages of the generative process, standard global self-attention is replaced with the proposed multi-axis blocked self-attention which allows efficient mixing of local and global attention. Second, in high-resolution stages, we drop self-attention while only keeping multi-layer perceptrons reminiscent of the implicit neural function. To further improve the performance, we introduce an additional self-modulation component based on cross-attention. The resulting model, denoted as HiT, has a nearly linear computational complexity with respect to the image size and thus directly scales to synthesizing high definition images. We show in the experiments that the proposed HiT achieves state-of-the-art FID scores of 30.83 and 2.95 on unconditional ImageNet 128 × 128 and FFHQ 256 × 256, respectively, with a reasonable throughput. We believe the proposed HiT is an important milestone for generators in GANs which are completely free of convolutions. Our code is made publicly available at https://github.com/google-research/hit-gan.
authors.name: Long Zhao
authors.name: Zizhao Zhang
authors.name: Ting Chen
authors.name: Dimitris N. Metaxas
authors.name: Han Zhang
references.authors: Ivan Anokhin Kirill Demochkin Taras Khakhulin Gleb Sterkin Victor Lempitsky Denis Korzhenkov
references.title: Image generators with conditionally-independent pixel synthesis
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Iz Beltagy Matthew E Peters Arman Cohan
references.title: Longformer: The long-document transformer
references.venue: arXiv preprint arXiv:2004.05150,
references.authors: Tristan Bepler Ellen D Zhong Kotaro Kelley Edward Brignole Bonnie Berger
references.title: Explicitly disentangling image content from translation and rotation with spatial-VAE
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Andrew Brock Jeff Donahue Karen Simonyan
references.title: Large scale GAN training for high fidelity natural image synthesis
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Miles Brundage Shahar Avin Jack Clark Helen Toner Peter Eckersley Ben Garfinkel Allan Dafoe Paul Scharre Thomas Zeitzoff Bobby Filar
references.title: The malicious use of artificial intelligence: Forecasting, prevention, and mitigation
references.venue: arXiv preprint arXiv:1802.07228,
references.authors: Jiezhang Cao Yawei Li Kai Zhang Luc Van Gool
references.title: Video Super-Resolution Transformer
references.venue: arXiv preprint arXiv:2106.06847,
references.authors: Chun-Fu Chen Quanfu Fan Rameswar Panda
references.title: CrossViT: Cross-attention multi-scale vision transformer for image classification
references.venue: arXiv preprint arXiv:2103.14899,
references.authors: Ting Chen Mario Lucic Neil Houlsby Sylvain Gelly
references.title: On self modulation for generative adversarial networks
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Ting Chen Xiaohua Zhai Marvin Ritter Mario Lucic Neil Houlsby
references.title: Self-supervised GANs via auxiliary rotation loss
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Adam Coates Andrew Ng Honglak Lee
references.title: An analysis of single-layer networks in unsupervised feature learning
references.venue: In Proceedings of the International Conference on Artificial Intelligence and Statistics (AISTATS),
references.authors: Jeff Donahue Karen Simonyan
references.title: Large scale adversarial representation learning
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Alexey Dosovitskiy Lucas Beyer Alexander Kolesnikov Dirk Weissenborn Xiaohua Zhai Thomas Unterthiner Mostafa Dehghani Matthias Minderer Georg Heigold Sylvain Gelly
references.title: An image is worth 16x16 words: Transformers for image recognition at scale
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Emilien Dupont Yee Whye Teh Arnaud Doucet
references.title: Generative models as distributions of functions
references.venue: arXiv preprint arXiv:2102.04776,
references.authors: Patrick Esser Robin Rombach Björn Ommer
references.title: Taming transformers for high-resolution image synthesis
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Ian J Goodfellow Jean Pouget-Abadie Mehdi Mirza Bing Xu David Warde-Farley Sherjil Ozair Aaron Courville Yoshua Bengio
references.title: Generative adversarial nets
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Martin Heusel Hubert Ramsauer Thomas Unterthiner Bernhard Nessler Sepp Hochreiter
references.title: GANs trained by a two time-scale update rule converge to a local nash equilibrium
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Jonathan Ho Nal Kalchbrenner Dirk Weissenborn Tim Salimans
references.title: Axial attention in multidimensional transformers
references.venue: arXiv preprint arXiv:1912.12180,
references.authors: Quan Hoang Tu Dinh Nguyen Trung Le Dinh Phung
references.title: MGAN: Training generative adversarial nets with multiple generators
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Xun Huang Serge Belongie
references.title: Arbitrary style transfer in real-time with adaptive instance normalization
references.venue: In Proceedings of the IEEE International Conference on Computer Vision (ICCV),
references.authors: Zilong Huang Xinggang Wang Lichao Huang Chang Huang Yunchao Wei Wenyu Liu
references.title: CCNet: Criss-cross attention for semantic segmentation
references.venue: In Proceedings of the IEEE International Conference on Computer Vision (ICCV),
references.authors: Drew A Hudson C Lawrence Zitnick
references.title: Generative adversarial transformers
references.venue: In Proceedings of the International Conference on Machine Learning (ICML),
references.authors: Andrew Jaegle Felix Gimeno Andrew Brock Andrew Zisserman Oriol Vinyals Joao Carreira
references.title: Perceiver: General perception with iterative attention
references.venue: arXiv preprint arXiv:2103.03206,
references.authors: Yifan Jiang Shiyu Chang Zhangyang Wang
references.title: TransGAN: Two transformers can make one strong GAN
references.venue: arXiv preprint arXiv:2102.07074,
references.authors: Justin Johnson Alexandre Alahi Li Fei-Fei
references.title: Perceptual losses for real-time style transfer and superresolution
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Tero Karras Timo Aila Samuli Laine Jaakko Lehtinen
references.title: Progressive growing of GANs for improved quality, stability, and variation
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Tero Karras Miika Aittala Janne Hellsten Samuli Laine Jaakko Lehtinen Timo Aila
references.title: Training generative adversarial networks with limited data
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Tero Karras Samuli Laine Timo Aila
references.title: A style-based generator architecture for generative adversarial networks
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Tero Karras Samuli Laine Miika Aittala Janne Hellsten Jaakko Lehtinen Timo Aila
references.title: Analyzing and improving the image quality of StyleGAN
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Diederik P Kingma Jimmy Ba
references.title: Adam: A method for stochastic optimization
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Marian Kleineberg Matthias Fey Frank Weichert
references.title: Adversarial generation of continuous implicit shape representations
references.venue: In Eurographics,
references.authors: Alex Krizhevsky Geoffrey Hinton
references.title: Learning multiple layers of features from tiny
references.authors: Kwonjoon Lee Huiwen Chang Lu Jiang Han Zhang Zhuowen Tu Ce Liu
references.title: ViTGAN: Training GANs with Vision Transformers
references.venue: arXiv preprint arXiv:2107.04589,
references.authors: Chieh Hubert Lin Chia-Che Chang Yu-Sheng Chen Da-Cheng Juan Wei Wei Hwann-Tzong Chen
references.title: COCO-GAN: Generation by Parts via Conditional Coordinating
references.venue: In Proceedings of the IEEE International Conference on Computer Vision (ICCV),
references.authors: Chieh Hubert Lin Hsin-Ying Lee Yen-Chi Cheng Sergey Tulyakov Ming-Hsuan Yang
references.title: InfinityGAN: Towards infinite-resolution image synthesis
references.venue: arXiv preprint arXiv:2104.03963,
references.authors: Zinan Lin Ashish Khetan Giulia Fanti Sewoong Oh
references.title: PacGAN: The power of two samples in generative adversarial networks
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Steven Liu Tongzhou Wang David Bau Jun-Yan Zhu Antonio Torralba
references.title: Diverse image generation via self-conditioned GANs
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Ze Liu Yutong Lin Yue Cao Han Hu Yixuan Wei Zheng Zhang Stephen Lin Baining Guo
references.title: Swin transformer: Hierarchical vision transformer using shifted windows
references.venue: arXiv preprint arXiv:2103.14030,
references.authors: Ziwei Liu Ping Luo Xiaogang Wang Xiaoou Tang
references.title: Deep learning face attributes in the wild
references.venue: In Proceedings of the IEEE International Conference on Computer Vision (ICCV),
references.authors: Sachit Menon Alexandru Damian Shijia Hu Nikhil Ravi Cynthia Rudin
references.title: PULSE: Self-supervised photo upsampling via latent space exploration of generative models
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Lars Mescheder Andreas Geiger Sebastian Nowozin
references.title: Which training methods for GANs do actually converge
references.venue: In Proceedings of the International Conference on Machine Learning (ICML),
references.authors: Lars Mescheder Michael Oechsle Michael Niemeyer Sebastian Nowozin Andreas Geiger
references.title: Occupancy networks: Learning 3D reconstruction in function space
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Ben Mildenhall Pratul P Srinivasan Matthew Tancik Jonathan T Barron Ravi Ramamoorthi Ren Ng
references.title: NeRF: Representing scenes as neural radiance fields for view synthesis
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Jeong Joon Park Peter Florence Julian Straub Richard Newcombe Steven Lovegrove
references.title: DeepSDF: Learning continuous signed distance functions for shape representation
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Niki Parmar Ashish Vaswani Jakob Uszkoreit Lukasz Kaiser Noam Shazeer Alexander Ku Dustin Tran
references.title: Image transformer
references.venue: In Proceedings of the International Conference on Machine Learning (ICML),
references.authors: Stanislav Pidhorskyi Donald A Adjeroh Gianfranco Doretto
references.title: Adversarial latent autoencoders
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Alec Radford Jong Wook Kim Chris Hallacy Aditya Ramesh Gabriel Goh Sandhini Agarwal Girish Sastry Amanda Askell Pamela Mishkin Jack Clark
references.title: Learning transferable visual models from natural language supervision
references.venue: arXiv preprint arXiv:2103.00020,
references.authors: Aditya Ramesh Mikhail Pavlov Gabriel Goh Scott Gray Chelsea Voss Alec Radford Mark Chen Ilya Sutskever
references.title: Zero-shot text-to-image generation
references.venue: arXiv preprint arXiv:2102.12092,
references.authors: Ali Razavi Aaron van den Oord Oriol Vinyals
references.title: Generating diverse high-fidelity images with VQ- VAE-2
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Olga Russakovsky Jia Deng Hao Su Jonathan Krause Sanjeev Satheesh Sean Ma Zhiheng Huang Andrej Karpathy Aditya Khosla Michael Bernstein
references.title: ImageNet large scale visual recognition challenge
references.venue: International Journal of Computer Vision,
references.authors: Alexander Sage Eirikur Agustsson Radu Timofte Luc Van Gool
references.title: Logo synthesis and manipulation with clustered generative adversarial networks
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Tim Salimans Ian Goodfellow Wojciech Zaremba Vicki Cheung Alec Radford Xi Chen
references.title: Improved techniques for training GANs
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Edgar Schonfeld Bernt Schiele Anna Khoreva
references.title: A U-Net Based Discriminator for Generative Adversarial Networks
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Wenzhe Shi Jose Caballero Ferenc Huszár Johannes Totz Andrew P Aitken Rob Bishop Daniel Rueckert Zehan Wang
references.title: Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Ivan Skorokhodov Savva Ignatyev Mohamed Elhoseiny
references.title: Adversarial generation of continuous images
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Ryan Steed Aylin Caliskan
references.title: Image representations learned with unsupervised pre-training contain human-like biases
references.venue: In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency,
references.authors: Christian Szegedy Vincent Vanhoucke Sergey Ioffe Jon Shlens Zbigniew Wojna
references.title: Rethinking the inception architecture for computer vision
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Yu Tian Xi Peng Long Zhao Shaoting Zhang Dimitris N Metaxas
references.title: CR-GAN: Learning complete representations for multi-view generation
references.venue: In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI),
references.authors: Ilya Tolstikhin Neil Houlsby Alexander Kolesnikov Lucas Beyer Xiaohua Zhai Thomas Unterthiner Jessica Yung Daniel Keysers Jakob Uszkoreit Mario Lucic
references.title: MLP-Mixer: An all-MLP Architecture for Vision
references.venue: arXiv preprint arXiv:2105.01601,
references.authors: Hugo Touvron Piotr Bojanowski Mathilde Caron Matthieu Cord Alaaeldin El-Nouby Edouard Grave Armand Joulin Gabriel Synnaeve Jakob Verbeek Hervé Jégou
references.title: ResMLP: Feedforward networks for image classification with data-efficient training
references.venue: arXiv preprint arXiv:2105.03404,
references.authors: Hugo Touvron Matthieu Cord Matthijs Douze Francisco Massa Alexandre Sablayrolles Hervé Jégou
references.title: Training data-efficient image transformers & distillation through attention
references.venue: arXiv preprint arXiv:2012.12877,
references.authors: Aaron van den Oord Oriol Vinyals Koray Kavukcuoglu
references.title: Neural discrete representation learning
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Ashish Vaswani Prajit Ramachandran Aravind Srinivas Niki Parmar Blake Hechtman Jonathon Shlens
references.title: Scaling local self-attention for parameter efficient visual backbones
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Ashish Vaswani Noam Shazeer Niki Parmar Jakob Uszkoreit Llion Jones Aidan N Gomez Łukasz Kaiser Illia Polosukhin
references.title: Attention is all you need
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Huiyu Wang Yukun Zhu Hartwig Adam Alan Yuille Liang-Chieh Chen
references.title: MaX-DeepLab: End-to-end panoptic segmentation with mask transformers
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Huiyu Wang Yukun Zhu Bradley Green Hartwig Adam Alan Yuille Liang-Chieh Chen
references.title: Axial- DeepLab: Stand-alone axial-attention for panoptic segmentation
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Xiaolong Wang Ross Girshick Abhinav Gupta Kaiming He
references.title: Non-local neural networks
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Mika Westerlund
references.title: The emergence of deepfake technology: A review
references.venue: Technology Innovation Management Review,
references.authors: Zhisheng Xiao Karsten Kreis Jan Kautz Arash Vahdat
references.title: VAEBM: A Symbiosis between Variational Autoencoders and Energy-based Models
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Han Zhang Ian Goodfellow Dimitris Metaxas Augustus Odena
references.title: Self-attention generative adversarial networks
references.venue: In Proceedings of the International Conference on Machine Learning (ICML),
references.authors: Han Zhang Jing Yu Koh Jason Baldridge Honglak Lee Yinfei Yang
references.title: Cross-modal contrastive learning for text-to-image generation
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
references.authors: Han Zhang Tao Xu Hongsheng Li Shaoting Zhang Xiaogang Wang Xiaolei Huang Dimitris N Metaxas
references.title: StackGAN: Text to photo-realistic image synthesis with stacked generative adversarial networks
references.venue: In Proceedings of the IEEE International Conference on Computer Vision (ICCV),
references.authors: Han Zhang Zizhao Zhang Augustus Odena Honglak Lee
references.title: Consistency regularization for generative adversarial networks
references.venue: In Proceedings of the International Conference on Learning Representations (ICLR),
references.authors: Zizhao Zhang Han Zhang Long Zhao Ting Chen Tomas Pfister
references.title: Aggregating nested transformers
references.venue: arXiv preprint arXiv:2105.12723,
references.authors: Long Zhao Xi Peng Yu Tian Mubbasir Kapadia Dimitris Metaxas
references.title: Learning to forecast and refine residual motion for image-to-video generation
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Long Zhao Xi Peng Yu Tian Mubbasir Kapadia Dimitris N Metaxas
references.title: Towards image-to-video translation: A structure-aware approach via multi-stage generative adversarial networks
references.venue: International Journal of Computer Vision,
references.authors: Shengyu Zhao Zhijian Liu Ji Lin Jun-Yan Zhu Song Han
references.title: Differentiable augmentation for dataefficient gan training
references.venue: In Advances in Neural Information Processing Systems (NeurIPS),
references.authors: Zhengli Zhao Sameer Singh Honglak Lee Zizhao Zhang Augustus Odena Han Zhang
references.title: Improved consistency regularization for GANs
references.venue: In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI),
references.authors: Jiapeng Zhu Yujun Shen Deli Zhao Bolei Zhou
references.title: In-domain GAN inversion for real image editing
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Jun-Yan Zhu Taesung Park Phillip Isola Alexei A Efros
references.title: Unpaired image-to-image translation using cycle-consistent adversarial networks
references.venue: In Proceedings of the IEEE International Conference on Computer Vision (ICCV),
sections.heading: 1 Introduction
sections.text: Attention-based models demonstrate notable learning capabilities for both encoder-based and decoderbased architectures [66, 69] due to their self-attention operations which can capture long-range dependencies in data. Recently, Vision Transformer [12], one of the most powerful attention-based models, has achieved a great success on encoder-based vision tasks, specifically image classification [12, 60], segmentation [37, 64], and vision-language modeling [46]. However, applying the Transformer to image generation based on Generative Adversarial Networks (GANs) is still an open problem.
  The main challenge of adopting the Transformer as a decoder/generator lies in two aspects. On one hand, the quadratic scaling problem brought by the self-attention operation becomes even worse when generating pixel-level details for high-resolution images. For example, synthesizing a high definition image with the resolution of 1024× 1024 leads to a sequence containing around one million pixels in the final stage, which is unaffordable for the standard self-attention mechanism. On the other hand, generating images from noise inputs poses a higher demand for spatial coherency in structure, color, and texture than discriminative tasks, and hence a more powerful yet efficient self-attention mechanism is desired for decoding feature representations from inputs.
  In view of these two key challenges, we propose a novel Transformer-based decoder/generator in GANs for high-resolution image generation, denoted as HiT. HiT employs a hierarchical structure of Transformers and divides the generative process into low-resolution and high-resolution stages, focusing on feature decoding and pixel-level generating, respectively. Specifically, its low-resolution
  ∗This work was done while Long Zhao was a student researcher at the Google Brain team. Correspondence to: Long Zhao (lz311@rutgers.edu) and Han Zhang (zhanghan@google.com).
  35th Conference on Neural Information Processing Systems (NeurIPS 2021).
  stages follow the design of Nested Transformers [73] but enhanced by the proposed multi-axis blocked self-attention to better capture global information. Assuming that spatial features are well decoded after low-resolution stages, in high-resolution stages, we drop all self-attention operations in order to handle extremely long sequences for high definition image generation. The resulting high-resolution stages of HiT are built by multi-layer perceptrons (MLPs) which have a linear complexity with respect to the sequence length. Note that this design aligns with the recent findings [58, 59] that pure MLPs manage to learn favorable features for images, but it simply reduces to an implicit neural function [41, 42, 43] in the case of generative modeling. To further improve the performance, we present an additional cross-attention module that acts as a form of self-modulation [8]. In summary, this paper makes the following contributions:
  • We propose HiT, a Transformer-based generator for high-fidelity image generation. Standard self-attention operations are removed in the high-resolution stages of HiT, reducing them to an implicit neural function. The resulting architecture easily scales to high definition image synthesis (with the resolution of 1024× 1024) and has a comparable throughput to StyleGAN2 [28].
  • To tame the quadratic complexity and enhance the representation capability of self-attention operation in low-resolution stages, we present a new form of sparse self-attention operation, namely multi-axis blocked self-attention. It captures local and global dependencies within nonoverlapping image blocks in parallel by attending to a single axis of the input tensor at a time, each of which uses a half of attention heads. The proposed multi-axis blocked self-attention is efficient, simple to implement, and yields better performance than other popular self-attention operations [37, 62, 73] working on image blocks for generative tasks.
  • In addition, we introduce a cross-attention module performing attention between the input and intermediate features. This module re-weights intermediate features of the model as a function of the input, playing a role as self-modulation [8], and provides important global information to high-resolution stages where self-attention operations are absent.
  • The proposed HiT obtains competitive FID [16] scores of 30.83 and 2.95 on unconditional ImageNet [49] 128 × 128 and FFHQ [28] 256 × 256, respectively, highly reducing the gap between ConvNet-based GANs and Transformer-based ones. We also show that HiT not only works for GANs but also can serve as a general decoder for other models such as VQ-VAE [61]. Moreover, we observe that the proposed HiT can obtain more performance improvement from regularization than its ConvNet-based counterparts. To the best of our knowledge, these are the best reported scores for an image generator that is completely free of convolutions, which is an important milestone towards adopting Transformers for high-resolution generative modeling.
sections.heading: 2 Related work
sections.text: Transformers for image generation. There are two main streams of image generation models built on Transformers [63] in the literature. One stream of them [14, 44] is inspired by auto-regressive models that learn the joint probability of the image pixels. The other stream focuses on designing Transformer-based architecture for generative adversarial networks (GANs) [15]. This work follows the spirit of the second stream. GANs have made great progress in various image generation tasks, such as image-to-image translation [57, 74, 75, 79] and text-to-image synthesis [70, 71], but most of them depend on ConvNet-based backbones. Recent attempts [23, 32] build a pure Transformer-based GAN by a careful design of attention hyper-parameters as well as upsampling layers. However, such a model is only validated on small scale datasets (e.g., CIFAR-10 [31] and STL-10 [10] consisting of 32× 32 images) and does not scale to complex real-world data. To our best knowledge, no existing work has successfully applied a Transformer-based architecture completely free of convolutions for high-resolution image generation in GANs.
  GANformer [21] leverages the Transformer as a plugin component to build the bipartite structure to allow long-range interactions during the generative process, but its main backbone is still a ConvNet based on StyleGAN [28]. GANformer and HiT are different in the goal of using attention modules. GANformer utilizes the attention mechanism to model the dependences of objects in a generated scene/image. Instead, HiT explores building efficient attention modules for synthesizing general objects. Our experiments demonstrate that even for simple face image datasets, incorporating the attention mechanism can still lead to performance improvement. We believe our work reconfirms the necessity of using attention modules for general image generation tasks, and more importantly, we
  present an efficient architecture for attention-based high-resolution generators which might benefit the design of future attention-based GANs.
  Attention models. Many efforts [2, 17, 65] have been made to reduce the quadratic complexity of self-attention operation. When handling vision tasks, some works [37, 62, 73] propose to compute local self-attention in blocked images which takes advantage of the grid structure of images. [6] also presents local self-attention within image blocks but it does not perform self-attention across blocks as in HiT. The most related works to the proposed multi-axis blocked self-attention are [17, 65] where they also compute attention along axes. But our work differs notably in that we compute different attentions within heads on blocked images. Some other works [7, 21, 22] avoid directly applying standard self-attention to the input pixels, and perform attention between the input and a small set of latent units. Our cross-attention module differs from them in that we apply cross-attention to generative modeling designed for pure Transformer-based architectures.
  Implicit neural representations. The largest popularity of implicit neural representations/functions (INRs) is studied in 3D deep learning to represent a 3D shape in a cheap and continuous way [41, 42, 43]. Recent studies [1, 13, 34, 54] explore the idea of using INRs for image generation, where they learn a hyper MLP network to predict an RGB pixel value given its coordinates on the image grid. Among them, [1, 54] are closely related to our high-resolution stages of the generative process. One remarkable difference is that our model is driven by the cross-attention module and features generated in previous stages instead of the hyper-network presented in [1, 54].
sections.heading: 3 Approach
sections.heading: 3.1 Main Architecture
sections.text: In the case of unconditional image generation, HiT takes a latent code z ∼ N (0, I) as input and generates an image of the target resolution through a hierarchical structure. The latent code is first projected into an initial feature with the spatial dimension of H0 × W0 and channel dimension of C0. During the generation process, we gradually increase the spatial dimension of the feature map while reducing the channel dimension in multiple stages. We divide the generation stages into low-resolution stages and high-resolution stages to balance feature dependency range in decoding and computation efficiency. The overview of the proposed method is illustrated in Figure 1.
  In low-resolution stages, we allow spatial mixing of information by efficient attention mechanism. We follow the decoder form of Nested Transformer [73] where in each stage, the input feature is first
  divided into non-overlapping blocks where each block can be considered as a local patch. After being combined with learnable positional encoding, each block is processed independently via a shared attention module. We enhance the local self-attention of Nested Transformer by the proposed multiaxis blocked self-attention that can produce a richer feature representation by explicitly considering local (within blocks) as well as global (across blocks) relations. We denote the overall architecture of these stages as multi-axis Nested Transformer.
  Assuming that spatial dependency is well modeled in the low-resolution stages, the high-resolution stages can focus on synthesizing pixel-level image details purely based on the local features. Thus in the high-resolution stage, we remove all self-attention modules and only maintain MLPs which can further reduce computation complexity. The resulting architecture in this stage can be viewed as an implicit neural function conditioned on the given latent feature as well as positional information.
  We further enhance HiT by adding a cross-attention module at the beginning of each stage which allows the network to directly condition the intermediate features on the initial input latent code. This kind of self-modulation layer leads to improved generative performance, especially when selfattention modules are absent in high-resolution stages. In the following sections, we provided detailed descriptions for the two main architectural components of HiT: (i) multi-axis blocked self-attention module and (ii) cross-attention module, respectively.
sections.heading: 3.2 Multi-Axis Blocked Self-Attention
sections.text: Different from the blocked self-attention in Nested Transformer [73], the proposed multi-axis blocked self-attention performs attention on more than a single axis. The attentions performed in two axes correspond to two forms of sparse self-attention, namely regional attention and dilated attention. Regional attention follows the spirit of blocked local self-attention [37, 62] where tokens attend to their neighbours within non-overlapped blocks. To remedy the loss of global attention, dilated attention captures long-range dependencies between tokens across blocks: it subsamples attention regions in a manner similar to dilated convolutions with a fixed stride equal to the block size. Figure 2 illustrates an example of these two attentions.
  To be specific, given an input of image with size (H,W,C), it is blocked into a tensor X of the shape (b× b, Hb × W b , C) representing (b, b) non-overlapping blocks each with the size of ( H b , W b ). Dilated attention mixes information along the first axis of X while keeping information along other axes independent; regional attention works in an analogous manner over the second axis of X . They are straightforward to implement: attention over the i-th axis of X can be implemented by einsum operation which is available in most deep learning libraries.
  We mix regional and dilated attention in a single layer by computing them in parallel, each of which uses a half of attention heads. Our method can be easily extended to model more than two axes by performing attention on each of the axis in parallel. Axial attention [17, 20, 65] can be viewed as a special case of our method, where the blocking operation before attention is removed. However, we find blocking is the key to achieve significant performance improvement in the experiment. This is because the blocked structure reveals a better inductive bias for images. Compared with [17, 37, 65] where different attention modules are interleaved in consecutive layers, our approach aggregates local and global information in a single round, which is not only more flexible for architecture design but also shown to yield better performance than interleaving in our experiment.
  Balancing attention between axes. In each multi-axis blocked self-attention module, the input feature is blocked in a balanced way such that we have b× b ≈ Hb × W b . This ensures that regional and dilated attention is computed on an input sequence of a similar length, avoiding half of the attention heads are attended to a too sparse region. In general, performing dot-product attention between two input sequences of length N = H × W requires a total of O(N2) computation. When computing the balanced multi-axis blocked attention on an image with the block size of S, i.e., S = √ N , we perform attention on S sequences of length S, which is a total ofO(S ·S2) = O(N √ N) computation. This leads to an O( √ N) saving in computation over standard self-attention.
sections.heading: 3.3 Cross-Attention for Self-Modulation
sections.text: To further improve the global information flow, we propose to let the intermediate features of the model directly attend to a small tensor projected from the input latent code. This is implemented via a cross-attention operation and can be viewed as a form of self-modulation [8]. The proposed technique has two benefits. First, as shown in [8], self-modulation stabilizes the generator towards favorable conditioning values and also appears to improve mode coverage. Second, when self-attention modules are absent in high-resolution stages, attending to the input latent code provides an alternative way to capture global information when generating pixel-level details.
  Formally, let Xl be the first-layer feature representation of the l-th stage. The input latent code z is first projected into a 2D spatial embedding Z with the resolution of HZ ×WZ and dimension of CZ by a linear function. Xl is then treated as the query and Z as the key and value. We compute their cross-attention following the update rule: X ′l = MHA(Xl, Z + PZ), where MHA represents the standard mulit-head self-attention, X ′l is the output, and PZ is the learnable positional encoding having the same shape as Z. Note that Z is shared across all stages. For an input feature with the sequence length of N , the embedding size is a pre-defined hyperparameter far less than N (i.e., HZ ×WZ N ). Therefore, the resulting cross-attention operation has linear complexity O(N). In our initial experiments, we find that compared with cross-attention, using AdaIN [19] and modulated layers [28] for Transformer-based generators requires much higher memory cost during model training, which usually leads to out-of-memory errors when the model is trained for generating highresolution images. As a result, related work like ViT-GAN [32], which uses AdaIN and modulated layers, can only produce images up to the resolution of 64× 64. Hence, we believe cross-attention is a better choice for high-resolution generators based on Transformers.
sections.heading: 4 Experiments
sections.heading: 4.1 Experiment Setup
sections.text: Datasets. We validate the proposed method on three datasets: ImageNet [49], CelebA-HQ [25], and FFHQ [28]. ImageNet (LSVRC2012) [49] contains roughly 1.2 million images with 1000 distinct categories and we down-sample the images to 128 × 128 and 256 × 256 by bicubic interpolation. We use random crop for training and center crop for testing. This dataset is challenging for image generation since it contains samples with diverse object categories and textures. We also adopt ImageNet as the main test bed during the ablation study.
  CelebA-HQ [25] is a high-quality version of the CelebA dataset [38] containing 30,000 of the facial images at 1024 × 1024 resolution. To align with [25], we use these images for both training and evaluation. FFHQ [28] includes vastly more variation than CelebA-HQ in terms of age, ethnicity and image background, and also has much better coverage of accessories such as eyeglasses, sunglasses,
  and hats. This dataset consists of 70,000 high-quality images at 1024× 1024 resolution, out of which we use 50,000 images for testing and train models with all images following [28]. We synthesize images on these two datasets with the resolutions of 256× 256 and 1024× 1024. Evaluation metrics. We adopt the Inception Score (IS) [51] and the Fréchet Inception Distance (FID) [16] for quantitative evaluation. Both metrics are calculated based on a pre-trained Inception-v3 image classifier [56]. Inception score computes KL-divergence between the real image distribution and the generated image distribution given the pre-trained classifier. Higher inception scores mean better image quality. FID is a more principled and comprehensive metric, and has been shown to be more consistent with human judgments of realism [16, 70]. Lower FID values indicate closer distances between synthetic and real data distributions. In our experiments, 50,000 samples are randomly generated for each model to calculate the inception score and FID on ImageNet and FFHQ, while 30,000 samples are produced for comparison on CelebA-HQ. Note that we follow [51] to split the synthetic images into groups (5000 images per group) and report their averaged inception score.
sections.heading: 4.2 Implementation Details
sections.text: Architecture configuration. In our implementation, HiT starts from an initial feature of size 8× 8 projected from the input latent code. We use pixel shuffle [53] for upsampling the output of each stage, as we find using nearest neighbors leads to model failure which aligns with the observation in Nested Transformer [73]. The number of low-resolution stages is fixed to be 4 as a good trade-off between computational speed and generative performance. For generating images larger than the resolution of 128× 128, we scale HiT to different model capacities – small, base, and large, denoted as HiT-{S, B, L}. We refer to the supplementary materials for their detailed architectures.
  It is worth emphasizing that the flexibility of the proposed multi-axis blocked self-attention makes it possible for us to build smaller models than [37]. This is because they interleave different types of attention operations and thus require the number of attention blocks in a single stage to be even (at least 2). In contrast, our multi-axis blocked self-attention combines different attention outputs within heads which allows us to use an arbitrary number (e.g., 1) of attention blocks in a model.
  Training details. In all the experiments, we use a ResNet-based discriminator following the architecture design of [28]. Our model is trained with a standard non-saturating logistic GAN loss with R1 gradient penalty [40] applied to the discriminator. R1 penalty penalizes the discriminator for deviating from the Nash-equilibrium by penalizing the gradient on real data alone. The gradient penalty weight is set to 10. Adam [29] is utilized for optimization with β1 = 0 and β2 = 0.99. The learning rate is 0.0001 for both the generator and discriminator. All the models are trained using TPU for one million iterations on ImageNet and 500,000 iterations on FFHQ and CelebA-HQ. We set the mini-batch size to 256 for the image resolution of 128 × 128 and 256 × 256 while to 32 for the resolution of 1024 × 1024. To keep our setup simple, we do not employ any training tricks for GAN training, such as progressive growing, equalized learning rates, pixel normalization, noise injection, and mini-batch standard deviation that recent literature demonstrate to be cruicial for obtaining state-of-the-art results [25, 28]. When training on FFHQ and CelebA-HQ, we utilize balanced consistency regularization (bCR) [72, 77] for additional regularization where images are augmented by flipping, color, translation, and cutout as in [76]. bCR enforces that for both real and generated images, two sets of augmentations applied to the same input image should yield the same output. bCR is only added to the discriminator with the weight of 10. We also decrease the learning rate by half to stabilize the training process when bCR is used.
sections.heading: 4.3 Results on ImageNet
sections.text: Unconditional generation. We start by evaluating the proposed HiT on the ImageNet 128 × 128 dataset, targeting the unconditional image generation setting for simplicity. In addition to recently reported state-of-the-art GANs, we implement a ConvNet-based generator following the widely-used architecture from [69] while using the exactly same training setup of the proposed HiT (e.g., losses and R1 gradient penalty) denoted as ConvNet-R1 for a fair comparison. The results are shown in Table 1. We can see that HiT outperforms the previous ConvNet-based methods by a notable margin in terms of both IS and FID scores. Note that as reported in [11], BigGAN [4] achieves 30.91 FID on unconditional ImageNet, but its model is far larger (more than 70M parameters) than HiT (around 30M parameters). Therefore, the results are not directly comparable. Even though, HiT (30.83 FID)
  Table 1: Comparison with the state-of-the-art methods on the ImageNet 128 × 128 dataset. † is based on a supervised pre-trained ImageNet classifier.
  Table 2: Reconstruction FID on the ImageNet 256× 256 dataset. We note that VQVAE-2 utilizes a hierarchical organization of VQ-VAE and thus has two codebooks Z .
  is slightly better than BigGAN and achieves the state of the art among models with a similar capacity as shown in Table 1. We also note that [8, 36] leverage auxiliary regularization techniques and our method is complementary to them. Examples generated by HiT on ImageNet are shown in Figure 3, from which we observe nature visual details and diversity.
  Reconstruction. We are also interested in the reconstruction ability of the proposed HiT and evaluate by employing it as a decoder for the vector quantised variational auto-encoder (VQ-VAE [61]), a state-of-the-art approach for visual representation learning. In addition to the reconstruction loss and adversarial loss, our HiT-based VQ-VAE variant, namely VQ-HiT, is also trained with the perceptual loss [24] following the setup of [14, 78]. Please refer to the supplementary materials for more details on the architecture design and model training. We evaluate the metric of reconstruction FID on ImageNet 256 × 256 and report the results in Table 2. Our VQ-HiT attains the best performance while providing significantly more compression (i.e., smaller embedding size and fewer number of codes in the codebook Z) than [47, 48, 61].
sections.heading: 4.4 Higher Resolution Generation
sections.text: Baselines. To demonstrate the utility of our approach for high-fidelity images, we compare to stateof-the-art techniques for generating images on CelebA-HQ and FFHQ, focusing on two common resolutions of 256 × 256 and 1024 × 1024. The main competing method of the proposed HiT is StyleGAN [27, 28] – a hypernetwork-based ConvNet archieving the best performance on these two datasets. On the FFHQ dataset, apart from our ConvNet-based counterparts, we also compare to the most recent INR-based methods including CIPS [1] and INR-GAN [54]. These two models are closely related to HiT as the high-resolution stages of our approach can be viewed as a form of INR. Following the protocol of [1], we report the results of StyleGAN2 [28] trained without style-mixing and path regularization of the generator on this dataset.
  Results. We report the results in Table 3. Impressively, the proposed HiT obtains the best FID scores at the resolution of 256× 256 and sets the new state of the art on both datasets. Meanwhile, our performance is also competitive at the resolution of 1024 × 1024 but only slightly shy of StyleGAN. This is due to our finding that conventional regularization techniques such as [77] cannot be directly applied to Transformer-based architectures for synthesizing ultra high-resolution images. We believe this triggers a new research direction and will explore it as our future work. It is also worth mentioning that our method consistently outperforms INR-based models, which suggests the importance of involving the self-attention mechanism into image generation.
  Table 4 provides a more detailed comparison to our main competing methods in terms of the number of parameters, throughput, and FID on FFHQ 256 × 256. We find that the proposed HiT-S has a comparable runtime performance (throughput) with StyleGAN while yielding better generative results. More importantly, FID scores can be further improved when larger variants of HiT are employed. Figure 4 illustrates our synthetic face images on CelebA-HQ.
sections.heading: 4.5 Ablation Study
sections.text: We then evaluate the importance of different components of our model by its ablation on ImageNet 128× 128. A lighter-weight training configuration is employed in this study to reduce the training time. We start with a baseline architecture without any attention modules which reduces to a pure implicit neural function conditioned on the input latent code [3, 30]. We build upon this baseline by gradually incorporating cross-attention and self-attention modules. We compare the methods that perform attention without blocking (including standard self-attention [63], axial attention [17, 65]) and with blocking (including blocked local attention [62, 73]). We also compare a variant of our method where different types of attention are interleaved other than combined in attention heads.
  The results are reported in Table 5. As we can see, the latent code conditional INR baseline cannot fit training data favourably since it lacks an efficient way to capture the latent code during the generative process. Interestingly, incorporating the proposed cross-attention module improves the baseline and achieves the state of the art, thanks to its function of self-modulation. More importantly, we find that blocking is vital for attention: performing different types of attention after blocking can all improve the performance by a notable margin while the axial attention cannot. This is due to the fact that the
  image structure after blocking introduces a better inductive bias for images. At last, we observe that the proposed multi-axis blocked self-attention yields better FID scores than interleaving different attention outputs, and it achieves the best performance after balancing the attention axes.
  In Table 6, we investigate another form of our variations, where we incorporate attention in different number of stages across the generator. We can see that the more in the stack the attention is applied (low-resolution stages), the better the model performance will be. This study provides a validation for the effectiveness of self-attention operation in generative modeling. However, for feature resolutions larger than 64×64, we do not observe obvious performance gains brought by self-attention operations but a notable degradation in both training and inference time.
sections.heading: 4.6 Effectiveness of Regularization
sections.text: We further explore the effectiveness of regularization for the proposed Transformer-based generator. Note that different from the recent interest in training GANs in the few-shot scenarios [26, 76], we study the influence of regularization for ConvNet-based and Transformer-based generators in the fulldata regime. We use the whole training set of FFHQ 256× 256, and compare HiT-based variants with StyleGAN2 [26]. The regularization method is bCR [77]. As shown in Table 7, all variants of HiT achieve much larger margins of improvement than StyleGAN2. This confirms the finding [12, 23, 60] that Transformer-based architectures are much more data-hungry than ConvNets in both classification and generative modeling settings, and thus strong data augmentation and regularization techniques are crucial for training Transformer-based generators.
sections.heading: 5 Conclusion
sections.text: We present HiT, a novel Transformer-based generator for high-resolution image generation based on GANs. To address the quadratic scaling problem of Transformers, we structure the low-resolution stages of HiT following the design of Nested Transformer and enhance it by the proposed multi-axis blocked self-attention. In order to handle extremely long inputs in the high-resolution stages, we
  drop self-attention operations and reduce the model into implicit functions. We further improve the model performance by introducing a cross-attention module which plays a role of self-modulation. Our experiments demonstrate that HiT achieves highly competitive performance for high-resolution image generation compared with its ConvNet-based counterparts. For future work, we will investigate Transformer-based architectures for discriminators in GANs and efficient regularization techniques for Transformer-based generators to synthesize ultra high-resolution images.
  Ethics statement. We note that although this paper does not uniquely raise any new ethical challenges, image generation is a field with several ethical concerns worth acknowledging. For example, there are known issues around bias and fairness, either in the representation of generated images [39] or the implicit encoding of stereotypes [55]. Additionally, such algorithms are vulnerable to malicious use [5], mainly through the development of deepfakes and other generated media meant to deceive the public [67], or as an image denoising technique that could be used for privacy-invading surveillance or monitoring purposes. We also note that the synthetic image generation techniques have the potential to mitigate bias and privacy issues for data collection and annotation. However, such techniques could be misused to produce misleading information, and researchers should explore the techniques responsibly.
sections.heading: Acknowledgements
sections.text: We thank Chitwan Saharia, Jing Yu Koh, and Kevin Murphy for their feedback to the paper. We also thank Ashish Vaswani, Mohammad Taghi Saffar, and the Google Brain team for research discussions and technical assistance. This research has been partially funded by the following grants ARO MURI 805491, NSF IIS-1793883, NSF CNS-1747778, NSF IIS 1763523, DOD-ARO ACC-W911NF, NSF OIA-2040638 to Dimitris N. Metaxas.
title: Improved Transformer for High-Resolution GANs