Mutual Nearest Neighbors (MNN) is a batch correction algorithm that identifies pairs of cells from different batches that are mutual nearest neighbors in a high-dimensional expression space, meaning each cell is the other's closest neighbor across batches. These MNN pairs define a set of correspondences used to estimate a correction vector that shifts one batch's expression values toward the other, effectively removing systematic technical variation while preserving genuine biological heterogeneity.
Glossary
Mutual Nearest Neighbors (MNN)

What is Mutual Nearest Neighbors (MNN)?
A computational technique for identifying corresponding cell populations across different experimental batches to estimate and remove technical variation in single-cell data.
The method operates on the principle that cells of the same biological type should be more similar to each other than to cells of different types, regardless of batch origin. By applying a locally weighted correction based on the identified MNN pairs, the algorithm aligns the expression distributions of two batches without assuming a global linear transformation, making it robust to complex, non-linear batch effects commonly observed in single-cell RNA sequencing experiments.
Key Characteristics of MNN Correction
The Mutual Nearest Neighbors (MNN) method identifies robust biological correspondences between batches by finding cell pairs that are mutual best matches in high-dimensional space, using these 'anchors' to estimate and remove technical variation while preserving genuine biological heterogeneity.
The Mutual Nearest Neighbor Concept
A pair of cells from different batches forms an MNN pair when each cell is the other's nearest neighbor in a shared feature space. This reciprocity filters out spurious matches that arise from random sampling noise or batch-specific outliers. The logic is that if two cells are mutual best matches despite originating from different technical batches, they likely represent the same biological state. This concept originates from image alignment and manifold alignment theory, where MNN pairs serve as reliable landmarks for warping one distribution onto another.
Correction Vector Estimation
Once MNN pairs are identified, a correction vector is computed for each pair as the difference in expression between the two cells. For cells not part of an MNN pair, a correction is estimated by taking a weighted average of the correction vectors from the nearest MNN pairs in the reference batch. This smoothing step ensures that the correction varies smoothly across the expression manifold. The method applies this vector to the query batch cells, effectively subtracting the estimated batch effect while preserving the within-batch biological structure.
Ordered Merging Strategy
MNN correction integrates batches sequentially rather than all at once. The process begins by selecting the largest batch as the reference. The next batch is corrected onto this reference, and the two are merged. This merged dataset then serves as the new reference for the subsequent batch. This hierarchical merging strategy is computationally efficient and ensures that the reference representation grows more robust with each step. The order of merging is typically determined by batch size, but can be guided by data quality metrics.
Preservation of Biological Heterogeneity
A key advantage of MNN is that it only corrects cells that have a mutual match, leaving batch-unique cell types untouched. If a cell population exists only in one batch, it will not form an MNN pair and will not receive a correction vector, preventing the overcorrection that plagues global alignment methods. This makes MNN particularly suitable for atlas-scale integration where batches may contain distinct cell types. The method explicitly assumes that batch effects are orthogonal to biological space, operating only along dimensions of technical variation.
Cosine Normalization Preprocessing
MNN correction typically employs cosine normalization on the input expression matrix before identifying neighbors. This step divides each cell's expression profile by its L2 norm, projecting all cells onto a unit hypersphere. This normalization removes library size effects and focuses the neighbor search on relative expression patterns rather than absolute counts. On the hypersphere, Euclidean distance is equivalent to cosine dissimilarity, making the nearest neighbor search robust to differences in sequencing depth between batches.
Limitations and Diagnostics
MNN assumes that batch effects are constant across the expression space, which may not hold for complex, non-linear technical artifacts. The method also requires sufficient overlap in cell types between batches to find enough MNN pairs for robust correction. Diagnostic tools include examining the number of MNN pairs identified and the distribution of correction vector magnitudes. A low number of pairs or extremely large correction vectors may indicate poor batch overlap or severe technical variation that violates the method's assumptions.
Frequently Asked Questions
Clear, technical answers to the most common questions about Mutual Nearest Neighbors (MNN) batch effect correction, covering its mechanism, comparison to other methods, and practical application in single-cell data integration.
Mutual Nearest Neighbors (MNN) is a batch correction algorithm that identifies pairs of cells from different batches that reside in each other's nearest neighbor sets in a high-dimensional expression space, using these 'mutual' pairs as anchors to estimate and remove systematic technical variation. The method operates on the principle that cells in a MNN pair represent the same biological state across batches, and the expression difference between them is therefore a pure estimate of the batch effect. The algorithm first performs a principal component analysis (PCA) to reduce dimensionality, then for each cell in a query batch, it searches for its nearest neighbors in a reference batch. If a query cell is a nearest neighbor of a reference cell, and that reference cell is also a nearest neighbor of the query cell, they form a MNN pair. A correction vector is computed as the difference in expression profiles between the paired cells, and this vector is applied to the query batch. A key innovation is that the correction vector is smoothed using a Gaussian kernel weighted by the distance to multiple MNN pairs, preventing overcorrection to a single pair. The process is then repeated sequentially, merging corrected batches into the reference for subsequent rounds.
MNN vs. Other Batch Correction Methods
A feature-level comparison of Mutual Nearest Neighbors against other widely used batch correction algorithms for single-cell RNA sequencing data integration.
| Feature | MNN | Harmony | Seurat CCA |
|---|---|---|---|
Core Algorithm | Identifies mutual nearest neighbor pairs across batches to estimate correction vectors | Iterative soft clustering with maximum diversity clustering on PCA embeddings | Canonical correlation analysis to identify shared correlation structures and find anchors |
Requires Pre-selected Reference Batch | |||
Handles More Than 2 Batches | |||
Preserves Biological Heterogeneity | |||
Output Format | Corrected gene expression matrix | Harmonized low-dimensional embedding | Integrated expression matrix and corrected embeddings |
Computational Complexity | O(N^2) for MNN identification | O(N) per iteration | O(N^2) for anchor finding |
Typical Runtime (100k cells) | 10-30 min | 2-5 min | 15-45 min |
Assumes Shared Cell Types Across 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
Key concepts, algorithms, and evaluation metrics that define the Mutual Nearest Neighbors approach to batch effect correction in single-cell genomics.
Batch Effect
A systematic non-biological source of variation introduced across different experimental batches—such as different processing dates, reagents, or technicians—that can confound downstream analysis. MNN correction directly addresses this by identifying matching cell populations between batches and estimating a correction vector that removes technical noise while preserving genuine biological heterogeneity.
Scanorama
An algorithm for integrating heterogeneous single-cell datasets that identifies mutual nearest neighbors across all pairs of datasets and stitches them together into a unified panorama. Scanorama extends the core MNN concept by searching for matches across multiple datasets simultaneously, effectively correcting for batch effects in large-scale atlas-building projects without requiring a reference batch.
BBKNN (Batch-balanced KNN)
A graph-based data integration algorithm that constructs a k-nearest neighbor graph where each cell is connected to neighbors from each batch independently. Unlike MNN, which identifies explicit paired correspondences, BBKNN removes batch structure from the neighborhood graph itself, making it complementary to MNN-based methods and particularly effective for visualizing integrated data with UMAP or t-SNE.
k-nearest Neighbor Batch Effect Test (kBET)
A quantitative metric that evaluates the degree of batch mixing by comparing the local batch label distribution in a k-nearest neighbor graph to the global batch distribution. A perfect mix yields a chi-squared test acceptance rate near 1.0. kBET is a standard validation tool for assessing whether MNN correction has successfully removed batch-specific clustering.
Overcorrection Assessment
The process of evaluating whether a batch correction method has removed true biological variation alongside technical noise. For MNN, this is measured by the preservation of known cell-type clusters and the variance explained by biological covariates. Key indicators of overcorrection include the merging of distinct cell types or the loss of rare subpopulations that were present in only one batch.
Residual Batch Effect
Systematic technical variation that remains in a dataset after an initial batch correction procedure has been applied. In MNN workflows, residual effects often indicate an incomplete modeling of the experimental design—such as unaccounted-for processing sub-batches—and may require a secondary correction step or the inclusion of additional covariates in the design matrix.

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