Introduction
The Earth Mover’s Distance (EMD)—also known as the Wasserstein distance—is the "gold standard" for measuring the similarity between two probability distributions. Whether comparing the word frequencies in two documents or the pixel intensities in two images, EMD is highly effective because it accounts for the "ground distance" between coordinates (e.g., how semantically similar two different words are).
However, EMD has a fatal flaw: computational cost. Solving it exactly typically scales cubically ($O(h^3)$) with the size of the distributions. While "Relaxed" versions like the Relaxed Word Mover's Distance (RWMD) exist to bring this down to linear time, they fail miserably on "dense" data. For instance, if two images have identical pixel coordinates but different brightness levels, previous fast approximations often mistakenly calculate a distance of zero.
Researchers from IBM have developed a new suite of algorithms that approximate the EMD with linear time complexity and massive data parallelism. By introducing smarter constraints on how "mass" is transferred between distributions, their ACT (Approximate Iterative Constrained Transfers) algorithm achieves a staggering 10,000x speedup over state-of-the-art methods like Sinkhorn’s algorithm and WMD, while maintaining or even improving search accuracy.
Methods: Constraining the Flow
To bridge the gap between the speed of linear-complexity approximations and the robustness required for dense, overlapping data, the authors propose three nested relaxation algorithms. These provide increasingly tight lower bounds on the true EMD:
- Overlapping Mass Reduction (OMR): A simple preprocessing step that "cancels out" mass at identical coordinates for free before calculating the remaining distance.
- Iterative Constrained Transfers (ICT): This method relaxes the strict "in-flow" constraint of the standard EMD problem but adds a crucial capacity constraint: you cannot move more mass into a destination bin than that bin actually holds ($F_{i,j} \le q_j$).
- Approximate ICT (ACT): Because ICT can still be computationally heavy, ACT limits the number of transfer iterations to a constant $k$.
The Capacity Constraint
The primary "aha moment" of this research is realizing that previous fast approximations (like RWMD) were too loose. They allowed an infinite amount of mass to be dumped into the "cheapest" destination bin. By simply enforcing that a destination bin has a finite capacity, the lower bound becomes much tighter and significantly more useful for real-world data. Furthermore, the researchers found a principle of diminishing returns: most of the accuracy gain comes from the very first iteration of mass transfer (ACT-1), meaning we can get "good enough" results extremely quickly.
Hardware-Algorithm Alignment
The "secret sauce" for scaling this up is LC-ACT (Linear-Complexity ACT). It reformulates the problem into a series of dense matrix-matrix multiplications and top-$k$ selections. By moving away from the sequential, pointer-heavy logic of traditional network-flow solvers, this structure is perfectly suited for GPUs. It allows the algorithm to compare a single query document against an entire database of thousands of documents simultaneously.
Datasets and Key Results
The authors evaluated their methods on two classic benchmarks:
- 20 Newsgroups: A text dataset where documents are represented as histograms of 300-dimensional Word2Vec embeddings.
- MNIST: A dataset of 60,000 grayscale handwritten digits, where the "coordinates" are the 2D pixel positions ($28 \times 28 = 784$ bins) and the "weights" are the pixel intensities.
The results demonstrate massive improvements in both speed and robustness:
- Speed: On the 20 Newsgroups dataset, the new algorithms were four orders of magnitude (10,000x) faster than a multi-threaded CPU implementation of Word Mover’s Distance.
- Accuracy: On MNIST, ACT-1 achieved higher nearest-neighbor search accuracy than the popular Sinkhorn’s algorithm while being 10,000x faster on the same GPU hardware.
- Robustness: In a stress test where background noise (black pixels) was included in MNIST images, the previous state-of-the-art fast approximation (RWMD) collapsed to 10% precision. The authors' OMR and ACT methods maintained high precision (97%+), proving they can handle overlapping coordinates that baffle simpler models.
Limitations and Future Work
While groundbreaking for similarity search, the proposed methods provide a lower bound to the EMD. This is excellent for pruning, but it is not a replacement for the exact EMD in applications where an upper bound or the exact value is strictly required. Additionally, the algorithm introduces a hyperparameter $k$ (number of iterations). While $k=1$ works well for many cases, complex datasets might require tuning to find the optimal balance between speed and precision. Finally, formal proofs of optimality for the ICT flow were omitted for brevity, suggesting that further theoretical exploration of these relaxations could be a fruitful area for future academic work.
Summary updated