DL_JournalClub
Deep Learning Journal Club
view repo
Despite recent progress in generative image modeling, successfully generating highresolution, diverse samples from complex datasets such as ImageNet remains an elusive goal. To this end, we train Generative Adversarial Networks at the largest scale yet attempted, and study the instabilities specific to such scale. We find that applying orthogonal regularization to the generator renders it amenable to a simple "truncation trick", allowing fine control over the tradeoff between sample fidelity and variety by truncating the latent space. Our modifications lead to models which set the new state of the art in classconditional image synthesis. When trained on ImageNet at 128x128 resolution, our models (BigGANs) achieve an Inception Score (IS) of 166.3 and Frechet Inception Distance (FID) of 9.6, improving over the previous best IS of 52.52 and FID of 18.65.
READ FULL TEXT VIEW PDF
Generative models of natural images have progressed towards high fidelit...
read it
Deep generative models are becoming a cornerstone of modern machine lear...
read it
Generative adversarial networks (GAN) have shown remarkable results in i...
read it
Training Generative Adversarial Networks (GAN) on highfidelity images
u...
read it
Generative adversarial networks are the state of the art for generative
...
read it
Recent studies have shown remarkable success in face manipulation task w...
read it
Synthesizing high resolution photorealistic images has been a longstand...
read it
Deep Learning Journal Club
The state of generative image modeling has advanced dramatically in recent years, with Generative Adversarial Networks (GANs, Goodfellow et al. (2014)) at the forefront of efforts to generate highfidelity, diverse images with models learned directly from data. GAN training is dynamic, and sensitive to nearly every aspect of its setup (from optimization parameters to model architecture), but a torrent of research has yielded empirical and theoretical insights enabling stable training in a variety of settings. Despite this progress, the current state of the art in conditional ImageNet modeling (Zhang et al., 2018) achieves an Inception Score (Salimans et al., 2016) of 52.5, compared to 233 for real data.
In this work, we set out to close the gap in fidelity and variety between images generated by GANs and realworld images from the ImageNet dataset. We make the following three contributions towards this goal:
We demonstrate that GANs benefit dramatically from scaling, and train models with two to four times as many parameters and eight times the batch size compared to prior art. We introduce two simple, general architectural changes that improve scalability, and modify a regularization scheme to improve conditioning, demonstrably boosting performance.
As a side effect of our modifications, our models become amenable to the “truncation trick,” a simple sampling technique that allows explicit, finegrained control of the tradeoff between sample variety and fidelity.
We discover instabilities specific to large scale GANs, and characterize them empirically. Leveraging insights from this analysis, we demonstrate that a combination of novel and existing techniques can reduce these instabilities, but complete training stability can only be achieved at a dramatic cost to performance.
Our modifications substantially improve classconditional GANs. When trained on ImageNet at 128128 resolution, our models (BigGANs) improve the stateoftheart Inception Score (IS) and Fréchet Inception Distance (FID) from 52.52 and 18.65 to 166.3 and 9.6 respectively. We also successfully train BigGANs on ImageNet at 256256 and 512512 resolution, and achieve IS and FID of 233.0 and 9.3 at 256256 and IS and FID of 241.4 and 10.9 at 512512. Finally, we train our models on an even larger dataset – JFT300M – and demonstrate that our design choices transfer well from ImageNet.
A Generative Adversarial Network (GAN) involves Generator (G) and Discriminator (D) networks whose purpose, respectively, is to map random noise to samples and discriminate real and generated samples. Formally, the GAN objective, in its original form (Goodfellow et al., 2014) involves finding a Nash equilibrium to the following two player minmax problem:
(1) 
where is a latent variable drawn from distribution such as or . When applied to images, G and D
are usually convolutional neural networks
(Radford et al., 2016). Without auxiliary stabilization techniques, this training procedure is notoriously brittle, requiring finelytuned hyperparameters and architectural choices to work at all.
Much recent research has accordingly focused on modifications to the vanilla GAN procedure to impart stability, drawing on a growing body of empirical and theoretical insights (Nowozin et al., 2016; Sønderby et al., 2017; Fedus et al., 2018). One line of work is focused on changing the objective function (Arjovsky et al., 2017; Mao et al., 2016; Lim & Ye, 2017; Bellemare et al., 2017; Salimans et al., 2018) to encourage convergence. Another line is focused on constraining D through gradient penalties (Gulrajani et al., 2017; Kodali et al., 2017; Mescheder et al., 2018) or normalization (Miyato et al., 2018)
, both to counteract the use of unbounded loss functions and ensure
D provides gradients everywhere to G.Of particular relevance to our work is Spectral Normalization (Miyato et al., 2018), which enforces Lipschitz continuity on D
by normalizing its parameters with running estimates of their first singular values, inducing backwards dynamics that adaptively regularize the top singular direction. Relatedly
Odena et al. (2018) analyze the condition number of the Jacobian of G and find that performance is dependent on G’s conditioning. Zhang et al. (2018) find that employing Spectral Normalization in G improves stability, allowing for fewer D steps per iteration. We extend on these analyses to gain further insight into the pathology of GAN training.Other works focus on the choice of architecture, such as SAGAN (Zhang et al., 2018) which adds the selfattention block from (Wang et al., 2018) to improve the ability of both G and D to model global structure. ProGAN (Karras et al., 2018) trains highresolution GANs in the singleclass setting by training a single model across a sequence of increasing resolutions.
In conditional GANs (Mirza & Osindero, 2014) class information can be fed into the model in various ways. In (Odena et al., 2017) it is provided to G
by concatenating a 1hot class vector to the noise vector, and the objective is modified to encourage conditional samples to maximize the corresponding class probability predicted by an auxiliary classifier.
de Vries et al. (2017) and Dumoulin et al. (2017) modify the way class conditioning is passed to G by supplying it with classconditional gains and biases in BatchNorm (Ioffe & Szegedy, 2015) layers. In Miyato & Koyama (2018), Dis conditioned by using the cosine similarity between its features and a set of learned class embeddings as additional evidence for distinguishing real and generated samples, effectively encouraging generation of samples whose features match a learned class prototype.
Objectively evaluating implicit generative models is difficult (Theis et al., 2015)
. A variety of works have proposed heuristics for measuring the sample quality of models without tractable likelihoods
(Salimans et al., 2016; Heusel et al., 2017; Bińkowski et al., 2018; Wu et al., 2017). Of these, the Inception Score (IS, Salimans et al. (2016)) and Fréchet Inception Distance (FID, Heusel et al. (2017)) have become popular despite their notable flaws (Barratt & Sharma, 2018). We employ them as approximate measures of sample quality, and to enable comparison against previous work.Batch  Ch.  Param (M)  Shared  Hier.  Ortho.  Itr  FID  IS 
256 
64  81.5  SAGAN Baseline  
512  64  81.5  red✗  red✗  red✗  
1024 
64  81.5  red✗  red✗  red✗  
2048 
64  81.5  red✗  red✗  red✗  
2048 
96  173.5  red✗  red✗  red✗  
2048 
96  160.6  mygreen✓  red✗  red✗  
2048 
96  158.3  mygreen✓  mygreen✓  red✗  
2048 
96  158.3  mygreen✓  mygreen✓  mygreen✓  
2048 
64  71.3  mygreen✓  mygreen✓  mygreen✓  

