Truncation trick

On this page 7

The truncation trick is a sampling technique for generative adversarial networks that restricts latent vectors to the high-density center of their distribution, so that the generator produces more typical, higher-fidelity outputs at the cost of diversity. In Generative AI it is best known from BigGAN and StyleGAN, where a single scalar, usually called the truncation threshold or truncation psi (ψ), lets a user move smoothly along the fidelity-diversity trade-off without retraining the model.

The technique is applied only at inference time. Training still uses the full prior, typically a standard normal distribution, but sampling deliberately avoids the low-density tails where the generator received little training signal and where artifacts are most likely.

How the truncation trick reshapes latent sampling

The truncation trick works by pulling samples toward the mode of the latent distribution. A GAN maps a latent vector z to an image, and regions of latent space far from the mean are visited rarely during training. The generator therefore maps those regions to images that are less realistic, distorted or incoherent, which the trick avoids.

Two formulations are common. BigGAN-style truncation draws each component of z from a standard normal distribution and resamples any value whose magnitude exceeds a threshold, producing a truncated normal. StyleGAN-style truncation operates in the intermediate latent space W: it computes the average latent vector w̄ over many samples and replaces each sampled w with w' = w̄ + ψ(w - w̄), a linear interpolation toward the center.

The following table compares the two main variants and the parameter each one exposes.

VariantSpace affectedControl parameterBehavior at the extreme
BigGAN truncationInput noise zThreshold, often 0.04 to 2.0Near zero yields almost one image per class
StyleGAN truncationIntermediate latent Wψ between 0 and 1ψ = 0 returns the average image
Layer-limited truncationSelected W inputs onlyψ plus a layer cutoffCoarse features fixed, fine details vary
Class-conditional truncationPer-class mean in Wψ toward a class centerTypical example of the chosen class
Main variants of the truncation trick

The fidelity and diversity trade-off

Truncation raises sample quality and lowers sample variety in a single, predictable motion. As ψ or the threshold decreases, faces become more symmetrical, objects more canonical and backgrounds cleaner, but outputs start to resemble one another and rare attributes disappear.

This trade-off is visible in standard metrics. Inception Score (IS) rewards confident, class-recognizable images and therefore rises with stronger truncation. Fréchet Inception Distance (FID) compares the full feature distribution with real data, so it usually improves at moderate truncation and worsens at strong truncation, once lost diversity outweighs gained quality. Precision and recall metrics for generative models separate the two effects more clearly.

The table below summarizes typical effects of different truncation strengths; exact values depend on the model and dataset.

SettingVisual resultDiversityTypical metric behavior
ψ = 1.0 (none)Full variety, occasional artifactsHighestBest recall, weaker precision
ψ ≈ 0.7Clean outputs, broad varietyHighOften near the best FID
ψ ≈ 0.5Very polished, more uniformModerateHigher precision, FID rising
ψ ≈ 0.2 or lessNear-identical average imagesVery lowHigh IS, poor FID and recall
Typical effects of truncation strength

Why some generators tolerate truncation better

Not every GAN responds well to truncation. In the original BigGAN work, several large models produced saturation artifacts when sampled from a truncated prior, because the generator had not learned a smooth mapping near the center. The authors addressed this with orthogonal regularization, which encourages weight matrices to stay close to orthogonal and makes the generator amenable to truncation.

StyleGAN benefits from its mapping network, which transforms z into the more disentangled space W. Because W is less entangled than z, interpolating toward w̄ changes attributes gradually and coherently. StyleGAN also allows truncation to be applied only to the coarse layers, which fixes pose and overall shape while leaving color and texture free to vary.

How it relates to other quality controls in generative models

The truncation trick belongs to a broader family of inference-time controls that concentrate samples on high-likelihood regions. Each one trades coverage for typicality, although the mechanism differs by model family.

TechniqueModel familyMechanismShared effect
Truncation trickGANsShrinks latent samples toward the meanQuality up, diversity down
Classifier-free guidanceDiffusion modelsAmplifies conditional over unconditional predictionPrompt adherence up, variety down
Temperature scalingAutoregressive and flow modelsSharpens or flattens output distributionLower values give safer outputs
Top-k and nucleus samplingAutoregressive modelsCuts low-probability tokensFewer incoherent continuations
Comparison with related sampling controls

Truncation should not be confused with mode collapse. Mode collapse is a training failure in which the generator covers only part of the data distribution; truncation is a deliberate, reversible choice at sampling time on a model that may cover the distribution well.

Practical use, limitations and common mistakes

Practitioners choose ψ by purpose rather than by a fixed rule. Showcase images and demonstrations favor stronger truncation, while dataset augmentation and evaluation require weak or no truncation to preserve coverage of the real distribution.

SituationRecommended settingReason
Reporting FID or recallψ = 1.0 or as specifiedTruncation biases distribution metrics
Portfolio or demo imagesψ about 0.5 to 0.7Polished results with acceptable variety
Synthetic training dataψ about 0.8 to 1.0Preserves rare cases and edge examples
Exploring unusual outputsψ above 1.0Extrapolates away from the mean, with more artifacts
Choosing a truncation setting
  • Comparing models at different truncation levels makes FID and IS results misleading; always report the setting.
  • Strong truncation amplifies dataset bias, because the mean latent reflects the most common attributes in the training data.
  • Computing w̄ from too few samples gives an unstable center; tens of thousands of samples are a common choice.
  • Truncation cannot repair a poorly trained generator; it only hides tail regions of the latent space.

A plain-language summary

An image generator starts from a random list of numbers. Most of those numbers fall in a familiar middle range. A few land far out at the edges, and the generator handles those poorly. The truncation trick keeps the random numbers closer to the middle.

The result is like asking a portrait painter for a typical face instead of an unusual one. The pictures look cleaner and more convincing. They also look more alike. The single dial trades variety for polish, and the user decides where to set it.

An example from practice

A design team uses a StyleGAN model trained on product photos to generate concept images of ceramic vases. At ψ = 1.0, roughly one image in five shows warped rims or melted textures, which forces staff to sort through large batches by hand.

The team sets ψ to 0.6 for presentation material. Almost every output now looks like a plausible, well-lit vase, and review time drops sharply. However, the unusual asymmetrical shapes that inspired several earlier ideas largely disappear.

For idea generation the team therefore keeps a second workflow at ψ = 0.9, accepting more rejects in exchange for variety. When the team later benchmarks a new model, it disables truncation entirely so that FID scores remain comparable with published results.