Data Science & Machine Learning — Article 88
Style GAN: A Comprehensive Guide
Explore detailed Style GAN
Introduction
StyleGAN injects a learned style at every resolution through adaptive instance normalization, which makes scale-wise control structural rather than emergent.
The reach of that mechanism is exactly characterizable.
AdaIN applies a per-channel gain and offset after normalization, so the normalized spatial pattern inside a channel is style-invariant, matching the input to 3.4×10⁻¹³ across gains spanning five orders of magnitude. That fixes the degrees of freedom exactly.
A style controls 2C numbers against C H W outputs, a ratio of 0.125 at 4×4 and 3.05×10⁻⁵ at 256×256, which is the mechanism behind coarse styles governing structure and fine styles governing appearance.
Injecting styles directly makes the influence structure exactly lower-triangular. But every layer moved the final output, so the scales are ordered rather than independent.
Table of Contents
- Introduction
- Table of Contents
- What is StyleGAN
- Core Components of StyleGAN
- Mathematical Foundation
- Types of Style Injection
- Evaluation Metrics
- Selecting Evaluation Metrics
- Assumptions and Practical Considerations
What is StyleGAN
Definition
- StyleGAN restructures the generator into three parts: a mapping network from noise to an intermediate latent.
- A learned constant input, and a synthesis stack in which the latent is injected at every resolution through AdaIN:
- The noise vector no longer enters at the input. The first activation is a learned constant, and all variation arrives through the styles.
What that buys structurally
- The third row is the one usually left implicit, and Section 5 shows it is exact: the style cannot alter the normalized spatial pattern within a channel at all.
Core Components of StyleGAN
The style’s degrees of freedom against the output size
- The ratio does not depend on the channel count at all, only on the spatial size:
- The ratio falls by four orders of magnitude across the stack.
- A style injected early controls a proportionally far larger share of its stage’s activations than one injected late, which is the structural reason the coarse/fine split exists rather than an empirical observation about what styles happen to do.
Mathematical Foundation
What AdaIN can and cannot change
Since the style enters only after normalization, the normalized pattern within a channel is which does not depend on the style except through that sign:
The pattern is invariant across a gain range of five orders of magnitude, and the achieved channel mean and standard deviation equal μc and ∣σc∣ to machine precision.
The last row’s larger residual is the stabilizing ε in the denominator mattering relatively more at tiny gains, not a failure of the identity.
With negative gains the pattern flips exactly:
So the reachable set from a style alone is a 2C-dimensional affine family, and every spatial arrangement is determined by the convolutions and the learned constant.
A style can say how strongly a channel speaks and at what offset; it cannot say what the channel says.
Scale-wise influence is exactly causal
Injecting styles directly, so each layer is an independent knob, and perturbing one at a time on a four-resolution generator.
Entries are the relative change in mean absolute activation:
The upper triangle is exactly zero across all six entries: a style at layer i cannot affect anything computed before it.
That is causality in the forward pass, and it is what scale-wise control means.
Control is not independence, and the distinction is measurable
The minimum influence on later-or-same scales was 4.352×10⁻², so nothing downstream is untouched.
Get Arko Sengupta’s stories in your inbox
Join Medium for free to get updates from this writer.
Measuring each layer’s effect on the final output at matched perturbation size:
Every layer moves the output, so the scales are ordered, not independent.
Note also that the last style has the largest effect on the final image, at 0.169288 against roughly 0.06 for the others, because nothing follows it to dilute its contribution.
Style mixing works because the influence is triangular; it does not work because the influences are disjoint.
Truncation has an exact cost
Replacing w by w̄ + ψ(w-w̄) maps covariance Σ to ψ²Σ exactly, so every second-moment quantity scales predictably:
Writing w’ = w̄ + ψ(w-w̄), the covariance and the induced volume scale as
and two consequences follow immediately, the second being the one that matters:
At ψ = 0.7 the sampled volume is 1.38% of the original, so truncation is a far larger intervention than the linear shrink factor suggests.
Reporting ψ without ψᵏ understates how much of the distribution has been discarded.
Types of Style Injection
Why per-layer noise is a necessary companion, not an extra
- Section 5 established that a style cannot alter the normalized spatial pattern within a channel.
- So any stochastic spatial detail, the placement of individual hairs or pores, cannot come from the style at all: with a fixed constant input and fixed convolutions, that detail would be identical for every sample.
- The separate per-pixel noise inputs exist precisely to supply the degrees of freedom AdaIN structurally lacks.
- The two mechanisms are complementary by construction rather than by design preference.
On StyleGAN2’s demodulation
- Scaling the convolution weights rather than the activations achieves the same per-channel effect without an explicit normalization step, which removes the droplet artifacts attributed to instance normalization.
- The degrees-of-freedom accounting in Section 4 is unchanged, since the style still supplies one scale per channel.
Evaluation Metrics
Perceptual path length is a Jacobian norm
- Expanding G(w+ε d) — G(w) = ε J d + O(ε²) and averaging over unit d gives 𝔼d‖ Jd‖² = ‖ J‖F²/K:
- The measured value converges to a stable limit that sits a few percent above the finite-difference Jacobian norm.
- That residual is not measurement noise: the generator contains leaky-ReLU kinks, so the directional derivative averaged over random directions differs from the central-difference Jacobian evaluated along coordinate axes.
- Its size depends on the generator, and a second model gave 5.6%. The identification of PPL with a Jacobian norm is exact for a differentiable generator and approximate wherever kinks are crossed.
A metric with a degenerate optimum
- A generator that ignores its input entirely achieves a perfect perceptual path length.
- So PPL measures smoothness, and smoothness is necessary but not sufficient for disentanglement; it must always be read alongside a fidelity measure.
- This is the same structural problem Article 85 identified for alignment and Article 87 for PSNR: a metric optimized in isolation selects a degenerate model.
Selecting Evaluation Metrics
A diagnosis table
- The last row is the honest baseline rather than a failure.
- Section 5 measured every layer influencing the final output with minimum 4.35×10⁻², so a dense lower triangle is what a correctly functioning StyleGAN produces.
- Expecting a diagonal influence matrix misreads what the architecture guarantees.
On reporting truncation
- Papers quote ψ, but the quantity that describes the sampled distribution is ψᵏ. At K=12 and ψ=0.7 that is 1.384×10⁻², and real latent spaces have K in the hundreds, where the factor is astronomically small.
- Comparing two models at the same ψ compares them at the same linear shrink and not at the same diversity, so ψ must be held fixed or the volume factor reported for a comparison to mean anything.
What carries over unchanged
Assumptions and Practical Considerations
On measuring the influence matrix correctly
- The third row is a mistake I made and had to correct. Perturbing the shared latent w changes every layer’s style simultaneously, since each sℓ = Aℓ w depends on all of w.
- Doing that produced an apparent influence of 1.174×10⁻¹ on earlier scales, which looked like a violation of causality and was in fact a broken experiment.
- Perturbing the injected styles directly gave exactly 0.000×1⁰⁰.
- Any claim about scale-wise structure requires perturbing the styles, not the latent.
On what these measurements cover
- The synthesis stack here is four resolutions with eight channels and fixed random convolutions, chosen so the influence matrix and the Jacobian are computable directly.
- The AdaIN invariance and the 2C accounting are algebraic and hold at any size.
- The truncation identities are exact for any distribution with finite covariance.
- What is specific to this model is the magnitudes in the influence matrix, which depend on the convolutions.









