Kullback–Leibler divergence measures how an encoder’s probability distribution differs from a reference distribution. In a variational autoencoder, it acts as a regularization loss alongside reconstruction loss. section 17.1.2
The regularization term nudges the encoder output toward a well-rounded normal distribution centered around zero, producing a more structured latent space and reducing overfitting. section 17.1.2
VAE latent-space workflow
An encoder produces z_mean and z_log_var, which define a latent probability distribution. A sampled latent point z is passed to the decoder, while reconstruction and regularization losses train the model. section 17.1.2
Figure 17.4 A VAE maps an image to two vectors, z_mean and z_log_var, which define a probability distribution over the latent space, used to sample a latent point to decode.
Shows how a VAE maps an image to z_mean and z_log_var, defines a latent distribution, samples a latent point, and decodes it. section 17.1.2