In this section, we explore methods for scaling up GAN training to reap the performance benefits of larger models and larger batches. As a baseline, we employ the SAGAN architecture of Zhang et al. (2018), which uses the hinge loss (Lim & Ye, 2017; Tran et al., 2017) GAN objective. We provide class information to G with classconditional BatchNorm (Dumoulin et al., 2017; de Vries et al., 2017) and to D with projection (Miyato & Koyama, 2018). The optimization settings follow Zhang et al. (2018) (notably employing Spectral Norm in G) with the modification that we halve the learning rates and take two D steps per G step. For evaluation, we employ moving averages of G’s weights following Karras et al. (2018); Mescheder et al. (2018), with a decay of . We use Orthogonal Initialization (Saxe et al., 2014), whereas previous works used (Radford et al., 2016) or Xavier initialization (Glorot & Bengio, 2010). Each model is trained on 128 to 512 cores of a Google TPU v3 Pod (Google, 2018), and computes BatchNorm statistics in G across all devices, rather than perdevice as in standard implementations. We find progressive growing (Karras et al., 2018) unnecessary even for our largest 512512 models.
We begin by increasing the batch size for the baseline model, and immediately find tremendous benefits in doing so. Rows 14 of Table 1 show that simply increasing the batch size by a factor of 8 improves the stateoftheart IS by 46%. We conjecture that this is a result of each batch covering more modes, providing better gradients for both networks. One notable side effect of this scaling is that our models reach better final performance in fewer iterations, but become unstable and undergo complete training collapse. We discuss the causes and ramifications of this in Section 4. For these experiments, we stop training just after collapse, and report scores from checkpoints saved just before.
We then increase the width (number of channels) in every layer by 50%, approximately doubling the number of parameters in both models. This leads to a further IS improvement of 21%, which we posit is due to the increased capacity of the model relative to the complexity of the dataset. Doubling the depth does not appear to have the same effect on ImageNet models, instead degrading performance.
We note that class embeddings used for the conditional BatchNorm layers in G contain a large number of weights. Instead of having a separate layer for each embedding (Miyato et al., 2018; Zhang et al., 2018), we opt to use a shared embedding, which is linearly projected to each layer’s gains and biases (Perez et al., 2018). This reduces computation and memory costs, and improves training speed (in number of iterations required to reach a given performance) by 37%. Next, we employ a variant of hierarchical latent spaces, where the noise vector is fed into multiple layers of G rather than just the initial layer. The intuition behind this design is to allow G to use the latent space to directly influence features at different resolutions and levels of hierarchy. For our architecture, this is easily accomplished by splitting into one chunk per resolution, and concatenating each chunk to the conditional vector which gets projected to the BatchNorm gains and biases. Previous works (Goodfellow et al., 2014; Denton et al., 2015) have considered variants of this concept; our contribution is a minor modification of this design. Hierarchical latents improve memory and compute costs (primarily by reducing the parametric budget of the first linear layer), provide a modest performance improvement of around 4%, and improve training speed by a further 18%.


