Flow-Based Density Ratio Estimation for Intractable Distributions with Applications in Genomics

Egor Antipov, Alessandro Palma, Lorenzo Consoli, Stephan Günnemann, Andrea Dittadi, Fabian J Theis

Estimating the density ratio between two complex data distributions is a foundational problem in probabilistic modeling. It is essential for hypothesis testing, anomaly detection, and comparing experimental conditions. However, in high-dimensional domains like single-cell genomics—where data points represent the expression levels of thousands of genes in a single cell—calculating these ratios is notoriously difficult.

While modern generative models like Continuous Normalizing Flows (CNFs) can estimate these densities, the "naive" approach of calculating the density for condition A, then for condition B, and dividing them is computationally expensive. Because CNFs require solving an Ordinary Differential Equation (ODE) for every calculation, performing this twice doubles the computational workload. Worse, it compounds "discretization errors" (numerical inaccuracies that accumulate during simulation), leading to highly unstable ratio estimates.

The scRatio Approach

To overcome these limitations, researchers have developed scRatio, a novel method that leverages condition-aware flow matching to estimate density ratios via a single simulation. Instead of treating the two distributions as independent entities, the authors derive a single dynamical formulation that describes how the log-ratio of the densities evolves along a generative trajectory from random noise to structured data.

Key technical innovations include:

  • Single-Trajectory Tracking: The authors prove that the log-ratio can be estimated by integrating a specific vector field along a single generative path. This eliminates the need for two separate ODE simulations.
  • Score-Velocity Hybrid: To prevent numerical instability near the data manifold—where densities become extremely sharp—the model employs a neural network to estimate the "score" (the gradient of the log-density) alongside the velocity field.
  • Error Synchronization: By tracking the ratio along a single path, numerical errors in the numerator and denominator effectively synchronize and cancel out, yielding significantly more stable results than the naive approach.

Applications and Key Results

The paper validates scRatio across synthetic benchmarks and massive real-world biological datasets, demonstrating both computational efficiency and practical utility in genomics.

Superior Accuracy and Efficiency In high-dimensional synthetic Gaussian tests (up to 320 dimensions), scRatio achieved significantly lower error (MAE ~1.16) compared to score-matching baselines (MAE ~2.15–3.55). Furthermore, the method is substantially faster than the naive approach. Interestingly, the relative runtime actually decreased as dimensionality increased, likely due to smoother vector fields in higher dimensions.

Principled Batch Evaluation The authors propose using scRatio to evaluate "batch correction" (the removal of technical noise) in single-cell data, tested on the NeurIPS 2021 and C. Elegans datasets. If a correction is successful, the density ratio between two batches—conditioned on the same cell type—should approach zero, indicating the batch label no longer provides distinguishing information.

Biological Discovery and Patient Stratification Unlike simple binary classifiers that only predict if a cell is treated, scRatio provides a continuous, likelihood-based score quantifying how much a treatment shifts a cell's state.

  • In the ComboSciPlex dataset (~63,000 cells), scRatio successfully identified synergistic drug combinations that caused state shifts greater than the sum of their individual effects.
  • In a massive 10-million-cell PBMC dataset, the model successfully stratified patients into "strong" and "weak" responders to various cytokines, centering log-ratios around zero for non-responsive groups as expected.

Limitations and Future Directions

Despite its advantages, the method has limitations. Most notably, it struggles with "non-overlapping support"—if the two distributions exist in completely different regions of the data space, the ratio can explode or become numerically unstable. Additionally, while inference is fast, training requires separate neural networks for both the velocity field and the score function, which increases the initial setup time.

Future work may focus on failure detection mechanisms, such as inspecting log-ratio histograms to identify when distributions are too far apart for reliable estimation. Ultimately, the authors envision scRatio becoming a standard, open-source tool for likelihood-based comparisons in the single-cell community.

Summary updated

BibTeX
@inproceedings{antipov2026flow,
  author = {Egor Antipov and Alessandro Palma and Lorenzo Consoli and Stephan Günnemann and Andrea Dittadi and Fabian J Theis},
  title = {{Flow-Based Density Ratio Estimation for Intractable Distributions with Applications in Genomics}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=5zbPdMNcl9},
}
Figure