Course contents 15 / 34

15 / 34 · GANs

Wasserstein GANs and Lipschitz constraints

Why the Wasserstein distance gives the generator a slope where Jensen–Shannon goes flat, what it demands of the discriminator, and the practical approximations used by gradient penalties and spectral normalization.

On this page 5

Put all the data at one point, x=0x = 0, and let the generator put all its samples at x=θx = \theta. For θ=5\theta = 5 and θ=0.01\theta = 0.01 the Jensen–Shannon divergence is the same, ln⁡2\ln 2, because the distributions do not overlap in either case. The exact JS objective cannot tell that the second model is closer. This is a limitation of that objective in this example, not a claim that every finite GAN discriminator or non-saturating generator loss has zero gradient. The GAN note distinguishes those training losses.

What we want is a distance that measures how far the generated samples are from the data, and keeps shrinking as they approach. The Wasserstein GAN uses the Wasserstein-1 distance (Arjovsky, Chintala and Bottou, 2017). It brings a new demand: the discriminator, now called the critic, must not change faster than distance.

Wasserstein-1 distance#

Think of the data distribution PP and the generator’s distribution QQ as two piles of earth of equal mass. A transport plan γ(x,y)\gamma(x, y) says how much mass moves from xx to yy; its marginals must be PP and QQ, and Π(P,Q)\Pi(P, Q) is the set of all such plans (Peyré and Cuturi, 2019). Moving mass mm a distance ∥x−y∥\lVert x - y\rVert costs m∥x−y∥m\lVert x - y\rVert. The Wasserstein-1 distance, or earth mover’s distance, is the cheapest total cost:

W1(P,Q)=inf⁡γ∈Π(P,Q)E(x,y)∼γ ∥x−y∥.W_1(P, Q) = \inf_{\gamma \in \Pi(P, Q)} \mathbb E_{(x, y)\sim\gamma}\,\lVert x - y\rVert .

For the two point masses of the opening with θ≠0\theta\ne0, there is one plan, moving everything a distance ∣θ∣\lvert\theta\rvert:

DJS(δ0 ∥ δθ)=12ln⁡11/2+12ln⁡11/2=ln⁡2,DKL(δ0 ∥ δθ)=∞,W1(δ0,δθ)=∣θ∣.\begin{aligned} D_{\mathrm{JS}}(\delta_0 \,\|\, \delta_\theta) &= \tfrac12\ln\frac{1}{1/2} + \tfrac12\ln\frac{1}{1/2} = \ln 2, \\ D_{\mathrm{KL}}(\delta_0 \,\|\, \delta_\theta) &= \infty, \\ W_1(\delta_0, \delta_\theta) &= \lvert\theta\rvert . \end{aligned}

These JS and KL values assume θ≠0\theta\ne0. The mixture M=12(δ0+δθ)M = \tfrac12(\delta_0 + \delta_\theta) then puts mass 12\tfrac12 on each atom. At θ=0\theta=0, all three discrepancies are zero. Away from zero, JS is flat while W1W_1 has slope sign⁡(θ)\operatorname{sign}(\theta): descending it moves the model toward the data. Arjovsky et al. illustrate the related support issue with parallel line segments; here we compute the scalar point-mass case directly.

Figure

D_JS is flat for disjoint supports; W₁ keeps a slope

