<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://mihailoradovic.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://mihailoradovic.com/" rel="alternate" type="text/html" /><updated>2026-09-27T23:22:32+02:00</updated><id>https://mihailoradovic.com/feed.xml</id><title type="html">Mihailo Radović</title><subtitle>MSc student in Applied Mathematics at the University of Belgrade working on generative models, flow matching, robot learning, reinforcement learning and world models. Research, projects and blog.</subtitle><author><name>Mihailo Radović</name></author><entry><title type="html">Learnings on f-divergences</title><link href="https://mihailoradovic.com/blog/2026/09/25/f-divergences/" rel="alternate" type="text/html" title="Learnings on f-divergences" /><published>2026-09-25T00:00:00+02:00</published><updated>2026-09-25T00:00:00+02:00</updated><id>https://mihailoradovic.com/blog/2026/09/25/f-divergences</id><content type="html" xml:base="https://mihailoradovic.com/blog/2026/09/25/f-divergences/"><![CDATA[<p>For a long time, I’ve struggled with forgetting what I learn. I used to take notes on everything, but I rarely opened
them again: they were poorly structured, and half the time I couldn’t remember where I’d put them. I also wanted to
share them with people who might find them useful. That’s how I came up with the idea to start a blog.</p>

<p>A month ago, I finished a seminar paper for the Mathematical Statistics course in my master’s program at the University
of Belgrade, School of Electrical Engineering, titled <em>\(f\)-divergences: hypothesis testing, inequalities and statistical
estimation</em>. This post is where I write down what I learned while researching and writing it, so that I don’t forget it,
and so that others can get something out of it too. The paper itself is in Serbian, which is one more reason I couldn’t
just share it as is. So this isn’t a translation but a retelling: shorter, less formal, and focused on what these ideas
mean for machine learning. A few parts, especially the practical ones in Sections <a href="#section-6">6</a> and <a href="#section-7">7</a>,
weren’t in the paper at all.</p>

<p>I picked the topic for a selfish reason. I work with flow matching <a href="#ref-1">[1]</a>, and the generative modeling
literature is full of divergences. Maximum likelihood “minimizes KL” <a href="#ref-2">[2]</a>. The OG GAN “minimizes
Jensen–Shannon” <a href="#ref-3">[3]</a>. Wasserstein GANs exist because the other divergences “saturate”
<a href="#ref-4">[4]</a>, <a href="#ref-5">[5]</a>. RLHF adds a “KL penalty” <a href="#ref-6">[6]</a>, <a href="#ref-7">[7]</a>. Flow
matching talks about “optimal transport paths” <a href="#ref-1">[1]</a>, <a href="#ref-8">[8]</a>. I could follow these sentences, but
I didn’t really understand why these particular quantities show up, what they have in common, and where each of them
breaks. Writing the paper was my way of strengthening that part of my mathematical foundation.</p>

<p>If you remember one thing from this post, make it this: <strong>an \(f\)-divergence looks at the likelihood ratio
\(p(x)/q(x)\) at every point and averages a convex penalty of it.</strong> Almost everything below follows from that one
sentence: the nice properties, the connection to classifiers, Fisher information, the KL estimators used in RLHF, and
the failure that motivates Wasserstein distances.</p>

<p>I won’t prove everything. Where a proof is short or teaches something, I sketch it; otherwise I state the result and
point to the references. The main reference throughout is the book by Polyanskiy and Wu <a href="#ref-9">[9]</a>.</p>

<nav class="toc">
  <p><strong>Contents</strong></p>

<ul id="markdown-toc">
  <li><a href="#section-1" id="markdown-toc-section-1">1. A test statistic that was secretly a divergence</a></li>
  <li><a href="#section-2" id="markdown-toc-section-2">2. \(f\)-divergences</a>    <ul>
      <li><a href="#section-2-1" id="markdown-toc-section-2-1">2.1 The definition</a></li>
      <li><a href="#section-2-2" id="markdown-toc-section-2-2">2.2 The usual suspects</a></li>
      <li><a href="#section-2-3" id="markdown-toc-section-2-3">2.3 Forward vs reverse KL</a></li>
      <li><a href="#section-2-4" id="markdown-toc-section-2-4">2.4 Data processing: you can’t create information</a></li>
      <li><a href="#section-2-5" id="markdown-toc-section-2-5">2.5 Joint convexity: mixing makes things harder to distinguish</a></li>
    </ul>
  </li>
  <li><a href="#section-3" id="markdown-toc-section-3">3. Divergences as limits on classification</a>    <ul>
      <li><a href="#section-3-1" id="markdown-toc-section-3-1">3.1 Total variation and the best possible test</a></li>
      <li><a href="#section-3-2" id="markdown-toc-section-3-2">3.2 Bayes risk</a></li>
    </ul>
  </li>
  <li><a href="#section-4" id="markdown-toc-section-4">4. Inequalities between divergences</a>    <ul>
      <li><a href="#section-4-1" id="markdown-toc-section-4-1">4.1 Pinsker’s inequality</a></li>
      <li><a href="#section-4-2" id="markdown-toc-section-4-2">4.2 Hellinger, TV and χ²</a></li>
      <li><a href="#section-4-3" id="markdown-toc-section-4-3">4.3 Le Cam’s two-point method: where 1/√n comes from</a></li>
    </ul>
  </li>
  <li><a href="#section-5" id="markdown-toc-section-5">5. Zooming in: local behavior and Fisher information</a>    <ul>
      <li><a href="#section-5-1" id="markdown-toc-section-5-1">5.1 Every smooth \(f\)-divergence is χ² up close</a></li>
      <li><a href="#section-5-2" id="markdown-toc-section-5-2">5.2 Fisher information</a></li>
      <li><a href="#section-5-3" id="markdown-toc-section-5-3">5.3 What this means for ML</a></li>
    </ul>
  </li>
  <li><a href="#section-6" id="markdown-toc-section-6">6. Estimating divergences from samples</a>    <ul>
      <li><a href="#section-6-1" id="markdown-toc-section-6-1">6.1 Why plug-in estimates are bad</a></li>
      <li><a href="#section-6-2" id="markdown-toc-section-6-2">6.2 The variational representation</a></li>
      <li><a href="#section-6-3" id="markdown-toc-section-6-3">6.3 Every classifier is a density ratio estimator</a></li>
      <li><a href="#section-6-4" id="markdown-toc-section-6-4">6.4 Mutual information</a></li>
      <li><a href="#section-6-5" id="markdown-toc-section-6-5">6.5 Estimating the KL penalty in RLHF</a></li>
    </ul>
  </li>
  <li><a href="#section-7" id="markdown-toc-section-7">7. Where \(f\)-divergences break: Wasserstein distance</a>    <ul>
      <li><a href="#section-7-1" id="markdown-toc-section-7-1">7.1 Moving mass: Wasserstein distance</a></li>
      <li><a href="#section-7-2" id="markdown-toc-section-7-2">7.2 Kantorovich duality</a></li>
      <li><a href="#section-7-3" id="markdown-toc-section-7-3">7.3 One dimension: sort and match</a></li>
      <li><a href="#section-7-4" id="markdown-toc-section-7-4">7.4 Why this matters for flow matching</a></li>
    </ul>
  </li>
  <li><a href="#section-8" id="markdown-toc-section-8">8. Conclusion</a></li>
  <li><a href="#references" id="markdown-toc-references">References</a></li>
</ul>

</nav>

<h2 id="section-1">1. A test statistic that was secretly a divergence</h2>

<p>Comparing two probability distributions is one of the basic problems in statistics. We need some number that says how
much a distribution \(P\) differs from a distribution \(Q\). Formally, a <strong>divergence</strong> is any map that assigns such a number
\(D(P\|Q) \ge 0\) to every pair of distributions, with \(D(P\|Q) = 0\) if and only if \(P = Q\) <a href="#ref-9">[9]</a>.
Unlike a distance, a divergence doesn’t have to be symmetric or satisfy the triangle inequality.</p>

<p>Historically, the classic divergences weren’t derived from one general definition. Each was invented separately, for
its own problem: Pearson’s statistic for testing discrete distributions, the Kolmogorov–Smirnov and Cramér–von Mises
statistics for continuous ones, and the Kullback–Leibler divergence in information theory. Only in the 1960s did
Csiszár <a href="#ref-10">[10]</a> and, independently, Ali and Silvey <a href="#ref-11">[11]</a> notice that most of them are special
cases of one construction.</p>

<p>The nicest way I found into the topic is the classic <strong>goodness-of-fit</strong> problem. Given a sample \(X_1, \dots, X_n\), we
want to test whether it comes from a hypothesized distribution \(F_0\). The natural estimate of the unknown CDF is the
<strong>empirical CDF</strong></p>

