Models & Parameters

What Is a GAN? Adversarial Training, and Where It Still Wins

Also called gans, generative adversarial network, generative adversarial networks, adversarial network, esrgan, stylegan

A GAN (Generative Adversarial Network) is a pair of neural networks trained against each other, a generator that produces candidate images and a discriminator that judges whether they look real. The contest drives quality up in a single forward pass, which is why GANs remain standard for upscaling and face restoration even though diffusion replaced them for open-ended synthesis.

The contest at the centre of it

Training a GAN sets up an adversarial game between two networks. The generator maps random noise to an image. The discriminator receives a mix of real images and generated ones and has to label each one. The discriminator is trained to catch fakes; the generator is trained to fool it.

Neither can win permanently. Every time the discriminator gets sharper, the signal it sends back tells the generator exactly which cues gave it away, so the generator improves. The equilibrium, in theory, is a generator whose output is indistinguishable from the training distribution, at which point the discriminator is reduced to guessing.

Two properties fall out of this design and explain everything about where GANs are used today:

  • Inference is a single pass. No iterative denoising, no step count. Once trained, output is essentially instant, which matters for anything interactive or batch-heavy.
  • Training is fragile. The two networks have to improve at a similar pace. If the discriminator gets too strong, the generator receives no useful gradient and stalls. If the generator finds a cheap trick, it stops exploring. This is why GAN training earned a reputation for being finicky in a way diffusion training is not.

Why diffusion displaced it for synthesis

The shift was not about final image quality on a narrow domain. StyleGAN faces were extraordinary. It was about three things production work cares about more:

  1. Coverage. Diffusion learns the whole distribution and can be prompted across an enormous range of subjects. A GAN trained on faces produces faces.
  2. Steerability. Because diffusion generates over many steps, you can intervene between steps: guidance scale, negative prompts, masks, control inputs, denoising strength. A single-pass architecture offers far fewer intervention points.
  3. Training stability at scale. Diffusion objectives train predictably on billions of images. Adversarial objectives at that scale are much harder to keep balanced.
GANDiffusion
InferenceOne pass, millisecondsMany steps, seconds
SteerabilityLimitedHigh
Subject coverageNarrow domainVery broad
TrainingUnstable, needs balancePredictable
Still used forUpscale, restore, enhanceText to image, video

Where GANs are still the right choice

If you use AI tools daily, you are already using them, probably without noticing. The pattern is the same in every case: a well-defined input-to-output mapping, a need for speed, and no requirement for open-ended prompting.

  • Upscaling. Real-ESRGAN and its descendants are still the practical default for fast, cheap resolution increases.
  • Face restoration. GFPGAN and similar models recover blurred or damaged faces from low-resolution sources.
  • Portrait and skin enhancement. A narrow, repeatable transform where one-pass speed is the entire point.
  • Latent editing. StyleGAN's well-behaved latent space still supports smooth attribute edits (age, expression, pose) with a precision diffusion does not match as cleanly.
  • On-device and real-time work. Anything that has to run inside a video call or a phone camera pipeline.

The practical caution

Because these models were trained to produce plausible texture rather than to recover truth, an upscaler will confidently invent what is not there. Eyelashes, teeth, fabric weave, distant faces, small lettering: all get filled with something convincing. Two habits help. Compare against the source at 100 percent before you accept a result, and on faces prefer a lower upscale factor with two passes over one aggressive jump, since the invented detail compounds with each factor of enlargement.

The prompt for this

A starting point that reliably produces the effect. Adjust the subject and setting; keep the technical clauses.

Restore and upscale a soft 480p portrait to 4K, recover skin texture and eyelashes without changing identity

Try GAN yourself

Open the generator with a starting point already filled in.

Frequently asked questions

How does a GAN work in simple terms?
Two networks compete. The generator tries to produce images that pass for real, the discriminator tries to spot the fakes. Each one improving forces the other to improve, and training stops when the discriminator can no longer tell the difference. Only the generator is kept for inference.
What is the difference between a GAN and a diffusion model?
A GAN produces an image in one pass, so it is fast but hard to steer and prone to limited variety. A diffusion model refines noise over many steps, which is slower but far more controllable and covers a much wider range of subjects. That controllability is why diffusion won text to image.
What is mode collapse?
The classic GAN failure: the generator finds a narrow set of outputs that reliably fool the discriminator and stops exploring, so every result looks similar. It is a big part of why these models struggle at open-ended prompting and thrive on narrow, well-defined tasks.
Are GANs obsolete?
No, they moved. Almost every fast upscaler, face restorer and portrait enhancer in production is GAN-based, because those tasks have a well-defined target and need to run in milliseconds. What GANs lost was general prompt-driven image synthesis.
Why do GAN upscalers invent details?
Because they were trained to produce plausible high-resolution texture, not to recover information that is not in the source. Missing eyelashes, teeth and fabric weave get filled with a convincing guess. On faces and small text this is worth checking every time.

Related terms