Style-Based Generators
StyleGAN’s mapping network, style modulation and controllable synthesis.
Between 2017 and 2021 one research group rebuilt the GAN generator four times. Each rebuild fixed a specific, visible defect: training that fell apart at high resolution, entangled controls, water-droplet blobs, and textures glued to the screen while faces moved. Following the fixes is a tour of what a generator's architecture actually controls.
What you’ll learn
- Explain progressive growing and StyleGAN's mapping network, style modulation, constant input, noise inputs and style mixing.
- Prove that AdaIN overrides each channel's statistics, derive StyleGAN2's weight demodulation, and explain path-length regularization.
- Explain texture sticking as an aliasing problem and how StyleGAN3 treats feature maps as bandlimited continuous signals.
- Analyze the truncation trick as a fidelity–diversity trade-off, and place GANs among generative models as of the mid-2020s.
From progressive growing to styles
Progressive growing (Karras, Aila, Laine & Lehtinen, 2018) attacked the instability of high-resolution GANs by not starting at high resolution. Generator and discriminator begin at ; new layers for , then and onward are added during training, each faded in by blending its output with an upsampled copy of the previous resolution as a weight rises from 0 to 1. The networks learn coarse structure first and refine it, and the paper reached faces on a new high-quality version of the CelebA dataset. It also introduced a minibatch standard-deviation feature that lets the discriminator see how varied a batch is (a cheap defense against collapse), an equalized learning rate that rescales each layer's weights at runtime by its He initialization constant, and pixelwise feature normalization in the generator.
StyleGAN (Karras, Laine & Aila, 2019) kept the discriminator and the progressive schedule but redesigned how the latent enters the generator.
Style mixing exploits the localization. During training a fraction of images are generated from two latents: drives the layers before a random crossover point and the layers after it, which discourages the network from assuming adjacent styles are correlated. At inference, copying the coarse styles ( to ) from one face transfers pose, face shape and eyeglasses; the middle styles ( to ) carry smaller facial features and hair style; the fine styles carry the color scheme and microstructure. The noise inputs take over truly stochastic detail, such as the exact placement of hairs and freckles, so the latent need not encode it.
Why a mapping network? must follow a fixed distribution, so if some combination of factors is rare or missing in the data (say, long hair on a particular face shape), the generator must warp to avoid producing it. is not tied to any fixed distribution, so the mapping can absorb that warping and leave closer to linear in the factors of variation. Karras et al. introduced two measures to test the claim on their new FFHQ dataset of 70,000 faces at :
- Perceptual path length (PPL): subdivide interpolation paths into steps of size and average the perceptual distance (a weighted difference of VGG16 features) between images at the ends of each step, scaled by . Paths use slerp in and plain interpolation in . A short path means no abrupt changes along the way.
- Linear separability: label 200,000 generated images with classifiers for 40 CelebA attributes, keep the more confidently labeled half, fit a linear SVM per attribute in latent space, and report , the conditional entropy of the true labels given the SVM's side. Lower means the attributes are more linearly separable.
On both measures beat substantially.
You generate two faces, A and B, and build a third by taking the styles for the and layers from B and all other styles from A. What do you expect?
- B's colors and skin texture on A's face shape and pose
- An average of the two faces at every scale
- B's pose, face shape and eyeglasses, with A's finer features, colors and texture
- A face identical to A, since only two layers changed
Show the answer
C. B's pose, face shape and eyeglasses, with A's finer features, colors and texture
The coarse layers decide large-scale structure, and AdaIN resets channel statistics at every layer, so B's coarse styles fix the layout that A's finer styles then render. This is style mixing as reported by Karras, Laine & Aila (2019).
StyleGAN2: demodulation and smooth latents
Most StyleGAN images contain a faint blob, like a water droplet, visible in the feature maps from about upward. Karras et al. (2020) traced it to AdaIN itself. Normalizing each feature map separately discards the relative magnitudes of features, and the generator learns to sneak magnitude information past the normalization by creating a strong localized spike that dominates the statistics. Remove the normalization and the droplets disappear, but the styles need some normalization to stay in range. StyleGAN2 normalizes the weights instead, based on the statistics the activations are expected to have.
Fold the style into the convolution: scale the weights reading input map by its style . Here indexes output maps and the kernel's spatial taps:
Assume the input activations are independent with unit standard deviation. Output at a position is , a sum of independent terms, so its variance is the sum of squared weights:
Divide each output map's weights by that standard deviation, with a small for numerical safety, to restore unit variance:
Unlike AdaIN this uses no statistics of the actual feature maps, only of the weights and styles, so it cannot erase information the generator carries in magnitudes, and there is no incentive to create spikes. It is also cheap: modulation and demodulation act on the kernel, implemented as a grouped convolution with one kernel per example.
One output map of a convolution reads 4 input maps; every weight is and every style is . With independent unit-variance inputs, what is the output's standard deviation before demodulation?
Show the answer
0.6
There are weights, so . Demodulation divides those weights by , restoring unit variance. Doubling one style raises its 9 weights' contribution fourfold, and demodulation renormalizes the whole output, so styles change the mix of inputs, not the overall scale.
Path-length regularization. Karras et al. found that lower PPL correlated with images that looked better, and argued that a well-conditioned map from to images, where a fixed-size step in changes the image by a fixed amount in every direction, should help. With the Jacobian of the generator at and a random image, they penalize
with a running average of the observed lengths. Since , the penalty asks for the same overall gain everywhere, and in high dimensions it is minimized when is orthogonal up to a global scale at every . It cannot be pushed to zero PPL, which would mean a constant generator; Karras et al. note that minimizing PPL directly leads to a degenerate solution with zero recall. The penalty is computed only every few minibatches (lazy regularization: every 16 for the discriminator's penalty, every 8 for the path-length term), at little cost in quality.
StyleGAN2 also dropped progressive growing, whose intermediate resolutions produced phase artifacts: details such as teeth and eyes that stayed fixed on screen as the face turned, then jumped. A generator with skip connections that sum RGB outputs from every resolution, and a residual discriminator, learn coarse-to-fine without changing the network's topology during training.
StyleGAN3: aliasing and texture sticking
Animate a StyleGAN2 face by interpolating its latent, and fine details such as hair and stubble appear glued to the screen while the face moves underneath them: texture sticking. The generator is using absolute pixel coordinates, which it should have no access to. Karras et al. (2021) located the leaks: image borders, per-pixel noise inputs, positional encodings and, above all, aliasing from imperfect upsampling filters and from pointwise nonlinearities applied on the pixel grid. Aliasing in convolution layers is introduced in Convolution, Pooling & Receptive Fields.
Alias-free GAN (StyleGAN3) treats every feature map as the samples of a bandlimited continuous signal and requires each layer to be a well-defined operation on the continuous signal, which then makes it equivariant to translations (and optionally rotations) in the continuous domain:
- Convolutions and up/downsampling are already fine if their filters are proper low-pass filters; StyleGAN3 uses Kaiser-windowed sinc filters, with cutoffs that rise gradually through the layers.
- Pointwise nonlinearities are the problem. A ReLU applied to a smooth signal creates sharp kinks, whose spectrum extends to arbitrarily high frequencies; on a discrete grid those frequencies alias. StyleGAN3 temporarily upsamples by , applies the nonlinearity at the higher rate, low-pass filters, and downsamples back.
- No absolute positions. The learned constant input becomes Fourier features, which can be translated and rotated exactly; per-pixel noise inputs are removed; borders are handled by computing on a margin around the visible image.
The translation-equivariant StyleGAN3-T keeps convolutions; StyleGAN3-R also becomes equivariant to rotations by using convolutions and radially symmetric (jinc-based) filters. Equivariance is measured as the PSNR, in decibels, between "transform the input, then generate" and "generate, then transform the output". FID stayed comparable to StyleGAN2 (3.67 for StyleGAN3-T and 3.66 for -R against 3.79 on unaligned FFHQ at ), while the motion became natural: textures now move with the surfaces they belong to.
Think first StyleGAN2 is trained only on still images and is scored only on still images. Why should anyone care that it is not equivariant?
Because the latent space is used to animate and edit: interpolation videos, pose changes, and any downstream use that moves content in the image. Sticking textures are invisible in single frames and glaring in motion. More fundamentally, a network that exploits absolute pixel coordinates has learned something false about images, that content depends on where the frame is, which also limits how well its internal representations transfer.
Truncation, and where GANs stand
Every GAN has rare latents that produce poor samples. The truncation trick trades diversity for fidelity by avoiding them. BigGAN (Brock, Donahue & Simonyan, 2019), trained on ImageNet at a then-unprecedented scale (batch size up to 2,048), sampled from a truncated normal, resampling any coordinate whose magnitude exceeds a threshold. Lowering the threshold raised the Inception Score, a fidelity measure, while variety fell, until FID, which also penalizes lost diversity, got worse. Not every generator tolerates truncated inputs, so BigGAN added an orthogonality penalty with , which pushes filters toward orthogonality without constraining their norms; it raised the share of models amenable to truncation from 16% to 60%.
StyleGAN truncates in instead, pulling each latent toward the average:
At nothing changes; at every sample is the "average face"; in between, samples become more typical and less varied. Applying it only to the coarse layers keeps fine-detail variety. In the language of Evaluating Generative Models, truncation raises precision and lowers recall.
Where GANs stand. Diffusion models overtook GANs in image quality around 2021 (Dhariwal & Nichol, 2021) and, by the mid-2020s, dominate image and video generation. GANs keep three niches:
- One-step generation. A generator samples in a single forward pass. GigaGAN (Kang et al., 2023) scaled a GAN to text-to-image synthesis and generates a image in about 0.13 seconds; StyleGAN-XL (Sauer, Schwarz & Geiger, 2022) reached on ImageNet; and R3GAN (Huang, Gokaslan, Kuleshov & Tompkin, 2024) showed that a regularized relativistic loss lets a modernized, trick-free architecture beat StyleGAN2 on several datasets.
- Adversarial losses as components. The discriminators of VQGAN-style tokenizers, latent-diffusion autoencoders, super-resolution models and neural audio codecs, and the adversarial term in diffusion distillation such as ADD (Sauer et al., 2024), which samples large image models in 1 to 4 steps (see Few-Step Generation).
- Small data and editing. Adaptive discriminator augmentation (Karras et al., 2020) trains StyleGAN-quality models from a few thousand images, and StyleGAN latent spaces remain a laboratory for inversion and editing.
Key takeaways
- Progressive growing trained GANs coarse to fine; StyleGAN then fed the latent through a mapping network to and injected it as per-layer styles via AdaIN, starting from a learned constant, with per-pixel noise for stochastic detail.
- AdaIN resets each channel's mean and standard deviation, so styles act at the scale of their layer, which is what style mixing exploits; PPL and linear separability showed smoother and more linear than .
- StyleGAN2 replaced AdaIN by weight demodulation , which removed droplet artifacts, and added path-length regularization and skip/residual architectures without progressive growing.
- StyleGAN3 traced texture sticking to aliasing and positional leaks, and made the generator equivariant by treating feature maps as bandlimited signals and filtering around every nonlinearity.
- Truncation ( in , or truncated normals in BigGAN) trades diversity for fidelity. As of the mid-2020s GANs matter mainly for one-step generation, as adversarial losses inside other systems, and for small-data training and editing.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why does StyleGAN map through an 8-layer MLP to instead of feeding to the synthesis network?
- To make sampling faster
- To reduce the latent dimension
- Because must follow a Gaussian distribution
- Because is not tied to a fixed distribution, so the mapping can absorb the warping that data statistics demand and leave closer to linear in the factors of variation
Show the answer
D. Because is not tied to a fixed distribution, so the mapping can absorb the warping that data statistics demand and leave closer to linear in the factors of variation
is forced to be Gaussian, so a generator fed directly must curve it to avoid generating rare or absent factor combinations. The learned mapping lets take whatever shape suits the synthesis network, and PPL and linear separability were both better in .
What does StyleGAN2's demodulation normalize, and why does that remove the droplet artifacts?
- The activations of each feature map, using their measured mean and variance, exactly as AdaIN does
- The modulated weights of each output map, by the standard deviation the output would have for independent unit-variance inputs; no measured activation statistics are discarded, so there is no reason to create spikes
- The generator's output image, by clipping it to a valid range
- The latent , by projecting it onto the unit sphere
Show the answer
B. The modulated weights of each output map, by the standard deviation the output would have for independent unit-variance inputs; no measured activation statistics are discarded, so there is no reason to create spikes
Dividing by fixes the expected output scale using only weights and styles. AdaIN's per-map normalization of actual activations was what the droplets were exploiting.
You lower StyleGAN's truncation parameter from to . What happens?
- Samples become more typical and individually cleaner, but less varied: fidelity up, diversity down
- Samples become more varied, because latents are spread further from the mean
- Nothing, because truncation only affects training
- The generator must be retrained for the new
Show the answer
A. Samples become more typical and individually cleaner, but less varied: fidelity up, diversity down
pulls every latent halfway toward the average, away from the rare regions that produce poor samples. In precision–recall terms, precision rises and recall falls; at every sample is the same average face.
What did StyleGAN3 identify as the main cause of texture sticking?
- Too few latent dimensions to describe motion
- Mode collapse of the generator
- Aliasing and other unintended positional references, such as image borders and per-pixel noise, that let the network tie details to pixel coordinates
- The truncation trick
Show the answer
C. Aliasing and other unintended positional references, such as image borders and per-pixel noise, that let the network tie details to pixel coordinates
Imperfect resampling filters and pointwise nonlinearities on the pixel grid create aliased frequencies that depend on the grid's position. StyleGAN3 treats feature maps as bandlimited continuous signals, filters around every nonlinearity, and removes absolute-position inputs.
Further reading
- T. Karras, T. Aila, S. Laine & J. Lehtinen, "Progressive growing of GANs for improved quality, stability, and variation," ICLR (2018).
- T. Karras, S. Laine & T. Aila, "A style-based generator architecture for generative adversarial networks," CVPR (2019).
- T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen & T. Aila, "Analyzing and improving the image quality of StyleGAN," CVPR (2020).
- T. Karras, M. Aittala, S. Laine, E. Härkönen, J. Hellsten, J. Lehtinen & T. Aila, "Alias-free generative adversarial networks," NeurIPS (2021).
- A. Brock, J. Donahue & K. Simonyan, "Large scale GAN training for high fidelity natural image synthesis," ICLR (2019).