Published on

From Spread MLE to Implicit MLE

Authors
Mingtian Zhang

1. Implicit Generative Models and IMLE

Implicit generative models are easy to sample from but often do not have a tractable likelihood. Let

Zp(z),Y=Gθ(Z),Z\sim p(z), \qquad Y=G_\theta(Z),

and let qθq_\theta denote the resulting distribution of YY. We can generate samples from qθq_\theta, but evaluating qθ(x)q_\theta(x) may be impossible. The problem is even more severe when qθq_\theta is supported on a low-dimensional manifold, because an ordinary density may not exist at all.

Implicit Maximum Likelihood Estimation (IMLE) trains such a generator without ever requiring access to its density. Given a data distribution pdatap_{\mathrm{data}}, the population IMLE objective can be written as

LIMLE(θ)=EXpdataEY1:mqθm[min1jmXYj2].\mathcal L_{\mathrm{IMLE}}(\theta) = \mathbb E_{X\sim p_{\mathrm{data}}} \mathbb E_{Y_{1:m}\sim q_\theta^m} \left[ \min_{1\le j\le m} \|X-Y_j\|^2 \right].

For an empirical dataset x1,,xnx_1,\ldots,x_n, this becomes

L^IMLE(θ)=EY1:mqθm[1ni=1nmin1jmxiYj2].\widehat{\mathcal L}_{\mathrm{IMLE}}(\theta) = \mathbb E_{Y_{1:m}\sim q_\theta^m} \left[ \frac1n \sum_{i=1}^n \min_{1\le j\le m} \|x_i-Y_j\|^2 \right].

In practice, IMLE repeatedly performs three steps:

  1. Sample a pool of latent codes z1,,zmz_1,\ldots,z_m.
  2. Generate candidates Yj=Gθ(zj)Y_j=G_\theta(z_j).
  3. For each data point, find its nearest generated candidate and update the generator to reduce the matched distance.

The matching direction is important: every data point selects a generated sample. This encourages the generator to cover all observed modes rather than only improving samples in regions it already generates well.

The expectation over Y1:mY_{1:m} averages over the random candidate pools produced by the model. The empirical average over the data can equivalently be viewed as an expectation under the empirical data distribution.

This objective does not immediately resemble a likelihood-based objective. The following sections show how it can be derived from a finite-sample approximation to spread maximum likelihood.

2. From an Ill-Defined KL to the Spread KL Divergence

Consider a data distribution pdatap_{\mathrm{data}} and an implicit model distribution qθq_\theta. A natural objective is the forward KL divergence, which, whenever both distributions admit densities with respect to the same base measure, can be written as

KL(pdataqθ)=EXpdata[logpdata(X)logqθ(X)].\operatorname{KL} \left( p_{\mathrm{data}} \|q_\theta \right) = \mathbb E_{X\sim p_{\mathrm{data}}} \left[ \log p_{\mathrm{data}}(X) - \log q_\theta(X) \right].

Since the first term does not depend on θ\theta, minimizing the forward KL is equivalent to maximum likelihood:

argminθKL(pdataqθ)=argmaxθEXpdata[logqθ(X)].\arg\min_\theta \operatorname{KL} \left( p_{\mathrm{data}} \|q_\theta \right) = \arg\max_\theta \mathbb E_{X\sim p_{\mathrm{data}}} \left[ \log q_\theta(X) \right].

That premise fails for the implicit generator above. Mapping a low-dimensional latent into a higher-dimensional observation space leaves qθq_\theta supported on a lower-dimensional manifold, with no ordinary density with respect to the ambient Lebesgue measure. Worse, even when pdatap_{\mathrm{data}} and qθq_\theta both concentrate on low-dimensional manifolds, their supports may fail to overlap exactly, in which case KL(pdataqθ)\operatorname{KL}(p_{\mathrm{data}}\|q_\theta) is infinite or not meaningfully defined through ordinary density ratios.

Spreading the Distributions

Spread divergence addresses this by applying the same smoothing kernel to both distributions. Using Gaussian spreading,

X~=X+σϵ,Y~=Y+σϵ,ϵ,ϵN(0,I),\widetilde X = X+\sigma\epsilon, \qquad \widetilde Y = Y+\sigma\epsilon', \qquad \epsilon,\epsilon'\sim\mathcal N(0,I),

the corresponding spread distributions are the convolutions

pσ=pdataϕσ,qθ,σ=qθϕσ,ϕσ(u)=N(u;0,σ2I).p_\sigma = p_{\mathrm{data}}*\phi_\sigma, \qquad q_{\theta,\sigma} = q_\theta*\phi_\sigma, \qquad \phi_\sigma(u) = \mathcal N(u;0,\sigma^2I).

Gaussian convolution turns the original, possibly singular distributions into smooth distributions with densities over the full observation space. The spread KL divergence

KL(pσqθ,σ)\operatorname{KL} \left( p_\sigma \|q_{\theta,\sigma} \right)

is therefore well defined, whatever the supports of pdatap_{\mathrm{data}} and qθq_\theta happen to be.

Why Spreading Loses Nothing

