SECTION 01 / 1

Realization of Variational Divergence Minimization (VDM)

8 min read
On this page 15 headings

What is VDM?

Variational Divergence Minimization (VDM) is a framework for training generative models by minimizing a divergence between the real-data distribution and the model-generated distribution.

The central idea is to convert a divergence, which may be difficult to compute directly, into a variational optimization objective that can be estimated from samples.

Goal: Train a generator so that its output distribution resembles the distribution of real training data.

Dataset and real-data distribution

Consider a dataset:

D={x1,x2,…,xn}D=\{x_1,x_2,\ldots,x_n\}

Assume the observations are independently and identically distributed:

xi∼iidPXx_i\overset{iid}{\sim}P_X

Here:

  1. DD: training dataset

  2. xix_i: an individual training sample

  3. nn: number of samples

  4. PXP_X: real-data probability distribution

  5. i.i.d.: independent and identically distributed

For example, if the dataset contains handwritten digits, PXP_X describes the underlying distribution of real digit images.

We observe samples from PXP_X, but generally do not know its exact probability density.

Real data follow P_X; generated data follow P_θ. The goal is to bring the generated distribution closer to the real one.
Real data follow P_X; generated data follow P_θ. The goal is to bring the generated distribution closer to the real one.

Latent noise and the generator

First, sample a random latent vector:

z∼N(0,I)z\sim\mathcal N(0,I)

where 00 is the zero mean vector and II is the identity covariance matrix.

A generator neural network transforms the latent vector into a synthetic observation:

x^=gθ(z)\hat{x}=g_\theta(z)

Here:

  1. zz: latent random vector

  2. gθg_\theta: generator function

  3. θ\theta: generator parameters, including weights and biases

  4. x^\hat{x}: generated sample

  5. PθP_\theta: distribution induced by the generator

Thus:

z∼N(0,I)⟶gθ(z)=x^⟶x^∼Pθz\sim\mathcal N(0,I) \quad\longrightarrow\quad g_\theta(z)=\hat{x} \quad\longrightarrow\quad \hat{x}\sim P_\theta

Changing θ\theta changes the generated samples and therefore the model distribution PθP_\theta.

The generator maps latent noise to a sample. The scoring network receives a real or generated sample and returns a score.
The generator maps latent noise to a sample. The scoring network receives a real or generated sample and returns a score.

Original divergence minimization objective

We want the generated distribution PθP_\theta to resemble the real distribution PXP_X.

The mathematical objective is:

θ∗=arg⁡min⁡θDf(PX∥Pθ)\boxed{\theta^*=\arg\min_\theta D_f(P_X\parallel P_\theta)}

Here, DfD_f is an ff-divergence.

For distributions with densities pXp_X and pθp_\theta, under appropriate conditions:

Df(PX∥Pθ)=∫pθ(x)f(pX(x)pθ(x))dxD_f(P_X\parallel P_\theta) = \int p_\theta(x) f\left(\frac{p_X(x)}{p_\theta(x)}\right)dx

The function ff is convex, conventionally normalized by

f(1)=0f(1)=0

The notation arg⁡min⁡θ\arg\min_\theta means finding the generator parameters that minimize the divergence.

Important: The generator minimizes divergence; it does not necessarily minimize the individual output values of the scoring network.

Why direct divergence minimization is difficult

The divergence formula involves the density ratio:

pX(x)pθ(x)\frac{p_X(x)}{p_\theta(x)}

In many generative modeling problems, we can sample from the real and generated distributions but cannot evaluate both densities directly.

This makes the original divergence difficult to calculate and optimize.

The solution is to use the variational representation studied in Week 1.

Variational representation of an f-divergence

Recall the convex conjugate:

f∗(t)=sup⁡u{ut−f(u)}f^*(t)=\sup_u\{ut-f(u)\}

Fenchel–Young inequality gives:

f(u)≥ut−f∗(t)f(u)\ge ut-f^*(t)

Using the density ratio and taking expectations leads to:

Df(PX∥Pθ)≥EPX[T(X)]−EPθ[f∗(T(X))]D_f(P_X\parallel P_\theta) \ge \mathbb E_{P_X}[T(X)] - \mathbb E_{P_\theta}[f^*(T(X))]

Define the variational objective:

J(θ,T)=EPX[T(X)]−EPθ[f∗(T(X))]\boxed{ J(\theta,T)= \mathbb E_{P_X}[T(X)] - \mathbb E_{P_\theta}[f^*(T(X))] }

Here:

  1. TT: an admissible scoring function

  2. f∗f^*: convex conjugate of ff

  3. EPX\mathbb E_{P_X}: expectation over real samples

  4. EPθ\mathbb E_{P_\theta}: expectation over generated samples

