Inferensys

Glossary

scVI (Single-cell Variational Inference)

A deep generative model based on a variational autoencoder that models single-cell RNA-seq data with a zero-inflated negative binomial distribution, explicitly accounting for batch effects as a latent variable for probabilistic normalization.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
DEFINITION

What is scVI (Single-cell Variational Inference)?

scVI is a deep generative model that uses a variational autoencoder to model single-cell RNA-seq data with a zero-inflated negative binomial distribution, explicitly accounting for batch effects as a latent variable for probabilistic normalization.

scVI (Single-cell Variational Inference) is a deep generative model that combines a variational autoencoder with a zero-inflated negative binomial (ZINB) distribution to probabilistically model single-cell RNA sequencing data. It explicitly treats batch effects as a learned latent variable, enabling the simultaneous normalization, imputation, and visualization of scRNA-seq data without assuming linear corrections.

Unlike linear methods such as ComBat, scVI learns a non-linear, probabilistic mapping of gene expression to a low-dimensional latent space that captures biological variability while conditioning out technical artifacts. The model estimates library size and batch-specific scaling factors as part of its generative process, producing denoised, batch-corrected expression estimates that preserve the inherent uncertainty and zero-inflation characteristic of single-cell data.

PROBABILISTIC NORMALIZATION

Core Characteristics of scVI

scVI (Single-cell Variational Inference) is a deep generative model that uses a variational autoencoder with a zero-inflated negative binomial distribution to model single-cell RNA-seq data, explicitly treating batch effects as a latent variable for probabilistic normalization.

01

Zero-Inflated Negative Binomial (ZINB) Likelihood

scVI models raw UMI counts directly using a ZINB distribution, which explicitly accounts for two key properties of scRNA-seq data: overdispersion (variance exceeding the mean) and zero-inflation (an excess of zero counts due to dropout events).

  • The ZINB is parameterized by three outputs from the decoder: mean expression (μ), gene-specific dispersion (r), and a dropout probability (π)
  • This avoids the need for arbitrary log-transformations or pseudocount additions that distort the data distribution
  • The model learns that a zero count can arise from either true biological absence or technical dropout, preserving biological signals
02

Latent Variable Batch Correction

Batch effects are modeled as a latent variable within the variational autoencoder framework, allowing scVI to learn a batch-agnostic representation of cell state.

  • A one-hot encoded batch identifier is provided as an input to the decoder alongside the latent cell representation
  • The encoder learns to produce a latent space that captures biological variation only, while the decoder uses the batch ID to reconstruct batch-specific technical artifacts
  • This design enables probabilistic batch correction where uncertainty is propagated rather than producing a single point estimate
03

Library Size Normalization

scVI handles varying sequencing depths through an explicit library size factor that is modeled as an observed random variable.

  • The model conditions on the log-transformed total UMI count per cell, treating it as a known covariate
  • This separates technical variation in total counts from genuine biological differences in gene expression proportions
  • The approach is more robust than global scaling methods like CPM normalization because it is integrated into the probabilistic generative process
04

Amortized Variational Inference

scVI uses amortized inference through a shared encoder neural network, enabling rapid posterior approximation for thousands of cells without per-cell optimization.

  • The encoder maps each cell's gene expression vector to the parameters of a Gaussian posterior distribution over the latent space
  • This is computationally efficient: once trained, new cells can be embedded with a single forward pass
  • The reparameterization trick enables gradient-based optimization of the evidence lower bound (ELBO) using stochastic gradient descent
05

Differential Expression with Uncertainty

scVI provides a Bayesian framework for differential expression testing that accounts for both biological variability and technical uncertainty.

  • Posterior samples are drawn from the latent space to generate multiple plausible expression estimates for each gene in each condition
  • A Bayes factor or log-fold change distribution is computed, providing a measure of statistical confidence
  • This approach naturally handles the zero-inflated nature of the data without relying on ad-hoc pseudocounts or arbitrary detection thresholds
06

Scalable Training with minibatches

scVI is trained using minibatch stochastic variational inference, allowing it to scale to datasets with millions of cells.

  • The training procedure subsamples cells and genes at each iteration, keeping memory requirements constant regardless of dataset size
  • This enables the model to be applied to atlas-scale integration projects such as the Human Cell Atlas
  • The architecture supports GPU acceleration, with training times scaling sub-linearly with the number of cells
SCVI DEEP DIVE

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the scVI probabilistic framework for single-cell data normalization and analysis.

scVI (single-cell Variational Inference) is a deep generative model that uses a variational autoencoder (VAE) architecture to model single-cell RNA-seq data. It explicitly represents the observed gene expression counts as being drawn from a zero-inflated negative binomial (ZINB) distribution, which naturally accounts for the overdispersion and dropout events characteristic of scRNA-seq data. The model learns a low-dimensional latent representation of each cell that captures true biological heterogeneity. Critically, scVI treats batch identifiers as a latent variable within the decoder, conditioning the reconstructed gene expression on both the biological latent code and the batch assignment. This forces the encoder to learn a batch-invariant representation of cell state, achieving probabilistic normalization without the need for a separate, post-hoc correction step. Training proceeds via stochastic variational inference, maximizing the evidence lower bound (ELBO).

Prasad Kumkar

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.