<div class="math-display">\[
F_n(x) = \frac{\#\{i : X_i \le x\}}{n},
\]</div>

<p>and the Glivenko–Cantelli theorem says that \(F_n\) converges to the true CDF uniformly, almost surely:
\(\sup_x |F_n(x) - F(x)| \to 0\) <a href="#ref-12">[12]</a>. You can see this in <a href="#fig-1">Figure 1</a>. So \(F_n\) is a legitimate
estimate of the distribution, and the gap between \(F_n\) and \(F_0\) can be read as an estimate of a <em>distance between
distributions</em>, not just random noise. The question is how to measure that gap.</p>

<figure id="fig-1">
  <img src="/images/f-divergences/empirical_cdf.png" alt="Empirical CDF of samples of size 10 and 100 compared to the normal CDF" />
  <figcaption><strong>Figure 1.</strong> The empirical CDF \(F_n\) of a sample from \(N(0,1)\) approaches the true CDF \(F_0\)
  as the sample grows (Glivenko–Cantelli).</figcaption>
</figure>

<p>The oldest answer is Pearson’s \(\chi^2\) test. Split the real line into \(r\) bins \(A_1, \dots, A_r\), let \(p_{j0}\) be the
probability of bin \(j\) under \(F_0\), and let \(N_j\) be the number of sample points that fall into it. Pearson’s
statistic is <a href="#ref-12">[12]</a></p>

<div class="math-display">\[
\chi^2 = \sum_{j=1}^r \frac{(N_j - n p_{j0})^2}{n p_{j0}}.
\]</div>

<p>Now define the <strong>\(\chi^2\)-divergence</strong> between two discrete distributions \(p\) and \(q\) as
\(\chi^2(p\|q) = \sum_j (p_j - q_j)^2 / q_j\). Substituting the empirical frequencies \(\hat p_j = N_j / n\) gives</p>

<div class="math-display">\[
\chi^2 = n \sum_{j=1}^r \frac{(\hat p_j - p_{j0})^2}{p_{j0}} = n\,\chi^2(\hat p\,\|\,p_0).
\]</div>

<p>So, a statistic we had only ever used as a recipe is exactly \(n\) times a divergence between the empirical distribution
and the hypothesized one.</p>

<p>This is also how the test works. If the sample really does come from \(F_0\) (the null hypothesis), then for large \(n\)
the statistic behaves like a random variable with the \(\chi^2\) distribution with \(r - 1\) degrees of freedom. It’s one
less than the number of bins because the counts must add up to \(n\), so only \(r - 1\) of them can vary freely. You
compute the statistic, compare it with, say, the 95th percentile of the \(\chi^2(r-1)\) distribution, and reject \(F_0\) if
it’s larger: a divergence that big would be unlikely if \(F_0\) were true.</p>

<p>The Kolmogorov–Smirnov statistic \(\sqrt{n}\,\sup_x |F_n(x) - F_0(x)|\) and the Cramér–von Mises statistic
\(n \int (F_n - F_0)^2\, dF_0\) compare <em>CDFs</em>, not densities or probabilities at individual points. As we’ll see, that
means they are <em>not</em> \(f\)-divergences. Keep them in mind; they come back in <a href="#section-7-3">Section 7.3</a>.</p>

<h2 id="section-2">2. \(f\)-divergences</h2>

<h3 id="section-2-1">2.1 The definition</h3>

<p>Let \(f : (0, \infty) \to \mathbb{R}\) be a convex function with \(f(1) = 0\). The <strong>\(f\)-divergence</strong> of \(P\) from \(Q\) is
<a href="#ref-9">[9]</a></p>

<div class="math-display">\[
D_f(P\|Q) = \mathbb{E}_{X \sim Q}\left[ f\!\left( \frac{p(X)}{q(X)} \right) \right] = \int q(x)\, f\!\left( \frac{p(x)}{q(x)} \right) dx,
\]</div>

<p>with a sum instead of the integral for discrete distributions. In full generality, \(p/q\) is replaced by the
Radon–Nikodym derivative \(dP/dQ\), which also covers distributions without densities, but the intuition is the same.</p>

<p>The quantity \(r(x) = p(x)/q(x)\) is the <strong>likelihood ratio</strong>: how many times more likely the point \(x\) is under \(P\)
than under \(Q\). If the distributions agree, \(r \equiv 1\). The condition \(f(1) = 0\) says “no penalty where the
distributions agree”, and convexity says that large deviations of \(r\) from \(1\) cost disproportionately more. The
divergence is the average penalty, weighted by \(Q\).</p>

<p>Why is this always nonnegative? It’s a one-line application of Jensen’s inequality, and it’s the whole reason the
definition works. Since \(\mathbb{E}_Q[r(X)] = \int p = 1\),</p>

<div class="math-display">\[
D_f(P\|Q) = \mathbb{E}_Q[f(r)] \ge f(\mathbb{E}_Q[r]) = f(1) = 0.
\]</div>

<p>If \(f\) is strictly convex at \(1\), equality forces \(r\) to be constant, hence \(r \equiv 1\) and \(P = Q\) <a href="#ref-9">[9]</a>.</p>

<p>Two details that will matter later:</p>

<ul>
  <li><strong>\(f\) is not unique.</strong> Adding \(c(t-1)\) to \(f\) doesn’t change the divergence, because \(\mathbb{E}_Q[r - 1] = 0\). This
looks like a technicality, but in <a href="#section-6-5-3">Section 6.5.3</a> it turns out to be exactly the trick behind the best KL
estimator used in RLHF.</li>
  <li>
    <p><strong>What if \(q(x) = 0\) but \(p(x) &gt; 0\)?</strong> Then the ratio \(p/q\) is infinite, and the term \(q\, f(p/q)\) has the form
\(0 \cdot \infty\). The natural value is its limit as \(q\) shrinks to zero. Writing \(t = p/q\), so that \(q = p/t\),</p>

    <div class="math-display">\[
  q\, f\!\left(\frac{p}{q}\right) = p\, \frac{f(t)}{t} \;\longrightarrow\; p \cdot \lim_{t \to \infty} \frac{f(t)}{t} \qquad (q \to 0,\ t \to \infty).
  \]</div>

    <p>So everything depends on how fast \(f\) grows. For KL, \(f(t)/t = \log t \to \infty\), and for \(\chi^2\),
\(f(t)/t \approx t \to \infty\): if \(P\) puts any mass where \(Q\) has none, the divergence is infinite. For total
variation, Hellinger and Jensen–Shannon, \(f\) grows at most linearly, so \(f(t)/t\) levels off at a finite value
(\(\tfrac12\), \(1\) and \(\log 2\)) and the divergence stays finite. The right panel of <a href="#fig-2">Figure 2</a> shows exactly
this.</p>
  </li>
</ul>

<h3 id="section-2-2">2.2 The usual suspects</h3>

<p>Different choices of \(f\) give the classic divergences:</p>

<table>
  <thead>
    <tr>
      <th>Divergence</th>
      <th>\(f(t)\)</th>
      <th>Symmetric</th>
      <th>Range</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Kullback–Leibler \(\mathrm{KL}(P\|Q)\)</td>
      <td>\(t \log t\)</td>
      <td>no</td>
      <td>\([0, +\infty]\)</td>
    </tr>
    <tr>
      <td>\(\chi^2\)-divergence \(\chi^2(P\|Q)\)</td>
      <td>\((t-1)^2\)</td>
      <td>no</td>
      <td>\([0, +\infty]\)</td>
    </tr>
    <tr>
      <td>Total variation \(\mathrm{TV}(P,Q)\)</td>
      <td>\(\tfrac12 \lvert t-1 \rvert\)</td>
      <td>yes</td>
      <td>\([0, 1]\)</td>
    </tr>
    <tr>
      <td>Squared Hellinger \(H^2(P,Q)\)</td>
      <td>\((1-\sqrt t)^2\)</td>
      <td>yes</td>
      <td>\([0, 2]\)</td>
    </tr>
    <tr>
      <td>Jensen–Shannon \(\mathrm{JS}(P,Q)\)</td>
      <td>\(t\log\frac{2t}{t+1} + \log\frac{2}{t+1}\)</td>
      <td>yes</td>
      <td>\([0, 2\log 2]\)</td>
    </tr>
  </tbody>
</table>

<p><a href="#fig-2">Figure 2</a> plots these generators. They’re all convex and all pass through \((1, 0)\); what tells them apart is
how fast they grow, which decides whether the divergence can be infinite.</p>

<figure id="fig-2">
  <img src="/images/f-divergences/generators.png" alt="Generator functions of the classic f-divergences and their growth at infinity" />
  <figcaption><strong>Figure 2.</strong> Left: the generators are all convex and pass through \((1, 0)\). Right: \(f(t)/t\)
  for large \(t\). When it has a finite limit (TV, \(H^2\), JS), the divergence can never be infinite.</figcaption>
</figure>

<p>Here’s what each one measures. In every case, the formula comes from plugging that row’s \(f\) into the definition
\(D_f(P\|Q) = \int q\, f(p/q)\).</p>

<h4 id="section-2-2-1">2.2.1 KL divergence</h4>

<p>With \(f(t) = t \log t\), the \(q\) cancels:</p>

<div class="math-display">\[
\mathrm{KL}(P\|Q) = \int q\, \frac{p}{q} \log\frac{p}{q} = \int p \log\frac{p}{q} = \mathbb{E}_{X\sim P}\left[\log\frac{p(X)}{q(X)}\right].
\]</div>

<p>It’s the average log-likelihood ratio when the data really comes from \(P\): how surprised, on average, you’d be by samples
from \(P\) if you believed they came from \(Q\). In information theory, it’s the expected number of extra bits (or nats, with
the natural log) you waste by encoding samples from \(P\) with a code designed for \(Q\). Note that the average is taken
under \(P\), so KL mostly cares about the places where \(P\) has mass. This makes it strongly asymmetric: if \(Q\) gives zero
probability to something \(P\) can produce, \(\mathrm{KL}(P\|Q) = \infty\), while \(\mathrm{KL}(Q\|P)\) can still be finite.
<a href="#section-2-3">Section 2.3</a> shows why this matters so much in ML.</p>

<h4 id="section-2-2-2">2.2.2 χ²-divergence</h4>

<p>With \(f(t) = (t-1)^2\),</p>

<div class="math-display">\[
\chi^2(P\|Q) = \int q \left(\frac{p}{q} - 1\right)^2 = \int \frac{(p - q)^2}{q} = \mathrm{Var}_{X\sim Q}\left[\frac{p(X)}{q(X)}\right],
\]</div>

<p>where the last step uses \(\mathbb{E}_Q[p/q] = 1\). So \(\chi^2\) is simply the variance of the likelihood ratio. This is
Pearson’s divergence from <a href="#section-1">Section 1</a>, and in ML it shows up whenever you reweight samples: if you estimate an
expectation under \(P\) using \(n\) samples from \(Q\) and importance weights \(p/q\) (as in off-policy RL), your effective
sample size is roughly \(n / (1 + \chi^2(P\|Q))\). Because of the division by \(q\), it’s extremely sensitive to places where
\(Q\) has little mass. In <a href="#section-5">Section 5</a> it will turn out to describe the <em>local</em> behavior of every smooth
\(f\)-divergence.</p>

<h4 id="section-2-2-3">2.2.3 Total variation</h4>

<p>With \(f(t) = \tfrac12 |t - 1|\),</p>

<div class="math-display">\[
\mathrm{TV}(P, Q) = \frac12 \int q \left| \frac{p}{q} - 1 \right| = \frac12 \int |p - q|,
\]</div>

<p>which is half the area between the two densities (left panel of <a href="#fig-3">Figure 3</a>). Equivalently, it’s the largest
amount by which the two distributions can disagree about the probability of any single event, \(\sup_A |P(A) - Q(A)|\),
attained by the event \(A = \{x : p(x) &gt; q(x)\}\). It’s always between \(0\) and \(1\), it equals \(1\) exactly when the two
distributions don’t overlap at all, and it’s symmetric and satisfies the triangle inequality, so it’s a true distance.
Some texts drop the \(\tfrac12\) and use \(f(t) = |t - 1|\), which gives \(\int |p - q|\) with values in \([0, 2]\); this post
keeps the \(\tfrac12\) throughout, following <a href="#ref-9">[9]</a>. <a href="#section-3">Section 3</a> shows it measures exactly how well the best possible classifier can tell \(P\) and \(Q\) apart.</p>

<figure id="fig-3">
  <img src="/images/f-divergences/tv_area.png" alt="Total variation as the area between two densities, and divergence growth as two Gaussians separate" />
  <figcaption><strong>Figure 3.</strong> Left: total variation is half the area between the densities, the complement of
  their overlap. Right: as two Gaussians move apart, TV and \(H^2\) saturate at \(1\) and \(2\), while KL and \(\chi^2\) grow
  without bound.</figcaption>
</figure>

<h4 id="section-2-2-4">2.2.4 Squared Hellinger distance</h4>

<p>With \(f(t) = (1 - \sqrt t)^2\),</p>

<div class="math-display">\[
H^2(P, Q) = \int q \left(1 - \sqrt{\frac{p}{q}}\right)^2 = \int \big(\sqrt p - \sqrt q\big)^2 = 2 - 2\int \sqrt{pq}.
\]</div>

<p>So it’s the squared Euclidean distance between the <em>square roots</em> of the densities. The integral \(\int \sqrt{pq}\),
called the Bhattacharyya coefficient, measures overlap: it’s \(1\) when the distributions are identical and \(0\) when they
don’t overlap, so \(H^2\) lies between \(0\) and \(2\) (right panel of <a href="#fig-3">Figure 3</a>). Its practical superpower is
independence: for \(n\) i.i.d. samples, the overlap simply multiplies, \(\int \sqrt{p^n q^n} = \left(\int \sqrt{pq}\right)^n\).
That gives an exact formula for the Hellinger distance between the distributions of \(n\) samples, which is why it’s a
standard tool in asymptotic statistics. (Total variation, by contrast, has no such formula.)</p>

<h4 id="section-2-2-5">2.2.5 Jensen–Shannon divergence</h4>

<p>The generator in the table looks scary, but it’s equivalent to a much friendlier form: compare both distributions to
their average \(M = \tfrac12 (P + Q)\),</p>

<div class="math-display">\[
\mathrm{JS}(P, Q) = \mathrm{KL}(P\|M) + \mathrm{KL}(Q\|M).
\]</div>

<p>It’s symmetric by construction, and it’s always finite. Since \(m = \tfrac12 (p + q) \ge \tfrac12 p\), the ratio \(p/m\) is
never larger than \(2\), so each KL term is at most \(\log 2\). It’s also the divergence behind the original GAN: with the
optimal discriminator, the generator minimizes \(-\log 4 + \mathrm{JS}(P_{\text{data}}, P_G)\) <a href="#ref-3">[3]</a>.
(Many ML papers put a factor of \(\tfrac12\) in front, which changes the range to \([0, \log 2]\). I’m following the
convention from my seminar paper.)</p>

<h3 id="section-2-3">2.3 Forward vs reverse KL</h3>

<p>The asymmetry of KL matters a lot in machine learning, so it’s worth a short detour. Take a model \(P_\theta\) with
density \(p_\theta\), and data from a distribution \(P_{\text{data}}\) with density \(p_{\text{data}}\). Maximum likelihood
training maximizes the average log-likelihood of the dataset, \(\frac1N \sum_{i=1}^N \log p_\theta(x_i)\), which by the
law of large numbers estimates \(\mathbb{E}_{x \sim P_{\text{data}}}[\log p_\theta(x)]\). The trick for seeing what this
expectation measures is to add and subtract \(\log p_{\text{data}}(x)\) inside it:</p>

<div class="math-display">\[
\begin{aligned}
\mathbb{E}_{x \sim P_{\text{data}}}[\log p_\theta(x)]
&amp;= \mathbb{E}_{x \sim P_{\text{data}}}\left[\log p_{\text{data}}(x) - \log\frac{p_{\text{data}}(x)}{p_\theta(x)}\right] \\
&amp;= \underbrace{\mathbb{E}_{x \sim P_{\text{data}}}[\log p_{\text{data}}(x)]}_{-H(P_{\text{data}})}
 \;-\; \underbrace{\mathbb{E}_{x \sim P_{\text{data}}}\left[\log\frac{p_{\text{data}}(x)}{p_\theta(x)}\right]}_{\mathrm{KL}(P_{\text{data}}\,\|\,P_\theta)} .
\end{aligned}
\]</div>

<p>The first term is minus the entropy of the data, \(H(P) = -\mathbb{E}_{X\sim P}[\log p(X)]\), and the second is exactly the
KL formula from <a href="#section-2-2-1">Section 2.2.1</a>. The entropy depends only on the data, not on \(\theta\). So <strong>maximum
likelihood is exactly minimizing the forward KL</strong> \(\mathrm{KL}(P_{\text{data}}\|P_\theta)\). The same identity, read with
a minus sign, says that the cross-entropy loss we minimize when training classifiers and language models is
\(H(P_{\text{data}}) + \mathrm{KL}(P_{\text{data}}\|P_\theta)\): an irreducible part set by the data, plus a KL part that
training can shrink. Since KL is never negative, no model can get its loss below the entropy of the data.</p>

<p>Now look at which mistakes the forward KL punishes. Its integrand \(p_{\text{data}} \log(p_{\text{data}}/p_\theta)\)
explodes wherever the data has mass and the model doesn’t, so the model is forced to cover every mode of the data, even
if that means putting mass in between them. This is called <em>mode-covering</em>. The reverse KL,
\(\mathrm{KL}(P_\theta\|P_{\text{data}}) = \mathbb{E}_{x\sim P_\theta}[\log(p_\theta/p_{\text{data}})]\), punishes the
opposite mistake: putting model mass where the data has none. The cheapest solution is often to sit inside a single
mode and ignore the rest, which is called <em>mode-seeking</em>. Variational inference and KL-regularized reinforcement learning
use this direction. The classic illustration is in Bishop’s book <a href="#ref-2">[2]</a>; <a href="#fig-4">Figure 4</a> is my version.</p>

<figure id="fig-4">
  <img src="/images/f-divergences/forward_reverse_kl.png" alt="A single Gaussian fitted to a two-mode distribution with forward and reverse KL" />
  <figcaption><strong>Figure 4.</strong> The best single Gaussian under forward KL matches the mean and variance of the
  target and covers both modes. Under reverse KL, it locks onto one mode.</figcaption>
</figure>

<p>This trade-off only bites when the model can’t represent the data exactly, like the single Gaussian in
<a href="#fig-4">Figure 4</a>; with enough capacity, both directions have the same answer, \(P_\theta = P_{\text{data}}\). Sander
Dieleman has a great practitioner’s take on it in
<a href="https://sander.ai/2020/03/24/audio-generation.html#mode-covering-vs-mode-seeking-behaviour">his post on audio generation</a>
<a href="#ref-13">[13]</a>. Likelihood-based models tend to be mode-covering, adversarial models tend to be mode-seeking, and
which one you want depends on the task. Mode-covering buys diversity when the conditioning leaves a lot open, and
mode-seeking buys realism when the conditioning already pins down most of the output, as in text-to-speech.</p>

<h3 id="section-2-4">2.4 Data processing: you can’t create information</h3>

<p>The most important property of \(f\)-divergences, alongside nonnegativity, is the <strong>data processing inequality</strong> (DPI).
Take any “channel” \(P_{Y|X}\) that turns an input \(X\) into an output \(Y\). This could be a deterministic function, a noisy
measurement, or a neural network encoder. If we feed it inputs from \(P_X\) and from \(Q_X\), we get outputs from \(P_Y\) and
\(Q_Y\), and <a href="#ref-9">[9]</a></p>

<div class="math-display">\[
D_f(P_Y\|Q_Y) \le D_f(P_X\|Q_X).
\]</div>

<p>No processing can make two distributions easier to tell apart. The proof is Jensen again: the likelihood ratio of the
outputs is a conditional expectation of the likelihood ratio of the inputs, and conditional expectation can only reduce
the average of a convex function.</p>

<p>For machine learning, this means an encoder can throw information away, but it can never create it. For example, if
you compare real and generated images through some feature extractor, any \(f\)-divergence between the feature
distributions is at most the divergence between the images themselves.</p>

<p>A special case gets used over and over. Processing \(X\) into the indicator \(\mathbf{1}\{X \in A\}\) turns both
distributions into Bernoulli distributions, so</p>

<div class="math-display">\[
D_f\big(\mathrm{Ber}(P(A))\,\|\,\mathrm{Ber}(Q(A))\big) \le D_f(P\|Q)
\]</div>

<p>for every event \(A\). A question about two whole distributions becomes a question about two numbers. This is the key
step behind Pinsker’s inequality in <a href="#section-4-1">Section 4.1</a>.</p>

<h3 id="section-2-5">2.5 Joint convexity: mixing makes things harder to distinguish</h3>

<p>\(D_f(P\|Q)\) is convex in the pair \((P, Q)\) jointly <a href="#ref-9">[9]</a>:</p>

<div class="math-display">\[
D_f\big(\lambda P_1 + (1-\lambda) P_0 \,\big\|\, \lambda Q_1 + (1-\lambda) Q_0\big) \le \lambda D_f(P_1\|Q_1) + (1-\lambda) D_f(P_0\|Q_0).
\]</div>

<p>My favorite proof uses the DPI. Let a coin \(X \sim \mathrm{Ber}(\lambda)\) pick which pair we draw from, and let
\(Y \sim P_X\) or \(Y \sim Q_X\). The divergence between the joint distributions of \((X, Y)\) is exactly the weighted average
on the right, and forgetting \(X\) is a form of processing that turns them into the mixtures on the left. Intuitively,
mixing hides which component a sample came from, so the mixtures are harder to tell apart.</p>

<p>The convexity is never strict, though. For example, \(\mathrm{TV}(\mathrm{Ber}(p), \mathrm{Ber}(q)) = |p - q|\) is
piecewise linear. And convexity in each argument separately is the reason naive estimators of divergences are biased,
which we’ll get to in <a href="#section-6-1">Section 6.1</a>.</p>

<h2 id="section-3">3. Divergences as limits on classification</h2>

<p>So far, divergences have been formal definitions. This section is the one that made them feel <em>real</em> to me: they
measure exactly how well two hypotheses can be told apart from data.</p>

<h3 id="section-3-1">3.1 Total variation and the best possible test</h3>

<p>Suppose we observe \(X\) and know it comes from one of two known distributions, \(H_0 : X \sim P\) or \(H_1 : X \sim Q\). A test
\(\varphi(x) \in \{0, 1\}\) decides which one. It can make two kinds of error: \(\alpha = P[\varphi(X) = 1]\) (rejecting a
true \(H_0\)) and \(\beta = Q[\varphi(X) = 0]\) (accepting a false \(H_0\)). The Neyman–Pearson lemma says that optimal tests
only ever look at the data through the likelihood ratio \(p(x)/q(x)\), thresholding it <a href="#ref-14">[14]</a>.</p>

<p>What’s the smallest possible \(\alpha + \beta\)? Write</p>

<div class="math-display">\[
\alpha + \beta = \int_{\{\varphi = 1\}} p + \int_{\{\varphi = 0\}} q = 1 + \int_{\{\varphi=1\}} (p - q).
\]</div>

<p>The last integral is smallest if we reject exactly where it’s negative, i.e., where \(q(x) &gt; p(x)\). Plugging that in:</p>

<div class="math-display">\[
\min_\varphi \{\alpha + \beta\} = 1 - \int_{\{q &gt; p\}} (q - p) = 1 - \mathrm{TV}(P, Q),
\]</div>

<p>where the last step uses the fact that \(p - q\) integrates to zero, so its positive and negative parts each carry half of
\(\int |p - q|\) <a href="#ref-9">[9]</a>.</p>

<p><strong>Total variation measures exactly how much better than a coin flip the best possible test is.</strong> If \(\mathrm{TV} = 0\),
the best you can do is guess; if \(\mathrm{TV} = 1\), you never make a mistake. In classifier language, the best achievable
balanced accuracy for telling samples of \(P\) from samples of \(Q\) is \(\tfrac12 (1 + \mathrm{TV}(P, Q))\). The DPI for TV
becomes obvious from this angle too: if processing the data could help, the optimal test on the raw data wouldn’t have
been optimal.</p>

<h3 id="section-3-2">3.2 Bayes risk</h3>

<p>The sum \(\alpha + \beta\) implicitly assumes both hypotheses are equally likely and both errors are equally costly. With
prior probabilities \(\pi_0\) and \(\pi_1 = 1 - \pi_0\), the smallest weighted error is the <strong>Bayes risk</strong> <a href="#ref-14">[14]</a></p>

<div class="math-display">\[
R_\pi(P, Q) = \min_\varphi \big\{ \pi_0 \alpha + \pi_1 \beta \big\} = \int \min\{\pi_0 p(x),\, \pi_1 q(x)\}\, dx,
\]</div>

<p>the area under the lower of the two weighted densities (left panel of <a href="#fig-5">Figure 5</a>). Pulling \(q(x)\) out of the
minimum gives \(\int q\, f_\pi(p/q)\) with \(f_\pi(t) = \min\{\pi_0 t, \pi_1\}\). That function is concave, not convex, and
\(f_\pi(1) \neq 0\), but \(h_\pi(t) = f_\pi(1) - f_\pi(t)\) fixes both problems (right panel of <a href="#fig-5">Figure 5</a>). So
\(D_{h_\pi}(P\|Q) = f_\pi(1) - R_\pi(P, Q)\): <strong>every Bayes risk is an \(f\)-divergence</strong>, up to a sign and a constant.</p>

<figure id="fig-5">
  <img src="/images/f-divergences/bayes_risk.png" alt="Bayes risk as the area under the smaller of two weighted densities, and the matching generator function" />
  <figcaption><strong>Figure 5.</strong> Left: the Bayes risk is the area under the lower of the two weighted densities;
  the optimal threshold is where they cross. Right: the concave \(f_\pi\) and the convex generator \(h_\pi\) with
  \(h_\pi(1) = 0\).</figcaption>
</figure>

<p>The converse is the surprising part. Call the <em>statistical information</em> at a prior \(\pi\) the amount by which observing
\(X\) lowers the Bayes risk, compared with guessing from the prior alone. Every \(f\)-divergence can be written as an integral
of this statistical information over all priors, weighted by a nonnegative function determined by the second derivative
of \(f\) <a href="#ref-14">[14]</a>. So choosing \(f\) means choosing which trade-offs between the two kinds of error you care about.
Total variation puts all its weight on the balanced prior \(\pi_0 = \pi_1\), while KL spreads it over all priors.</p>

<p>This is also why “train a classifier to tell real from fake samples” and “measure a divergence between distributions”
keep turning out to be the same thing in ML. We’ll make that precise in <a href="#section-6-3">Section 6.3</a>.</p>

<h2 id="section-4">4. Inequalities between divergences</h2>

<p>Why would anyone care how divergences relate to each other? Because one divergence is often easy to <em>compute</em> while
another is easy to <em>interpret</em>. KL adds up over independent samples and has closed forms for Gaussians; TV is an error
probability. Inequalities let you compute one and conclude something about the other.</p>

<p>The comparisons can’t be symmetric. TV and \(H^2\) are bounded, while KL and \(\chi^2\) can be infinite, so bounded
divergences can always be controlled by unbounded ones, but not the other way around without extra assumptions.</p>

<h3 id="section-4-1">4.1 Pinsker’s inequality</h3>

<p>The most famous one bounds total variation by KL <a href="#ref-15">[15]</a>:</p>

<div class="math-display">\[
\mathrm{TV}(P, Q) \le \sqrt{\tfrac12 \mathrm{KL}(P\|Q)},
\]</div>

<p>and the constant is the best possible. I like the proof because it combines two tools from Section 2: the DPI from
<a href="#section-2-4">Section 2.4</a> and the event form of TV from <a href="#section-2-2-3">Section 2.2.3</a>.</p>

<ol>
  <li><strong>Reduce to two points.</strong> For any event \(A\), the DPI with the indicator of \(A\) gives
\(\mathrm{KL}(P\|Q) \ge \mathrm{KL}(P(A)\,\|\,Q(A))\), where \(\mathrm{KL}(p\|q)\) is shorthand for the KL divergence
between \(\mathrm{Ber}(p)\) and \(\mathrm{Ber}(q)\). If the inequality holds for Bernoulli distributions, then
\(\sqrt{\mathrm{KL}(P\|Q)/2} \ge |P(A) - Q(A)|\) for every \(A\), and taking the supremum over \(A\) gives TV.</li>
  <li>
    <p><strong>Prove it for Bernoullis.</strong> Using Taylor’s formula with integral remainder, and \(t(1-t) \le \tfrac14\),</p>

    <div class="math-display">\[
   \mathrm{KL}(p\|q) = \int_q^p \frac{p - t}{t(1-t)}\, dt \ge 4 \int_q^p (p - t)\, dt = 2(p - q)^2.
   \]</div>

    <p>Since \(\mathrm{TV}(\mathrm{Ber}(p), \mathrm{Ber}(q)) = |p - q|\), we’re done <a href="#ref-9">[9]</a>.</p>
  </li>
</ol>

<p>In practice, Pinsker means <em>small KL implies small TV</em>, so convergence in KL, which is usually easier to prove, transfers
to TV, which has an operational meaning. It shows up in RL theory too: the monotonic improvement bound behind TRPO is
stated in terms of total variation and converted to KL with a Pinsker-type inequality <a href="#ref-16">[16]</a>.</p>

<p>The reverse direction fails in general. If \(P\) puts a little mass where \(q = 0\), TV is small but KL is infinite. On a
finite alphabet where \(Q\) gives every outcome probability at least \(Q_{\min}\), a short computation gives
\(\chi^2(P\|Q) \le 2\,\mathrm{TV}^2 / Q_{\min}\) and therefore</p>

<div class="math-display">\[
\mathrm{KL}(P\|Q) \le \log\big(1 + \chi^2(P\|Q)\big) \le \log\!\left(1 + \frac{2\,\mathrm{TV}(P,Q)^2}{Q_{\min}}\right).
\]</div>

<p>The constant blows up as \(Q_{\min} \to 0\), exactly as the counterexample predicts <a href="#ref-15">[15]</a>.</p>

<h3 id="section-4-2">4.2 Hellinger, TV and χ²</h3>

<p>For the bounded divergences, comparisons work in both directions <a href="#ref-9">[9]</a>:</p>

<div class="math-display">\[
\tfrac12 H^2(P,Q) \le \mathrm{TV}(P,Q) \le H(P,Q)\sqrt{1 - \tfrac14 H^2(P,Q)}.
\]</div>

<p>The proof is two lines. The left side follows by integrating</p>

<div class="math-display">\[
(\sqrt p - \sqrt q)^2 \le |\sqrt p - \sqrt q|\,(\sqrt p + \sqrt q) = |p - q| .
\]</div>

<p>For the right side, write \(|p - q| = |\sqrt p - \sqrt q| \cdot (\sqrt p + \sqrt q)\) and apply Cauchy–Schwarz, using
\(\int (\sqrt p + \sqrt q)^2 = 4 - H^2\).</p>

<p>So TV and Hellinger go to zero together and reach their maxima together, although not at the same speed. Combined with
the product rule for Hellinger from <a href="#section-2-2-4">Section 2.2.4</a>, this is why Hellinger is the standard tool for asking
whether two families of hypotheses can be told apart asymptotically.</p>

<p>Cauchy–Schwarz also gives \(\mathrm{TV} \le \tfrac12\sqrt{\chi^2}\), and together with \(H^2 \le \mathrm{KL} \le \log(1 + \chi^2) \le \chi^2\)
we get a hierarchy in which \(\chi^2\) controls everything else. A theorem by Harremoës and Vajda explains why reductions
to Bernoulli distributions keep giving the best constants: the boundary of the set of all achievable pairs
\((D_f(P\|Q), D_g(P\|Q))\) is always attained by distributions on just two points <a href="#ref-9">[9]</a>.</p>

<h3 id="section-4-3">4.3 Le Cam’s two-point method: where 1/√n comes from</h3>

<p>These inequalities are the workhorse behind lower bounds in estimation theory. Le Cam’s idea is to pick just two
parameter values \(\theta_0\) and \(\theta_1\) that are far apart, but whose data distributions are close. No estimator can
be accurate for both, because an accurate estimator would give a good test between them, and <a href="#section-3-1">Section 3.1</a>
limits how good any test can be <a href="#ref-9">[9]</a>.</p>

<p>For \(n\) i.i.d. samples, total variation between the product distributions is hard to compute, but KL simply adds up:
\(\mathrm{KL}(P^n\|Q^n) = n\,\mathrm{KL}(P\|Q)\). For the mean of a Gaussian, with \(\theta_1 - \theta_0 = 2\delta\), Pinsker gives</p>

<div class="math-display">\[
\mathrm{TV}(P_{\theta_0}^n, P_{\theta_1}^n) \le \sqrt{\tfrac{n}{2}\, \mathrm{KL}(P_{\theta_0}\|P_{\theta_1})} = \sqrt{\tfrac{n}{2} \cdot 2\delta^2} = \delta\sqrt n .
\]</div>

<p>So as long as \(\delta\) is much smaller than \(1/\sqrt n\) (written \(\delta \ll 1/\sqrt n\)), the total variation is close to
zero, and by <a href="#section-3-1">Section 3.1</a> no test can do much better than a coin flip: the two hypotheses are practically
indistinguishable. <a href="#fig-6">Figure 6</a> shows this for several sample sizes. That’s the information-theoretic reason why
estimation error in regular parametric models scales like \(1/\sqrt n\).</p>

<figure id="fig-6">
  <img src="/images/f-divergences/le_cam.png" alt="Two overlapping distributions for nearby parameters, and the error bound as a function of their distance" />
  <figcaption><strong>Figure 6.</strong> Left: two parameter values whose data distributions overlap heavily. Right: the
  lower bound \(1 - \mathrm{TV}\) on the total error, as a function of the gap \(\delta\), for different sample sizes. The
  dotted lines mark \(\delta \sim 1/\sqrt n\).</figcaption>
</figure>

<h2 id="section-5">5. Zooming in: local behavior and Fisher information</h2>

<p>In statistics and ML, we usually compare nearby members of a parametric family \(\{P_\theta\}\), not two arbitrary
distributions. What does \(D_f(P_t\|P_0)\) look like when \(t\) is small?</p>

<h3 id="section-5-1">5.1 Every smooth \(f\)-divergence is χ² up close</h3>

<p>Write the likelihood ratio as \(p_t / p_0 = 1 + \varepsilon_t\), where \(\varepsilon_t \to 0\), and expand \(f\) around \(1\):</p>

<div class="math-display">\[
f(1 + \varepsilon) = f&#39;(1)\,\varepsilon + \tfrac12 f&#39;&#39;(1)\,\varepsilon^2 + o(\varepsilon^2).
\]</div>

<p>The linear term integrates to zero, for the same reason adding \(c(t-1)\) to \(f\) changes nothing
(<a href="#section-2-1">Section 2.1</a>). What’s left is</p>

<div class="math-display">\[
D_f(P_t\|P_0) \approx \frac{f&#39;&#39;(1)}{2} \int \frac{(p_t - p_0)^2}{p_0} = \frac{f&#39;&#39;(1)}{2}\, \chi^2(P_t\|P_0).
\]</div>

<p><strong>Locally, every smooth \(f\)-divergence is \(\chi^2\) in disguise</strong>, and the choice of \(f\) only affects the constant
\(f&#39;&#39;(1)/2\) <a href="#ref-9">[9]</a>.</p>

<h3 id="section-5-2">5.2 Fisher information</h3>

<p>For a smooth family, \(\chi^2(P_t\|P_0)/t^2\) converges to</p>

<div class="math-display">\[
J_F = \int \frac{(\partial_t p_t)^2}{p_t} = \mathbb{E}\big[ (\partial_t \log p_t(X))^2 \big],
\]</div>

<p>the <strong>Fisher information</strong>. Putting it together, for a multi-parameter family,</p>

<div class="math-display">\[
D_f(P_{\theta + h}\|P_\theta) = \frac{f&#39;&#39;(1)}{2}\, h^\top J_F(\theta)\, h + o(\|h\|^2).
\]</div>

<table>
  <thead>
    <tr>
      <th>Divergence</th>
      <th>\(f&#39;&#39;(1)\)</th>
      <th>Local behavior</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>\(\chi^2\)</td>
      <td>\(2\)</td>
      <td>\(J_F\, t^2\)</td>
    </tr>
    <tr>
      <td>KL</td>
      <td>\(1\)</td>
      <td>\(\tfrac12 J_F\, t^2\)</td>
    </tr>
    <tr>
      <td>\(H^2\)</td>
      <td>\(\tfrac12\)</td>
      <td>\(\tfrac14 J_F\, t^2\)</td>
    </tr>
    <tr>
      <td>JS</td>
      <td>\(\tfrac12\)</td>
      <td>\(\tfrac14 J_F\, t^2\)</td>
    </tr>
    <tr>
      <td>TV</td>
      <td>—</td>
      <td>linear in \(\lvert t \rvert\), not \(t^2\)</td>
    </tr>
  </tbody>
</table>

<p>Total variation is the exception again. Its generator isn’t differentiable at \(1\), and it grows linearly: for
\(P_t = N(t, 1)\), \(\mathrm{TV}(P_t, P_0) \approx |t|/\sqrt{2\pi}\).</p>

<p><a href="#fig-7">Figure 7</a> checks all of this on the family \(N(t, 1)\), whose Fisher information is \(J_F = 1\). In the right panel,
each divergence is divided by its predicted quadratic \(\tfrac{f&#39;&#39;(1)}{2} t^2\), so the local result says every curve
should start at \(1\), and they all do. Away from \(t = 0\), though, the quadratic approximation is no longer exact, and each
divergence drifts off in its own way:</p>

<ul>
  <li><strong>KL</strong> stays flat at \(1\), because for two Gaussians with the same variance it’s <em>exactly</em> \(t^2/2\).</li>
  <li><strong>Hellinger and JS</strong> bend down. They’re bounded (by \(2\) and \(2\log 2\)), so they must eventually fall below any
parabola.</li>
  <li><strong>\(\chi^2\)</strong> shoots up. For these Gaussians it equals \(e^{t^2} - 1 = t^2 + t^4/2 + \dots\), which grows much faster than
\(t^2\). This is the variance-of-the-likelihood-ratio view from <a href="#section-2-2-2">Section 2.2.2</a> at work: squaring the
ratio \(p/q\) makes \(\chi^2\) dominated by the tails, where \(q\) is tiny and the ratio is huge.</li>
</ul>

<figure id="fig-7">
  <img src="/images/f-divergences/local_fisher.png" alt="Divergences between N(t,1) and N(0,1) with their quadratic approximations" />
  <figcaption><strong>Figure 7.</strong> Left: divergences between \(N(t,1)\) and \(N(0,1)\) (solid) and their quadratic
  approximations (dashed); TV is linear instead. Right: divided by \(\tfrac{f&#39;&#39;(1)}{2} t^2\), every smooth divergence
  starts at the same value, the Fisher information \(J_F = 1\), and only separates once \(t\) is no longer small.</figcaption>
</figure>

<h3 id="section-5-3">5.3 What this means for ML</h3>

<p>Geometrically, all smooth \(f\)-divergences induce the same local quadratic form, and the Fisher information is the metric
tensor that information geometry is built on. This has very practical consequences:</p>

<ul>
  <li><strong>Natural gradient</strong> <a href="#ref-17">[17]</a>. Instead of taking the steepest step in parameter space, take the steepest step
among parameters at a fixed KL distance. Since that KL is locally \(\tfrac12 h^\top J_F h\), the update becomes
\(h \propto -J_F^{-1} \nabla L\), which doesn’t depend on how you parameterize the model.</li>
  <li><strong>Trust regions in RL.</strong> TRPO constrains the KL divergence between the old and the new policy, and solves the
constrained problem using exactly this quadratic Fisher approximation <a href="#ref-16">[16]</a>. PPO’s clipping is a cheaper
proxy for the same idea <a href="#ref-18">[18]</a>.</li>
  <li><strong>For small steps, the choice of divergence barely matters.</strong> Every smooth \(f\)-divergence is approximately
\(\tfrac{f&#39;&#39;(1)}{2}\, h^\top J_F h\), so KL, \(\chi^2\) and Hellinger trust regions agree up to a constant factor, and two
divergences with the <em>same</em> \(f&#39;&#39;(1)\) agree completely, up to higher-order terms. Differences only show up for large
steps. This is exactly why the \(k_2\) estimator of KL in <a href="#section-6-5-2">Section 6.5.2</a> has such a small bias.</li>
</ul>

<h2 id="section-6">6. Estimating divergences from samples</h2>

<p>Everything so far assumed we know \(P\) and \(Q\). In practice we only have samples \(X_1, \dots, X_n \sim P\) and
\(Y_1, \dots, Y_m \sim Q\). Estimating a divergence is much harder than estimating a mean, because \(D_f\) depends on the
distributions nonlinearly, through their ratio, so it’s not the expectation of any known function of the data
<a href="#ref-19">[19]</a>.</p>

<h3 id="section-6-1">6.1 Why plug-in estimates are bad</h3>

<p>The obvious approach for discrete data with \(k\) possible outcomes is to replace the distributions by empirical
frequencies \(\hat p_i = N_i / n\) and compute \(D_f(\hat p\|\hat q)\). This is consistent when \(k\) is fixed and \(n \to \infty\),
but it’s <strong>systematically biased upward</strong>. Even with \(Q\) known, convexity (<a href="#section-2-5">Section 2.5</a>) and Jensen give</p>

<div class="math-display">\[
\mathbb{E}\big[D_f(\hat p\,\|\,q)\big] \ge D_f\big(\mathbb{E}[\hat p]\,\|\,q\big) = D_f(P\|Q).
\]</div>

<p>If \(P = Q\), the true value is zero, but the estimate is positive unless the sample frequencies happen to match \(Q\)
exactly.</p>

<p><a href="#section-5">Section 5</a> even tells us how big the bias is. The error \(\hat p - p\) is of order \(1/\sqrt n\), the divergence
is locally quadratic with constant \(f&#39;&#39;(1)/2\), and \(\mathbb{E}[\chi^2(\hat p\|p)] = (k-1)/n\), so, at least when \(P\) and
\(Q\) are close <a href="#ref-9">[9]</a>,</p>

<div class="math-display">\[
\mathbb{E}\big[D_f(\hat p\,\|\,q)\big] - D_f(P\|Q) \approx \frac{f&#39;&#39;(1)}{2} \cdot \frac{k-1}{n}.
\]</div>

<p>For KL, that’s about \((k-1)/(2n)\), and in that case it holds for any \(Q\). The bias depends on the number of outcomes
\(k\), not just the sample size. When \(k\) is comparable to \(n\) or larger, the bias is as large as the quantity being
estimated. Think of distributions over a language model’s vocabulary, where \(k\) is in the hundreds of thousands. For
continuous data it’s even worse: the empirical distribution has no density, so the plug-in estimate isn’t defined without
first estimating densities, which runs into the curse of dimensionality.</p>

<p>The key observation is that \(D_f(P\|Q)\) doesn’t need \(p\) and \(q\) separately, only their ratio \(p/q\). That’s a single
function, and it’s often much smoother than either density. The question is how to estimate it without estimating the
densities.</p>

<h3 id="section-6-2">6.2 The variational representation</h3>

<p>The answer is convex duality. The <strong>convex conjugate</strong> of \(f\) is \(f^*(v) = \sup_u \{uv - f(u)\}\), and for convex \(f\) the
relation goes both ways: \(f(u) = \sup_v \{uv - f^*(v)\}\). Plugging this into the definition, pointwise at \(u = p(x)/q(x)\),
and swapping the supremum with the integral gives <a href="#ref-19">[19]</a></p>

<div class="math-display">\[
D_f(P\|Q) = \sup_{g} \Big\{ \mathbb{E}_{P}[g(X)] - \mathbb{E}_{Q}\big[f^*(g(Y))\big] \Big\},
\]</div>

<p>with the supremum attained at \(g^* = f&#39;(p/q)\). Restricting \(g\) to any smaller class gives a lower bound.</p>

<p>This is the most useful formula in the post for ML. There are <strong>no densities in it</strong>, only two expectations, one under
\(P\) and one under \(Q\). Replace them with sample averages, let \(g\) be a neural network (a “critic”), and maximize with
SGD. As a bonus, the optimal critic is a transformed likelihood ratio, so you get an estimate of \(p/q\) for free.</p>

<p>For KL, \(f^*(v) = e^{v-1}\), which gives \(\mathrm{KL}(P\|Q) = \sup_g \{\mathbb{E}_P[g] - \mathbb{E}_Q[e^{g-1}]\}\) with
optimum \(g = 1 + \log(p/q)\) <a href="#ref-19">[19]</a>. A closely related and tighter form is the Donsker–Varadhan
representation, \(\mathrm{KL}(P\|Q) = \sup_g \{\mathbb{E}_P[g] - \log \mathbb{E}_Q[e^{g}]\}\), which MINE uses to estimate
mutual information with neural networks <a href="#ref-20">[20]</a>. For total variation, \(f\) isn’t differentiable, and the optimal
\(g\) only tells you <em>where</em> \(p &gt; q\), not by how much. That’s just the optimal test from <a href="#section-3-1">Section 3.1</a>.</p>

<h3 id="section-6-3">6.3 Every classifier is a density ratio estimator</h3>

<p>There’s an even more direct way to get the ratio. Train a probabilistic classifier \(D(x)\) to distinguish samples of \(P\)
(label 1) from samples of \(Q\) (label 0), with balanced classes and the usual logistic loss. The optimal classifier is
\(D^*(x) = p(x) / (p(x) + q(x))\), so</p>

<div class="math-display">\[
\frac{p(x)}{q(x)} = \frac{D^*(x)}{1 - D^*(x)}.
\]</div>

<p>So every classifier you train to tell two datasets apart is secretly a density ratio estimator, and through the formula
in <a href="#section-6-2">Section 6.2</a>, a divergence estimator. A GAN discriminator is exactly this. f-GAN <a href="#ref-21">[21]</a> makes
the connection explicit: pick any \(f\), use the variational bound as the GAN objective, and the original GAN falls out as
the Jensen–Shannon case.</p>

<h3 id="section-6-4">6.4 Mutual information</h3>

<p>Mutual information is also an \(f\)-divergence: \(I(X; Y) = \mathrm{KL}(P_{XY}\|P_X \otimes P_Y)\), the KL divergence between
the joint distribution and the product of the marginals. Both are easy to sample from a single dataset of pairs
\((X_i, Y_i)\): the pairs themselves are samples from \(P_{XY}\), and shuffling the \(Y\)’s gives (approximately) samples from
\(P_X \otimes P_Y\). Plugging these into a variational bound gives neural MI estimators like MINE <a href="#ref-20">[20]</a>. The
InfoNCE objective behind contrastive learning <a href="#ref-22">[22]</a> is a related lower bound on mutual information. It has low
variance, but it can never exceed the log of the batch size <a href="#ref-23">[23]</a>.</p>

<h3 id="section-6-5">6.5 Estimating the KL penalty in RLHF</h3>

<p>This part wasn’t in my paper, but it’s where these ideas finally clicked for me. When a language model is fine-tuned
with RL, the objective usually includes a penalty \(\beta \cdot \mathrm{KL}(\pi_\theta\|\pi_{\text{ref}})\) that keeps the
policy \(\pi_\theta\) close to a reference model \(\pi_{\text{ref}}\), typically the supervised fine-tuned starting point
<a href="#ref-6">[6]</a>, <a href="#ref-7">[7]</a>. This prevents the policy from drifting into degenerate text that happens to fool
the reward.</p>

<p>This setting is different from Sections <a href="#section-6-1">6.1</a>–<a href="#section-6-4">6.4</a>. Both models give us log-probabilities,
so we can compute the likelihood ratio exactly for any token, and there’s nothing to learn. The only problem is that the
KL is an average over all possible sequences, far too many to sum over, so in practice it’s estimated from the tokens the
policy actually sampled. For a sampled token \(x \sim \pi_\theta\), let \(r = \pi_{\text{ref}}(x) / \pi_\theta(x)\). We want
\(\mathrm{KL}(\pi_\theta\|\pi_{\text{ref}}) = \mathbb{E}_{\pi_\theta}[-\log r]\). John Schulman’s blog post
<a href="#ref-24">[24]</a> compares three per-sample estimators. Each is computed from a single sampled token, and averaging it
over many samples estimates the KL.</p>

<h4 id="section-6-5-1">6.5.1 \(k_1 = -\log r\): unbiased but noisy</h4>

<p>This is the direct estimator. Its average is exactly the KL, so it’s unbiased. But it has high variance, and it’s
negative whenever the reference likes a token more than the policy does (\(r &gt; 1\)), even though the KL itself is never
negative.</p>

<h4 id="section-6-5-2">6.5.2 \(k_2 = \tfrac12 (\log r)^2\): low variance, slightly biased</h4>

<p>This one is never negative and has low variance, but it’s biased: its average isn’t exactly the KL. The bias is small as
long as the policy stays close to the reference, and <a href="#section-5">Section 5</a> explains why:</p>

<ol>
  <li>The average of \(k_2\) is itself an \(f\)-divergence: \(\mathbb{E}_{\pi_\theta}[k_2] = D_{f_2}(\pi_{\text{ref}}\|\pi_\theta)\)
with \(f_2(t) = \tfrac12 (\log t)^2\).</li>
  <li>The KL we want is also an \(f\)-divergence: \(\mathrm{KL}(\pi_\theta\|\pi_{\text{ref}}) = D_{f}(\pi_{\text{ref}}\|\pi_\theta)\)
with \(f(t) = -\log t\).</li>
  <li>Both generators have the same second derivative at \(1\): \(f_2&#39;&#39;(1) = f&#39;&#39;(1) = 1\). So by <a href="#section-5-2">Section 5.2</a>,
when the policy is a small step \(h\) away from the reference, <em>both</em> divergences are approximately
\(\tfrac12\, h^\top J_F h\), the same Fisher-information quadratic.</li>
</ol>

<p>The two only differ in higher-order terms, which is why \(k_2\) is nearly unbiased near the reference, and why its bias
grows once the policy drifts away.</p>

<h4 id="section-6-5-3">6.5.3 \(k_3 = (r - 1) - \log r\): unbiased and low variance</h4>

<p>This one gets the best of both. It’s unbiased because</p>

<div class="math-display">\[
\mathbb{E}_{\pi_\theta}[r - 1] = \sum_x \pi_\theta(x)\, \frac{\pi_{\text{ref}}(x)}{\pi_\theta(x)} - 1 = 0,
\]</div>

<p>so adding \(r - 1\) to \(k_1\) doesn’t change its average. It does cancel much of its noise, though: when \(k_1 = -\log r\) is
very negative (\(r\) large), \(r - 1\) is very positive. That’s exactly the “add \(c(t-1)\) to \(f\)” freedom from
<a href="#section-2-1">Section 2.1</a>. And \(k_3\) is never negative, because the convex function \(-\log r\) lies above its tangent line
at \(r = 1\), which is \(1 - r\), and \(k_3\) is exactly the vertical gap between the two. (A gap like this, between a convex
function and its tangent line, is called a <em>Bregman divergence</em>.)</p>

<h4 id="section-6-5-4">6.5.4 How they compare</h4>

<p><a href="#fig-8">Figure 8</a> shows the difference. On the left, all three estimators are zero at \(r = 1\), but only \(k_1\) dips below
zero. On the right are single-sample estimates for a toy policy and reference: all three have the right average (up to
\(k_2\)’s small bias), but \(k_1\) is spread over a wide range of positive and negative values, while \(k_2\) and \(k_3\) are
never negative and much more concentrated.</p>

<figure id="fig-8">
  <img src="/images/f-divergences/kl_estimators.png" alt="The three KL estimators as functions of the ratio r, and histograms of their single-sample values" />
  <figcaption><strong>Figure 8.</strong> Left: each estimator as a function of the ratio \(r\). Right: the distribution of
  single-sample estimates when the policy is \(N(0,1)\) and the reference is \(N(0.5,1)\), so the true KL is \(0.125\)
  (log scale). The legend shows each estimator's mean and standard deviation.</figcaption>
</figure>

<p>To check the numbers, I reran Schulman’s Gaussian experiment: policy \(N(0,1)\), reference \(N(\mu, 1)\), true KL \(\mu^2/2\).
The table shows the bias and the standard deviation of a <em>single-sample</em> estimate, both relative to the true KL. Bias is
given as a percentage of the KL. Standard deviation is given as a multiple of it, so a value of \(20\) means one sample’s
noise is 20 times the quantity you’re estimating (averaging \(N\) samples divides it by \(\sqrt N\)).</p>

<table>
  <thead>
    <tr>
      <th>Reference</th>
      <th>True KL</th>
      <th>\(k_1\) bias</th>
      <th>\(k_1\) std</th>
      <th>\(k_2\) bias</th>
      <th>\(k_2\) std</th>
      <th>\(k_3\) bias</th>
      <th>\(k_3\) std</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>\(N(0.1, 1)\)</td>
      <td>\(0.005\)</td>
      <td>\(0\%\)</td>
      <td>\(20\)</td>
      <td>\(0.25\%\)</td>
      <td>\(1.42\)</td>
      <td>\(0\%\)</td>
      <td>\(1.42\)</td>
    </tr>
    <tr>
      <td>\(N(0.5, 1)\)</td>
      <td>\(0.125\)</td>
      <td>\(0\%\)</td>
      <td>\(4.0\)</td>
      <td>\(6.25\%\)</td>
      <td>\(1.50\)</td>
      <td>\(0\%\)</td>
      <td>\(1.48\)</td>
    </tr>
    <tr>
      <td>\(N(1, 1)\)</td>
      <td>\(0.5\)</td>
      <td>\(0\%\)</td>
      <td>\(2.0\)</td>
      <td>\(25\%\)</td>
      <td>\(1.73\)</td>
      <td>\(0\%\)</td>
      <td>\(1.70\)</td>
    </tr>
  </tbody>
</table>

<p>These values agree with a two-million-sample simulation and with exact formulas for this Gaussian case: \(k_1\) has
relative standard deviation \(2/\mu\); \(k_2\) has relative bias \(\mu^2/4\) and relative standard deviation \(\sqrt{2 + \mu^2}\);
and \(k_3\) has relative standard deviation \(\sqrt{e^{\mu^2} - 1 - \mu^2}\,/\,(\mu^2/2)\). Close to the reference (first
row), \(k_1\)’s noise is 20 times the signal, while \(k_2\) and \(k_3\) are practically identical. Further away, \(k_2\)’s bias
grows to 25%, and \(k_3\) stays unbiased with the lowest variance of the three.</p>

<h4 id="section-6-5-5">6.5.5 What TRL does</h4>

<p>The GRPO algorithm from DeepSeekMath uses \(k_3\) as its KL term <a href="#ref-25">[25]</a>, and Hugging Face’s TRL library
implements it exactly that way. This is the per-token KL in <code class="language-plaintext highlighter-rouge">GRPOTrainer</code> <a href="#ref-26">[26]</a>, where
<code class="language-plaintext highlighter-rouge">ref_per_token_logps - per_token_logps</code> is \(\log r\):</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">per_token_kl</span> <span class="o">=</span> <span class="p">(</span>
    <span class="n">torch</span><span class="p">.</span><span class="nf">exp</span><span class="p">(</span><span class="n">ref_per_token_logps</span> <span class="o">-</span> <span class="n">per_token_logps</span><span class="p">)</span> <span class="o">-</span> <span class="p">(</span><span class="n">ref_per_token_logps</span> <span class="o">-</span> <span class="n">per_token_logps</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>
<span class="p">)</span>
</code></pre></div></div>

<p>That’s \(e^{\log r} - \log r - 1 = (r - 1) - \log r\), which is \(k_3\).</p>

<p>TRL’s <code class="language-plaintext highlighter-rouge">RLOOTrainer</code> makes a different choice: it uses \(k_1\) (<code class="language-plaintext highlighter-rouge">old_per_token_logps - ref_per_token_logps</code>), sums it over
all the tokens of a sequence, and subtracts it from the reward instead of adding it to the loss <a href="#ref-26">[26]</a>. A comment
in the TRL source says this is intentional and follows the RLOO paper <a href="#ref-27">[27]</a>, which in turn follows the
original RLHF setup <a href="#ref-6">[6]</a>. My reading of why it makes sense: the KL-regularized objective can be written as
a single expectation,</p>

<div class="math-display">\[
\mathbb{E}_{y \sim \pi_\theta}[R(y)] - \beta\, \mathrm{KL}(\pi_\theta\|\pi_{\text{ref}})
= \mathbb{E}_{y \sim \pi_\theta}\left[ R(y) - \beta \log\frac{\pi_\theta(y)}{\pi_{\text{ref}}(y)} \right],
\]</div>

<p>and the log-ratio of a whole sequence \(y\) is exactly \(k_1\) summed over its tokens. So putting \(k_1\) into the reward makes
a REINFORCE-style method like RLOO optimize precisely the regularized objective. Negative per-token values don’t matter
there, because they’re just summed into one scalar reward per sequence. GRPO instead adds the KL to the loss token by
token, where a nonnegative, low-variance per-token estimate like \(k_3\) is the natural choice.</p>

<p>One last connection: the penalty is the <em>reverse</em> KL from the policy’s point of view, which by
<a href="#section-2-3">Section 2.3</a> means it’s mode-seeking. It punishes the policy for producing text the reference finds
unlikely, but it doesn’t stop the policy from dropping some of the reference’s modes. That’s one explanation offered for
the loss of output diversity after RL fine-tuning.</p>

<h2 id="section-7">7. Where \(f\)-divergences break: Wasserstein distance</h2>

<p>All \(f\)-divergences share one structural limitation, and it comes straight from the definition. They compare the
densities \(p(x)\) and \(q(x)\) <em>at the same point</em> \(x\). The geometry of the space, meaning how far apart two points are,
never enters the formula.</p>

<p>The simplest example makes this painfully clear. Let \(P = \delta_0\) and \(Q_\theta = \delta_\theta\) be point masses at \(0\)
and \(\theta\). For every \(\theta \neq 0\), the supports are disjoint, so</p>

<div class="math-display">\[
\mathrm{TV} = 1, \qquad H^2 = 2, \qquad \mathrm{JS} = 2\log 2, \qquad \mathrm{KL} = \chi^2 = +\infty,
\]</div>

<p>no matter what \(\theta\) is. For \(\theta = 0.01\) and for \(\theta = 100\), every \(f\)-divergence gives the same answer, even
though in the first case the distributions are practically identical.</p>

<p>This isn’t just a curiosity. If you train a model \(Q_\theta\) by minimizing an \(f\)-divergence to the data, and their
supports don’t overlap, the divergence is constant in \(\theta\), the gradient is zero, and optimization can’t make any
progress. Real data like images concentrates near low-dimensional manifolds, and two such manifolds in a
high-dimensional space almost never overlap. Arjovsky and Bottou showed that this is the root of the vanishing gradient
problem in the original GAN, where Jensen–Shannon simply saturates <a href="#ref-4">[4]</a>.</p>

<p>This is also one reason generative models add noise. Arjovsky and Bottou suggested adding noise to both distributions so
that their supports overlap <a href="#ref-4">[4]</a>. Score-based diffusion models perturb the data with Gaussian noise
partly for the same reason: data on a low-dimensional manifold doesn’t even have a well-defined score (the gradient of
its log-density), while the noisy distribution covers the whole space <a href="#ref-28">[28]</a>. And normalizing flows add small
uniform noise to discrete pixel values, called <em>dequantization</em>, so that a continuous density can’t cheat by putting
infinite density on the discrete values <a href="#ref-29">[29]</a>.</p>

<h3 id="section-7-1">7.1 Moving mass: Wasserstein distance</h3>

<p>What we need is a different question. Instead of “how different are the two densities at each point?”, ask <strong>“how much
work does it take to turn one distribution into the other?”</strong> Think of \(P\) as a pile of dirt and \(Q\) as the shape you
want to build. Moving a bit of dirt costs its amount times the distance it travels, and the distance between the
distributions is the cheapest total cost of the whole job. This is the oldest question in optimal transport: Gaspard
Monge posed it in 1781, literally about how to move soil from excavations to embankments <a href="#ref-30">[30]</a>. That’s also
why the resulting distance is known in computer science as the <strong>earth mover’s distance</strong> <a href="#ref-31">[31]</a>.
<a href="#fig-9">Figure 9</a> illustrates the idea.</p>

<figure id="fig-9">
  <img src="/images/f-divergences/earth_mover.gif" alt="Animation of a shovel moving balls of mass from distribution P to distribution Q" />
  <figcaption><strong>Figure 9.</strong> The earth mover's picture: a shovel moves \(P\)'s mass, bit by bit, to where \(Q\)
  needs it, and the counter adds up the work, amount times distance.</figcaption>
</figure>

<p><a href="#fig-10">Figure 10</a> shows the contrast with \(f\)-divergences on a one-dimensional example. \(f\)-divergences compare the two
densities <em>vertically</em>, point by point, while optimal transport asks how far mass has to travel <em>horizontally</em>. The
picture is one-dimensional to keep it simple, but the same idea works in any number of dimensions.</p>

<figure id="fig-10">
  <img src="/images/f-divergences/transport.png" alt="Moving mass from one distribution to another, and vertical versus horizontal comparison" />
  <figcaption><strong>Figure 10.</strong> Left: optimal transport turns \(P\) into \(Q\) by moving mass. Right:
  \(f\)-divergences compare \(p(x)\) and \(q(x)\) at the same point (vertical lines), while Wasserstein distance measures how
  far the mass has to move (horizontal arrow).</figcaption>
</figure>

<p>Formally, the <strong>Wasserstein distance</strong> of order \(p \ge 1\) is <a href="#ref-32">[32]</a></p>

<div class="math-display">\[
W_p(P, Q) = \left( \inf_{\gamma \in \Gamma(P, Q)} \int \|x - y\|^p \, d\gamma(x, y) \right)^{1/p},
\]</div>

<p>where \(\Gamma(P, Q)\) is the set of <em>couplings</em>: joint distributions whose marginals are \(P\) and \(Q\). Each coupling is a
transport plan, where \(\gamma(x, y)\) says how much of the mass at \(x\) is moved to \(y\), and \(\|x - y\|^p\) is the cost of
moving it. The points \(x\) and \(y\) can live in any number of dimensions, and \(\|x - y\|\) is the usual Euclidean distance
between them.</p>

<p>Note that \(p\) is the <em>order</em>, not the dimension: it’s the power the distance is raised to in the cost. \(W_1\) charges
amount times distance, like the dirt-moving picture, while \(W_2\) charges amount times distance squared, which makes long
moves disproportionately expensive. Both show up in ML: \(W_1\) in Wasserstein GANs (<a href="#section-7-2">Section 7.2</a>) and \(W_2\)
in flow matching (<a href="#section-7-4">Section 7.4</a>).</p>

<p>For the point masses from the start of this section, there’s only one plan, moving everything from \(0\) to \(\theta\), so
\(W_p(\delta_0, \delta_\theta) = |\theta|\). It grows with the distance, exactly as intuition demands, even though the
supports never overlap. The left panel of <a href="#fig-11">Figure 11</a> shows it next to the saturated \(f\)-divergences.</p>

<p>Two more properties make \(W_p\) attractive. First, unlike KL, it’s a true metric: symmetric, and it satisfies the triangle
inequality. Second, it can see distributions converge even when their supports never overlap. Take \(P_n = \delta_{1/n}\),
a point mass that slides toward \(0\). For every \(n\), \(\mathrm{TV}(P_n, \delta_0) = 1\) and \(\mathrm{KL} = \infty\), so no
\(f\)-divergence notices that \(P_n\) is getting closer to \(\delta_0\), but \(W_p(P_n, \delta_0) = 1/n \to 0\). In technical
terms, convergence in \(W_p\) is equivalent to <em>weak convergence</em> (averages of every bounded continuous function converge)
plus convergence of the \(p\)-th moments, which keeps mass from escaping to infinity <a href="#ref-32">[32]</a>.</p>

<h3 id="section-7-2">7.2 Kantorovich duality</h3>

<p>Computing \(W_p\) means solving an optimization problem over couplings, so a dual form is extremely useful. For any order
\(p\), with \(x\) and \(y\) in any number of dimensions, Kantorovich duality says <a href="#ref-30">[30]</a></p>

<div class="math-display">\[
W_p^p(P, Q) = \sup_{\varphi,\, \psi} \Big\{ \mathbb{E}_P[\varphi(X)] + \mathbb{E}_Q[\psi(Y)] \Big\}
\quad \text{over all } \varphi, \psi \text{ with } \varphi(x) + \psi(y) \le \|x - y\|^p \text{ for all } x, y.
\]</div>

<p>There’s a nice economic reading of this. Imagine a shipping company that charges \(\varphi(x)\) to pick up a unit of dirt
at \(x\) and \(\psi(y)\) to drop it off at \(y\). To stay competitive, its combined price can never exceed what it would cost
you to move the dirt yourself, \(\|x - y\|^p\). The most it can earn under that rule is exactly the optimal transport cost.</p>

<p>For \(p = 1\), the two price functions collapse into one, and the constraint turns into a smoothness condition. A function
\(g\) is <strong>1-Lipschitz</strong> if</p>

<div class="math-display">\[
|g(x) - g(y)| \le \|x - y\| \quad \text{for all } x, y,
\]</div>

<p>meaning its value can’t change faster than the distance between its inputs. For a differentiable function of one
variable, that just says its slope is at most \(1\) in absolute value, \(|g&#39;(x)| \le 1\); in several dimensions, it says the
gradient has norm at most \(1\). (More generally, \(g\) is \(L\)-Lipschitz if \(|g(x) - g(y)| \le L\,\|x - y\|\).) With that,
the optimal \(\psi\) is simply \(-\varphi\), and we get the <strong>Kantorovich–Rubinstein duality</strong> <a href="#ref-32">[32]</a>:</p>

<div class="math-display">\[
W_1(P, Q) = \sup_{g \text{ 1-Lipschitz}} \Big\{ \mathbb{E}_P[g(X)] - \mathbb{E}_Q[g(Y)] \Big\}.
\]</div>

<p>Compare this with the variational formula for \(f\)-divergences from <a href="#section-6-2">Section 6.2</a>. Both are “the supremum,
over critics \(g\), of a difference of two expectations”. For \(f\)-divergences, \(g\) can be anything, but the second term goes
through \(f^*\). For \(W_1\), the second term is plain, but \(g\) has to be 1-Lipschitz. That constraint is exactly where
geometry enters: nearby points must get nearby values. This is the idea behind the Wasserstein GAN, whose critic is kept
Lipschitz, first by weight clipping <a href="#ref-5">[5]</a> and later with a gradient penalty that pushes the norm of the
critic’s gradient toward \(1\) <a href="#ref-33">[33]</a>.</p>

<p>The two families are comparable in only one direction. On a space with diameter \(\mathrm{diam}\), we have
\(W_1 \le \mathrm{diam} \cdot \mathrm{TV}\), because no mass travels further than the diameter, but the point-mass example
shows there’s no reverse bound. Wasserstein distance is a <em>weaker</em> measure of difference, and that weakness is exactly
what makes it give useful gradients when \(f\)-divergences give none.</p>

<h3 id="section-7-3">7.3 One dimension: sort and match</h3>

<p>In one dimension, optimal transport has a completely explicit solution. Mass is moved monotonically: the smallest values
of \(P\) go to the smallest values of \(Q\), and so on, so transport paths never cross. This is also the plan the shovel
follows in <a href="#fig-9">Figure 9</a>. With CDFs \(F\) and \(G\) and quantile functions \(F^{-1}\) and \(G^{-1}\) <a href="#ref-32">[32]</a>,</p>

<div class="math-display">\[
W_p(P, Q) = \left( \int_0^1 \big| F^{-1}(u) - G^{-1}(u) \big|^p \, du \right)^{1/p},
\]</div>

<p>and the optimal map is \(T = G^{-1} \circ F\). For \(p = 1\), it gets even better:</p>

<div class="math-display">\[
W_1(P, Q) = \int_0^1 \big| F^{-1}(u) - G^{-1}(u) \big| \, du = \int_{-\infty}^{\infty} \big| F(x) - G(x) \big| \, dx .
\]</div>

<p>Both integrals measure the same area between the two CDFs, once horizontally and once vertically (right panel of
<a href="#fig-11">Figure 11</a>). This closes the loop with <a href="#section-1">Section 1</a>: the Kolmogorov–Smirnov statistic is the
<em>supremum</em> of \(|F_n - F_0|\), and \(W_1\) is its <em>integral</em> version. Both compare CDFs, which is why neither is an
\(f\)-divergence. For two samples of the same size, you don’t need any density estimation at all: sort both samples and pair
them up, \(W_p(P_n, Q_n) = \big( \tfrac1n \sum_i |X_{(i)} - Y_{(i)}|^p \big)^{1/p}\).</p>

<figure id="fig-11">
  <img src="/images/f-divergences/wasserstein.png" alt="f-divergences constant in theta while W1 grows linearly, and W1 as the area between two CDFs" />
  <figcaption><strong>Figure 11.</strong> Left: for point masses at \(0\) and \(\theta\), every \(f\)-divergence is constant,
  while \(W_1\) grows linearly. Right: in one dimension, \(W_1\) is the area between the CDFs.</figcaption>
</figure>

<p>The two ways of comparing distributions also give two different “straight lines” from \(P\) to \(Q\), shown in
<a href="#fig-12">Figure 12</a>:</p>

<ul>
  <li><strong>The mixture path</strong> \((1-t)P + tQ\) fades mass out in one place and fades it in somewhere else. It’s the straight line
for total variation, the simplest \(f\)-divergence: since \((1-t)P + tQ - P = t(Q - P)\), we get
\(\mathrm{TV}(P, (1-t)P + tQ) = t \cdot \mathrm{TV}(P, Q)\), so TV grows at a constant speed along it. Measured by \(W_2\),
though, it rushes ahead early.</li>
  <li><strong>The transport path</strong> slides every quantile along a straight line, \(x_t = (1-t)\,x + t\,T(x)\). It’s the straight line
for \(W_2\), with \(W_2(P, \rho_t) = t \cdot W_2(P, Q)\). Measured by TV, though, it almost jumps: as soon as the moving mass
stops overlapping with \(P\), TV is nearly \(1\), even though the mass has barely moved.</li>
</ul>

<figure id="fig-12">
  <video autoplay="" loop="" muted="" playsinline="" poster="/images/f-divergences/ot_vs_mixture.png">
    <source src="/images/f-divergences/ot_vs_mixture.mp4" type="video/mp4" />
  </video>
  <figcaption><strong>Figure 12.</strong> Top: the mixture path, which moves at a constant speed in TV. Bottom: the
  transport path, which moves at a constant speed in \(W_2\). The readouts show how far along each path we are, measured
  in TV and in \(W_2\).</figcaption>
</figure>

<p>Two details are worth spelling out. First, why \(W_2\) and not \(W_1\)? Because \(W_1\) can’t tell these two paths apart.
Picture \(P\) and \(Q\) as two lumps of mass a distance \(d\) apart. At time \(t\), the mixture path has moved a fraction \(t\) of
the mass the whole distance \(d\), while the transport path has moved all of the mass a distance \(td\). \(W_1\) charges mass
times distance, so both cost \(t \cdot d\), and both paths move at a constant speed in \(W_1\). (In general,
\(W_1(P, (1-t)P + tQ) = t \cdot W_1(P, Q)\), because the Kantorovich–Rubinstein formula only depends on \(P - Q\).) \(W_2\)
charges mass times distance <em>squared</em>, which punishes long moves. The mixture path costs \(t \cdot d^2\), so
\(W_2 = \sqrt t \cdot d\), while the transport path costs \(1 \cdot (td)^2\), so \(W_2 = t \cdot d\). Only the transport path
moves at a constant speed, and \(\sqrt t\) is why the mixture path rushes ahead early in <a href="#fig-12">Figure 12</a>. \(W_2\) is
also the distance behind flow matching, where the squared distance becomes kinetic energy
(<a href="#section-7-4">Section 7.4</a>).</p>

<p>Second, total variation stays finite along both paths, even once the moving mass no longer overlaps with \(P\); it just
saturates, because it can never exceed \(1\). It equals \(1\) only when the two distributions share no mass at all. Gaussian
densities are positive everywhere, so \(P\) and \(Q\) technically do overlap, but only where both are tiny: they share about
\(0.03\%\) of their mass, so \(\mathrm{TV}(P, Q) \approx 0.9997\). The readouts in <a href="#fig-12">Figure 12</a> show TV as a
percentage of this value.</p>

<p>The bottom path is the natural one for a flow model. An ODE moves mass continuously, so it can’t make mass disappear in
one place and reappear in another. To follow the top path, it would have to rush mass through the almost empty gap
between \(P\) and \(Q\) at enormous speed (infinite speed, if the supports were truly disjoint). That’s the bridge to the
last subsection.</p>

<h3 id="section-7-4">7.4 Why this matters for flow matching</h3>

<p>Flow matching learns a velocity field \(v_t(x)\) and generates
samples by solving the ODE \(\frac{d}{dt} x_t = v_t(x_t)\), which carries noise samples at \(t = 0\) to data samples at
\(t = 1\) <a href="#ref-1">[1]</a>. Its standard “conditional optimal transport” path moves each sample along a straight line.
That isn’t an arbitrary choice, and the reason becomes clear once you see optimal transport as <em>motion</em> instead of a static
plan.</p>

<p>Picture the mass of \(P\) flowing into \(Q\) over time \(t \in [0, 1]\). At each moment, \(\rho_t(x)\) is the density of the mass
and \(v_t(x)\) is its velocity at the point \(x\), the same kind of object flow matching learns. Two ingredients describe such
a flow:</p>

<ul>
  <li><strong>Mass is conserved.</strong> It isn’t created or destroyed; it only moves. This is the <em>continuity equation</em>,
\(\partial_t \rho_t + \nabla \cdot (\rho_t v_t) = 0\): the density at a point changes only because mass flows in or out
of it. It’s the formal version of “no teleporting” from <a href="#fig-12">Figure 12</a>.</li>
  <li><strong>Moving mass costs kinetic energy.</strong> The total cost of a flow is \(\int_0^1 \int \|v_t(x)\|^2 \rho_t(x)\, dx\, dt\):
squared speed, weighted by how much mass moves at that speed, added up over time. It’s the \(\tfrac12 m v^2\) from physics,
without the \(\tfrac12\).</li>
</ul>

<p>The <strong>Benamou–Brenier formula</strong> <a href="#ref-34">[34]</a> says that the cheapest flow from \(P\) to \(Q\) costs exactly \(W_2^2\):</p>

<div class="math-display">\[
W_2^2(P, Q) = \min_{\rho_t,\, v_t} \int_0^1 \!\! \int \|v_t(x)\|^2 \, \rho_t(x)\, dx\, dt
\quad \text{subject to} \quad \partial_t \rho_t + \nabla \cdot (\rho_t v_t) = 0,\ \ \rho_0 = P,\ \rho_1 = Q.
\]</div>

<p>In the cheapest flow, every particle moves in a straight line at constant speed, since any detour or change of speed
wastes kinetic energy. That’s the transport path from <a href="#fig-12">Figure 12</a>, and it’s why straight paths are the natural
target for flow matching. The flow that flow matching actually learns from independently paired noise and data isn’t
optimal in general, so its trajectories curve and need more ODE steps to integrate. Rectified flow <a href="#ref-35">[35]</a> and
minibatch optimal transport couplings <a href="#ref-8">[8]</a>, <a href="#ref-36">[36]</a> are ways of straightening them.</p>

<p>In one dimension, there’s a clean guarantee about the endpoints. ODE trajectories can’t cross, so the map from noise to
data defined by any flow is increasing, and the only increasing map that pushes a continuous \(P\) onto \(Q\) is
\(G^{-1} \circ F\) from <a href="#section-7-3">Section 7.3</a>, the optimal transport map. So in 1D, every flow model ends up with the
optimal transport map between its endpoints, even though its trajectories in between needn’t be straight. In higher
dimensions there’s no such guarantee, which is why the choice of coupling matters so much in flow matching. And optimal
transport isn’t always what you want: with paired data, for example, you might want the flow to respect the given pairs
rather than the cheapest ones.</p>

<h2 id="section-8">8. Conclusion</h2>

<p>The main thing I took away from this project is how much follows from one definition. An \(f\)-divergence compares two
distributions through the likelihood ratio, and the convex function \(f\) only decides how deviations of that ratio are
penalized. From there:</p>

<ul>
  <li><strong>Nonnegativity, the data processing inequality and joint convexity</strong> hold for every \(f\), with proofs that are
basically Jensen’s inequality (<a href="#section-2">Section 2</a>).</li>
  <li><strong>They have operational meaning.</strong> Total variation is exactly how well the best classifier can do, and every
\(f\)-divergence is a weighted integral, over all priors, of how much the data lowers the Bayes risk
(<a href="#section-3">Section 3</a>).</li>
  <li><strong>Inequalities</strong> let you compute one divergence and conclude something about another. Pinsker and Le Cam’s method
explain where the familiar \(1/\sqrt n\) comes from (<a href="#section-4">Section 4</a>).</li>
  <li><strong>Locally, they’re all the same</strong>: every smooth \(f\)-divergence is \(f&#39;&#39;(1)/2\) times the same Fisher-information
quadratic (<a href="#section-5">Section 5</a>). That’s the geometry behind natural gradients and trust regions. It also explains
why the \(k_2\) estimator is nearly unbiased near the reference: its average is an \(f\)-divergence with the same \(f&#39;&#39;(1)\)
as the KL it estimates (<a href="#section-6-5-2">Section 6.5.2</a>).</li>
  <li><strong>Estimation from samples</strong> should go through the variational representation, which means through critics and
classifiers, rather than through plugging in empirical frequencies (Sections <a href="#section-6-1">6.1</a>–<a href="#section-6-4">6.4</a>).
When both densities can be evaluated, as with language models, simple per-sample estimators work instead, and the best
of them, \(k_3\), is a small, beautiful application of the freedom in choosing \(f\) (<a href="#section-6-5">Section 6.5</a>).</li>
  <li><strong>Their limitation is structural.</strong> They compare densities point by point, so they’re blind to the geometry of the
space (<a href="#section-7">Section 7</a>).</li>
</ul>

<p>So when should you use which? My paper ended with a comparison between \(f\)-divergences and Wasserstein distance, and I
still think it’s the right summary:</p>

<table>
  <thead>
    <tr>
      <th> </th>
      <th>\(f\)-divergences</th>
      <th>Wasserstein distance</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>What it compares</td>
      <td>the densities, point by point, through \(p/q\)</td>
      <td>how far mass has to move</td>
    </tr>
    <tr>
      <td>Uses the geometry of the space</td>
      <td>no</td>
      <td>yes, through the distance between points</td>
    </tr>
    <tr>
      <td>Disjoint supports</td>
      <td>saturates (TV, \(H^2\), JS) or is infinite (KL, \(\chi^2\))</td>
      <td>stays finite and grows with the distance</td>
    </tr>
    <tr>
      <td>Interpretation</td>
      <td>information and testing: DPI, optimal error, likelihood</td>
      <td>transport cost; a true metric</td>
    </tr>
    <tr>
      <td>Computation</td>
      <td>simple with densities; from samples via variational bounds</td>
      <td>1D: sort the samples; higher dimensions: OT solvers or Lipschitz critics</td>
    </tr>
    <tr>
      <td>Best when</td>
      <td>distributions share support, and distinguishability or information is what matters</td>
      <td>supports may not overlap, or the geometry of the space matters</td>
    </tr>
  </tbody>
</table>

<p>In short: if the distributions live on the same support and you care about how distinguishable they are,
\(f\)-divergences are the natural choice, with a precise meaning in terms of testing and information. If the supports might
not overlap, which is typical for data on low-dimensional manifolds, or if the geometry of the space matters, Wasserstein
distance is the better tool. The price is losing the information-theoretic interpretation and harder computation in high
dimensions.</p>

<p>If you spot a mistake here, I’d be grateful if you <a href="mailto:mihailo.radovic11@gmail.com">let me know</a>.</p>

<h2 id="references">References</h2>

<ol class="references">
  <li id="ref-1">Y. Lipman, R. T. Q. Chen, H. Ben-Hamu, M. Nickel, M. Le. <a href="https://arxiv.org/abs/2210.02747">Flow Matching for Generative Modeling</a>. <em>ICLR</em>, 2023.</li>
  <li id="ref-2">C. M. Bishop. <a href="https://www.microsoft.com/en-us/research/publication/pattern-recognition-machine-learning/"><em>Pattern Recognition and Machine Learning</em></a>, Sections 1.6.1 and 10.1.2. Springer, 2006.</li>
  <li id="ref-3">I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, Y. Bengio. <a href="https://arxiv.org/abs/1406.2661">Generative Adversarial Nets</a>. <em>NeurIPS</em>, 2014.</li>
  <li id="ref-4">M. Arjovsky, L. Bottou. <a href="https://arxiv.org/abs/1701.04862">Towards Principled Methods for Training Generative Adversarial Networks</a>. <em>ICLR</em>, 2017.</li>
  <li id="ref-5">M. Arjovsky, S. Chintala, L. Bottou. <a href="https://arxiv.org/abs/1701.07875">Wasserstein Generative Adversarial Networks</a>. <em>ICML</em>, 2017.</li>
  <li id="ref-6">D. M. Ziegler, N. Stiennon, J. Wu, T. B. Brown, A. Radford, D. Amodei, P. Christiano, G. Irving. <a href="https://arxiv.org/abs/1909.08593">Fine-Tuning Language Models from Human Preferences</a>. arXiv:1909.08593, 2019.</li>
  <li id="ref-7">L. Ouyang et al. <a href="https://arxiv.org/abs/2203.02155">Training Language Models to Follow Instructions with Human Feedback</a>. <em>NeurIPS</em>, 2022.</li>
  <li id="ref-8">A. Tong, K. Fatras, N. Malkin, G. Huguet, Y. Zhang, J. Rector-Brooks, G. Wolf, Y. Bengio. <a href="https://arxiv.org/abs/2302.00482">Improving and Generalizing Flow-Based Generative Models with Minibatch Optimal Transport</a>. <em>TMLR</em>, 2024.</li>
  <li id="ref-9">Y. Polyanskiy, Y. Wu. <a href="https://www.cambridge.org/9781108832908"><em>Information Theory: From Coding to Learning</em></a>. Cambridge University Press, 2025. A <a href="http://www.stat.yale.edu/~yw562/ln.html">prepublication version</a> is free on the authors' website.</li>
  <li id="ref-10">I. Csiszár. <a href="https://real.mtak.hu/201426/">Eine informationstheoretische Ungleichung und ihre Anwendung auf den Beweis der Ergodizität von Markoffschen Ketten</a>. <em>A Magyar Tudományos Akadémia Matematikai Kutató Intézetének Közleményei</em>, 8:85–108, 1963.</li>
  <li id="ref-11">S. M. Ali, S. D. Silvey. <a href="https://doi.org/10.1111/j.2517-6161.1966.tb00626.x">A General Class of Coefficients of Divergence of One Distribution from Another</a>. <em>Journal of the Royal Statistical Society, Series B</em>, 28(1):131–142, 1966.</li>
  <li id="ref-12">M. Merkle. <a href="https://akademska-misao.rs/proizvod/verovatnoca-i-statistika-za-inzenjere-i-studente-tehnike-4-dopunjeno-i-izmenjeno-izd/"><em>Verovatnoća i statistika za inženjere i studente tehnike</em></a> (in Serbian), 4th ed. Akademska misao, Belgrade, 2016.</li>
  <li id="ref-13">S. Dieleman. <a href="https://sander.ai/2020/03/24/audio-generation.html">Generating Music in the Waveform Domain</a>, section "Mode-covering vs. mode-seeking behaviour". Blog post, 2020.</li>
  <li id="ref-14">M. D. Reid, R. C. Williamson. <a href="https://arxiv.org/abs/0901.0356">Information, Divergence and Risk for Binary Experiments</a>. <em>Journal of Machine Learning Research</em>, 12:731–817, 2011.</li>
  <li id="ref-15">I. Sason, S. Verdú. <a href="https://arxiv.org/abs/1508.00335"><em>f</em>-Divergence Inequalities</a>. <em>IEEE Transactions on Information Theory</em>, 62(11):5973–6006, 2016.</li>
  <li id="ref-16">J. Schulman, S. Levine, P. Moritz, M. I. Jordan, P. Abbeel. <a href="https://arxiv.org/abs/1502.05477">Trust Region Policy Optimization</a>. <em>ICML</em>, 2015.</li>
  <li id="ref-17">S. Amari. <a href="https://doi.org/10.1162/089976698300017746">Natural Gradient Works Efficiently in Learning</a>. <em>Neural Computation</em>, 10(2):251–276, 1998.</li>
  <li id="ref-18">J. Schulman, F. Wolski, P. Dhariwal, A. Radford, O. Klimov. <a href="https://arxiv.org/abs/1707.06347">Proximal Policy Optimization Algorithms</a>. arXiv:1707.06347, 2017.</li>
  <li id="ref-19">X. Nguyen, M. J. Wainwright, M. I. Jordan. <a href="https://arxiv.org/abs/0809.0853">Estimating Divergence Functionals and the Likelihood Ratio by Convex Risk Minimization</a>. <em>IEEE Transactions on Information Theory</em>, 56(11):5847–5861, 2010.</li>
  <li id="ref-20">M. I. Belghazi, A. Baratin, S. Rajeswar, S. Ozair, Y. Bengio, A. Courville, R. D. Hjelm. <a href="https://arxiv.org/abs/1801.04062">MINE: Mutual Information Neural Estimation</a>. <em>ICML</em>, 2018.</li>
  <li id="ref-21">S. Nowozin, B. Cseke, R. Tomioka. <a href="https://arxiv.org/abs/1606.00709">f-GAN: Training Generative Neural Samplers using Variational Divergence Minimization</a>. <em>NeurIPS</em>, 2016.</li>
  <li id="ref-22">A. van den Oord, Y. Li, O. Vinyals. <a href="https://arxiv.org/abs/1807.03748">Representation Learning with Contrastive Predictive Coding</a>. arXiv:1807.03748, 2018.</li>
  <li id="ref-23">B. Poole, S. Ozair, A. van den Oord, A. A. Alemi, G. Tucker. <a href="https://arxiv.org/abs/1905.06922">On Variational Bounds of Mutual Information</a>. <em>ICML</em>, 2019.</li>
  <li id="ref-24">J. Schulman. <a href="http://joschu.net/blog/kl-approx.html">Approximating KL Divergence</a>. Blog post, 2020.</li>
  <li id="ref-25">Z. Shao et al. <a href="https://arxiv.org/abs/2402.03300">DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models</a>. arXiv:2402.03300, 2024.</li>
  <li id="ref-26">Hugging Face. <a href="https://github.com/huggingface/trl">TRL: Transformer Reinforcement Learning</a>, <code>trl/trainer/grpo_trainer.py</code> and <code>trl/trainer/rloo_trainer.py</code>. GitHub, accessed September 2026.</li>
  <li id="ref-27">A. Ahmadian, C. Cremer, M. Gallé, M. Fadaee, J. Kreutzer, O. Pietquin, A. Üstün, S. Hooker. <a href="https://arxiv.org/abs/2402.14740">Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs</a>. <em>ACL</em>, 2024.</li>
  <li id="ref-28">Y. Song, S. Ermon. <a href="https://arxiv.org/abs/1907.05600">Generative Modeling by Estimating Gradients of the Data Distribution</a>. <em>NeurIPS</em>, 2019.</li>
  <li id="ref-29">L. Theis, A. van den Oord, M. Bethge. <a href="https://arxiv.org/abs/1511.01844">A Note on the Evaluation of Generative Models</a>. <em>ICLR</em>, 2016.</li>
  <li id="ref-30">C. Villani. <a href="https://doi.org/10.1007/978-3-540-71050-9"><em>Optimal Transport: Old and New</em></a>. Springer, 2009.</li>
  <li id="ref-31">Y. Rubner, C. Tomasi, L. J. Guibas. <a href="https://doi.org/10.1023/A:1026543900054">The Earth Mover's Distance as a Metric for Image Retrieval</a>. <em>International Journal of Computer Vision</em>, 40(2):99–121, 2000.</li>
  <li id="ref-32">V. M. Panaretos, Y. Zemel. <a href="https://arxiv.org/abs/1806.05500">Statistical Aspects of Wasserstein Distances</a>. <em>Annual Review of Statistics and Its Application</em>, 6:405–431, 2019.</li>
  <li id="ref-33">I. Gulrajani, F. Ahmed, M. Arjovsky, V. Dumoulin, A. Courville. <a href="https://arxiv.org/abs/1704.00028">Improved Training of Wasserstein GANs</a>. <em>NeurIPS</em>, 2017.</li>
  <li id="ref-34">J.-D. Benamou, Y. Brenier. <a href="https://doi.org/10.1007/s002110050002">A Computational Fluid Mechanics Solution to the Monge–Kantorovich Mass Transfer Problem</a>. <em>Numerische Mathematik</em>, 84(3):375–393, 2000.</li>
  <li id="ref-35">X. Liu, C. Gong, Q. Liu. <a href="https://arxiv.org/abs/2209.03003">Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow</a>. <em>ICLR</em>, 2023.</li>
  <li id="ref-36">A.-A. Pooladian, H. Ben-Hamu, C. Domingo-Enrich, B. Amos, Y. Lipman, R. T. Q. Chen. <a href="https://arxiv.org/abs/2304.14772">Multisample Flow Matching: Straightening Flows with Minibatch Couplings</a>. <em>ICML</em>, 2023.</li>
</ol>]]></content><author><name>Mihailo Radović</name></author><category term="Divergence" /><category term="Wasserstein distance" /><category term="KL divergence" /><category term="Mathematics" /><category term="Statistics" /><category term="Information Theory" /><summary type="html"><![CDATA[What I learned about f-divergences while writing a seminar paper, and why they keep showing up in machine learning.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mihailoradovic.com/images/f-divergences/forward_reverse_kl.png" /><media:content medium="image" url="https://mihailoradovic.com/images/f-divergences/forward_reverse_kl.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>