1
$\begingroup$

I understand the basic of how GANs work with the min-max game, etc. However, I don't fully understand how the error backpropagates to the generator.

Let's say I have an input vector $x$ to the generator. The generator computes some output $G(x)$. If I perform some non-differentiable function on $G(x)$, call it $h(G(x))$, can this be the input to my discriminator?

For example, maybe $h(z)$ is a clustering function, that clusters elements of $z$ into groups. My ground truth sample for the discriminator might be existing clusters $\hat{h}(x)$. Could my generator produce $G(x)$, but my discriminator see as input $\left(h\left(G(x)\right), \hat{h}(x)\right)$?

If so, how does the backpropagation work, given that $h(z)$ is not differentiable?

$\endgroup$
2
$\begingroup$

If $h$ is nondifferentiable, then using GANs is not straightforward. One example of where you might want to do this is sentence generation, where an LSTM models a (conditional) probability distribution across possible sentences and the function $h$ samples one particular sentence from the distribution. A discrete clustering would also be nondifferentiable. In this case, it is necessary to use reinforcement learning techniques.

For example, the popular REINFORCE algorithm has been used to train GANs for the sentence generation task. See https://arxiv.org/abs/1609.05473.

$\endgroup$
2
$\begingroup$

You can use backpropagation with non-differentiable operations, but the gradients won't propagate through them and hence you won't be able to train weights that are before those operations. Sometimes this is a problem, sometimes it is not.

In the proposed case, you would not be able to perform the optimization of the generator loss, as the non-differentiable operation $h$ prevents from using backpropagation in the Generator's weights.

However, why would you have such a setup instead of a normal $D(G(x))$? If you have cluster labels, you can use conditional GANs by supplying those labels to both Generator and Discriminator.

P.S.: one option for having the clustering in your GAN setup would be to implement a differentiable clustering approach by leveraging internal representation separation (see this paper)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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