Generative Adversarial Network
A Generative Adversarial Network, or GAN, is a deep learning framework in which two neural networks are trained simultaneously in competition. The generato...
How Generative Adversarial Networks Work
A Generative Adversarial Network, or GAN, is a deep learning framework in which two neural networks are trained simultaneously in competition. The generator network learns to produce synthetic data samples, such as images, that resemble real data. The discriminator network learns to distinguish real samples from those produced by the generator. This adversarial dynamic drives both networks to improve continuously.
The generator takes a random noise vector as input and transforms it through a series of layers into a data sample. Initially its outputs are random and unconvincing. The discriminator receives both real samples from the training dataset and fake samples from the generator and learns to classify each as real or fake. Its output is a probability between 0 and 1.
Training alternates between updating the discriminator to correctly identify real versus fake, and updating the generator to fool the discriminator into classifying its outputs as real. The generator never directly sees real data; it only receives the feedback signal from the discriminator's judgements. Over thousands of iterations, the generator produces increasingly realistic outputs.
The training process can be unstable. Mode collapse occurs when the generator finds a small set of outputs that always fool the discriminator, producing diverse-looking but repetitive samples. Various training tricks and alternative formulations like Wasserstein GAN address this by improving gradient signal quality during training.
A concrete example: the StyleGAN architecture generates photorealistic human face images by progressively adding detail at increasing resolutions. Starting from a 4 by 4 pixel representation and upscaling to 1024 by 1024, the generator produces faces indistinguishable from real photographs by human observers.
Exam tip: be ready to explain why GAN training is harder than standard supervised training. There is no fixed target; both networks' loss landscapes change as the other network improves. The Nash equilibrium, where neither network can improve given the other, is the theoretical ideal but difficult to achieve in practice. Mentioning this dynamic and at least one stabilisation technique shows depth of understanding.