Unlike models which need to backpropagate through their latents, GANs can employ an arbitrary prior
, yet the vast majority of previous works have chosen to draw from either or . We question the optimality of this choice and explore alternatives in Appendix E.Remarkably, our best results come from using a different latent distribution for sampling than was used in training. Taking a model trained with and sampling from a truncated normal (where values which fall outside a range are resampled to fall inside that range) immediately provides a boost to IS and FID. We call this the Truncation Trick: truncating a vector by resampling the values with magnitude above a chosen threshold leads to improvement in individual sample quality at the cost of reduction in overall sample variety. Figure 2(a) demonstrates this: as the threshold is reduced, and elements of are truncated towards zero (the mode of the latent distribution), individual samples approach the mode of G’s output distribution.
This technique allows finegrained, posthoc selection of the tradeoff between sample quality and variety for a given G. Notably, we can compute FID and IS for a range of thresholds, obtaining the varietyfidelity curve reminiscent of the precisionrecall curve (Figure 16). As IS does not penalize lack of variety in classconditional models, reducing the truncation threshold leads to a direct increase in IS (analogous to precision). FID penalizes lack of variety (analogous to recall) but also rewards precision, so we initially see a moderate improvement in FID, but as truncation approaches zero and variety diminishes, the FID sharply drops. The distribution shift caused by sampling with different latents than those seen in training is problematic for many models. Some of our larger models are not amenable to truncation, producing saturation artifacts (Figure 2(b)) when fed truncated noise. To counteract this, we seek to enforce amenability to truncation by conditioning G to be smooth, so that the full space of will map to good output samples. For this, we turn to Orthogonal Regularization (Brock et al., 2017), which directly enforces the orthogonality condition:
(2) 
where is a weight matrix and a hyperparameter. This regularization is known to often be too limiting (Miyato et al., 2018), so we explore several variants designed to relax the constraint while still imparting the desired smoothness to our models. The version we find to work best removes the diagonal terms from the regularization, and aims to minimize the pairwise cosine similarity between filters but does not constrain their norm:
(3) 
where denotes a matrix with all elements set to . We sweep values and select , finding this small additional regularization sufficient to improve the likelihood that our models will be amenable to truncation. Across runs in Table 1, we observe that without Orthogonal Regularization, only 16% of models are amenable to truncation, compared to 60% when trained with Orthogonal Regularization.
We find that current GAN techniques are sufficient to enable scaling to large models and distributed, largebatch training. We find that we can dramatically improve the state of the art and train models up to 512512 resolution without need for explicit multiscale methods like Karras et al. (2018). Despite these improvements, our models undergo training collapse, necessitating early stopping in practice. In the next two sections we investigate why settings which were stable in previous works become unstable when applied at scale.


