On Approximating Total Variation Distance

Arnab Bhattacharyya, Sutanu Gayen, Kuldeep S. Meel, Dimitrios Myrisiotis, N. V. Vinodchandran

Abstract

While common distance measures like KL divergence are easy to compute for product distributions, this paper proves that exactly calculating the Total Variation (TV) distance is #P-complete—essentially as hard as the most difficult counting problems in computer science. However, the authors provide a silver lining: they develop the first deterministic, fully polynomial-time approximation schemes (FPTAS) for TV distance when one of the distributions is uniform or has a limited number of distinct parameters.

The Challenge of Total Variation Distance

In machine learning, we often need to know how "different" two probability distributions are. Total Variation (TV) distance is a gold-standard metric because it has a clear physical meaning: it represents the maximum possible difference in probability that the two distributions can assign to the same event.

For simple "product distributions" (where each dimension is an independent Bernoulli trial), you might expect distance calculation to be easy. Indeed, for measures like KL divergence or Hellinger distance, the calculation "tensorizes"—meaning you can compute the distance for each dimension independently and combine them. However, TV distance does not tensorize. This paper investigates the computational complexity of TV distance: Is it actually hard to compute for high-dimensional data, and if so, can we at least approximate it efficiently?

Computational Complexity and Hardness

The authors utilize Computational Complexity Theory to prove that exact computation of TV distance is #P-complete, placing it in the same difficulty class as the most challenging counting problems in computer science.

  1. Hardness Reductions: By reducing the problem from #SUBSETPROD, the authors show that a fast algorithm for exact TV distance would solve notoriously difficult combinatorial problems.
  2. The "3-Marginal" Threshold: A striking finding is that exact computation remains #P-complete even if one distribution is extremely simple, possessing only three distinct probability values across all $n$ dimensions. This underscores the fundamental difficulty of the metric.
  3. Bayesian Networks: The complexity increases further with dependencies. For sparse Bayesian networks (even with in-degree 2), deciding if the TV distance is non-zero is NP-complete.

A Deterministic Approximation Framework

Despite the hardness of exact calculation, the paper provides a breakthrough in approximation. The authors transform the estimation of TV distance into a counting problem similar to #KNAPSACK (counting the number of ways to fill a knapsack under a weight limit).

Unlike previous randomized approaches, this work introduces a deterministic framework. The core technique involves dividing the range of possible probability values into logarithmic intervals. By using dynamic programming-based knapsack solvers, the algorithm counts how many outcomes fall into each "bucket" to estimate the total distance.

Logarithmic bucketing of probability values used in the deterministic approximation scheme (FPTAS).

Key Results and Insights

The research clarifies a sharp "complexity phase transition" between exactness and approximation:

  • FPTAS for Uniform $Q$: The authors developed a deterministic algorithm that approximates the TV distance between an arbitrary product distribution $P$ and a uniform distribution $U$ within a factor of $(1+\epsilon)$ in time polynomial in $n$ and $1/\epsilon$.
  • Generalization to Constant Marginals: The FPTAS extends to cases where distribution $Q$ has a constant number of distinct marginal probabilities, providing a near-complete characterization of the complexity landscape for these distributions.
  • Bridging Fields: By reframing probabilistic sums as knapsack-style counting problems, the authors leverage established tools from approximation algorithm literature for statistical distance estimation.

Future Directions

The primary limitation of the current FPTAS is the requirement for one distribution to have a constant number of distinct marginals. If both distributions have $n$ unique marginals, a deterministic polynomial-time algorithm remains elusive. The authors pose a significant open question: Does a deterministic FPTAS exist for the TV distance between two arbitrary product distributions? While randomized versions (FPRAS) exist, a deterministic solution remains a major goal for the field.

Summary updated

BibTeX
@inproceedings{bhattacharyya2023approximating,
  author = {Arnab Bhattacharyya and Sutanu Gayen and Kuldeep S. Meel and Dimitrios Myrisiotis and A. Pavan and N. V. Vinodchandran},
  title = {{On Approximating Total Variation Distance}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/387},
}
Figure