Well-definedness alone would not be enough. Smoothing could in principle blur away exactly the differences we are trying to detect, leaving an objective that is finite but no longer informative about the original distributions. This does not happen for Gaussian spreading: the spread KL is a genuine divergence on the original distributions,

KL(pσqθ,σ)=0pdata=qθ.\boxed{ \operatorname{KL} \left( p_\sigma \|q_{\theta,\sigma} \right) = 0 \quad\Longleftrightarrow\quad p_{\mathrm{data}} = q_\theta . }

This holds for every fixed σ>0\sigma>0, and follows from the fact that Gaussian convolution is injective, so that pσ=qθ,σp_\sigma=q_{\theta,\sigma} already forces pdata=qθp_{\mathrm{data}}=q_\theta. See the spread divergence paper for the proof and for the general conditions a noise distribution must satisfy for its spread divergence to be a valid divergence.

So nothing is lost by spreading: driving the spread KL to zero matches the two distributions we actually care about, even though KL(pdataqθ)\operatorname{KL}(p_{\mathrm{data}}\|q_\theta) may itself be ill-defined. What remains is to turn this divergence into something we can optimize.

3. Spread Maximum Likelihood

Expanding the spread KL exactly as before,

KL(pσqθ,σ)=EX~pσ[logpσ(X~)logqθ,σ(X~)],\operatorname{KL} \left( p_\sigma \|q_{\theta,\sigma} \right) = \mathbb E_{\widetilde X\sim p_\sigma} \left[ \log p_\sigma(\widetilde X) - \log q_{\theta,\sigma}(\widetilde X) \right],

the first term again does not depend on θ\theta. Minimizing the spread KL is therefore maximum likelihood under the spread model, which gives the Spread Maximum Likelihood objective

Lspread(θ)=EX~pσ[logqθ,σ(X~)].\boxed{ \mathcal L_{\mathrm{spread}}(\theta) = \mathbb E_{\widetilde X\sim p_\sigma} \left[ \log q_{\theta,\sigma}(\widetilde X) \right]. }

Because the two objectives differ only by a θ\theta-independent constant, the identifiability of the spread KL carries over directly. Assuming the data distribution is realizable,

argmaxθLspread(θ)={θ:qθ=pdata}.\arg\max_\theta \mathcal L_{\mathrm{spread}}(\theta) = \left\{ \theta: q_\theta = p_{\mathrm{data}} \right\} .

Spread MLE is thus not a compromise objective that merely happens to be computable. Its optimum recovers the unspread data distribution, so it estimates the same thing ordinary MLE would have estimated had the latter been well defined.

For an implicit model, the spread density is a Gaussian mixture over model samples,

qθ,σ(x)=EYqθ[N(x;Y,σ2I)],q_{\theta,\sigma}(x) = \mathbb E_{Y\sim q_\theta} \left[ \mathcal N(x;Y,\sigma^2I) \right],

which is a smooth density even when the original model is implicit or singular. Substituting it in,

Lspread(θ)=EX~[logEYqθexp(X~Y22σ2)]+C.\mathcal L_{\mathrm{spread}}(\theta) = \mathbb E_{\widetilde X} \left[ \log \mathbb E_{Y\sim q_\theta} \exp\left( -\frac{\|\widetilde X-Y\|^2}{2\sigma^2} \right) \right] +C.

This is a valid likelihood objective, but the inner expectation is generally intractable.

4. A Finite-Sample Approximation

Draw mm samples from the implicit model:

Y1,,Ymqθ.Y_1,\ldots,Y_m\sim q_\theta.

The spread density can be approximated by a finite Gaussian mixture:

q^θ,σ,m(x)=1mj=1mN(x;Yj,σ2I).\widehat q_{\theta,\sigma,m}(x) = \frac1m \sum_{j=1}^m \mathcal N(x;Y_j,\sigma^2I).

This gives the multi-sample objective

Lm,σ(θ)=EX~,Y1:m[log1mj=1mexp(X~Yj22σ2)]+C.\mathcal L_{m,\sigma}(\theta) = \mathbb E_{\widetilde X,Y_{1:m}} \left[ \log \frac1m \sum_{j=1}^m \exp\left( -\frac{\|\widetilde X-Y_j\|^2}{2\sigma^2} \right) \right] +C.

Because the finite mixture is an unbiased estimator of the spread density, Jensen's inequality gives

Lm,σ(θ)Lspread(θ).\mathcal L_{m,\sigma}(\theta) \le \mathcal L_{\mathrm{spread}}(\theta).

This is the same general construction used in multi-sample likelihood bounds such as the importance weighted autoencoder: a finite Monte Carlo average is placed inside the logarithm, and the expectation of the resulting log gives a lower bound on the exact log marginal likelihood.

As mm\to\infty, the finite mixture approaches the exact spread density under suitable conditions.

5. The Small-Noise Limit

Consider the core log-sum-exp term:

2σ2logj=1mexp(X~Yj22σ2).-2\sigma^2 \log \sum_{j=1}^m \exp\left( -\frac{\|\widetilde X-Y_j\|^2}{2\sigma^2} \right).

