liveBook · Manning

Variational autoencoder

As explained in Generative AI in Action

A variational autoencoder is a generative neural model that encodes data into a probabilistic latent representation and decodes samples from that representation into reconstructed or newly generated data.

A variational autoencoder (VAE) generates new data points that resemble its input data while allowing variation. For images, that can mean creating faces or designs similar to those it has learned, rather than exact copies. VAEs can also support anomaly detection and recommendation systems. section 4.1

A VAE has two neural networks. An encoder maps an image to a lower-dimensional latent space that captures essential features. Instead of choosing only one latent point, it represents a distribution described by a mean and variance. A decoder samples from that distribution and reconstructs an image. Different samples allow different, related outputs. section 4.1.1

Figure 4.4 Variational autoencoder architecture
figure

Follow the input through the encoder, latent representation, and decoder to see where sampling enters the generation process. section 4.1.1

Useful image tasks include:

  • Generating images that share features with training images, such as faces, fashion designs, or art. section 4.1.1
  • Reconstructing missing or corrupted image regions, including in medical images or old photographs. section 4.1.1
  • Transferring stylistic elements between images or manipulating image features. section 4.1.1

Choose the architecture to fit the task. VAEs are suited to producing varied data similar to the original, including relatively simple images; GANs target greater realism in complex, diverse images, while diffusion models target high-quality modeling of complex data when generation speed is less important. A VAE can also be a component within a diffusion system. For deployed image generation, consider image quality, speed, computing resources, training data, and questions of ownership and authenticity. section 4.1 section 4.1.4

How Generative AI in Action covers it

How deep it goes
Explains encoder–decoder flow and sampling through mean and variance without deriving training mathematics or providing implementation code.
Examples
Uses generated faces, fashion designs, art, medical-image repair, and photograph restoration as examples.
What it assumes
Introduces mean, variance, and normal-distribution sampling in plain language while treating neural networks as familiar components.
What you can do after
Evaluate/understand it as an option for generating image variations or reconstructing images, while weighing task and deployment requirements.
How it connects
Relates VAEs to latent spaces, image inpainting, style transfer, GANs, and diffusion models.

Also explained in

Compare how 13 books explain variational autoencoder →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.