Jensen–Shannon divergence and Wasserstein-1 distance between two point massesTop: a red point mass P at zero and a blue point mass Q theta at theta equals 0.7, with a double arrow of length theta between them. Bottom: a plot against theta from minus 1.2 to 1.2. The Jensen–Shannon divergence is a flat red line at ln 2, about 0.693, with a hole at theta equals zero where it drops to a single point at zero; it is labelled flat, no gradient. The Wasserstein-1 distance is a green V shape equal to the absolute value of theta, labelled slope plus or minus 1, useful gradient.P = δ₀ (real)Qθ = δθ (model)θ0θ00.51value−1−0.50.51θW₁ = |θ|DJS = ln 2DJS is flat:∂JS/∂θ = 0 off zeroslope ±1:useful gradientDJS = 0 only at θ = 0Jensen–Shannon divergence and Wasserstein-1 distance between two point massesTop: a red point mass P at zero and a blue point mass Q theta at theta equals 0.7, with a double arrow of length theta between them. Bottom: a plot against theta from minus 1.2 to 1.2. The Jensen–Shannon divergence is a flat red line at ln 2, about 0.693, with a hole at theta equals zero where it drops to a single point at zero; it is labelled flat, no gradient. The Wasserstein-1 distance is a green V shape equal to the absolute value of theta, labelled slope plus or minus 1, useful gradient.P = δ₀(real)Qθ = δθ(model)θ0θ00.51value−1−0.50.51θDJS = ln 2: flat,∂JS/∂θ = 0W₁: slope ±1useful gradientDJS = 0 only at θ = 0
For P = δ₀ and Q_θ = δ_θ with θ ≠ 0, D_JS = ln 2 ≈ 0.693 nats while W₁ = |θ|. Away from zero, W₁ has slope ±1. At θ = 0 both values vanish, but W₁ is not differentiable.

The example generalizes under regularity assumptions. Write QθQ_\theta for the distribution of Gθ(z)G_\theta(z). On the compact data space of Arjovsky, Chintala and Bottou (2017), local Lipschitz continuity in (θ,z)(\theta,z), with integrable local constants over zz, gives continuity and almost-everywhere differentiability of W1(P,Qθ)W_1(P,Q_\theta) (Theorem 1 and Assumption 1). Corollary 1 covers finite feedforward compositions of affine maps and smooth Lipschitz activations when E∥z∥<∞\mathbb E\lVert z\rVert<\infty; the authors also state the result for rectifiers. An arbitrary network is not covered merely because it is feedforward. On a compact space, convergence in KL or JS implies convergence in W1W_1, but the converse fails (Theorem 2). Our nonzero point masses approaching zero demonstrate that distinction.

The dual form#

Directly optimizing a transport plan can be costly for large distributions. The Kantorovich–Rubinstein duality instead expresses the cost through scalar functions that we can approximate by a critic. For probability distributions on a compact set, with distance as the transport cost,

W1(P,Q)=sup⁡∥f∥L≤1[Ex∼Pf(x)−Ex∼Qf(x)],W_1(P, Q) = \sup_{\lVert f\rVert_L \le 1} \Big[\mathbb E_{x\sim P} f(x) - \mathbb E_{x\sim Q} f(x)\Big],

where ∥f∥L≤1\lVert f\rVert_L \le 1 means ff is 1-Lipschitz: ∣f(x)−f(y)∣≤∥x−y∥\lvert f(x) - f(y)\rvert \le \lVert x - y\rVert for all x,yx, y. The function ff scores real samples high and fakes low, like a discriminator, but its score may not change faster than distance. Without that constraint and with P≠QP \ne Q, any separating ff could be scaled up and the supremum would be +∞+\infty. The same formula holds on Rd\mathbb R^d for distributions with finite first moments, with the Lipschitz functions normalized at one point (Peyré, 2025, Section 6.5).

One direction is three lines. Take any plan γ∈Π(P,Q)\gamma \in \Pi(P, Q) and any 1-Lipschitz ff:

EPf−EQf=E(x,y)∼γ[f(x)−f(y)]≤E(x,y)∼γ ∥x−y∥.\begin{aligned} \mathbb E_P f - \mathbb E_Q f &= \mathbb E_{(x, y)\sim\gamma}\big[f(x) - f(y)\big] \\ &\le \mathbb E_{(x, y)\sim\gamma}\,\lVert x - y\rVert . \end{aligned}

The first line holds because the marginals of γ\gamma are PP and QQ, the second because ff is 1-Lipschitz. The supremum over ff on the left and the infimum over γ\gamma on the right give sup⁡≤W1\sup \le W_1. Read f(x)f(x) as a price of earth at xx: a price list that never differs by more than the distance cannot charge more than the cheapest plan. That the best price list matches the plan exactly is the theorem, proved for compact spaces in Peyré (2025), Proposition 5.5 (Kantorovich duality) with Proposition 6.17 and Eq. (6.23), which specialize it to the cost ∥x−y∥\lVert x - y\rVert.