Much previous work has investigated GAN stability from a variety of analytical angles and on toy problems, but the instabilities we observe occur for settings which are stable at small scale, necessitating direct analysis at large scale. We monitor a range of weight, gradient, and loss statistics during training, in search of a metric which might presage the onset of training collapse, similar to (Odena et al., 2018). We found the top three singular values of each weight matrix to be the most informative. They can be efficiently computed using the Alrnoldi iteration method (Golub & der Vorst, 2000), which extends the power iteration method, used in Miyato et al. (2018), to estimation of additional singular vectors and values. A clear pattern emerges, as can be seen in Figure 3(a) and Appendix F: most G layers have wellbehaved spectral norms, but some layers (typically the first layer in G, which is overcomplete and not convolutional) are illbehaved, with spectral norms that grow throughout training and explode at collapse.
To ascertain if this pathology is a cause of collapse or merely a symptom, we study the effects of imposing additional conditioning on G to explicitly counteract spectral explosion. First, we directly regularize the top singular values of each weight, either towards a fixed value or towards some ratio of the second singular value, (with the stopgradient operation to prevent the regularization from increasing
). Alternatively, we employ a partial singular value decomposition to instead clamp
. Given a weight , its first singular vectors and , and the value to which the will be clamped, our weights become:(4) 
where is set to either or . We observe that both with and without Spectral Normalization these techniques have the effect of preventing the gradual increase and explosion of either or , but even though in some cases they mildly improve performance, no combination prevents training collapse. This evidence suggests that while conditioning G might improve stability, it is insufficient to ensure stability. We accordingly turn our attention to D.
As with G, we analyze the spectra of D’s weights to gain insight into its behavior, then seek to stabilize training by imposing additional constraints. Figure 3(b) displays a typical plot of for D (with further plots in Appendix F). Unlike G, we see that the spectra are noisy, is wellbehaved, and the singular values grow throughout training but only jump at collapse, instead of exploding.
The spikes in D’s spectra might suggest that it periodically receives very large gradients, but we observe that the Frobenius norms are smooth (Appendix F), suggesting that this effect is primarily concentrated on the top few singular directions. We posit that this noise is a result of optimization through the adversarial training process, where G periodically produces batches which strongly perturb D . If this spectral noise is causally related to instability, a natural counter is to employ gradient penalties, which explicitly regularize changes in D’s Jacobian. We explore the zerocentered gradient penalty from Mescheder et al. (2018):
(5) 
With the default suggested strength of 10, training becomes stable and improves the smoothness and boundedness of spectra in both G and D, but performance severely degrades, resulting in a 45% reduction in IS. Reducing the penalty partially alleviates this degradation, but results in increasingly illbehaved spectra; even with the penalty strength reduced to (the lowest strength for which sudden collapse does not occur) the IS is reduced by 20%. Repeating this experiment with various strengths of Orthogonal Regularization, DropOut (Srivastava et al., 2014), and L2 (See Appendix H for details), reveals similar behaviors for these regularization strategies: with high enough penalties on D, training stability can be achieved, but at a substantial cost to performance.
We also observe that D’s loss approaches zero during training, but undergoes a sharp upward jump at collapse (Appendix F). One possible explanation for this behavior is that D is overfitting to the training set, memorizing training examples rather than learning some meaningful boundary between real and generated images. As a simple test for D’s memorization (related to Gulrajani et al. (2017)), we evaluate uncollapsed discriminators on the ImageNet training and validation sets, and measure what percentage of samples are classified as real or generated. While the training accuracy is consistently above 98%, the validation accuracy falls in the range of 5055%, no better than random guessing (regardless of regularization strategy). This confirms that D is indeed memorizing the training set; we deem this in line with D’s role, which is not explicitly to generalize, but to distill the training data and provide a useful learning signal for G.
We find that stability does not come solely from G or D, but from their interaction through the adversarial training process. While the symptoms of their poor conditioning can be used to track and identify instability, ensuring reasonable conditioning proves necessary for training but insufficient to prevent eventual training collapse. It is possible to enforce stability by strongly constraining D, but doing so incurs a dramatic cost in performance. With current techniques, better final performance can be achieved by relaxing this conditioning and allowing collapse to occur at the later stages of training, by which time a model is sufficiently trained to achieve good results.




