Optimal Transport (OT) defines a rigorous geometry for comparing probability distributions by calculating the minimal total work required to transform one distribution into another. In single-cell genomics, this framework treats each batch as a discrete empirical distribution of cells in a high-dimensional gene expression space, and it computes a transport plan—a coupling matrix—that specifies how to map cells from a query batch onto a reference batch while minimizing the sum of squared Euclidean distances between matched cells.
Glossary
Optimal Transport

What is Optimal Transport?
Optimal Transport is a mathematical framework for comparing probability distributions that is used in batch correction to find a minimal-cost mapping or coupling between cells from different batches, aligning their distributions in a principled manner.
Unlike methods that rely solely on Mutual Nearest Neighbors (MNN) or linear corrections, OT-based batch correction solves a convex optimization problem, often regularized with entropic constraints via the Sinkhorn algorithm, to find a globally optimal, probabilistic alignment. This principled approach preserves the underlying biological manifold structure and avoids overcorrection by ensuring that the mapping is a true mathematical coupling, making it highly effective for complex, non-linear batch effects in multi-center studies.
Key Features of Optimal Transport for Batch Correction
Optimal transport provides a rigorous mathematical framework for aligning probability distributions in single-cell data, finding the minimal-cost mapping between cells from different batches to correct technical variation while preserving biological structure.
The Kantorovich Relaxation
Unlike the original Monge formulation requiring a deterministic one-to-one mapping, the Kantorovich relaxation allows probabilistic couplings where mass from a single source cell can be split across multiple target cells. This is critical for batch correction because cell populations often have different sizes across batches. The solution is a transport plan—a joint probability matrix—that specifies how much mass flows between each pair of cells, minimizing the total cost while respecting marginal constraints.
Earth Mover's Distance as a Cost Metric
The Earth Mover's Distance (EMD), also known as the Wasserstein distance, quantifies the minimal cost to transform one distribution into another. In batch correction:
- Cost matrix: Pairwise distances between cells in gene expression space
- Interpretation: EMD captures both the magnitude and geometry of distributional shift
- Advantage over KL divergence: EMD respects the underlying metric space and remains well-defined even when distributions have non-overlapping supports
Entropic Regularization for Computational Tractability
Exact optimal transport computation scales as O(n³ log n), making it prohibitive for large single-cell datasets. Entropic regularization, introduced by Cuturi (2013), adds an entropy penalty to the objective:
- Smooths the transport plan, making the problem strictly convex
- Enables the Sinkhorn algorithm, reducing complexity to O(n²)
- The regularization parameter λ controls the trade-off between precision and speed
- Small λ yields sparse, precise couplings; large λ produces diffuse, faster solutions
Gromov-Wasserstein for Cross-Modality Alignment
When batches are measured in different feature spaces—such as integrating scRNA-seq with scATAC-seq—standard optimal transport fails because cells don't share a common coordinate system. Gromov-Wasserstein (GW) optimal transport compares distributions using intra-domain distances:
- Aligns cells by preserving pairwise similarity structures within each modality
- Matches cells that have analogous relational profiles to their respective neighbors
- Enables translation between fundamentally different molecular measurement technologies
Unbalanced Optimal Transport for Variable Cell Proportions
Standard optimal transport assumes exact mass preservation—every cell must be matched. Unbalanced optimal transport relaxes this constraint using divergence penalties on marginal violations:
- Accounts for cell types present in one batch but absent in another
- Uses Kullback-Leibler divergence or total variation penalties to allow mass creation/destruction
- Critical for realistic scenarios where biological conditions genuinely alter cell-type proportions, not just their distributions
Fused Gromov-Wasserstein for Structured Features
Fused Gromov-Wasserstein (FGW) combines the strengths of both classical and GW optimal transport by optimizing a weighted sum of:
- Feature-level cost: Direct comparison of shared features (like Wasserstein)
- Structure-level cost: Comparison of intra-domain geometries (like GW)
- The trade-off parameter α balances feature fidelity against topological preservation
- Particularly effective when batches share some features but have distinct relational structures, such as integrating spatial transcriptomics with dissociated scRNA-seq
Frequently Asked Questions
Clear, technically precise answers to the most common questions about using optimal transport theory to align probability distributions and correct batch effects in high-dimensional biological data.
Optimal transport (OT) is a mathematical framework for comparing and aligning probability distributions by finding a minimal-cost mapping that transforms one distribution into another. In batch effect correction, OT treats each batch of high-dimensional single-cell data as a discrete probability distribution in gene expression space. The algorithm computes a transport plan—a coupling matrix—that specifies how to move the mass (cells) from a source batch to match the distribution of a target batch, minimizing a cost function typically based on Euclidean distance or geodesic distance in a latent space. This principled alignment preserves the underlying biological structure while removing technical variation, making it particularly effective for integrating heterogeneous single-cell RNA sequencing datasets where non-linear distortions exist between batches.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Master the mathematical and computational frameworks that underpin Optimal Transport-based batch correction. These concepts are essential for understanding how minimal-cost mappings align high-dimensional single-cell distributions.
Wasserstein Distance
The fundamental metric minimized by optimal transport, also known as the Earth Mover's Distance. It quantifies the minimal 'work' required to transform one probability distribution into another by moving probability mass. In batch correction, a low Wasserstein distance between batches after alignment indicates successful harmonization. Unlike f-divergences like KL-divergence, it respects the underlying geometry of the data space.
Kantorovich Relaxation
The convex relaxation of the original Monge optimal transport problem. Instead of finding a deterministic map T that pushes one distribution onto another, it solves for a coupling matrix (or transport plan) that describes the joint distribution with the input and output distributions as marginals. This probabilistic formulation is what makes OT computationally tractable for discrete single-cell data.
Entropic Regularization
A technique that adds an entropy penalty to the standard optimal transport objective, solved via the Sinkhorn algorithm. This makes the optimization strictly convex and allows for fast, differentiable, and GPU-accelerated computation. The regularization parameter trades off precision for speed: a small value yields an exact but slow solution, while a larger value produces a fuzzier, faster coupling.
Gromov-Wasserstein Distance
An extension of optimal transport that compares distributions defined in different metric spaces by aligning their intra-domain distance matrices. This is critical for integrating single-cell datasets from different species or modalities where direct feature correspondence is absent. It matches cells based on the preservation of pairwise similarity structures rather than absolute feature values.
Unbalanced Optimal Transport
A formulation that relaxes the strict mass conservation constraint of classical OT, allowing for the creation or destruction of mass with a penalty. This is vital for batch correction when cell-type proportions differ drastically between batches or when one batch contains a cell population entirely absent from the other. It prevents the algorithm from forcing spurious alignments.
Sinkhorn Divergence
A debiased version of entropic optimal transport that interpolates between pure Wasserstein distance and Maximum Mean Discrepancy (MMD). It corrects for the entropic bias that shrinks the transport distance. This metric is positive definite and can be used directly as a loss function to train neural networks for batch-invariant representation learning.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us