I am a little bit puzzled about the following. In a generative adversarial network, we consider a binary classification problem with a binary cross-entropy loss.

Now, the generator wants to minimize this loss and the discriminator wants to maximize this loss. I understand why the Bayes-optimal classifier is the optimal discriminator in this case, and why (algebraically), for this optimal discriminator, minimizing the loss corresponds to minimizing the Jensen-Shannon divergence (which is of course what we want).

What I do not understand on an intuitive level is why the generator does not want to maximize and the discriminator to minimize the loss. Wouldn't that correspond to the generator making the classification task as difficult as possible for the best-possible discriminator?

Would very much appreciate if someone has an intuitive argument for why the minmax makes sense.

Possible reference: https://lilianweng.github.io/posts/2017-08-20-gan/#kullbackleibler-and-jensenshannon-divergence

  • 2
    $\begingroup$ The discriminator strives to keep the data distribution away from the generator distribution as much as possible to eventually learn of all aspects of the data distribution, while the generator distribution tries to come as close as possible from the data distribution. If the Jensen-Shannon divergence was readily available, the discriminator would not be necessary to learn the generator distribution from the data. $\endgroup$
    – Xi'an
    May 7, 2022 at 17:03
  • $\begingroup$ @Xi'an Thank you very much for your fast response. I think what is unclear to me, is why $\max_D L(G, D)$ would keep the data distribution $p_r$ away from the generator distribution $p_z$. Wouldn't it do the opposite? As far as I understand, $L(G, D)$ is a logistic loss for the binary classification task. When $p_z$ is close to $p_r$, I would assume that this loss is large (they are hard to distinguish). When $p_z$ is far away from $p_r$, I would assume that this loss is small (they are easy to distinguish). Is this interpretation wrong? (because this would indicate that $D$ should minimize) $\endgroup$
    – heroxav
    May 7, 2022 at 17:52

1 Answer 1


As stated here, the L(G,D) you cite above is not a loss, rather it should be called an objective. The negative of L(G,D) can be called a 'loss'. Perhaps this is one source of confusion. In fact, in the GAN paper, the objective is called a value function, V(G,D).

enter image description here

Additionally, given the objective, $\mathbb{E}_{x\sim\ p_r(x)}[log[D(x)] + \mathbb{E}_{x\sim\ p_g(x)}[log1 - D(x)]]$, you can see that it reaches a maximum value of 0 when D(x)=1 (correctly) for all real samples and D(x)=0 (correctly) for all fake samples produced by the Generator; when the Discriminator is wrong the objective decreases to negative values. Hence the objective is maximized while training the Discriminator to output the correct class.

On the other hand, the Generator wants to get better and fool the Discriminator to output the wrong class (D(x)=1) for the fake samples and hence we train the Generator to get better by minimizing the objective, i.e., pushing it to values less than zero.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.