Relativistic Objectives and Pairwise Ranking Bradley–Terry pairing critic · shift invariance · product-measure JS divergence · information bounds · fixed vs. random pairing landscapes
From Absolute Thresholds to Pairwise Ranking
Motivation
A single-sample discriminator scores each observation x against a fixed zero threshold (D(x) \gtrless 0), whereas pairwise preference models, such as Bradley–Terry reward models in RLHF, predict which of two candidates is better from their score difference:
Threshold fragility under score shifts: Adding a constant b to all critic scores flips single-sample threshold verdicts against 0, even though the relative ordering of real and generated samples has not changed.
Relativistic pairing (RpGAN; Jolicoeur-Martineau, 2019): Pairs a real sample x \sim p with a generated sample x' \sim q and predicts which member is real from their difference D(x) - D(x').
Three core questions: (1) Does the optimal ranker still estimate \lambda(x) = \log(p(x)/q(x))? (2) What divergence does it measure? (3) When does pairwise ranking prevent mode collapse?
The Bradley–Terry Pairing Objective (RpGAN)
Formulation & Implementation
Given an independent pair (x, x') with x \sim p and x' \sim q, the relativistic pairing objective models the probability that x outranks x' via the Bradley–Terry likelihood\sigma(D(x) - D(x')):
The critic maximizes \Phi(D) (minimizes -\Phi(D) = \mathbb{E}[\operatorname{softplus}(D(x') - D(x))] over aligned minibatch pairs (x_i, x'_i)), while the practical non-saturating generator loss rpgan_loss_G swaps the arguments:
def rpgan_loss_D(critic, real, fake):"""Relativistic pairing critic loss -E[log sigma(D(x) - D(x'))]."""return F.softplus(critic(fake) - critic(real)).mean()def rpgan_loss_G(critic, real, fake):"""Non-saturating pairing loss for the generator."""return F.softplus(critic(real) - critic(fake)).mean()
Shift Invariance and the Optimal Pairing Critic
Optimality Theorem
\frac{\delta \Phi}{\delta D(t)} = 0 \quad \Longleftrightarrow \quad D^\star(x) = \log \frac{p(x)}{q(x)} + c = \lambda(x) + c
Shift invariance: For any constant b \in \mathbb{R}, \Phi(D + b) = \Phi(D). The sign of an individual score D(x') is arbitrary; monitor the pairwise ranking accuracyP(D(x) > D(x')).
Unique optimal ranker: Because \log \sigma is strictly concave, setting the functional derivative \delta \Phi / \delta D(t) to zero identifies D^\star(x) = \lambda(x) + c uniquely up to an additive shift c.
Worked Example: Pairwise Ranking on Two States
Concrete Calculation
Consider a two-state space \{0, 1\} with p = (0.8, 0.2) and q = (0.2, 0.8). Compare the product distribution P = p \otimes q (real sample first) against Q = q \otimes p (real sample second):
Ordered Pair (a_1, a_2)
(0, 0) (Tied)
(1, 1) (Tied)
(0, 1) (Mixed)
(1, 0) (Mixed)
P = p \otimes q (real first)
0.16
0.16
0.64
0.04
Q = q \otimes p (real second)
0.16
0.16
0.04
0.64
Tied pairs (0, 0) and (1, 1) carry zero ordering information, while mixed pair (0, 1) identifies the real element with posterior probability \frac{0.64}{0.64 + 0.04} = \frac{16}{17} \approx 94.1\% (vs. 80\% from a single sample).
At D^\star(0) - D^\star(1) = \lambda(0) - \lambda(1) = \log 16, the gain \sup_D \Phi(D) + \log 2 \approx 0.319 nats equals \mathrm{JS}(P, Q)(1.66\times larger than \mathrm{JS}(p, q) \approx 0.193 nats):
Mutual-information interpretation: For a randomly ordered pair (a_1, a_2) with ordering label y \in \{0, 1\}, d_{\mathrm{Rp}}(p, q) = I((a_1, a_2); y) is the information the pair carries about which member is real.
Near equilibrium (q \to p): Redundancy I(a_1; a_2) = \Theta(\|p - q\|^4) vanishes faster than \mathrm{JS}(p, q) = \Theta(\|p - q\|^2), so d_{\mathrm{Rp}}(p, q) \approx 2\,\mathrm{JS}(p, q).
General sandwich bound:\mathrm{JS}(p, q) \le d_{\mathrm{Rp}}(p, q) \le \min(2\,\mathrm{JS}(p, q), \log 2), still saturating at \log 2 on disjoint supports.
Saturating vs. non-saturating rank weight:w_{\textrm{Rp}}(x') is the expected win probability of x' against real data x \sim p; rpgan_loss_G uses 1 - w_{\textrm{Rp}}(x') = \mathbb{E}_p[\sigma(D(x) - D(x'))] \approx 1 when D(x') \ll D(x).
Shift-invariant comparison: Compares D(x') against the live distribution of real scores D(x) rather than a fixed zero threshold.
Discrete Mode-Coverage Landscapes: Three Objectives
Collisions (n^n - n! configurations): Every x'_i sits on a real point \{x_1, \ldots, x_n\} but at least two coincide, leaving a real mode uncovered.
Stepping Off a Collision: Fixed vs. All-Pairs
Cycle Rule on Directed Graphs
Under fixed pairing \mathcal{E}_{\mathrm{diag}}, draw a directed arrow from each real index i to the position of its paired generated point x'_i. Around any directed cycle, score differences \sum (D(x_i) - D(x'_i)) = 0 cancel, so concavity of \log\sigma forces tied scores (-\log 2 per cycle edge); on acyclic arrows, D(x_i) - D(x'_i) \to +\infty achieves 0:
gen classical, all pairs, paired: nats, multiples of log 2
[0, 0] [-0.477 -0.347 -0.347] [-0.69 -0.5 -0.5 ]
[0, 0.1] [-0.347 -0.173 -0.347] [-0.5 -0.25 -0.5 ]
When both generated points collide on x_1([0, 0]) and x'_2 steps off toward x_2([0, 0.1]), both \mathcal{E}_{\mathrm{GAN}} and \mathcal{E}_{\mathrm{all}} strictly increase (from -0.477 and -0.347 to -0.347 and -0.173), trapping x'_2 at the collision.
Under fixed pairing \mathcal{E}_{\mathrm{diag}}, the self-loop 1 \to 1 stays tied at -\log 2 while the acyclic edge 2 \to x'_2 stays at 0, so the loss remains completely flat at -0.5\log 2 \approx -0.347 all the way to x_2.
Enumerating Suboptimal Collision Minima
Fixed Coupling vs. Minibatch Re-Pairing
Counting, over all assignments in \{0, \ldots, n-1\}^n(n = 2, 3), the collisions that are strict local minima:
def small_moves(gen):"""Each generated point stays or steps to one of n fresh positions next to it.""" n =len(gen)for steps in itertools.product(range(n +1), repeat=n):ifany(steps):yield [g + k /10if k else g for g, k inzip(gen, steps)]def count_bad_minima(n):"""Suboptimal strict local minima among the assignments, per loss.""" best, count = losses(list(range(n))), np.zeros(3, dtype=int)for gen in itertools.product(range(n), repeat=n): value = losses(list(gen)) rises = np.all([losses(m) > value +1e-9for m in small_moves(list(gen))], axis=0) count += rises & (value > best +1e-9)return count
n = 2: classical 2, all pairs 2, paired 0; n^n - n! = 2
n = 3: classical 21, all pairs 21, paired 0; n^n - n! = 21
Why Minibatch Training Faces All-Pairs Collisions
Practical Pitfall
What Sun et al. (2020) proved: The fixed one-to-one coupling objective \mathcal{E}_{\mathrm{diag}} has 0 suboptimal collision local minima (0 vs. n^n - n!), because any colliding point x'_i not on a directed cycle can move toward x_i along a flat plateau.
What happens under minibatch re-pairing: Drawing fresh independent minibatches from p and q at every step averages over random pairings, evaluating the all-pairs expectation\mathcal{E}_{\mathrm{all}} = d_{\mathrm{Rp}}(\hat{p}, \hat{q}) - \log 2 (which retains all n^n - n! collision minima).
Takeaway: In §16.4, our 2 \times 2 experiment on 25 Gaussians confirms that R_1 + R_2 gradient penalties, rather than pairing alone, drive mode coverage.
Saturating vs. Non-Saturating Pairing Near Data
Overlapping Mixture Benchmark
When p and q already overlap, as on the 3-component 2D Gaussian mixture benchmark (\mathrm{JS}(p, q_0) = 0.529 nats), both the saturating pairing generator loss (\min_G \Phi(D), weight w_{\textrm{Rp}}) and the non-saturating pairing loss (rpgan_loss_G, weight 1 - w_{\textrm{Rp}}) converge to within a few thousandths of a nat:
pairing critic; generator loss, runs 0, 1, 2
non-saturating median JS 0.0006 0.0005 0.0007 first JS < 0.01 2400 2600 2400
saturating median JS 0.0020 0.0017 0.0014 first JS < 0.01 1800 1800 1800
Near the data distribution, generated samples frequently outrank real samples (w_{\textrm{Rp}}(x') \approx \frac{1}{2}), so neither weight saturates, and the saturating arm actually crosses \mathrm{JS} < 0.01 nats slightly earlier (step 1{,}800 vs. 2{,}200\text{--}2{,}600).
Six Units Away: Saturating Pairing Stalls
Separated Start Benchmark
When initialized far from the data at \theta_0 = 6.0 on the 1D Gaussian shift problem (p = \mathcal{N}(0, 1),q_\theta = \mathcal{N}(\theta, 1)), every generated sample ranks far below every real sample (D(x') \ll D(x)), driving w_{\textrm{Rp}}(x') = \mathbb{E}_p[\sigma(D(x') - D(x))] \to 0:
Why we always use rpgan_loss_G: At \theta_0 = 6.0, the saturating pairing generator receives a median gradient below 5 \times 10^{-4} and remains stuck at \theta = 6.00 after 1{,}500 steps, whereas the non-saturating pairing generator (1 - w_{\textrm{Rp}} \approx 1) receives gradient \approx 3.1 and reaches |\theta| < 0.5 around step 330.
Concept Check: Relativistic Critics and Pairings
Check Your Understanding
Test your understanding of relativistic pairwise objectives:
Behavior of the divergence ratio d_{\mathrm{Rp}}(p, q) / \mathrm{JS}(p, q): On our two-state example, d_{\mathrm{Rp}}(p, q) / \mathrm{JS}(p, q) = 0.319 / 0.193 \approx 1.66. What value does this ratio approach as q \to p, and what value does it approach when p and q have disjoint supports?
Escape path under fixed pairing: For n = 2 with fixed pairing x_1 \leftrightarrow x'_1 and x_2 \leftrightarrow x'_2, suppose both generated points collide on x_1(x'_1 = x'_2 = x_1). What is the best-response paired loss \mathcal{E}_{\mathrm{diag}}, and how does it behave as x'_2 moves continuously from x_1 to x_2?
Answers:
By d_{\mathrm{Rp}}(p, q) = 2\,\mathrm{JS}(p, q) - I(a_1; a_2): as q \to p, I(a_1; a_2) = \Theta(\|p - q\|^4)\ll\mathrm{JS}(p, q) = \Theta(\|p - q\|^2), so the ratio approaches 2. On disjoint supports, both d_{\mathrm{Rp}} and \mathrm{JS} saturate at \log 2, so the ratio approaches 1.
At x'_1 = x'_2 = x_1, edge 1 \to 1 forms a 1-cycle (contributing -\frac{1}{2}\log 2) while edge 2 \to 1 is acyclic (contributing 0), giving \mathcal{E}_{\mathrm{diag}} = -\frac{1}{2}\log 2 \approx -0.347. As x'_2 moves across empty space toward x_2, \mathcal{E}_{\mathrm{diag}} stays completely flat at -\frac{1}{2}\log 2 and then drops to -\log 2 once x'_2 lands on x_2 (closing the second 1-cycle 2 \to 2).
Concept Check: Relativistic Critics and Pairings (cont.)
Check Your Understanding
Interpreting individual critic scores: After training an RpGAN critic, you evaluate D(x') = +3.5 on a generated image. Does D(x') > 0 mean the critic classifies x' as more likely real than generated?
Answer:
No. Because \Phi(D + b) = \Phi(D) is shift-invariant, the zero level of D is arbitrary. Only pairwise differences D(x) - D(x') (or the ranking accuracy P(D(x) > D(x'))) are meaningful.