For the point masses, f(x)=−∣x∣f(x) = -\lvert x\rvert is 1-Lipschitz and gives f(0)−f(θ)=∣θ∣f(0)-f(\theta)=\lvert\theta\rvert, attaining the supremum. Its slope at a fake sample is ±1\pm1 when θ≠0\theta\ne0; at zero it is not differentiable and the distance is already minimized. A perfect binary discriminator only has to separate the two occupied points. Its classification objective does not prescribe a useful slope between them.

WGAN losses#

The critic ff is a network with a real-valued output and no sigmoid. It maximizes the dual objective; the generator appears only in the second expectation and wants the critic’s score on fakes to be high:

LD=−Ex∼P[f(x)]+Ez∼pz[f(G(z))],LG=−Ez∼pz[f(G(z))].\begin{aligned} \mathcal L_D &= -\mathbb E_{x\sim P}\big[f(x)\big] + \mathbb E_{z\sim p_z}\big[f(G(z))\big], \\ \mathcal L_G &= -\mathbb E_{z\sim p_z}\big[f(G(z))\big] . \end{aligned}

What does −LD-\mathcal L_D measure? If the critic family is KK-Lipschitz, even its best member gives −LD≤K W1(P,Q)-\mathcal L_D \le K\,W_1(P, Q), with equality only when the family contains KK times an optimal 1-Lipschitz critic; in training, −LD-\mathcal L_D is a minibatch estimate of it. The dual motivates training the critic close to optimality, and Theorem 3 of Arjovsky, Chintala and Bottou (2017) says why. On a compact space, with latent noise zz having a density and GθG_\theta locally Lipschitz in (θ,z)(\theta, z) with constants of finite mean over zz, an optimal 1-Lipschitz critic f∗f^* exists and ∇θW1(P,Qθ)=−Ez[∇θf∗(Gθ(z))]\nabla_\theta W_1(P, Q_\theta) = -\mathbb E_z\big[\nabla_\theta f^*(G_\theta(z))\big] wherever both sides are defined. The generator’s gradient, ∇θLG\nabla_\theta\mathcal L_G, is the gradient of W1W_1 when the critic is optimal: the derivative of a maximum is the partial derivative at the maximizer, an envelope argument. This idealized statement does not guarantee that finite critic optimization finds that maximizer. The original algorithm takes ncritic=5n_{\text{critic}} = 5 critic steps per generator step.

The original paper observed a correlation between a falling critic estimate and improving samples in its experiments. This is not a quality certificate: capacity, optimization, minibatch noise and the Lipschitz scale all affect the value. Comparing models requires a shared evaluation protocol; FID is one feature-based statistic with its own limitations, not an exact substitute for W1W_1.

Where it breaks: clipping the weights#

The losses alone do not keep ff Lipschitz. The original WGAN clipped every critic weight to [−c,c][-c, c], with c=0.01c = 0.01, after each step. Bounded weights give a KK-Lipschitz critic when it is built from linear layers and 1-Lipschitz activations. A layer’s matrix WW of size m×nm \times n with entries in [−c,c][-c, c] has rows wiw_i with ∥wi∥2≤nc2\lVert w_i\rVert^2 \le nc^2, so by Cauchy–Schwarz on each row ∥Wh∥2=∑i(wi⊤h)2≤mnc2∥h∥2\lVert Wh\rVert^2 = \sum_i (w_i^\top h)^2 \le mnc^2\lVert h\rVert^2. A convolution on images of fixed size is such a matrix too, with kernel weights or zeros as entries. Biases do not change a Lipschitz constant, and the product rule below gives K≤∏lcmlnlK \le \prod_l c\sqrt{m_l n_l}, so the bound above holds. The authors identified clipping as a crude way to enforce the constraint (Arjovsky, Chintala and Bottou, 2017): a large cc can slow critic optimization, while a small cc can produce vanishing gradients.

The WGAN-GP paper reports two failure mechanisms in its experiments (Gulrajani et al., 2017, Section 3): clipping concentrated weights near the bounds and limited the critic’s fitted structure; a 12-layer critic also showed growing or decaying layerwise gradient norms for the tested c∈{10−1,10−2,10−3}c\in\{10^{-1},10^{-2},10^{-3}\}. These are empirical demonstrations, not inevitable behavior of every clipped network. The two methods below replace clipping.

