StyleGAN
StyleGAN separates what to draw from how to render it, so coarse layers pick the pose while fine layers pick freckles, each steerable on its own.
Why Does This Exist?
ProGAN drew sharp megapixel faces but offered no steering wheel. Its latent vector entangled everything: nudging one number changed age, pose, and lighting together, and mixing two faces produced unpredictable blends. Artists could generate but not direct.
StyleGAN restructured the generator around control. A mapping network first converts noise into an intermediate code , and that code enters every layer separately through adaptive instance normalisation. Coarse layers read as pose and shape, fine layers read it as colour and microstructure. Style mixing, feeding one face's code to coarse layers and another's to fine layers, then works exactly as hoped. Editing real photos through this machinery is covered in GAN inversion.
Think of It Like This
A film director with separate departments
A director tells the set department "a rainy street", the costume department "wool coats", and the lighting crew "cold blue". Each department interprets the same script at its own scale, and the director can reshoot costumes without moving buildings.
The code is the script and each resolution layer is a department. Traditional generators hand every department an identical photocopy of one note; StyleGAN lets the director brief each department at its own level. The shoot fails when departments stop matching, mixed styles that clash, which is why mixing range choice matters.
How It Actually Works
The mapping network , eight fully connected layers, converts into . Each synthesis layer transforms into scale and bias and applies them to normalised feature maps :
and are per-channel statistics, so each layer's content is standardised before the style is imposed. Resolution decides meaning: layers – (up to ) set pose, face shape, and hairstyle; layers – set colours, skin texture, and background detail. Independent per-pixel Gaussian noise injected after each convolution supplies stochastic detail like freckle placement and hair strands.
Worked example
Style-mix face A (pose donor) with face B (texture donor) at pixels and layer pairs. Feed A's code to layers – and B's to layers –. The output keeps A's head angle and jawline but wears B's skin tone, lighting, and freckles. Move the boundary to layer and A's identity leaks into mid-level features; move it to and B's pose starts intruding. The boundary position is the creative control.
Code
AdaIN in five lines, the operation that imposes style on standardised features.
def adain(x: list[list[float]], scale: float, bias: float) -> list[list[float]]: """Impose style (scale, bias) on a single-channel feature map.""" flat = [v for row in x for v in row] mu = sum(flat) / len(flat) # content statistics first sigma = (sum((v - mu) ** 2 for v in flat) / len(flat)) ** 0.5 + 1e-6 return [[round(scale * (v - mu) / sigma + bias, 2) for v in row] for row in x]
print(adain([[0.2, 0.8], [0.4, 0.6]], 1.5, 0.1)) # -> [[-1.91, 2.11], [-0.57, 0.77]]Watch Out For
Blob artefacts from AdaIN normalisation
StyleGAN 1 occasionally renders odd round blobs, most visibly in skies and walls. The cause is the AdaIN step itself: normalising each channel lets the generator hide signal magnitude information that the next layer needs, and it compensates with localised magnitude spikes.
StyleGAN 2 redesigned normalisation into weight demodulation, removing the blobs. If you see them, you are running version 1; upgrade rather than tuning around the artefact.
Assuming every layer boundary mixes cleanly
Mixing at arbitrary boundaries can splice incompatible features, a child's jawline with an elder's skin texture, producing uncanny outputs that users blame on the model. Boundaries inside coarse layers change identity; inside fine layers change rendering.
Mix within the – versus – split first and move the boundary deliberately. Log which ranges produced each result.
The Quick Version
- StyleGAN maps noise through an -layer network into style code .
- AdaIN imposes per-layer scale and bias on standardised features at every resolution.
- Layers – control pose and shape; layers – control colour and microstructure.
- Style mixing feeds different codes to coarse and fine layers for hybrid faces.
- Version 1 blobs come from AdaIN itself; version 2 demodulation removes them.