Fix XX, ϵ\epsilon and Y1:mY_{1:m} for a moment. As σ0\sigma\to0, the largest exponential term dominates, so that pointwise

2σ2logj=1mexp(X~Yj22σ2)minjXYj2.-2\sigma^2 \log \sum_{j=1}^m \exp\left( -\frac{\|\widetilde X-Y_j\|^2}{2\sigma^2} \right) \longrightarrow \min_j \|X-Y_j\|^2.

The same limit performs two operations at once:

  1. The data noise disappears because
X~=X+σϵX.\widetilde X=X+\sigma\epsilon\to X.
  1. The soft Gaussian responsibilities become a hard nearest-neighbour assignment.

Both the 1m\frac1m inside the logarithm and the additive constant CC are killed by the σ2\sigma^2 factor, so rescaling Lm,σ\mathcal L_{m,\sigma} by 2σ2-2\sigma^2 yields

2σ2Lm,σ(θ)    EXpdataEY1:mqθm[minjXYj2]=LIMLE(θ),-2\sigma^2\,\mathcal L_{m,\sigma}(\theta) \;\longrightarrow\; \mathbb E_{X\sim p_{\mathrm{data}}} \mathbb E_{Y_{1:m}\sim q_\theta^m} \left[ \min_j \|X-Y_j\|^2 \right] = \mathcal L_{\mathrm{IMLE}}(\theta),

which is exactly the population IMLE objective of Section 1. This last step exchanges the limit with the expectation, which is not automatic: assuming pdatap_{\mathrm{data}} and qθq_\theta have finite second moments, and under suitable uniform-integrability conditions, the limit may be passed through the expectation. Bounded GθG_\theta, or a compact parameter set with uniformly bounded second moments, is enough in practice.

Replacing pdatap_{\mathrm{data}} by the empirical distribution of x1,,xnx_1,\ldots,x_n gives L^IMLE(θ)\widehat{\mathcal L}_{\mathrm{IMLE}}(\theta),

EY1:mqθm[1ni=1nminjxiYj2].\mathbb E_{Y_{1:m}\sim q_\theta^m} \left[ \frac1n \sum_{i=1}^n \min_j \|x_i-Y_j\|^2 \right].

Note that the rescaling factor 2σ2-2\sigma^2 is negative, which is what reconciles the two directions of optimisation. Therefore, at the objective-function level, IMLE is the small-noise limit of the rescaled finite-sample spread likelihood. Each training example is matched to its nearest generated sample, and the generator is trained to reduce those distances.

6. The Connection

The relationship can be summarized as

Spread MLEfinite Monte Carlo Gaussian mixturesmall-noise hard assignmentIMLE.\boxed{ \text{Spread MLE} \rightarrow \text{finite Monte Carlo Gaussian mixture} \rightarrow \text{small-noise hard assignment} \rightarrow \text{IMLE}. }

More explicitly, working throughout with the 2σ2-2\sigma^2 rescaling of the previous section,

2σ2logEYqθexp(X+σϵY22σ2)2σ2log1mj=1mexp(X+σϵYj22σ2)σ0minjXYj2.\begin{aligned} & -2\sigma^2 \log \mathbb E_{Y\sim q_\theta} \exp\left( -\frac{\|X+\sigma\epsilon-Y\|^2}{2\sigma^2} \right) \\ &\quad\approx -2\sigma^2 \log \frac1m \sum_{j=1}^m \exp\left( -\frac{\|X+\sigma\epsilon-Y_j\|^2}{2\sigma^2} \right) \\ &\quad\xrightarrow[\sigma\to0]{} \min_j \|X-Y_j\|^2 . \end{aligned}

The first step is a finite Monte Carlo approximation. The second is an exact pointwise limit; passing the limit through the expectation requires standard integrability conditions. The 1m\frac1m inside the logarithm contributes 2σ2logm2\sigma^2\log m, which vanishes as σ0\sigma\to0 and so leaves no trace in the limit.

7. What Is Lost Along the Way?

The connection is useful, but it is not an exact equivalence.

First, the finite-sample objective is a lower bound on spread likelihood, rather than the exact likelihood itself. For fixed mm, it generally has a Jensen gap:

E[logq^θ,σ,m(x)]logqθ,σ(x).\mathbb E \left[ \log \widehat q_{\theta,\sigma,m}(x) \right] \le \log q_{\theta,\sigma}(x).

Second, the small-noise limit replaces the full Gaussian mixture with only its nearest component. All soft responsibilities are discarded.

Spread MLE therefore remains a probabilistically well-defined likelihood method, while IMLE is its finite-sample, hard-assignment limit.

This perspective explains several otherwise surprising features of IMLE:

  • Generated samples act as mixture centers.
  • Squared Euclidean distance appears naturally under Gaussian spreading.
  • Each data point selects its nearest generated sample.
  • An expectation over random generated sample sets is required.
  • The resulting objective encourages mode coverage.

The cleanest interpretation is:

IMLE can be viewed as the zero-noise hard-assignment limit of a finite-sample approximation to spread maximum likelihood.

References