What is the function of the discriminator in a GAN?
Determine whether examples are real or fake.
Determine whether examples are real or fake.
Card 1 of 259. Answer: Determine whether examples are real or fake.
About · Quizzes · History of AI · To suggest new questions or report an error send me a dm.
It decides whether an example is real or fake. The discriminator D is a binary classifier: given x, it outputs D(x), the probability that x came from the training data rather than the generator. It is trained with binary cross-entropy, real examples labeled 1 and generated ones 0.
For a fixed generator, the best discriminator is D*(x) = p_data(x) / (p_data(x) + p_g(x)), where p_g is the generator's distribution. If at some x the real density is 0.3 and the generated density 0.1, D* = 0.75; where the two match, D* = 0.5 and it can only guess. Its gradient is the generator's only training signal, so D acts as a learned loss that keeps changing.
Interviewers focus on balance. A discriminator that wins too easily saturates and starves the generator of gradient; one too weak gives useless feedback. Remedies include one-sided label smoothing, 0.9 instead of 1 for real labels, and spectral normalization. Wasserstein GANs replace it with a critic that outputs an unbounded score, not a probability.