BoMb-OT: On Batch of Mini-batches Optimal Transport

Khai Nguyen, Quoc Nguyen, Nhat Ho, Tung Pham, Hung Bui, Dinh Phung, Trung Le

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 measuring distances between probability distributions by finding the most efficient way to transform one into another. However, its computational complexity—typically $O(n^3 \log n)$ for $n$ samples—limits its direct application to large-scale datasets. Mini-batch OT (m-OT) was introduced to mitigate this by averaging OT costs over random subsets. While computationally efficient, m-OT fails to satisfy the identity property (the distance between identical distributions is non-zero) and ignores the structural relationships between different mini-batches, leading to noisy gradients and suboptimal transportation plans.

The BoMb-OT Framework

We propose Batch of Mini-batches Optimal Transport (BoMb-OT), a hierarchical approach that treats mini-batches as individual entities within a higher-dimensional space. Unlike m-OT, which applies uniform weights to all mini-batch pairs, BoMb-OT optimizes the coupling between them.

Conceptual comparison between Full OT, mini-batch OT (m-OT), and the proposed Batch of Mini-batches OT (BoMb-OT).

The method operates in two distinct stages:

  1. Local OT Computation: We calculate the OT distance between every pair of mini-batches sampled from the source and target distributions.
  2. Meta-OT Optimization: Instead of a simple average, we solve a "meta" OT problem to determine the optimal coupling between the mini-batches themselves. This step identifies which mini-batches are most representative of each other across the distributions.

This hierarchical structure restores the identity property, making BoMb-OT a more theoretically sound approximation of the true Wasserstein distance. Furthermore, the resulting transportation plan is sparser and more informative, as only the most relevant batch pairs drive the optimization process.

Experimental Evaluation

BoMb-OT was evaluated across a variety of tasks, demonstrating consistent improvements over standard mini-batch methods.

Deep Generative Modeling and Domain Adaptation

In generative tasks on MNIST, CIFAR10, and CelebA, BoMb-OT achieved lower FID scores and more stable convergence. In Deep Domain Adaptation, the benefits were particularly pronounced for small batch sizes. For instance, on the SVHN-to-MNIST task with a batch size of 10, BoMb-OT improved classification accuracy by 19.08% over m-OT. On the Office-Home benchmark, the unbalanced version (BoMb-UOT) outperformed several state-of-the-art methods in the majority of tasks.

Color Transfer

Qualitative results in color transfer tasks highlight the precision of BoMb-OT. While standard m-OT often produces "averaging" artifacts due to its uniform weighting of batches, BoMb-OT generates images that are visually closer to the target palette while maintaining realistic textures.

Qualitative comparison of color transfer results between m-OT and BoMb-OT.

Conclusion

BoMb-OT addresses the fundamental theoretical and practical limitations of standard mini-batch OT. By introducing a hierarchical meta-OT step, it restores metric properties and improves the quality of transportation plans across diverse applications. While it introduces some computational overhead due to the $k^2$ local OT problems, this is manageable with modern GPU implementations. Future research will explore extending this framework to Gromov-Wasserstein distances for comparing distributions in incomparable spaces.

Summary updated

BibTeX
@inproceedings{nguyen2022bomb,
  author = {Khai Nguyen and Quoc Nguyen and Nhat Ho and Tung Pham and Hung Bui and Dinh Phung and Trung Le},
  title = {{BoMb-OT: On Batch of Mini-batches Optimal Transport}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=apBEkTYv8gj},
}
Figure