Dive into Deep Learning · §16.3
Relativistic objectives
the critic ranks pairs · the value is JS of the two orderings · rank weight replaces threshold weight · paper versus code
\Phi(D) = E_{x \sim p,\; x' \sim q}\big[\log \sigma\big(D(x) - D(x')\big)\big]
sec_regularized.sec_gan_objectives therefore do not apply directly.Because \Phi is concave in D, any stationary point is a global maximum. Its functional derivative is
\frac{\delta \Phi}{\delta D(t)} = p(t)\, E_{x' \sim q}[\sigma(D(x') - D(t))] - q(t)\, E_{x \sim p}[\sigma(D(t) - D(x))]
D^\star = \lambda = \log \frac{p}{q} \quad \text{up to an additive constant}
Ranking estimates the same density ratio as classification. What changes is the value of the game.
P = p \otimes q, Q = q \otimes p: the two orderings of an independent real–fake pair.
d_{\mathrm{Rp}}(p, q) := \sup_D \Phi + \log 2 = \mathrm{JS}(p \otimes q,\, q \otimes p) = H\big[\tfrac12(p \otimes q + q \otimes p)\big] - H[p] - H[q]
Jolicoeur-Martineau.2020 (general concave payoffs, value not computed); the closed form above is computed here, for the logistic payoff.| property | statement |
|---|---|
| sandwich | \mathrm{JS}(p, q) \leq d_{\mathrm{Rp}} \leq \log 2 |
| near q = p | d_{\mathrm{Rp}} = 2\,\mathrm{JS} + O(\epsilon^3): a pair carries twice the information |
| disjoint supports | d_{\mathrm{Rp}} = \log 2: saturates exactly as JS does |
Pairing still saturates on disjoint supports, and unregularized RpGAN training need not converge. Section :numref:sec_gan_convergence analyzes the training dynamics.
w_{\mathrm{Rp}}(x') = E_{x \sim p}[\sigma(D(x') - D(x))] \qquad w_{\mathrm{GAN}}(x') = \sigma(D(x'))
Sun.Fang.Schwing.2020: n^n - n! mode-dropping local minima for the classical loss; none for the relativistic one.sup Phi + log 2, by gradient ascent: 0.376889913
JS(p (x) q, q (x) p), computed directly: 0.376889913
entropy form H[(P+Q)/2] - H[p] - H[q]: 0.376889913
JS(p, q) = 0.234050, log 2 = 0.693147
max |D - lambda|, both centered: 4.4e-16
Gradient ascent using the stationarity condition agrees with the direct product-space JS computation to nine decimal places. The recovered critic equals \lambda up to a constant.
The threshold weight changes around the arbitrary zero level. The rank weight changes across the distribution of real scores and continues to distinguish samples after the threshold weight is nearly saturated.
| generator plays | weight | badly ranked sample |
|---|---|---|
| minimize \Phi (paper’s zero-sum Eq. 2) | E_{x \sim p}[\sigma(D(x') - D(x))] | \to 0: stalls |
| maximize E[\log \sigma(D(x') - D(x))] (the code) | E_{x \sim p}[\sigma(D(x) - D(x'))] | \to 1: largest |
Both variants have the same fixed point, but the paper’s displayed zero-sum objective gives smaller updates to badly ranked samples early in training.
sec_gan_convergence.