WGAN-GP: gradient penalty#

For differentiable ff on Rd\mathbb R^d, being 1-Lipschitz is equivalent to ∥∇f(x)∥2≤1\lVert\nabla f(x)\rVert_2\le1 everywhere. The reverse implication integrates the directional derivative along the segment between two points; the same argument works on an open convex domain. This motivates controlling gradients directly. WGAN-GP keeps the WGAN losses and adds a penalty to the critic (Gulrajani et al., 2017):

LD=Ez[f(G(z))]−Ex∼P[f(x)]+λ Ex^[(∥∇x^f(x^)∥2−1)2],\begin{aligned} \mathcal L_D ={}& \mathbb E_{z}\big[f(G(z))\big] - \mathbb E_{x\sim P}\big[f(x)\big] \\ &+ \lambda\,\mathbb E_{\hat x}\Big[\big(\lVert\nabla_{\hat x} f(\hat x)\rVert_2 - 1\big)^2\Big], \end{aligned}

with λ=10\lambda = 10 in all the paper’s experiments. The generator’s loss is unchanged.

Why two-sided. The literal inequality suggests penalizing only norms above 1, max⁡(0,∥∇f∥2−1)2\max(0,\lVert\nabla f\rVert_2-1)^2. WGAN-GP instead pulls the norm toward 1. Proposition 1 of Gulrajani et al. (2017) motivates this using an optimal transport coupling: under its compactness and differentiability assumptions, with no mass coupled to itself, an optimal critic has unit gradient along the coupled segments. This does not say that every randomly paired segment must have unit gradient, nor that a two-sided penalty preserves every optimal critic. For our point masses, f=−∣x∣f=-\lvert x\rvert has ∣f′∣=1\lvert f'\rvert=1 except at zero.

Where x^\hat x comes from. The proposition is about segments between coupled points, and the optimal coupling is unknown. WGAN-GP pairs each real sample with a random fake, draws α∼U(0,1)\alpha \sim U(0, 1) and takes the point

x^=α xr+(1−α) xf\hat x = \alpha\,x_r + (1 - \alpha)\,x_f

on the segment between them.

The random pairing is a heuristic, not the unknown optimal coupling. A finite soft penalty at sampled points does not certify a global Lipschitz bound. In code, draw one α\alpha per image and broadcast it over pixels. torch.autograd.grad(..., create_graph=True) retains a derivative graph so that the critic parameters can receive a gradient through the penalty (PyTorch documentation). Sum independent per-image scores when taking this vector–Jacobian product, then flatten each input gradient before taking its norm. During a critic update, detach generated samples from the generator; the generator update uses its separate loss without this penalty.

Figure

The gradient penalty is evaluated between real and fake samples

Interpolated points for the WGAN-GP gradient penaltyA two-dimensional scatter. Five illustrative red points on the right and five blue points on the left. Each real sample is joined to a fake sample by a dashed segment, and a green point x hat lies at a fixed position along each segment. Faint parallel lines are level sets of the critic f. At one green point an arrow of unit length shows the gradient of f, labelled: the penalty on its norm is evaluated here.real xr ~ Pfake xf = G(z)x̂ = α xr + (1 − α) xf, α ~ U(0, 1)∇f(x̂)level sets of the critic fpenalty (‖∇f(x̂)‖2 − 1)² evaluated hereInterpolated points for the WGAN-GP gradient penaltyA two-dimensional scatter. Five illustrative red points on the right and five blue points on the left. Each real sample is joined to a fake sample by a dashed segment, and a green point x hat lies at a fixed position along each segment. Faint parallel lines are level sets of the critic f. At one green point an arrow of unit length shows the gradient of f, labelled: the penalty on its norm is evaluated here.real xr ~ Pfake xf = G(z)x̂ = α xr + (1 − α) xf, α ~ U(0, 1)∇f(x̂)level sets of the critic fpenalty (‖∇f(x̂)‖2 − 1)² evaluated here
Five fixed pairs and fractions α = 0.2, 0.35, 0.5, 0.65, 0.8 illustrate interpolation. The algorithm samples α uniformly; these points are fixed. The illustrated linear critic has unit gradient and zero penalty. This is a schematic, not a training result.