Model  Res.  FID/IS  (min FID) / IS  FID / (valid IS)  FID / (max IS) 

SNGAN 
128  27.62 / 36.80  N/A  N/A  N/A 
SAGAN 
128  18.65 / 52.52  N/A  N/A  N/A 
BigGAN 
128  /  /  /  
BigGAN 
256  /  /  /  / 
BigGAN 
512  /  /  /  / 

Evaluation of models at different resolutions. We report scores without truncation (Column 3), scores at the best FID (Column 4), scores at the IS of validation data (Column 5), and scores at the max IS (Column 6). Standard deviations are computed over at least three random initializations.
We evaluate our models on ImageNet ILSVRC 2012 (Russakovsky et al., 2015) at 128128, 256256, and 512512 resolutions, employing the settings from Table 1, row 8. Architectural details for each resolution are available in Appendix B. Samples are presented in Figure 4, with additional samples in Appendix A, and we report IS and FID in Table 2. As our models are able to trade sample variety for quality, it is unclear how best to compare against prior art; we accordingly report values at three settings, with detailed curves in Appendix D. First, we report the FID/IS values at the truncation setting which attains the best FID. Second, we report the FID at the truncation setting for which our model’s IS is the same as that attained by the real validation data, reasoning that this is a passable measure of maximum sample variety achieved while still achieving a good level of “objectness.” Third, we report FID at the maximum IS achieved by each model, to demonstrate how much variety must be traded off to maximize quality. In all three cases, our models outperform the previous stateoftheart IS and FID scores achieved by Miyato et al. (2018) and Zhang et al. (2018).
Our observation that D overfits to the training set, coupled with our model’s sample quality, raises the obvious question of whether or not G simply memorizes training points. To test this, we perform classwise nearest neighbors analysis in pixel space and the feature space of pretrained classifier networks (Appendix A
). In addition, we present both interpolations between samples and classwise interpolations (where
is held constant) in Figures 8 and 9. Our model convincingly interpolates between disparate samples, and the nearest neighbors for its samples are visually distinct, suggesting that our model does not simply memorize training data.We note that some failure modes of our partiallytrained models are distinct from those previously observed. Most previous failures involve local artifacts (Odena et al., 2016), images consisting of texture blobs instead of objects (Salimans et al., 2016), or the canonical mode collapse. We observe class leakage, where images from one class contain properties of another, as exemplified by Figure 4(d). We also find that many classes on ImageNet are more difficult than others for our model; our model is more successful at generating dogs (which make up a large portion of the dataset, and are mostly distinguished by their texture) than crowds (which comprise a small portion of the dataset and have more largescale structure). Further discussion is available in Appendix A.
To confirm that our design choices are effective for even larger and more complex and diverse datasets, we also present results of our system on a subset of JFT300M (Sun et al., 2017). The full JFT300M dataset contains 300M realworld images labeled with 18K categories. Since the category distribution is heavily longtailed, we subsample the dataset to keep only images with the 8.5K most common labels. The resulting dataset contains 292M images – two orders of magnitude larger than ImageNet. For images with multiple labels, we sample a single label randomly and independently whenever an image is sampled. To compute IS and FID for the GANs trained on this dataset, we use an Inception v2 classifier (Szegedy et al., 2016) trained on this dataset. Quantitative results are presented in Table 3. All models are trained with batch size 2048. We compare an ablated version of our model – comparable to SAGAN (Zhang et al., 2018) but with the larger batch size – against a “full” version that makes uses of all of the techniques applied to obtain the best results on ImageNet (shared embedding, hierarchical latents, and orthogonal regularization). Our results show that these techniques substantially improve performance even in the setting of this much larger dataset at the same model capacity (64 base channels). We further show that for a dataset of this scale, we see significant additional improvements from expanding the capacity of our models to 128 base channels, while for ImageNet GANs that additional capacity was not beneficial.
In Figure 18 (Appendix D), we present truncation plots for models trained on this dataset. Unlike for ImageNet, where truncation limits of tend to produce the highest fidelity scores, IS is typically maximized for our JFT300M models when the truncation value ranges from 0.5 to 1. We suspect that this is at least partially due to the intraclass variability of JFT300M labels, as well as the relative complexity of the image distribution, which includes images with multiple objects at a variety of scales. Interestingly, unlike models trained on ImageNet, where training tends to collapse without heavy regularization (Section 4), the models trained on JFT300M remain stable over many hundreds of thousands of iterations. This suggests that moving beyond ImageNet to larger datasets may partially alleviate GAN stability issues.
The improvement over the baseline GAN model that we achieve on this dataset without changes to the underlying models or training and regularization techniques (beyond expanded capacity) demonstrates that our findings extend from ImageNet to datasets with scale and complexity thus far unprecedented for generative models of images.
Ch.  Param (M)  Shared  Hier.  Ortho.  FID  IS  (min FID) / IS  FID / (max IS) 

