Part of the generative visual computing notes.
Autoregressive factorization
The probability chain rule gives
The factorization itself is exact. Modeling assumptions enter when we choose the conditional distributions and their parameterization. Image models also need an ordering of pixels, channels, or tokens.
For a binary sequence , suppose the relevant probabilities are , , and . The joint probability is . We multiply the probabilities of the observed values, not always the probabilities of a one.
Training uses known prefixes. A causal architecture can evaluate many conditional losses in parallel. Generation must obtain a prefix before conditioning on it, so it generally proceeds sequentially.
FVSBN uses logistic conditionals. NADE adds shared hidden computations to represent more complicated dependencies. PixelCNN uses masked convolutions. Its first-layer mask excludes the target input; later masks can include the current hidden location when that location already contains only permitted information. A mask must be checked against every computational path. A reverse branch can leak future pixels even if another branch is causal.
Gated PixelCNN separates vertical and horizontal information to address blind spots. WaveNet uses causal, dilated convolutions for audio. Next-scale image prediction changes the unit of generation from individual tokens to scales, introducing assumptions about dependencies within a scale.
Autoencoders and VAEs
An ordinary autoencoder maps to a code and reconstructs it. A bottleneck or regularizer discourages simple copying. Denoising autoencoders reconstruct clean inputs from corrupted versions. Sparse autoencoders constrain activity. Contractive autoencoders penalize sensitivity of the code to small input changes.
A VAE gives the latent variable a probabilistic interpretation. For a diagonal Gaussian encoder,
This reparameterization separates the sampled noise from the differentiable parameters. With a standard-normal prior,
Training minimizes negative reconstruction log likelihood plus this KL term. Observation dimensions and latent dimensions should be summed consistently before averaging over a batch. Arbitrarily averaging one term and summing the other changes their relative weight.
Reconstruction draws from the encoder distribution for an observed image. Unconditional generation draws from the prior and uses only the decoder. A smooth reconstruction does not guarantee that arbitrary prior draws decode well.
Conditional VAEs include a known condition in the model. A beta-VAE changes the weight on the prior KL, trading reconstruction against a stronger constraint on the code. IWAE averages importance weights inside a logarithm to form a tighter bound in expectation as the number of samples increases. A hierarchical VAE introduces multiple latent levels. A masked autoencoder instead learns representations by reconstructing missing patches; it is not automatically a normalized latent-variable density model.
Normalizing flows
Let be invertible. Probability mass is preserved even though density changes with local volume:
For , density is divided by two. Omitting this factor would make the transformed density integrate to two rather than one.
Affine coupling leaves one group unchanged and transforms the other:
The inverse subtracts the shift and divides by the scale. The triangular Jacobian makes the log determinant equal to the sum of the scale outputs. Alternating groups or mixing channels lets later layers change coordinates that earlier layers left fixed.
MAF and IAF favor different directions of computation. In the standard formulations, MAF supports parallel density evaluation but sequential generation, while IAF supports parallel generation but sequential inversion for arbitrary observations. The useful direction depends on the application.
Worked example: an invertible coupling layer
Consider a two-dimensional input . Keep and transform the other coordinate by . This gives . Inverting the layer recovers exactly.
The Jacobian determinant is two, so its log absolute determinant is . If this map takes observations to base variables , the density becomes . If the same transformation is described in the generation direction, the inverse Jacobian appears instead. Checking the direction avoids a common sign error in flow likelihoods.
Further reading
Real NVP develops affine coupling layers with tractable Jacobians. Auto-Encoding Variational Bayes provides a useful contrast: its latent model does not require the observation map to be invertible.