No batch normalization in the critic. The penalty treats the critic as a function of one image. With batch normalization each output depends on the whole minibatch, and the per-input gradient no longer describes the function being constrained. WGAN-GP therefore drops batch normalization from the critic and recommends layer normalization. Instance normalization, which normalizes each image’s channels separately, also avoids cross-image dependence; neither choice by itself guarantees a 1-Lipschitz critic.

With the penalty, −LD-\mathcal L_D is the raw score gap minus the weighted penalty. Log both terms separately. Neither the raw gap nor the penalized objective is guaranteed to be a lower bound on W1W_1: the synthetic calculation below has distance 0.65 but a penalized optimum 0.67640625. Soft regularization is not the hard dual constraint.

SN-GAN: spectral normalization#

The second approach constrains the weights instead of the gradients (Miyato et al., 2018). Divide each layer’s weight matrix by its spectral norm, its largest singular value, assuming W≠0W\ne0:

W^=Wσmax⁡(W),σmax⁡(W)=max⁡h≠0∥Wh∥2∥h∥2.\begin{aligned} \hat W &= \frac{W}{\sigma_{\max}(W)}, \\ \sigma_{\max}(W) &= \max_{h \ne 0}\frac{\lVert Wh\rVert_2}{\lVert h\rVert_2} . \end{aligned}

A linear map sends the unit circle to an ellipse. The singular values are its semi-axes, and the largest one is the most any vector can be stretched: the Lipschitz constant of h↦Whh \mapsto Wh. After the division no direction is stretched by more than 1.

Figure

A matrix stretches the unit circle into an ellipse; its largest singular value is the longest semi-axis

Spectral normalization of a 2 by 2 matrixThree panels. First: the unit circle with two perpendicular unit vectors v1 and v2. Second: after multiplying by W the circle becomes a tilted ellipse; its long semi-axis sigma 1 times u1 has length 1.66 and its short semi-axis sigma 2 times u2 has length 0.58; the dashed unit circle is shown for reference. Third: after dividing W by sigma max the ellipse has semi-axes 1 and 0.35 and fits inside the dashed unit circle, touching it at plus and minus u1.unit circle ‖h‖₂ = 1v1v2after W: stretchedσ1u1σ2u2σ₁ = σmax = 1.66σ₂ = σmin = 0.58after Ŵ = W / σmaxu1touches at ±u₁longest semi-axis = 1‖Ŵh‖₂ ≤ ‖h‖₂W÷σ₁Spectral normalization of a 2 by 2 matrixThree panels. First: the unit circle with two perpendicular unit vectors v1 and v2. Second: after multiplying by W the circle becomes a tilted ellipse; its long semi-axis sigma 1 times u1 has length 1.66 and its short semi-axis sigma 2 times u2 has length 0.58; the dashed unit circle is shown for reference. Third: after dividing W by sigma max the ellipse has semi-axes 1 and 0.35 and fits inside the dashed unit circle, touching it at plus and minus u1.unit circle ‖h‖₂ = 1v1v2after W: stretchedσ1u1σ2u2σ₁ = σmax = 1.66σ₂ = σmin = 0.58after Ŵ = W / σmaxu1touches at ±u₁longest semi-axis = 1‖Ŵh‖₂ ≤ ‖h‖₂multiply by Wdivide by σmax
The selected W = [[1.3, 0.7], [0.3, 0.9]] has singular values 1.66 and 0.58. Dividing by the exact σ₁ gives semi-axes 1 and 0.35, inside the unit circle. This is an exact 2×2 calculation, without power-iteration error.

ReLU is 1-Lipschitz; LeakyReLU is too when the absolute value of its negative slope is at most 1. Constants multiply under composition: ∣f(g(x))−f(g(y))∣≤Lf∥g(x)−g(y)∥≤LfLg∥x−y∥\lvert f(g(x))-f(g(y))\rvert\le L_f\lVert g(x)-g(y)\rVert\le L_fL_g\lVert x-y\rVert. For a chain of linear layers and such activations,

∥f∥L≤∏lσmax⁡(Wl),\lVert f\rVert_L \le \prod_{l} \sigma_{\max}(W_l),

