Most people have seen a deepfake: a photorealistic face of a person who does not exist, or a video of someone saying words they never spoke. At the heart of this “convincing fake” technology lies the GAN (Generative Adversarial Network). Introduced in 2014, this mechanism became one of the wellsprings of the generative AI boom that followed.
What makes GANs fascinating is how they are trained. Rather than drilling a single AI on the right answers, you pit two AIs against each other, raising one of them to the point where it can produce data indistinguishable from the real thing. In the words of the original paper, the relationship is like that of “a team of counterfeiters” and “the police” who try to catch them1.
This article explores what a GAN is from four angles—the basic idea, the learning mechanism, applications and limits, and how GANs differ from the now-dominant diffusion model—using almost no mathematics. If a neural network is “the mechanism by which AI learns,” a GAN is a flagship example of “the mechanism by which AI creates”—a milestone you cannot skip in understanding generative AI.
The Basic Idea: Make Two AIs Compete
The original GAN paper is “Generative Adversarial Nets,” published in 2014 by Ian Goodfellow and seven co-authors1. The authors open by describing their framework like this: “We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models: a generative model G that captures the data distribution, and a discriminative model D that estimates the probability that a sample came from the training data rather than G”1.
Put plainly, a GAN consists of two players.
- Generator (G): Takes random noise as raw material and produces realistic-looking data (for example, face photos). This is the “make the fake” role.
- Discriminator (D): Decides whether a given piece of data is “real (training data)” or “fake (made by the generator).” This is the “spot the forgery” role.
You set these two against each other. The generator tries to make ever more convincing fakes to fool the discriminator. The paper states, “The training procedure for G is to maximize the probability of D making a mistake”1. The discriminator, in turn, tries harder not to be fooled. As the two keep escalating their skills against each other, the generator’s fakes become refined to the point where they cannot be told apart from the real thing. This is the core of a GAN.
The “Counterfeiters and Police” Analogy
The paper itself explains this relationship with a famous analogy: “the generative model can be thought of as analogous to a team of counterfeiters, trying to produce fake currency and use it without detection, while the discriminative model is analogous to the police, trying to detect the counterfeit currency”1.
The counterfeiters keep producing more sophisticated forgeries to avoid being caught. The police keep sharpening their eye to detect the increasingly clever forgeries. As this chase continues, the counterfeiters’ bills eventually become indistinguishable from genuine currency. What a GAN aims for is exactly this: to obtain a counterfeiter (the generator) capable of producing fakes that cannot be told from the real thing.
Wikipedia describes the same structure in more general terms: “two neural networks compete with each other in the form of a zero-sum game, where one agent’s gain is another agent’s loss”2.
The Roles of Generator and Discriminator
Let us look more concretely at what the two AIs are doing.
The Generator: From Noise to “Meaningful Data”
The generator’s input is a string of random numbers (random noise). Its output is data that looks just like the real thing. Wikipedia explains that “the generator learns to map from a latent space to the true data distribution, aiming to produce candidates that the discriminator cannot distinguish from real data”2.
The key concept here is the latent space. The generator interprets the input random numbers as something like a “blueprint of facial features” and converts them into a concrete collection of pixels (a face photo). As training progresses, simply nudging the numbers in this latent space causes features such as hair color, the direction the face is turned, or the degree of a smile to change continuously. The generator is not merely memorizing images; it is learning the very structure of “what combination of elements makes up a face.”
The Discriminator: A Classifier That Guesses Real or Fake
The discriminator is, in effect, a yes/no classifier that outputs, for a single input image, “what is the probability that this is real?” Wikipedia summarizes the relationship as “the generative network generates candidates while the discriminative network evaluates them”2.
The discriminator’s training resembles supervised learning: real training data is given the label “real,” data made by the generator is given the label “fake,” and the discriminator is trained to tell them apart correctly. The verdict the discriminator delivers—was it fooled, or did it catch the fake?—then becomes the very clue used to train the generator.
┌──────────────┐
random ──► │ Generator G │──► fake data ──┐
noise │(counterfeiter)│ │
└──────────────┘ ▼
┌──────────────┐
│Discriminator D│──► real? fake?
│ (police) │ │
real data ───────────────────────►└──────────────┘ │
▲ │
└──── feed the verdict back to retrain both ◄──────────┘
The Learning Mechanism: The Minimax Game and Equilibrium
A GAN’s learning is formulated as a game in which two players have exactly opposite goals. The original paper calls this a “minimax two-player game”1. As Wikipedia frames it, “the generator aims to minimize the objective, and the discriminator aims to maximize the objective”2. One and the same metric—one wants to push it down, the other wants to push it up—and this tug-of-war drives the learning.
So where does this tug-of-war stop? The theoretical goal is clear. The paper states that “a unique solution exists, with G recovering the training data distribution and D equal to 1/2 everywhere”1.
The discriminator becoming “1/2 (a coin flip)” is the ideal state of a GAN. Wikipedia, too, describes the equilibrium as a state where “the generator perfectly mimics the reference, and the discriminator outputs 1/2 deterministically on all inputs”2. When the discriminator can no longer tell real from fake at all and can only answer with a 50-50 guess, it means the generator’s fakes have become statistically indistinguishable from the real thing. You could put it this way: the counterfeiter has become so skilled that the police have no choice left but to flip a coin.
| Learning stage | Generator (G) | Discriminator (D) |
|---|---|---|
| Early | Can only make crude fakes | Easily spots the fakes |
| Middle | Gradually grows more refined | Harder to tell them apart |
| Ideal equilibrium | Makes fakes indistinguishable from real | Only 1/2 (a coin flip) accuracy1 |
A technically important point is that this learning runs on relatively simple machinery. The paper emphasizes that if both the generator and the discriminator are multilayer perceptrons (neural networks), the entire system can be trained using only backpropagation, without Markov chains or complex inference networks1. This was a major advantage over other generative models of the time.
The Difficulty of Training: Mode Collapse and Instability
Elegant as it is in theory, a GAN is famously difficult to train in practice, because you have to raise two networks in balance at the same time, and if one becomes too strong, learning breaks down.
A representative failure is mode collapse. Wikipedia explains that “GANs often suffer from mode collapse where they fail to generalize properly, missing entire modes from the input data”2. For instance, even when trained on handwritten digits from 0 through 9, the generator may end up “only generating pictures of digit 0”2. The generator finds a single point where “as long as I make this, I can fool the discriminator,” retreats into it, and loses diversity.
On top of that, there are difficulties such as the balance of power between generator and discriminator oscillating so that training never stabilizes, and the trouble of judging when to stop training. If the discriminator is too strong, the generator gets caught no matter what it makes and cannot learn; if it is too weak, the generator settles for sloppy fakes. To maintain this delicate balance, a great deal of practical ingenuity has accumulated over the years.
Development and Applications: From Photorealistic Faces to Style Transfer
The basic GAN was later extended in many directions. A prime example is StyleGAN, which dramatically raised the quality of image generation. Wikipedia explains that “the Style Generative Adversarial Network, or StyleGAN for short, is an extension to the GAN architecture”3. Researchers at Nvidia announced it in December 2018 and made the code public in February 20193.
What brought StyleGAN’s power to public attention was a website called “This Person Does Not Exist.” Created in February 2019 by former Uber engineer Phillip Wang using StyleGAN, the site displays “a new face on each web page reload”3. Every face shown is photorealistic yet belongs to a person who does not exist in this world. The original paper, too, noted that GANs can “generate new photographs that look at least superficially authentic to human observers, having many realistic characteristics”2.
Beyond this, GANs have been applied to a wide range of fields: super-resolution that converts low-resolution images to high resolution, automatic colorization of black-and-white photos, style transfer that converts one artistic style into another, and the completion of medical images.
The Shadow of Deepfakes
GANs also raised social concerns. Being able to produce faces and voices that look and sound just like the real thing means, conversely, being able to create “videos that make a person say things they never said” or “evidence photos of things that never existed”—so-called deepfakes.
The technology itself is neither good nor evil, but the risk of misuse—impersonation, fraud, the spread of disinformation—has become a reality. Ironically, the technology to “detect” such fakes is also built on the same idea as the GAN’s discriminator: a model that classifies real versus fake. The cat-and-mouse game of generation and detection can be seen as the competition between counterfeiters and police that played out inside the GAN, now reproduced at the scale of society as a whole.
How GANs Differ from Diffusion Models: What Leads Image Generation Today
For a long time GANs were the flagship of image generation, but as the 2020s arrived, diffusion models—represented by Stable Diffusion and DALL·E—took the mainstream seat in image generation. The two share the same goal of “producing data that looks just like the real thing,” but their approaches to making it are completely different.
Whereas a GAN competes two networks to generate an image all at once, a diffusion model starts from a noise-filled image and gradually removes the noise, “carving out” the image over many steps. This difference gives each its own strengths and weaknesses.
| Aspect | GAN | Diffusion model |
|---|---|---|
| Learning mechanism | Compete two networks (adversarial) | Learn noise removal step by step (iterative) |
| Training stability | Prone to instability (mode collapse, oscillation) | Said to be relatively stable |
| Generation speed | Fast (generates in one pass) | Slow (requires many steps) |
| Diversity | Prone to losing diversity via mode collapse | Said to obtain diverse outputs more easily |
GANs, because of their adversarial training, are prone to instability and carry the problem of mode collapse. Diffusion models, by contrast, have no two competing networks and train by removing noise step by step, so they are said to be relatively stable and to preserve data diversity more easily. On the other hand, GANs have a clear advantage in that they “can generate an image in a single pass and are therefore fast,” and they are still used where real-time performance is required.
In other words, rather than diffusion models having completely “replaced” GANs, it is more accurate to see them as two great lineages heading toward the same goal of image generation, used differently depending on the application. In understanding the full picture of generative AI, it is well worth grasping the difference in thinking between these two major families.
What GANs Left Behind
While GANs’ direct application range is being ceded to diffusion models, their philosophy—the “adversarial” idea of raising performance by competing two models—has left its mark across broad areas of generative AI. Using a separate model to evaluate how realistic data is, or pitting an attacker against a defender to improve robustness: both of these ideas trace their origins back to the GAN’s “counterfeiters and police” structure.
Being the first to show, in a practical form, the mechanism by which data that looks just like the real thing rises out of random noise. And presenting a new design philosophy of “driving learning through competition.” On these two counts, a GAN remains an important turning point in the history of generative AI. If you would like to learn more about generation mechanisms, reading our articles on the diffusion model that powers today’s image generation, or on multimodal AI that handles text, images, and audio together, will bring the substance of the phrase “AI creates something” into three-dimensional view.
Sources
- Generative Adversarial Networks - Ian Goodfellow et al., 2014. The original GAN paper (published at NIPS 2014 under the title “Generative Adversarial Nets”)
- Generative adversarial network - Wikipedia (definition, zero-sum game, mode collapse, applications)
- StyleGAN - Wikipedia (StyleGAN and This Person Does Not Exist)