Introduction
A multi-batch single-cell RNA-seq dataset mixes two kinds of variation. Cells differ because they are different cell types or states, and they also differ because they were captured in different batches: different protocols, laboratories, donors or chemistries. An integration method has to return a representation in which comparable cells from different batches sit together, while cells that are biologically different stay apart. The scIB benchmark measures both halves, biological conservation and batch correction, over a suite of metrics [1].
The difficulty is that the method never sees a label that says which variation is which. In this task the only annotation is the batch code. Anything that removes between-batch variation risks removing biology that happens to be unevenly distributed across batches, which is the usual case when batches differ in composition. The field has answered this in several ways. Linear-model and empirical-Bayes corrections regress the batch out of every gene [2, 3]. Anchor methods find mutual nearest neighbours between batches and treat them as the same cell state [4, 5, 6]. Harmony alternates soft clustering, with a penalty that rewards clusters mixing all batches, with cluster-wise linear correction [7]. Graph methods leave the embedding alone and balance the neighbour graph across batches [8]. Deep generative models condition a count likelihood on the batch [9]. The task also offers two pretrained single-cell transformers [10, 11], whose zero-shot embeddings have been reported to integrate batches poorly [12, 13].
Two further constraints of this task shape our design. The method learns in fit on one split and
must represent, in embed, cells that may come from donors fit never saw. And it may return
either an embedding or a kNN graph, or both. We chose to work with the raw counts only, to treat
Harmony as a strong but incomplete first step, and to ask what can be added after it that removes
more of the batch signal without removing biology.
Method
Our method uses no transformer (it spends none of the forward budget and trains no parameters). It is a fixed sequence of six stages: a basis fitted once, then five operations on the scored cells, followed by a graph read-out.
A deterministic basis fitted on the adaptation split
In fit we log-normalise each cell, ,
select 2000 highly variable genes with a batch-aware selection, standardise each selected gene with
the mean and standard deviation of the adaptation split, and keep 50 principal components. Every
quantity here is a function of genes and of global distributions, not of particular cells, so the
basis transfers to cells from donors or protocols the adaptation split did not contain. In embed
the scored cells are projected through the same panel, the same statistics and the same rotation.
We compute the components by an eigendecomposition of the covariance rather than by a randomised SVD, and fix the sign of each component so that its largest-magnitude loading is positive. This was not a stylistic choice: in development the randomised solver produced slightly different bases in different processes, and that difference moved the downstream neighbourhood metrics by more than some of the design decisions we were trying to compare (Section 4).
# Deterministic PCA via covariance eigendecomposition (sklearn's
# randomised SVD varies across processes through threaded BLAS,
# which measurably perturbs downstream neighbourhood metrics).
C = (Z.T @ Z) / max(Z.shape[0] - 1, 1)
evals, evecs = np.linalg.eigh((C + C.T) / 2.0)
order = np.argsort(-evals)
V = evecs[:, order][:, :k]
# sign convention: largest-|loading| entry of each PC is positive
jmax = np.argmax(np.abs(V), axis=0)
signs = np.sign(V[jmax, np.arange(k)])
signs[signs == 0] = 1.0
self.components_ = (V * signs[None, :]).astype(np.float64)
self.n_components_ = k
class _P: # minimal stand-in exposing the attribute fit() logs
n_components_ = k
self.pca = _P()
return self
def transform(self, counts):
X = np.asarray(_lognorm(counts)[:, self.panel].todense())
Z = (X - self.mu) / self.sd
return (Z @ self.components_).astype(np.float32)The pipeline at embed time
The scored cells pass through five stages in a fixed order. Each one has a fallback that returns its input unchanged if it fails, so a failing stage degrades the method to the stages before it.
pcs = self.basis.transform(ctx.counts)
batch = np.asarray(ctx.batch)
z = np.asarray(pcs, dtype=np.float32)
multi_batch = len(np.unique(batch)) >= 2
if ctx.n_cells >= 100 and multi_batch:
z = _harmony(z, batch, log=ctx.log)
z = _mnn_refine(z, batch, step=0.5, iters=2)
z = _discriminant_shrink(z, batch, seed=0)
z = _mnn_refine(z, batch, step=0.3, iters=1)
z = _diffuse(z, alpha=self.DIFFUSE_ALPHA, steps=self.DIFFUSE_STEPS, k=15)
elif ctx.n_cells >= 100:
z = _diffuse(z, alpha=self.DIFFUSE_ALPHA, steps=self.DIFFUSE_STEPS, k=15)
z = np.asarray(z, dtype=np.float32)
z = np.nan_to_num(z, nan=0.0, posinf=0.0, neginf=0.0)
np.clip(z, -6.0e4, 6.0e4, out=z)
z = reduce_dim(z, self.max_dim, 0)Averaged Harmony. We run Harmony [7] on the 50 components with three fixed initialisations and average the three corrected embeddings, . Harmony returns its output in the coordinate system of its input whatever the initialisation, so the average is itself a valid embedding. A single run's result depends noticeably on its random initialisation; the average does not, and it makes the whole method deterministic.
Mutual-neighbour attraction, propagated within batches
After Harmony, some batch offset remains at the level of individual neighbourhoods. We estimate it from anchors, in the spirit of mutual-nearest-neighbour correction [4]. For cells in batch and in batch , the pair is an anchor if is among the nearest neighbours of inside batch and is among the nearest neighbours of inside batch . Defining anchors per batch pair matters: with many batches, a cell's overall nearest neighbours may all come from one batch, and a global mutual-neighbour test then finds few anchors for the others. Every anchor cell with partners receives the correction toward the midpoint with its partners,
The correction is then spread to cells that are not anchors, on the assumption that batch effects are locally smooth. Over each cell's 15 nearest neighbours within its own batch, with Gaussian weights whose bandwidth is the batch's median distance to the fifteenth neighbour, we average the corrections of the anchor neighbours, . An anchor moves by , any other cell by (a cell with no anchor among those neighbours moves by , so not at all if it is not an anchor), and the whole field is applied with a step : . The first pass uses for two iterations; the second pass, after the shrinkage stage, uses for one.
keys = src * np.int64(n) + dst
keys_sorted = np.sort(keys)
rev = dst * np.int64(n) + src
mutual_mask = np.isin(rev, keys_sorted, assume_unique=False)
ms, md = src[mutual_mask], dst[mutual_mask]
if len(ms) == 0:
break
M = sp.csr_matrix((np.ones(len(ms)), (ms, md)), shape=(n, n))
M.data[:] = 1.0
deg = np.asarray(M.sum(1)).ravel()
has = deg > 0
partner_mean = (M @ Z) / np.maximum(deg, 1)[:, None]
corr = np.zeros_like(Z)
corr[has] = 0.5 * (partner_mean[has] - Z[has])
# within-batch Gaussian smoothing from own-batch cache (k_smooth)
# rebuild own-batch neighbour lists with larger k if needed
ks = k_smooth + 1
rows_l, cols_l, w_l = [], [], []
for b in batches:
m = members[b]
if len(m) < 3:
continue
nn = NearestNeighbors(n_neighbors=min(ks, len(m))).fit(Z[m])
d, li = nn.kneighbors(Z[m])
sig = np.median(d[:, -1]) + 1e-9
w = np.exp(-(d[:, 1:] ** 2) / (2 * sig ** 2))
rows_l.append(np.repeat(m, li.shape[1] - 1))
cols_l.append(m[li[:, 1:]].ravel())
w_l.append(w.ravel())
if rows_l:
Wm = sp.csr_matrix((np.concatenate(w_l),
(np.concatenate(rows_l), np.concatenate(cols_l))), shape=(n, n))
Wm = Wm.multiply(has.astype(float)[None, :]).tocsr()
rs = np.asarray(Wm.sum(1)).ravel()
prop = (Wm @ corr) / np.maximum(rs, 1e-9)[:, None]
blended = np.where(has[:, None], 0.5 * corr + 0.5 * prop, prop)
blended = np.where((rs > 0)[:, None], blended, corr)
else:
blended = corr
Z = Z + step * blendedThe implementation finds the mutual pairs without a loop over batch pairs: each directed candidate is encoded as the integer , and a pair is mutual when its reverse key is in the sorted key set.
Conditional discriminant shrinkage
The second correction acts on directions rather than on cells. We cluster the current embedding with k-means into clusters and treat a cluster as a set of comparable cells. Within cluster , the deviation of batch 's centroid from the cluster centroid is batch effect at fixed biology, so we collect it into a conditional between-batch scatter, counting only cluster-batch cells with at least three members,
The generalised eigenproblem gives directions ordered by the fraction of their total variance that is conditional between-batch variance, . We solve it by whitening, and , and shrink the coordinates along the top 15 directions by
A direction that is almost entirely batch is pulled strongly toward the mean; a direction that is almost entirely biology is barely touched. This is softer than projecting a batch subspace out, and within the top 15 directions the strength of the removal is set by the data rather than by a hard cut.
km = KMeans(n_clusters=min(K, n // 10), n_init=4, random_state=int(seed)).fit(Z)
cl = km.labels_
Sb = np.zeros((D, D))
for k in np.unique(cl):
m = cl == k
muk = Z[m].mean(0)
for b in np.unique(batch):
mb = m & (batch == b)
nb = int(mb.sum())
if nb >= 3:
d = (Z[mb].mean(0) - muk)[:, None]
Sb += nb * (d @ d.T)
Sb /= n
St = (Zc.T @ Zc) / n + 1e-6 * np.eye(D)
evals_t, evecs_t = np.linalg.eigh(St)
W = evecs_t @ np.diag(1.0 / np.sqrt(np.maximum(evals_t, 1e-12))) @ evecs_t.T
M = W @ Sb @ W
lam, U = np.linalg.eigh((M + M.T) / 2)
order = np.argsort(-lam)
lam, U = lam[order], U[:, order]
proj = (Zc @ W) @ U
nd = int(min(n_dirs, D))
shrink = np.ones(D)
shrink[:nd] = 1.0 / (1.0 + alpha * np.maximum(lam[:nd], 0.0))
Zc2 = ((proj * shrink[None, :]) @ U.T) @ np.linalg.inv(W)
out = (Zc2 + mu).astype(np.float32)Diffusion over the integrated manifold
The last stage denoises cell positions along the neighbourhood structure the earlier stages created. On the kNN graph of the embedding (), with Gaussian weights whose bandwidth for cell is its distance to the fifteenth neighbour, symmetrised by an elementwise maximum and row-normalised to , we apply two steps of
This is a low-pass filter on the graph: it tightens groups of cells that are already neighbours and pulls stragglers toward their neighbourhoods, which helps cluster-based conservation metrics and local batch mixing together.
idx, dist = _knn(Z, k)
sig = np.maximum(dist[:, -1:], 1e-9)
w = np.exp(-(dist[:, 1:] ** 2) / (2 * sig ** 2))
rows = np.repeat(np.arange(n), idx.shape[1] - 1)
W = sp.csr_matrix((w.ravel(), (rows, idx[:, 1:].ravel())), shape=(n, n))
W = W.maximum(W.T)
rs = np.asarray(W.sum(1)).ravel()
rs[rs == 0] = 1.0
Wn = sp.diags(1.0 / rs) @ W
out = Z.copy()
for _ in range(int(steps)):
out = (1.0 - alpha) * out + alpha * (Wn @ out)
out = out.astype(np.float32)A batch-balanced graph read-out
Besides the embedding, we return a kNN graph built from it with per-cell neighbour quotas, in the manner of batch-balanced neighbour graphs [8]. Each cell takes neighbours in total: a fraction of them from the other batches, split evenly among those batches (any remainder going to the batches whose nearest cell is closest), and the rest from its own batch. Edges carry Gaussian weights of their true distances with the median distance as bandwidth, the graph is symmetrised by a maximum, and every row is pruned to its 90 strongest edges, which bounds the degree of hub cells that symmetrisation creates. The graph changes no cell's position; it only decides which neighbours a graph-based metric sees.
k_total = int(min(k_total, n - 1))
k_cross = int(round((B - 1) / B * k_total))
k_within = k_total - k_cross
need = max(k_within, int(np.ceil(k_cross / max(B - 1, 1)))) + 1
members, cache = {}, {}
for b in batches:
m = np.nonzero(batch == b)[0]
members[b] = m
nn = NearestNeighbors(n_neighbors=min(need, len(m))).fit(Z[m])
cache[b] = nn.kneighbors(Z)
rows_l, cols_l, dist_l = [], [], []
for i in range(n):
bi = batch[i]
cand_i, cand_d = [], []
d, li = cache[bi][0][i], cache[bi][1][i]
start = 1 if (len(d) > 0 and d[0] == 0.0) else 0
sel = min(k_within, len(d) - start)
if sel > 0:
cand_i.extend(members[bi][li[start:start + sel]].tolist())
cand_d.extend(d[start:start + sel].tolist())
others = [b for b in batches if b != bi]
if others:
quota = {b: k_cross // (B - 1) for b in others}
rem = k_cross - quota[others[0]] * (B - 1)
by_first = sorted(others, key=lambda b: cache[b][0][i][0]
if len(cache[b][0][i]) else np.inf)
for j in range(rem):
quota[by_first[j % len(by_first)]] += 1
for b in others:
d, li = cache[b][0][i], cache[b][1][i]
sel = min(quota[b], len(d))
if sel > 0:
cand_i.extend(members[b][li[:sel]].tolist())
cand_d.extend(d[:sel].tolist())The method has no per-setting constants. Its only branches are on the number of cells and the number of batches present, and they exist so that tiny or single-batch inputs fall back to fewer stages; above 65535 cells the graph is not built and only the embedding is returned.
Results
| Method | ① | ② | ③ | ④ | ⑤ | ⑥ | ⑦ | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Batch-integration score ↑ | Bio-conservation ↑ | Batch-integration score ↑ | Bio-conservation ↑ | Batch-integration score ↑ | Bio-conservation ↑ | Batch-integration score ↑ | Bio-conservation ↑ | Batch-integration score ↑ | Bio-conservation ↑ | Batch-integration score ↑ | Bio-conservation ↑ | Batch-integration score ↑ | Bio-conservation ↑ | |
| Muse Wonder Full | 0.785 | 0.908 | 0.661 | 0.735 | 0.473 | 0.684 | 0.762 | 0.799 | 0.504 | 0.616 | 0.493 | 0.544 | 0.634 | 0.698 |
| Frozen Geneformer | 0.315 | 0.548 | 0.417 | 0.641 | 0.365 | 0.639 | 0.504 | 0.525 | 0.461 | 0.674 | 0.426 | 0.612 | 0.408 | 0.640 |
| Constant embedding | 0.440 | 0.350 | 0.447 | 0.357 | 0.443 | 0.342 | 0.439 | 0.349 | 0.424 | 0.369 | 0.425 | 0.375 | 0.427 | 0.360 |
| Random-target MLM | 0.252 | 0.389 | 0.303 | 0.335 | 0.342 | 0.332 | 0.325 | 0.349 | 0.326 | 0.303 | 0.311 | 0.306 | 0.366 | 0.317 |
| HVG + PCA | 0.425 | 0.723 | 0.476 | 0.698 | 0.290 | 0.684 | 0.543 | 0.706 | 0.451 | 0.720 | 0.476 | 0.660 | 0.414 | 0.691 |
| Harmony | 0.757 | 0.894 | 0.694 | 0.760 | 0.501 | 0.708 | 0.738 | 0.750 | 0.537 | 0.707 | 0.542 | 0.628 | 0.583 | 0.743 |
| Scanorama | 0.686 | 0.822 | 0.678 | 0.766 | 0.381 | 0.677 | 0.654 | 0.779 | 0.494 | 0.722 | 0.429 | 0.641 | 0.578 | 0.692 |
| scVI | 0.756 | 0.847 | 0.720 | 0.747 | 0.521 | 0.677 | 0.751 | 0.791 | 0.573 | 0.732 | 0.580 | 0.649 | 0.676 | 0.772 |
| Geneformer, continued MLM | 0.342 | 0.545 | 0.374 | 0.624 | 0.325 | 0.630 | 0.451 | 0.623 | 0.432 | 0.702 | 0.416 | 0.617 | 0.346 | 0.626 |
| scGPT, ECS + DAB | 0.545 | 0.726 | 0.639 | 0.742 | 0.469 | 0.725 | 0.676 | 0.766 | 0.490 | 0.705 | 0.547 | 0.639 | 0.607 | 0.742 |
| CLEAR | 0.340 | 0.561 | 0.398 | 0.642 | 0.333 | 0.679 | 0.505 | 0.628 | 0.410 | 0.699 | 0.442 | 0.628 | 0.366 | 0.648 |
| CONCORD | 0.685 | 0.803 | 0.642 | 0.697 | 0.532 | 0.656 | 0.647 | 0.750 | 0.554 | 0.683 | 0.565 | 0.626 | 0.696 | 0.789 |
| sysVI | 0.691 | 0.858 | 0.663 | 0.710 | 0.488 | 0.714 | 0.651 | 0.757 | 0.494 | 0.707 | 0.539 | 0.648 | 0.585 | 0.748 |
| scCRAFT | 0.822 | 0.826 | 0.720 | 0.753 | 0.574 | 0.700 | 0.792 | 0.784 | 0.584 | 0.709 | 0.602 | 0.621 | 0.632 | 0.667 |
| scCobra | 0.720 | 0.806 | 0.675 | 0.744 | 0.479 | 0.682 | 0.681 | 0.776 | 0.522 | 0.693 | 0.528 | 0.640 | 0.613 | 0.708 |
| DRVI | 0.721 | 0.827 | 0.683 | 0.735 | 0.477 | 0.645 | 0.743 | 0.789 | 0.526 | 0.734 | 0.543 | 0.647 | 0.683 | 0.771 |
| VICReg | 0.577 | 0.631 | 0.617 | 0.702 | 0.462 | 0.424 | 0.727 | 0.788 | 0.560 | 0.660 | 0.573 | 0.602 | 0.635 | 0.728 |
| ComBat | 0.712 | 0.838 | 0.572 | 0.713 | 0.481 | 0.665 | 0.655 | 0.777 | 0.492 | 0.698 | 0.531 | 0.641 | 0.665 | 0.677 |
| SCA | 0.498 | 0.721 | 0.408 | 0.659 | 0.327 | 0.677 | 0.574 | 0.744 | 0.434 | 0.718 | 0.474 | 0.651 | 0.508 | 0.674 |
| SCALEX | 0.546 | 0.641 | 0.541 | 0.568 | 0.499 | 0.563 | 0.615 | 0.664 | 0.466 | 0.529 | 0.450 | 0.502 | 0.485 | 0.518 |
| LIGER | 0.669 | 0.720 | 0.620 | 0.658 | 0.482 | 0.585 | 0.738 | 0.737 | 0.513 | 0.614 | 0.532 | 0.553 | 0.567 | 0.619 |
| Density-Adaptive BBSG | 0.691 | 0.798 | 0.673 | 0.721 | 0.494 | 0.646 | 0.678 | 0.759 | 0.566 | 0.513 | 0.549 | 0.458 | 0.629 | 0.659 |
| Zero-shot scGPT | 0.493 | 0.687 | 0.523 | 0.691 | 0.431 | 0.692 | 0.567 | 0.746 | 0.491 | 0.690 | 0.535 | 0.637 | 0.517 | 0.664 |
| Zero-shot SCimilarity | 0.460 | 0.710 | 0.495 | 0.732 | 0.365 | 0.691 | 0.546 | 0.753 | 0.420 | 0.735 | 0.453 | 0.667 | 0.504 | 0.747 |
| fastMNN | 0.718 | 0.841 | 0.704 | 0.771 | 0.456 | 0.694 | 0.734 | 0.807 | 0.480 | 0.692 | 0.531 | 0.635 | 0.621 | 0.723 |
| mnnCorrect | 0.693 | 0.802 | 0.647 | 0.765 | 0.381 | 0.685 | 0.685 | 0.789 | ||||||
| limma removeBatchEffect | 0.600 | 0.727 | 0.497 | 0.696 | 0.459 | 0.677 | 0.697 | 0.784 | 0.444 | 0.686 | 0.490 | 0.649 | 0.612 | 0.677 |
| Harmony, R package | 0.723 | 0.828 | 0.667 | 0.756 | 0.499 | 0.716 | 0.702 | 0.789 | 0.530 | 0.694 | 0.562 | 0.623 | 0.675 | 0.715 |
| LIGER, R package | 0.683 | 0.681 | 0.632 | 0.665 | 0.478 | 0.590 | 0.766 | 0.761 | 0.523 | 0.619 | 0.512 | 0.542 | 0.589 | 0.645 |
| scMerge2 | 0.726 | 0.834 | 0.675 | 0.728 | 0.507 | 0.604 | 0.704 | 0.755 | 0.509 | 0.593 | 0.536 | 0.643 | 0.630 | 0.642 |
| Seurat CCA | 0.744 | 0.861 | 0.621 | 0.710 | 0.490 | 0.559 | 0.721 | 0.766 | 0.502 | 0.633 | 0.518 | 0.574 | 0.634 | 0.749 |
| Seurat RPCA | 0.758 | 0.876 | 0.680 | 0.756 | 0.522 | 0.656 | 0.750 | 0.784 | 0.493 | 0.649 | 0.525 | 0.585 | 0.624 | 0.773 |
| STACAS | 0.713 | 0.835 | 0.653 | 0.743 | 0.446 | 0.689 | 0.727 | 0.785 | 0.485 | 0.687 | 0.501 | 0.604 | 0.588 | 0.785 |
| BBKNN | 0.462 | 0.969 | 0.430 | 0.822 | 0.301 | 0.665 | 0.410 | 0.845 | 0.290 | 0.641 | 0.326 | 0.583 | 0.358 | 0.673 |
| Zero-shot UCE | 0.532 | 0.664 | 0.610 | 0.717 | 0.448 | 0.677 | 0.530 | 0.702 | 0.497 | 0.723 | 0.542 | 0.650 | 0.570 | 0.679 |
| Zero-shot CellPLM | 0.515 | 0.697 | 0.483 | 0.708 | 0.364 | 0.684 | 0.555 | 0.710 | 0.471 | 0.709 | 0.472 | 0.644 | 0.521 | 0.700 |
| Zero-shot scPRINT | 0.424 | 0.590 | 0.558 | 0.658 | 0.446 | 0.648 | 0.537 | 0.567 | 0.505 | 0.614 | 0.454 | 0.591 | 0.546 | 0.584 |
| scGPT fine-tuned, OpenProblems | 0.466 | 0.686 | 0.515 | 0.728 | 0.432 | 0.671 | 0.557 | 0.730 | 0.486 | 0.709 | 0.504 | 0.638 | 0.540 | 0.697 |
- ① human pancreas, technology batches
- ② human immune, donor/study batches
- ③ human lung atlas, donor batches
- ④ human kidney (diabetic kidney disease), donor batches, single-nucleus
- ⑤ human cross-tissue atlas (GTEx), donor batches, single-nucleus
- ⑥ human multi-organ atlas (Tabula Sapiens), donor-by-assay batches
- ⑦ human cross-tissue immune atlas (Immune Cell Atlas), donor batches
Harmony is the alignment our method starts from, so it is the comparison that isolates what our stages add. Measured against it, the record is mixed.
On Pancreas and Kidney-DKD the added stages help on both metrics. On Pancreas our overall score is 0.785 against Harmony's 0.757, second only to scCRAFT [17] at 0.822, and our bio-conservation of 0.908 is behind only BBKNN, graph output [8] (0.969). On Kidney-DKD the overall score is 0.762 against Harmony's 0.738 and the best baseline's 0.792 (scCRAFT [17]), with bio-conservation of 0.799 against Harmony's 0.750. On ICA the overall score rises above Harmony's (0.634 against 0.583) while bio-conservation falls (0.698 against 0.743), which is the pattern of a method that buys batch mixing with biology.
On the other four settings our method is below Harmony on both metrics. On Immune and Lung the gap is small: an overall score of 0.661 against 0.694, and 0.473 against 0.501. On GTEx and TabulaSap the gap in bio-conservation is large. Our bio-conservation there is 0.616 and 0.544, against Harmony's 0.707 and 0.628, and below both the unintegrated HVG + PCA baseline (0.720 and 0.660) and the frozen Geneformer embedding (0.674 and 0.612). On those two settings our stages remove structure that the scIB conservation metrics count as biological.
The best baseline is not the same on every setting, and scVI [9] is ahead of us on the overall score on every setting except Pancreas and Kidney-DKD. Our reading, from the development data, is that the method is a strong refinement where batches share their cell states and a harmful one where they do not.
How we got here
We developed the method on three public benchmark datasets with held-out cell-type labels, scored locally with the scIB metrics; we refer to them as development datasets A, B and C. The labels were used only to score. The figures below are our development measurements, not evaluation results.
- Harmony set the bar, and plain conditional alignment did not reach it. On dataset A, Harmony on 50 log-normalised components scored a development total of 0.779, and scVI 0.772. Our first candidate was conditional alignment: cluster the cells, then shift each batch's cells inside each cluster onto the cluster mean. It scored 0.674, with a Leiden ARI of 0.47, because plain k-means clusters of an unintegrated embedding are batch-pure, so within-cluster shifts have nothing to align. Harmony's diversity penalty, which forces clusters to contain all batches, is exactly the mechanism this lacks. We therefore stopped trying to replace Harmony and built on top of it.
- Both refinements helped on their own, and more in sequence. After Harmony, mutual-neighbour attraction raised dataset A to 0.794 and conditional shrinkage with to 0.786. The order MNN, shrinkage, MNN gave 0.802 on dataset A and 0.639 on dataset B (Harmony: 0.626), and became the core of the stack.
- A count-based neural encoder was rejected for generality. We built a negative-binomial autoencoder trained with binomial thinning of the counts as augmentation, the natural augmentation for count data. Its raw latent had excellent cluster biology on dataset A (Leiden ARI 0.95), and variants with VICReg-style regularisation [20] were worse. As a base under our stack it gained on batch correction but lost on biology, and on dataset B it scored 0.600 against 0.639 for the PCA stack, so we kept the PCA basis.
- Diffusion was a clear gain. Smoothing over the kNN graph raised dataset A from 0.802 to 0.812, mostly through biology; a sweep chose for two steps (0.821 on dataset A). In the last minutes of the run a stronger setting, for two steps, won on all three datasets by our own summary (by 0.011 on dataset B), and it is what we submitted.
- The balanced graph was a gain where the graph is used. Under graph-based metrics it added 0.09 to 0.11 in iLISI and about 0.05 in kBET on dataset A with unchanged Leiden NMI and ARI. A first version produced extreme hub cells after symmetrisation; the row pruning removes them.
- Per-batch-pair anchors mattered. A faster global MNN cost about 0.01 against a pairwise loop; defining anchors per batch pair, vectorised by integer keys, matched the pairwise result exactly (0.821 on dataset A, 0.641 on dataset B) at three times the speed.
- Dataset C was the failure we did not fix. On dataset C our stack scored 0.671 against Harmony's 0.685. An ablation located the loss: the first MNN pass alone took the Leiden ARI from 0.79 to 0.64, while Harmony followed by diffusion alone scored 0.687. Anchor quality did not explain it cleanly: 95% of anchors on dataset A joined cells of the same label, 82% on dataset C, but only 68% on dataset B, where the stack still helped. We examined a distance-ratio criterion for anchors (it did not separate good from bad anchors), trust-region caps, rigid per-cluster shifts in place of per-cell attraction, a gate that corrected only clusters that were already mixed, and a label-free selection criterion based on neighbourhood agreement across split gene sets (it did not track the true conservation score). None was adopted. We then found that one batch of dataset C was distributed in normalised (TPM) units rather than counts, and with that batch removed our stack beat Harmony there too (0.688 against 0.677). Since this task guarantees raw counts, we concluded the regression was an artefact of that batch and kept the stack. The evaluation results on GTEx and TabulaSap suggest that this conclusion was at best incomplete.
- Determinism was engineered, not assumed. Single-initialisation Harmony gave development totals between 0.802 and 0.821 on dataset A across initialisations, mostly through kBET; averaging three gave 0.816 with a spread of 0.0004. Later, an apparent gain from in the shrinkage stage turned out to be cross-process variation of the randomised PCA; on the deterministic basis against was a wash (+0.002 on dataset A, −0.002 on dataset B), and we kept .
- Other variants were rejected on mixed evidence. A second Harmony round helped datasets A and C but cost 0.009 on dataset B; shrinkage before MNN, MNN with , diffusion over 10 or 25 neighbours and other cross-batch fractions in the graph were all mixed or negative.
On a split that held some donors of dataset B out of fit, the stack scored 0.694 against 0.577 for
the unintegrated reference, which is what persuaded us that the fitted basis transfers.
Limitations
- The method hurts biology on part of the evaluation. On GTEx and TabulaSap our bio-conservation is below Harmony's, below HVG + PCA and below the frozen Geneformer embedding. Both the MNN attraction and the conditional shrinkage assume that comparable cells exist in every batch, and that what differs between batches inside a cluster is technical. Where batches differ in composition, or where adjacent cell states form a continuum, mutual neighbours bridge different states and the shrinkage removes directions that carry biology. Our development data showed this failure, and our explanation of it appears to have been incomplete.
- No stage knows when to stop. Every refinement is applied with fixed strength. We tried to gate the corrections without labels and failed; a method that measured, without labels, whether a correction is removing batch or biology would address the main weakness here.
- Our gains are partly inherited. Most of the improvement over the unintegrated baselines comes from Harmony itself; our stages add to it on Pancreas and Kidney-DKD and the overall score of ICA, and subtract from it elsewhere.
- The design was chosen on three datasets. Constants such as the shrinkage strength, the MNN steps and the diffusion strength were selected on development datasets A, B and C, and the final diffusion strength in the run's last minutes, on small margins. The evaluation shows that the three were not representative of every setting.
- The pretrained models are unused. We did not touch either transformer. That is permitted, but it means the method says nothing about how to adapt a single-cell foundation model for integration, which is half of what the task offers.
References
- Malte D. Luecken, M. Büttner, K. Chaichoompu et al. (2022). Benchmarking atlas-level data integration in single-cell genomics. Nature Methods.
- W. Evan Johnson, Cheng Li, Ariel Rabinovic (2007). Adjusting batch effects in microarray expression data using empirical Bayes methods. Biostatistics.
- Matthew E. Ritchie, Belinda Phipson, Di Wu et al. (2015). limma powers differential expression analyses for RNA-sequencing and microarray studies. Nucleic Acids Research.
- Laleh Haghverdi, Aaron T L Lun, Michael D Morgan et al. (2018). Batch effects in single-cell RNA-sequencing data are corrected by matching mutual nearest neighbors. Nature Biotechnology.
- Tim Stuart, Andrew Butler, Paul Hoffman et al. (2019). Comprehensive Integration of Single-Cell Data. Cell.
- Brian Hie, Bryan Bryson, Bonnie Berger (2019). Efficient integration of heterogeneous single-cell transcriptomes using Scanorama. Nature Biotechnology.
- Ilya Korsunsky, Nghia Millard, Jean Fan et al. (2019). Fast, sensitive and accurate integration of single-cell data with Harmony. Nature Methods.
- Krzysztof Polański, Matthew D Young, Zhichao Miao et al. (2020). BBKNN: fast batch alignment of single cell transcriptomes. Bioinformatics.
- Romain Lopez, Jeffrey Regier, Michael B. Cole et al. (2018). Deep generative modeling for single-cell transcriptomics. Nature Methods.
- Christina V. Theodoris, Ling Xiao, Anant Chopra et al. (2023). Transfer learning enables predictions in network biology. Nature.
- Haotian Cui, Chloe Wang, Hassaan Maan et al. (2024). scGPT: toward building a foundation model for single-cell multi-omics using generative AI. Nature Methods.
- Kasia Z. Kedzierska, Lorin Crawford, Ava P. Amini et al. (2023). Assessing the limits of zero-shot foundation models in single-cell biology. bioRxiv.
- Rebecca Boiarsky, Nalini Singh, Alejandro Buendia et al. (2023). A Deep Dive into Single-Cell RNA Sequencing Foundation Models. bioRxiv.
- Wenkai Han, Yuqi Cheng, Jiayang Chen et al. (2022). Self-supervised contrastive learning for integrative single cell RNA-seq data analysis. Briefings in Bioinformatics.
- Qin Zhu, Zuzhi Jiang, Binyamin Zuckerman et al. (2026). Revealing a coherent cell-state landscape across single-cell datasets with CONCORD. Nature Biotechnology.
- Karin Hrovatin, Amir Ali Moinfar, Luke Zappia et al. (2025). Integrating single-cell RNA-seq datasets with substantial batch effects. BMC Genomics.
- Chuan He, Paraskevas Filippidis, Steven H. Kleinstein et al. (2025). Partially characterized topology guides reliable anchor-free scRNA-integration. Communications Biology.
- Bowen Zhao, Kailu Song, Dong-Qing Wei et al. (2025). scCobra allows contrastive cell embedding learning with domain adaptation for single cell data integration and harmonization. Communications Biology.
- Amir Ali Moinfar, Fabian J. Theis (2024). Disentangling cellular heterogeneity into interpretable biological factors through structured latent representations. bioRxiv.
- Adrien Bardes, Jean Ponce, Yann LeCun (2022). VICReg: Variance-Invariance-Covariance Regularization for Self-Supervised Learning. ICLR.
- Benjamin DeMeo, Bonnie Berger (2023). SCA: recovering single-cell heterogeneity through information-based dimensionality reduction. Genome Biology.
- Lei Xiong, Kang Tian, Yuzhe Li et al. (2022). Online single-cell data integration through projecting heterogeneous datasets into a common cell-embedding space. Nature Communications.
- Joshua D. Welch, Velina Kozareva, Ashley Ferreira et al. (2019). Single-Cell Multi-omic Integration Compares and Contrasts Features of Brain Cell Identity. Cell.
- Stephen Chung, Wenyu Du (2025). The Station: An Open-World Environment for AI-Driven Discovery.
- Graham Heimberg, Tony Kuo, Daryle J. DePianto et al. (2025). A cell atlas foundation model for scalable search of similar human cells. Nature.
- Yingxin Lin, Shila Ghazanfar, Kevin Y. X. Wang et al. (2019). scMerge leverages factor analysis, stable expression, and pseudoreplication to merge multiple single-cell RNA-seq datasets. Proceedings of the National Academy of Sciences.
- Yuhan Hao, Tim Stuart, Madeline H. Kowalski et al. (2024). Dictionary learning for integrative, multimodal and scalable single-cell analysis. Nature Biotechnology.
- Massimo Andreatta, Santiago J Carmona (2021). STACAS: Sub-Type Anchor Correction for Alignment in Seurat to integrate single-cell RNA-seq data. Bioinformatics.
- Yanay Rosen, Yusuf Roohani, Ayush Agrawal et al. (2023). Universal Cell Embeddings: A Foundation Model for Cell Biology. bioRxiv.
- Hongzhi Wen, Wenzhuo Tang, Xinnan Dai et al. (2024). CellPLM: Pre-training of Cell Language Model Beyond Single Cells. ICLR.
- Jérémie Kalfon, Jules Samaran, Gabriel Peyré et al. (2025). scPRINT: pre-training on 50 million cells allows robust gene network predictions. Nature Communications.