which is at most 1 after division by the exact nonzero norms. This is a global bound for this chain architecture. A residual sum has the sum of its branches’ bounds, so normalizing each branch alone does not make the whole network 1-Lipschitz. An identically zero weight matrix already has norm zero and needs separate handling rather than division by zero.

Computing σmax⁡\sigma_{\max}. A full SVD per update can be expensive. The practical method estimates it by a short power iteration, retaining vectors between updates. One update pair, starting from a right vector vv, is

u←Wv∥Wv∥2,v←W⊤u∥W⊤u∥2,σmax⁡≈u⊤Wv.\begin{aligned} u &\leftarrow \frac{Wv}{\lVert Wv\rVert_2}, \\ v &\leftarrow \frac{W^\top u}{\lVert W^\top u\rVert_2}, \\ \sigma_{\max} &\approx u^\top W v . \end{aligned}

For the matrix of the figure, W=(1.30.70.30.9)W = \begin{pmatrix} 1.3 & 0.7 \\ 0.3 & 0.9 \end{pmatrix} with σmax⁡=1.657\sigma_{\max} = 1.657, starting from v=(1,0)v = (1, 0):

StepEstimate of σmax⁡\sigma_{\max}
11.601
21.656
31.657

Here σ2/σ1≈0.35\sigma_2/\sigma_1\approx0.35, so two iterations already give error below 0.001. Reusing vectors can make short iterations effective when weights change slowly and the leading singular direction is separated. One iteration is a computational choice, not a universal accuracy guarantee; a poor initialization or a small spectral gap can make convergence slow.

The estimate is from below because ∣u⊤Wv∣≤∥u∥ ∥Wv∥≤σmax⁡\lvert u^\top Wv\rvert\le\lVert u\rVert\,\lVert Wv\rVert\le\sigma_{\max} for unit u,vu,v. Dividing by an underestimate can therefore leave a norm above 1, potentially by much more than a small rounding error. For convolution, flattening the kernel is also only a proxy for the full convolution operator; input size, stride and padding matter (Gouk et al., 2021, Section 3.2). Exact norms of a simple chain give a valid product bound, but that bound need not be tight. If a critic has a known bound KK, its population gap is at most KW1K W_1; equality requires sufficient capacity and optimality. Practical spectral normalization alone does not make its score an exact or calibrated Wasserstein estimate.

Miyato et al. used standard non-saturating GAN training and the hinge loss, comparing against WGAN-GP. Spectral normalization can be used with these different objectives. In PyTorch, torch.nn.utils.parametrizations.spectral_norm(nn.Conv2d(...)) registers a parametrization: the documented default is one power iteration when the weight is accessed in training mode, which need not mean exactly once per forward pass. The scaling note discusses its use in both networks.

What changed#

Both f-GAN in the GAN note and WGAN train a function inside a supremum. An f-divergence is built from density ratios; its behavior at disjoint supports depends on the chosen divergence. The point-mass example shows the specific JS/KL limitation here. Wasserstein-1 uses the ground distance, so it distinguishes nearby and distant disjoint supports. Its dual imposes a Lipschitz constraint that ties critic scores to that geometry.

What you should remember#

  • W1W_1 is the cheapest cost of moving PP onto QQ; for point masses at 0 and θ\theta it is ∣θ∣\lvert\theta\rvert, while JS is ln⁡2\ln 2 when θ≠0\theta\ne0 and zero when θ=0\theta=0.
  • Dual: W1=sup⁡∥f∥L≤1EPf−EQfW_1 = \sup_{\lVert f\rVert_L \le 1} \mathbb E_P f - \mathbb E_Q f; the critic plays ff and is trained close to optimal.
  • Weight clipping gives an architecture-dependent bound and can limit critic capacity or damage gradients.
  • WGAN-GP: λ(∥∇f(x^)∥2−1)2\lambda(\lVert\nabla f(\hat x)\rVert_2 - 1)^2 on random real–fake interpolates, λ=10\lambda = 10, no batch norm in the critic.
  • Spectral normalization divides weights by an estimated norm. Exact chain bounds and practical power/convolution approximations must be distinguished.