64  317.1  red✗  red✗  red✗  /  /  
64  99.4  mygreen✓  mygreen✓  mygreen✓  /  /  
96  207.9  mygreen✓  mygreen✓  mygreen✓  /  /  
128  355.7  mygreen✓  mygreen✓  mygreen✓  /  / 
We have demonstrated that Generative Adversarial Networks trained to model natural images of multiple categories highly benefit from scaling up, both in terms of fidelity and variety of the generated samples. As a result, our models set a new level of performance among ImageNet GAN models, improving on the state of the art by a large margin. We have also presented an analysis of the training behavior of large scale GANs, characterized their stability in terms of the singular values of their weights, and discussed the interplay between stability and performance.
We would like to thank Kai Arulkumaran, Matthias Bauer, Peter Buchlovsky, Jeffrey Defauw, Sander Dieleman, Ian Goodfellow, Ariel Gordon, Karol Gregor, Dominik Grewe, Chris Jones, Jacob Menick, Augustus Odena, Suman Ravuri, Ali Razavi, Mihaela Rosca, and Jeff Stanway.
Amortised map inference for image superresolution.
In ICLR, 2017.Revisiting unreasonable effectiveness of data in deep learning era.
In ICCV, pp. 843–852, 2017.Rethinking the inception architecture for computer vision.
In CVPR, pp. 2818–2826, 2016.


We use the ResNet (He et al., 2016) GAN architecture of (Zhang et al., 2018). This architecture is identical to that used by (Miyato et al., 2018), but with the channel pattern in D modified so that the number of filters in the first convolutional layer of each block is equal to the number of output filters (rather than the number of input filters, as in Miyato et al. (2018); Gulrajani et al. (2017)).
We use a single shared class embedding in G, which is linearly projected to produce persample gains and biases for the BatchNorm layers. The bias projections are zerocentered, while the gain projections are onecentered. When employing hierarchical latent spaces, the latent vector is split along its channel dimension into equal sized chunks, and each chunk is separately concatenated to the copy of the class embedding passed into a given block.








