Kd-tree Based Wasserstein Distance Approximation for High-Dimensional Data

Kanata Teshigawara, Keisho Oh, Ken Kobayashi, Kazuhide NakataarXiv 2026

TL;DR

The paper introduces kd-Flowtree, a novel method for approximating the Wasserstein distance (Optimal Transport) in high-dimensional spaces by swapping out quadtrees for $kd$-trees. This simple yet powerful modification allows the underlying tree structure to grow sufficiently deep in high dimensions, drastically improving nearest-neighbor search accuracy while maintaining fast, linear-time computation and low preprocessing overhead.

What Problem Does This Paper Address?

The Wasserstein distance (or Earth Mover's Distance) is a powerful metric for comparing probability distributions, widely used in tasks like document retrieval and image matching. However, calculating it exactly is computationally brutal, scaling cubically ($O(s^3 \log s)$) with the size of the distribution's support ($s$). This makes it impractical for large-scale, real-time retrieval applications.

To solve this, researchers previously proposed tree-based approximations like Flowtree, which embeds data into a quadtree to compute optimal transport matchings in linear time. While elegant, Flowtree suffers from the "curse of dimensionality." In high-dimensional spaces, a standard quadtree splits space into $2^D$ hypercubes at each step. If $D=50$, a single split creates $2^{50}$ regions, causing the tree to terminate almost immediately. Without sufficient tree depth, the approximation accuracy plummets. Other alternatives, like clustering trees, achieve better depth but suffer from painfully slow preprocessing times.

Methods

The authors propose kd-Flowtree, which replaces the quadtree embedding step with a modified $kd$-tree.

Unlike a quadtree, a $kd$-tree partitions space by alternating splits along one dimension at a time at the median coordinate value. To provide theoretical guarantees, the authors introduce a random shift to each split.

The key algorithmic advantages are:

  1. Adaptive Depth: The average depth of a $kd$-tree is $O(\log N)$, completely independent of the dimension $D$. This allows the tree to grow deep even in high-dimensional spaces.
  2. Fast Construction: Building the $kd$-tree takes $O(N \log N)$ time, which is independent of dimension $D$, unlike quadtrees ($O(ND \log N)$) or computationally expensive clustering trees.

Once the $kd$-tree is built, the standard Flowtree algorithm (Algorithm 1) is applied to compute the approximate transport cost.

Datasets

The method was evaluated on three real-world text datasets, where tokens were embedded into 50-, 100-, and 200-dimensional spaces using pretrained GloVe embeddings:

  • 20NEWS: English postings from 20 newsgroups.
  • AMAZON: Consumer reviews across four product categories.
  • BBC: English news articles across five topical sections.

The dataset characteristics are summarized in the paper's Table 2:

Table 2: Dataset size and average support size

Key Insights and Ideas

  • The Depth-Accuracy Link: The core "aha moment" is demonstrating that Flowtree's accuracy is explicitly bound to tree depth. Because quadtrees flatten out instantly in high dimensions, they fail in practical text and image applications. $kd$-trees solve this by splitting dimensions sequentially rather than simultaneously.
  • Dataset-Independent Accuracy: The authors mathematically prove a probabilistic upper bound for kd-Flowtree's search accuracy. Crucially, like the original Flowtree, this bound is independent of the overall dataset size, meaning the approximation quality won't degrade as your database grows.
  • Minor Dimensionality Trade-off: While the theoretical accuracy bound for kd-Flowtree introduces a minor dependence on dimension $D$ (unlike quadtrees), the authors show that in practice, this factor is negligible compared to the massive gains achieved by having a deeper tree.

Key Results

  • Superior Accuracy (Recall@k): In nearest-neighbor retrieval experiments across all datasets and dimensions (50, 100, 200), kd-Flowtree consistently and significantly outperformed the original quadtree-based Flowtree and 1-Greedy baseline methods, trailing only behind the much slower Sinkhorn approximation.
  • Faster Total Runtime: When accounting for preprocessing (tree construction), kd-Flowtree proved highly efficient. As the embedding dimension $D$ increased, the total runtime gap between kd-Flowtree and standard Flowtree widened significantly, showcasing the $kd$-tree's construction speed advantage in high dimensions. Clustering-tree methods (1-Greedy(C)) were sometimes slower than even the exact calculation due to preprocessing overhead.

Limitations and Future Work

While kd-Flowtree performs exceptionally well in practice, its theoretical guarantees do exhibit a slight decay as the dimensionality ($D$) scales up. Additionally, the current implementation assumes uniform weights across the distribution's support points.

For future work, the authors suggest exploring the application of $kd$-tree embeddings to other domains of optimal transport beyond nearest-neighbor retrieval.

Summary updated

BibTeX
@misc{teshigawara2026kd,
  author = {Kanata Teshigawara and Keisho Oh and Ken Kobayashi and Kazuhide Nakata},
  title = {{Kd-tree Based Wasserstein Distance Approximation for High-Dimensional Data}},
  year = {2026},
  eprint = {2601.12975},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.12975},
}
Figure