Notebook#

Run python3 scripts/notes/generative-practice.py wgan from the repository checkout. The standard-library script creates 129 scalar samples and a second empirical distribution translated by 0.65. The saved output comes from this calculation; no image dataset or pretrained generator is needed.

  • Sort the two equally weighted samples and average the absolute paired distances. Their empirical Wasserstein distance is 0.65. A linear critic with slopes 1, 3 and 9 gives gaps 0.65, 1.95 and 5.85: increasing an unconstrained critic can inflate its score without changing either distribution.
  • Restrict the slope to absolute value at most 1. The optimum reaches the exact distance. Then replace that constraint with a gradient penalty of weight 4. For a positive slope aa, the objective is 0.65a−4(a−1)20.65a-4(a-1)^2; its optimum is a=1.08125a=1.08125, with raw gap 0.7028125 and penalized objective 0.67640625.
  • The soft penalty permits a slope above 1, so neither of those latter values is the exact Wasserstein distance. This checks the critic constraint and its approximation in a family whose optimum is known. It does not train an image WGAN or establish image quality.

The example, script and observations were newly authored for this course with Codex assistance; the numerical results are from the linked run.

The numerical verifier also checks the point-mass boundary, the figure interpolation points and the spectral-norm table; its saved results include an explicit example of power iteration underestimating a norm. Run it with python3 scripts/notes/check-wgan-renewal.py. These are finite calculations, not an image-training benchmark.

Next#

Wasserstein-1 supplies a geometric training objective, while gradient penalties and spectral normalization approximate constraints on the critic. These tools do not by themselves guarantee image quality or stable optimization. The next note follows the move toward larger and more varied images through progressive growth, attention and scaling.

References#

  • M. Arjovsky, S. Chintala, L. Bottou. Wasserstein GAN. arXiv:1701.07875, 2017; ICML 2017. Section 2 and Example 1 (parallel lines), Theorem 1 and Corollary 1 (continuity), Theorem 2 (strength of the distances), Theorem 3 (the gradient through an optimal critic), Section 3 and Algorithm 1 (critic, clipping, ncritic=5n_{\text{critic}} = 5), Section 4 (an observed correlation with sample quality).
  • I. Gulrajani, F. Ahmed, M. Arjovsky, V. Dumoulin, A. Courville. Improved training of Wasserstein GANs. NeurIPS, 2017. Section 3 (failures of clipping), Proposition 1 (on a compact space), Section 4 and Algorithm 1 (the penalty, λ=10\lambda = 10, no batch normalization in the critic).
  • T. Miyato, T. Kataoka, M. Koyama, Y. Yoshida. Spectral normalization for generative adversarial networks. ICLR, 2018. Section 2 (the bound, Eq. 7); Section 4 (objectives); Appendix A (power iteration).
  • G. Peyré. Optimal transport for machine learners. arXiv:2505.06589, 2025; version 3, 2026. Proposition 5.5 (Kantorovich duality on compact spaces, with proof), Section 6.5: Proposition 6.17 and Eq. (6.23) (the Kantorovich–Rubinstein formula) and the case of non-compact spaces.
  • G. Peyré, M. Cuturi. Computational optimal transport. Foundations and Trends in Machine Learning, 11(5–6), 2019. Chapter 2; Section 6.1 and Eq. (6.1): W1W_1 on metric spaces.
  • H. Gouk, E. Frank, B. Pfahringer, M. J. Cree. Regularisation of neural networks by enforcing Lipschitz continuity. Machine Learning, 110, 2021. Section 3.2: the operator norm of a convolution.
  • R. Isachenko. Deep Generative Models, MIPT and YSDA, 2025. Lecture 5: the Wasserstein distance, Kantorovich–Rubinstein duality, weight clipping.
  • PyTorch 2.15 documentation: autograd.grad, parametrizations.spectral_norm. API behavior only; no training run is claimed.
  • A. Ryzhikov, S. Ali, A. Akhmatova, T. Ramazyan, K. Aithadzhaev, A. Khizhik. GenAI, Lecture 3: WGAN and the optimal transport problem, HSE, 25 January 2025. Background course reference; the local examples and checks use no lecture images, dataset or notebook code.