Our basic setup follows SAGAN (Zhang et al., 2018), and is implemented in TensorFlow (Abadi et al., 2016). We employ the architectures detailed in Appendix B, with nonlocal blocks inserted at a single stage in each network. Both G and D networks are initialized with Orthogonal Initialization (Saxe et al., 2014). We use the Adam optimizer (Kingma & Ba, 2014), with a constant learning rate of in D and in G; in both networks, and . We experimented with the number of D steps per G step (varying it from to ) and found that two D steps per G step gave the best results.
We use an exponential moving average of the weights of G at sampling time, with a decay rate set to 0.9999. We employ crossreplica BatchNorm (Ioffe & Szegedy, 2015) in G, where batch statistics are aggregated across all devices, rather than a single device as in standard implementations. Spectral Normalization (Miyato et al., 2018) is used in both G and D, following SAGAN (Zhang et al., 2018). We train on a Google TPU v3 Pod, with the number of cores proportional to the resolution: 128 for 128128, 256 for 256256, and 512 for 512512. Training takes between 24 and 48 hours for most models. We increase from the default to in BatchNorm and Spectral Norm to mollify lowprecision numerical issues.
We preprocess data by cropping along the long edge and rescaling to a given resolution with area resampling. As the ImageNet dataset has many lowresolution images, directly training at 512512 produces aliased results, so we filter out all images with a short edge length less than 400 pixels. Similar to the CelebAHQ dataset employed by Karras et al. (2018), this reduces the dataset size to around 200,000 instances.
The default behavior with batch normalized classifier networks is to use a running average of the activation moments at test time. Previous works
(Radford et al., 2016) have instead used batch statistics when sampling images. While this is not technically an invalid way to sample, it means that results are dependent on the test batch size (and how many devices it is split across), and further complicates reproducibility.We find that this detail is extremely important, with changes in test batch size producing drastic changes in performance. This is further exacerbated when one uses exponential moving averages of G’s weights for sampling, as the BatchNorm running averages are computed with nonaveraged weights and are poor estimates of the activation statistics for the averaged weights.
To counteract both these issues, we employ “standing statistics,” where we compute activation statistics at sampling time by running the G
through multiple forward passes (typically 100) each with different batches of random noise, and storing means and variances aggregated across all forward passes. Analogous to using running statistics, this results in
G’s outputs becoming invariant to batch size and the number of devices, even when producing a single sample.We compute the IS for both the training and validation sets of ImageNet. At 128128 the training data has an IS of 233, and the validation data has an IS of 166. At 256256 the training data has an IS of 377, and the validation data has an IS of 234. At 512512 the training data has an IS of 348, and the validation data has an IS of 241. The discrepancy between training and validation scores is due to the Inception classifier having been trained on the training data, resulting in highconfidence outputs that are preferred by the Inception Score.
While most previous work has employed or as the prior for (the noise input to G), we are free to choose any latent distribution from which we can sample. We explore the choice of latents by considering an array of possible designs, described below. For each latent, we provide the intuition behind its design and briefly describe how it performs when used as a dropin replacement for in an SAGAN baseline. As the Truncation Trick proved more beneficial than switching to any of these latents, we do not perform a full ablation study, and employ for our main results to take full advantage of truncation. The two latents which we find to work best without truncation are Bernoulli and Censored Normal , both of which improve speed of training and lightly improve final performance, but are less amenable to truncation.
We also ablate the choice of latent space dimensonality (which by default is ), finding that we are able to successfully train with latent dimensions as low as , and that with we see a minimal drop in performance. While this is substantially smaller than many previous works, direct comparison to singleclass networks (such as those in Karras et al. (2018), which employ a latent space on a highly constrained dataset with 30,000 images) is improper, as our networks have additional class information provided as input.
. A standard choice of the latent space which we use in the main experiments.
. Another standard choice; we find that it performs similarly to .
Bernoulli . A discrete latent might reflect our prior that underlying factors of variation in natural images are not continuous, but discrete (one feature is present, another is not). This latent outperforms (in terms of IS) by 8% and requires 60% fewer iterations.
, also called Censored Normal. This latent is designed to introduce sparsity in the latent space (reflecting our prior that certain latent features are sometimes present and sometimes not), but also allow those latents to vary continuously, expressing different degrees of intensity for latents which are active. This latent outperforms (in terms of IS) by 1520% and tends to require fewer iterations.
Bernoulli . This latent is designed to be discrete, but not sparse (as the network can learn to activate in response to negative inputs). This latent performs nearidentically to .
Independent Categorical in , with equal probability. This distribution is chosen to be discrete and have sparsity, but also to allow latents to take on both positive and negative values. This latent performs nearidentically to .
multiplied by Bernoulli . This distribution is chosen to have continuous latent factors which are also sparse (with a peak at zero), similar to Censored Normal but not constrained to be positive. This latent performs nearidentically to .
Concatenating and Bernoulli , each taking half of the latent dimensions. This is inspired by Chen et al. (2016), and is chosen to allow some factors of variation to be discrete, while others are continuous. This latent outperforms by around 5%.
Variance annealing: we sample from , where is allowed to vary over training. We compared a variety of piecewise schedules and found that starting with and annealing towards over the course of training mildly improved performance. The space of possible variance schedules is large, and we did not explore it in depth – we suspect that a more principled or bettertuned schedule could more strongly impact performance.
Persample variable variance: , where independently for each sample in a batch, and are hyperparameters. This distribution was chosen to try and improve amenability to the Truncation Trick by feeding the network noise samples with nonconstant variance. This did not appear to affect performance, but we did not explore it in depth. One might also consider scheduling , similar to variance annealing.



















































