Early Breakthroughs: GANs and VAEs
Welcome back! In Level 1, we learned that generative AI is all about creating new things—like writing a poem or painting a picture—by learning from existing data. But how did we get from simple pattern matching to the amazing AI art we see today? The answer starts with two key inventions: Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs). Think of them as the two trailblazers that opened the door for everything that followed.
What Are GANs?
Imagine you are a detective trying to spot a forged painting. A forger creates fake paintings, and you try to tell them apart from real ones. The forger gets better and better at fooling you, and you get better at catching fakes. This is exactly how a Generative Adversarial Network (GAN) works. It was invented by Ian Goodfellow and his colleagues in 2014, and it was a huge breakthrough.
A GAN has two parts that play a game against each other:
- The Generator: This is the forger. It takes random noise (like a handful of random numbers) and tries to turn it into something that looks real, such as a face or a cat.
- The Discriminator: This is the detective. It looks at data (both real examples from the training set and fakes from the generator) and tries to guess which is real and which is fake.
How the Game Works
- The generator creates a fake image.
- The discriminator looks at that fake image together with a real image from the training data.
- The discriminator judges each one: “Real” or “Fake.”
- Both networks learn from the results. The generator tries to become better at fooling the discriminator. The discriminator tries to become better at catching fakes.
Over time, the generator gets so good that the discriminator can no longer tell the difference—the fakes look just like the real thing. This is called adversarial training, and it’s why GANs can produce incredibly realistic images, like photorealistic faces of people who don’t exist.
The Impact of GANs
When GANs were introduced in 2014, they were a game-changer. Before GANs, generative models struggled to create high-quality, sharp images. GANs suddenly made it possible to generate images that looked almost like photographs. They sparked a wave of creativity: from generating fake celebrity faces to creating art, designing video game characters, and even helping scientists discover new drugs. GANs showed that AI could create things that were not just plausible, but impressive.
Variational Autoencoders (VAEs)
Around the same time as GANs, another important model was developed: the Variational Autoencoder (VAE). It was introduced by Diederik Kingma and Max Welling in 2013. VAEs take a different approach. Instead of a game between two networks, a VAE learns to compress data and then recreate it.
Think of a VAE like a very smart copying machine. You give it a picture of a cat. First, it squeezes that picture into a tiny, compressed “summary” of the cat (this is called the latent space). Then it tries to rebuild the original cat from that summary. The magic is that the summary is not just a compressed version—it’s a probabilistic representation. That means the VAE learns a range of possible summaries, so it can create new variations.
How a VAE Works
- Encoder: The encoder takes an input (like an image) and compresses it into a smaller set of numbers (the latent vector). It doesn’t give a single number; it gives a mean and a variance for each dimension, essentially describing a range of possible summaries.
- Decoder: The decoder takes that latent vector (or a slightly different one sampled from the range) and tries to reconstruct the original image.
The VAE learns to make the reconstructed image as close as possible to the original. And because the latent space is smooth and continuous, you can move around in it to generate new images that are similar but not exactly the same as the training data. For example, you can generate a whole family of cat faces that look like your original cat but with different fur colors or ear shapes.
Comparison: GANs vs. VAEs
- GANs are great at generating very realistic, sharp images (like a photo). But they can be tricky to train and sometimes produce weird results.
- VAEs are more stable and produce a broader variety of outputs, but the images can be a bit blurry compared to GANs.
Both models were huge steps forward. They proved that AI could generate novel data that was believable and useful. GANs and VAEs are the foundation upon which many modern generative AI tools are built—even if today’s models (like GPT-4 or DALL·E) use different architectures, the ideas of competing networks and compressed representations are still key.
Key Takeaways
- GANs use two networks (generator and discriminator) that compete to create and detect fake data. Invented by Ian Goodfellow in 2014.
- VAEs use an encoder-decoder structure to compress data into a probabilistic latent space and then reconstruct it, allowing for smooth generation of new variations. Invented by Kingma and Welling in 2013.
- Both GANs and VAEs were early breakthroughs that showed generative AI could produce realistic and creative outputs, paving the way for later advances.