On Transportation of Mini-batches: A Hierarchical Approach

Khai T. Nguyen, Dang Nguyen, Quoc P. Nguyen, Tung Pham, Hung Bui, Dinh Phung, Trung Le, Nhat Ho · DOI

Abstract

Mini-batch optimal transport (m-OT) has been successfully used in practical applications that involve probability measures with a very high number of supports. The m-OT solves several smaller optimal transport problems and then returns the average of their costs and transportation plans. Despite its scalability advantage, the m-OT does not consider the relationship between mini-batches which leads to undesirable estimation. Moreover, the m-OT does not approximate a proper metric between probability measures since the identity property is not satisfied. To address these problems, we propose a novel mini-batch scheme for optimal transport, named Batch of Mini-batches Optimal Transport (BoMb-OT), that finds the optimal coupling between mini-batches and it can be seen as an approximation to a well-defined distance on the space of probability measures. Furthermore, we show that the m-OT is a limit of the entropic regularized version of the BoMb-OT when the regularized parameter goes to infinity. Finally, we carry out experiments on various applications including deep generative models, deep domain adaptation, approximate Bayesian computation, color transfer, and gradient flow to show that the BoMb-OT can be widely applied and performs well in various applications.

Introduction

Optimal Transport (OT) provides a robust framework for comparing probability distributions by finding the most efficient way to map one to another. While powerful, its computational complexity—roughly $O(n^3 \log n)$ for $n$ data points—makes it impractical for large-scale datasets. To circumvent this, researchers often employ mini-batch OT (m-OT), which averages OT costs across randomly sampled mini-batch pairs.

However, m-OT has significant drawbacks. It treats all mini-batch pairs as equally important, ignoring the underlying structure of the data. Critically, m-OT fails the identity property: the cost of transporting a distribution to itself is non-zero. This prevents m-OT from being a true metric, potentially leading to instability in training regimes like Generative Adversarial Networks (GANs).

Methodology: Batch of Mini-batches Optimal Transport (BoMb-OT)

To resolve these issues, we introduce Batch of Mini-batches Optimal Transport (BoMb-OT). Unlike standard m-OT, which uses uniform weighting for all mini-batch pairs, BoMb-OT employs a hierarchical approach to find an optimal coupling between the mini-batches themselves.

The BoMb-OT framework compared to standard m-OT. BoMb-OT solves an "outer" OT problem to find optimal weights for mini-batch pairs, whereas m-OT uses uniform weights.

The BoMb-OT process involves three key stages:

  1. Local OT Computation: For $k$ mini-batches from distribution $A$ and $k$ from distribution $B$, we compute the OT cost for all $k \times k$ possible pairs.
  2. Global Coupling: We solve a "meta" OT problem using the $k \times k$ cost matrix to determine the optimal matching between mini-batches.
  3. Aggregation: The final transportation plan is an aggregation of local plans, weighted by the global coupling.

This formulation ensures that BoMb-OT satisfies the identity property, making it a mathematically well-behaved metric. Furthermore, we demonstrate that standard m-OT is a limiting case of BoMb-OT under infinite entropic regularization of the global coupling.

Experimental Evaluation

We evaluated BoMb-OT across several domains to demonstrate its versatility and performance:

  • Deep Generative Models: Benchmarked on MNIST, CIFAR10, and CelebA.
  • Deep Domain Adaptation: Tested on Digits (SVHN $\to$ MNIST), VisDA (Synthetic $\to$ Real), and the Office-Home dataset.
  • Color Transfer: Applied to natural images and artistic works.
  • Approximate Bayesian Computation (ABC): Evaluated using synthetic multivariate Gaussian data.

Key Results and Insights

BoMb-OT consistently outperforms standard m-OT across various metrics. In generative modeling, it achieves lower FID and Wasserstein-2 scores. In domain adaptation, it improved accuracy on the VisDA dataset by 1-2% and outperformed baselines in the majority of Office-Home tasks.

Qualitative results for color transfer. BoMb-OT produces a more faithful representation of the target palette compared to m-OT, which can suffer from artifacts.

Beyond quantitative improvements, BoMb-OT offers qualitative advantages. In color transfer tasks, it avoids the "color bleeding" common in m-OT, resulting in cleaner, more accurate transfers. The method is also computationally efficient; while it solves more OT problems, the small size of mini-batches allows for fast GPU-accelerated computation of local plans, while the outer problem remains manageable on the CPU.

Conclusion and Future Work

BoMb-OT provides a theoretically sound and practically effective hierarchical framework for mini-batch optimal transport. By restoring the identity property and intelligently coupling mini-batches, it offers a more robust metric for deep learning applications. Future research will explore extending this hierarchical approach to Gromov-Wasserstein distances for comparing distributions in different metric spaces and further refining its application in unbalanced OT scenarios.

Summary updated

BibTeX
@inproceedings{nguyen2022transportation,
  author = {Khai T. Nguyen and Dang Nguyen and Quoc P. Nguyen and Tung Pham and Hung Bui and Dinh Phung and Trung Le and Nhat Ho},
  title = {{On Transportation of Mini-batches: A Hierarchical Approach}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=apBEkTYv8gj},
}
Figure