We explored a range of novel and existing techniques which ended up degrading or otherwise not affecting performance in our setting. We report them here; our evaluations for this section are not as thorough as those for the main architectural choices.
We found that doubling the depth (by inserting an additional Residual block after every up or downsampling block) hampered performance.
We experimented with sharing class embeddings between both G and D (as opposed to just within G). This is accomplished by replacing D’s class embedding with a projection from G’s embeddings, as is done in G’s BatchNorm layers. In our initial experiments this seemed to help and accelerate training, but we found this trick scaled poorly and was sensitive to optimization hyperparameters, particularly the choice of number of D steps per G step.
We tried replacing BatchNorm in G with WeightNorm (Salimans & Kingma, 2016), but this crippled training. We also tried removing BatchNorm and only having Spectral Normalization, but this also crippled training.
We tried adding BatchNorm to D (both classconditional and unconditional) in addition to Spectral Normalization, but this crippled training.
We tried varying the choice of location of the attention block in G and D (and inserting multiple attention blocks at different resolutions) but found that at 128128 there was no noticeable benefit to doing so, and compute and memory costs increased substantially. We found a benefit to moving the attention block up one stage when moving to 256256, which is in line with our expectations given the increased resolution.
We tried using filter sizes of 5 or 7 instead of 3 in either G or D or both. We found that having a filter size of 5 in G only provided a small improvement over the baseline but came at an unjustifiable compute cost. All other settings degraded performance.
We tried varying the dilation for convolutional filters in both G and D at 128128, but found that even a small amount of dilation in either network degraded performance.
We tried bilinear upsampling in G in place of nearestneighbors upsampling, but this degraded performance.
In some of our models, we observed classconditional mode collapse, where the model would only output one or two samples for a subset of classes but was still able to generate samples for all other classes. We noticed that the collapsed classes had embedings which had become very large relative to the other embeddings, and attempted to ameliorate this issue by applying weight decay to the shared embedding only. We found that small amounts of weight decay () instead degraded performance, and that only even smaller values () did not degrade performance, but these values were also too small to prevent the class vectors from exploding. Higherresolution models appear to be more resilient to this problem, and none of our final models appear to suffer from this type of collapse.
We experimented with using MLPs instead of linear projections from G’s class embeddings to its BatchNorm gains and biases, but did not find any benefit to doing so. We also experimented with Spectrally Normalizing these MLPs, and with providing these (and the linear projections) with a bias at their output, but did not notice any benefit.
We tried gradient norm clipping (both the global variant typically used in recurrent networks, and a local version where the clipping value is determined on a perparameter basis) but found this did not alleviate instability.
We performed various hyperparameter sweeps in this work:
We swept the Cartesian product of the learning rates for each network through [, , , , , , ], and initially found that the SAGAN settings (G’s learning rate , D’s learning rate ) were optimal at lower batch sizes; we did not repeat this sweep at higher batch sizes but did try halving and doubling the learning rate, arriving at the halved settings used for our experiments.
We swept the R1 gradient penalty strength through [, , , , , , , , ]. We find that the strength of the penalty correlates negatively with performance, but that settings above impart training stability.
We swept the keep probabilities for DropOut in the final layer of D through [, , , , , ]. We find that DropOut has a similar stabilizing effect to R1 but also degrades performance.
We swept D’s Adam parameter through [, , , , ] and found it to have a light regularization effect similar to DropOut, but not to significantly improve results. Higher terms in either network crippled training.
We swept the strength of the modified Orthogonal Regularization penalty in G through [, , , , , ], and selected .
Comments
There are no comments yet.