discriminator
The discriminator is the "judge" of a GAN: shown an image, it decides whether it is a real training image or a fake from the generator. It is an ordinary image classifier, but its true purpose is not classification for its own sake — it is to manufacture a learning signal for the generator. Every time it detects a fake, the gradient of "what made this look fake" is passed back to the generator as instructions for improvement. A good discriminator is what makes a good generator possible.
Precisely, the discriminator is a function D mapping an image x to a value in [0,1], the estimated probability that x is real; it is trained as a binary classifier to maximize E over real x of log D(x), plus E over z of log(1 − D(G(z))) — that is, push D(real) toward 1 and D(fake) toward 0. Architecturally (per DCGAN) it is a strided-convolution CNN with LeakyReLU and normalization, downsampling to a single logit. For a fixed generator the optimal discriminator is D*(x) = p_data(x) / (p_data(x) + p_g(x)) — it reports the relative density of real versus generated at each point, which is precisely the information the generator needs to move p_g toward p_data.
The two networks must stay roughly balanced. If the discriminator becomes too strong it pushes D(fake) toward 0, where the saturating generator loss has no gradient and learning stalls; if too weak it gives uninformative signals. Techniques to keep it well-behaved include the non-saturating generator loss, one-sided label smoothing, spectral normalization (bounding the discriminator's Lipschitz constant), and gradient penalties. In Wasserstein GAN the discriminator is replaced by a critic that outputs an unbounded real-valued score (not a probability), estimating the Earth-Mover distance, and is constrained to be 1-Lipschitz.
The discriminator is usually thrown away after training — you keep only the generator. But it is not useless on its own: discriminator features transfer to downstream tasks, its score can rank sample quality, and PatchGAN discriminators (used in pix2pix and CycleGAN) judge realism on overlapping local patches rather than the whole image, which sharpens textures.