Under appropriate conditions, maximizing over a sufficiently rich class of admissible functions recovers the divergence:

Df(PX∥Pθ)=sup⁡TJ(θ,T)D_f(P_X\parallel P_\theta)=\sup_T J(\theta,T)

This formulation is useful because expectations can be approximated using samples.

Replace a difficult density-based divergence with a variational objective, then represent the scoring function by a neural network.
Replace a difficult density-based divergence with a variational objective, then represent the scoring function by a neural network.

Parameterizing the scoring function

Instead of searching over all possible functions TT, represent the scoring function with a neural network:

Tw(x)T_w(x)

where ww contains the scoring network's trainable parameters.

The practical objective becomes:

J(θ,w)=EPX[Tw(X)]−EPθ[f∗(Tw(X))]\boxed{ J(\theta,w)= \mathbb E_{P_X}[T_w(X)] - \mathbb E_{P_\theta}[f^*(T_w(X))] }

The scoring network learns a function that maximizes the variational objective for a fixed generator.

Its output is a score, not necessarily a probability.

The function must also satisfy the domain requirements of f∗f^*. The teacher introduces a suitable output activation for this in the next topic.

The min–max objective

Combining generator optimization with scoring-network optimization gives:

min⁡θmax⁡w[EPX[Tw(X)]−EPθ[f∗(Tw(X))]]\boxed{ \min_\theta\max_w \left[ \mathbb E_{P_X}[T_w(X)] - \mathbb E_{P_\theta}[f^*(T_w(X))] \right] }

The two networks have opposing optimization objectives.

Scoring network:

max⁡wJ(θ,w)\max_w J(\theta,w)

For fixed generator parameters, find the scoring function that gives the strongest available variational lower bound.

Generator:

min⁡θJ(θ,w)\min_\theta J(\theta,w)

For a fixed scoring function, update the generator to reduce the objective.

The intended overall result is to reduce the divergence between real and generated distributions.

When the scoring-function family is restricted, the maximized variational objective may be only a lower bound on the true divergence. Exact equivalence requires suitable assumptions about the function class and optimization.

The scoring network maximizes the variational objective; the generator minimizes it. The displayed objective is not a rule to minimize each individual score.
The scoring network maximizes the variational objective; the generator minimizes it. The displayed objective is not a rule to minimize each individual score.

Estimate the objective from samples

Expectations are population averages. With n real samples and m independent noise samples, replace each expectation by its own sample average. The real and generated batch sizes need not be equal.

J^(θ,w)=1n∑i=1nTw(xi)−1m∑j=1mf∗ ⁣(Tw(gθ(zj))).\begin{aligned}\widehat J(\theta,w)&=\frac1n\sum_{i=1}^{n}T_w(x_i)\\&\quad-\frac1m\sum_{j=1}^{m}f^*\!\left(T_w(g_\theta(z_j))\right).\end{aligned}

Suppose the mean score on real samples is 1.5, and the mean conjugate-transformed score on generated samples is 0.6. The estimated objective is 1.5 − 0.6 = 0.9. These are illustrative evaluated averages, not raw probabilities.

Keep the scoring network fixed. If a generator update changes the second mean to 0.8, the estimate becomes 1.5 − 0.8 = 0.7. The objective decreased. Notice that the generated conjugate-transformed term increased: minimizing the difference does not mean pushing every scoring output down.

A finite-sample estimate fluctuates and need not itself be a certified lower bound on the population divergence. The variational lower-bound statement concerns the population expectations under its assumptions.

Why is this adversarial optimization?

The problem is called adversarial because the two networks have opposing objectives.

  1. The scoring network tries to expose discrepancies between real and generated distributions.

  2. The generator tries to reduce those discrepancies.

The networks do not need to output opposite numerical scores. Their opposition comes from maximizing versus minimizing the same objective.

This leads to a min–max or saddle-point optimization problem.

The networks optimize the same objective in opposite directions: the critic exposes discrepancies and the generator reduces them.
The networks optimize the same objective in opposite directions: the critic exposes discrepancies and the generator reduces them.

Understanding a saddle point

Consider the simple mathematical example:

J(θ,w)=θ2−w2J(\theta,w)=\theta^2-w^2

For w=0w=0:

J(θ,0)=θ2J(\theta,0)=\theta^2

This is minimized at:

θ=0\theta=0

For θ=0\theta=0:

J(0,w)=−w2J(0,w)=-w^2

This is maximized at:

w=0w=0

Therefore:

(θ∗,w∗)=(0,0)\boxed{(\theta^*,w^*)=(0,0)}

The point is a minimum in the θ\theta direction and a maximum in the ww direction.

This illustrates the mathematical meaning of a saddle point. Real neural-network objectives are more complicated and are not guaranteed to converge to such a point.

