A Visual Guide To Variational Autoencoders (VAEs)

AI, But Simple Issue #45

Hello from the AI, but simple team! If you enjoy our content, consider supporting us so we can keep doing what we do.

Our newsletter is no longer sustainable to run at no cost, so we’re relying on different measures to cover operational expenses. Thanks again for reading!

A Visual Guide To Variational Autoencoders (VAEs)

AI, But Simple Issue #45

In Partnership With:

Variational autoencoders (VAEs) are autoencoder-based neural networks used for generative tasks such as image generation or reconstructing missing data.

They are comparable to traditional autoencoders but use probabilistic techniques to not only reconstruct input data but also generate new, similar data to what they were trained on.

The most popular use cases for VAEs are:

  • Generating new images, such as faces or digits.

  • Anomaly detection by identifying data with high reconstruction error.

  • Dimensionality reduction, reducing data dimensions for visualization.

VAE-generated handwritten digits

Being a generative model, its performance is compared to other similar generative models, such as GANs or diffusion models. Want to learn more about GANs? We did a deep dive in one of our previous issues:

At its heart, a VAE still has the same structure and components as a standard autoencoder: it has both an encoder and a decoder.

Like standard autoencoders, VAEs map inputs into a latent space (a smaller, lower-dimensional representation), then reconstruct latent space vectors back to the input space.

The key feature of VAEs is that, unlike regular autoencoders (which map inputs to fixed points in the latent space), VAEs learn a probability distribution over the data.

Given an input, the encoder maps it to a distribution in the latent space, outputting the parameters (mean and variance) of the distribution.

The decoder samples from this distribution back to the input space, reconstructing the data and generating new samples. Sampling from the learned distribution allows the model to obtain new but similar data points.

Big thanks to our partners for keeping this newsletter free. If you have a second, clicking the ad below helps us a ton—and who knows, you might find something you’ll enjoy.

The gold standard of business news

Morning Brew is transforming the way working professionals consume business news.

They skip the jargon and lengthy stories, and instead serve up the news impacting your life and career with a hint of wit and humor. This way, you’ll actually enjoy reading the news—and the information sticks.

Best part? Morning Brew’s newsletter is completely free. Sign up in just 10 seconds and if you realize that you prefer long, dense, and boring business news—you can always go back to it.

Why Not Use A Standard Autoencoder?

Standard autoencoders don’t have good generative abilities since the latent space is deterministic. This means for a given input, the encoder produces a fixed output. Every time you pass the same input, the same latent vector is produced.

When we sample from a regular autoencoder, since the encoder produces a single latent vector for each input, we would get the same result every time—there's no way to sample new latent points that correspond to new data.

Subscribe to keep reading

This content is free, but you must be subscribed to AI, But Simple to continue reading.

Already a subscriber?Sign In.Not now