For J(θ,w) = θ² − w², the origin is a minimum in θ and a maximum in w. This toy example does not guarantee convergence for neural networks.
For J(θ,w) = θ² − w², the origin is a minimum in θ and a maximum in w. This toy example does not guarantee convergence for neural networks.

Complete mathematical flow

There are two sampling streams, not a transformation from real observations into latent noise. Real observations come from the dataset; latent noise enters the generator. The scoring network evaluates samples from both streams.

xi∼PX(real-data stream)zj∼N(0,I),x^j=gθ(zj)∼Pθ(generated-data stream)\begin{aligned}x_i&\sim P_X &&\text{(real-data stream)}\\z_j&\sim\mathcal N(0,I),\quad \hat x_j=g_\theta(z_j)\sim P_\theta &&\text{(generated-data stream)}\end{aligned}

The original goal is to choose generator parameters that minimize the divergence. Its variational realization replaces the density calculation with expectations and a trainable scoring network.

θ∗∈arg min⁡θDf(PX∥Pθ),min⁡θsup⁡wJ(θ,w)=min⁡θsup⁡w{EPX[Tw(X)]−EPθ[f∗(Tw(X))]}.\begin{aligned}\theta^*&\in\operatorname*{arg\,min}_\theta D_f(P_X\parallel P_\theta),\\\min_\theta\sup_w J(\theta,w)&=\min_\theta\sup_w\left\{\mathbb E_{P_X}[T_w(X)]-\mathbb E_{P_\theta}[f^*(T_w(X))]\right\}.\end{aligned}

We write sup when a best score may be approached without being attained. The usual min–max notation assumes the relevant extrema are attained. With a restricted neural-network family, the maximized objective can remain a lower bound rather than the full divergence.

Common mistakes

  1. Confusing PXP_X and PθP_\theta: PXP_X is the real-data distribution; PθP_\theta is the generated distribution.

  2. Confusing θ\theta and ww: θ\theta belongs to the generator; ww belongs to the scoring network.

  3. Assuming the critic minimizes: The scoring network maximizes the variational objective.

  4. Assuming the scoring output must be zero: The goal is not to force every Tw(x)T_w(x) to zero.

  5. Treating a restricted variational lower bound as automatically equal to the divergence: Equality requires suitable conditions.

  6. Confusing min⁡\min and arg⁡min⁡\arg\min: The former returns the minimum value; the latter identifies parameters achieving it.

Quick revision

VDM: Variational Divergence Minimization.

Real distribution: PXP_X.

Noise: z∼N(0,I)z\sim\mathcal N(0,I).

Generator: x^=gθ(z)\hat{x}=g_\theta(z).

Generated distribution: PθP_\theta.

Scoring network: Tw(x)T_w(x).

Generator objective: Minimize discrepancy.

Scoring network objective: Maximize the variational lower bound.

Overall objective:

min⁡θmax⁡wJ(θ,w)\boxed{\min_\theta\max_w J(\theta,w)}

One-line memory anchor:

The scoring network finds the strongest available measure of the difference, while the generator learns to reduce that difference.

Next topic: Implementing VDM with neural networks, including the output activation needed to keep Tw(x)T_w(x) in the domain of the convex conjugate.

Check your understanding

What changes when the generator parameters change?

Show solution

The mapping from noise to generated observations changes, so the induced distribution PθP_\theta may change. The real-data distribution PXP_{X} is the target and is not trained by those updates.

Which network maximizes the objective?

Show solution

The scoring network, with parameters w, maximizes it while the generator is fixed. The generator, with parameters θ\theta , minimizes it while the scoring network is fixed.

Does the scoring network output a probability by definition?

Show solution

No. It outputs an admissible score. Its permitted output range depends on the effective domain of the chosen convex conjugate.

Is every neural scoring network guaranteed to recover the exact divergence?

Show solution

No. A restricted function family and imperfect optimization may leave a gap. Equality requires a sufficiently rich admissible class and suitable regularity assumptions.

Real mean score = 2.0 and generated mean conjugate-transformed score = 1.3. What is the estimated objective?

Show solution

2.0 − 1.3 = 0.7. The second term is the average after applying the convex conjugate, not necessarily the average raw critic score.

In the saddle example, what happens along θ\theta when w = 0?

Show solution

The objective is θ\theta ², minimized at θ\theta = 0. Along w with θ\theta = 0, it is −w², maximized at w = 0.

Are real samples generated by passing them through the noise distribution?

Show solution

No. Real samples and latent noise are separate inputs. Noise passes through the generator to produce synthetic samples; the scoring network can evaluate both real and synthetic samples.

What is the difference between min and argmin?

Show solution

min gives the smallest objective value; argmin gives the parameter value or set of values that achieves that value. An optimum need not always be attained.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