When a tissue is wounded or inflamed, fibroblasts do not all respond the same way. Some become chemokine-secreting inflammatory cells, some become contractile scar-forming myofibroblasts, and some stay quiet. A drug or a disease shifts the proportions of these fates as much as it shifts gene expression within any one fate. Current generative models of single-cell perturbation describe a cell's response as one continuous movement through gene-expression space. In such a model, "which fate" is never a quantity it represents. We propose a different model. The fate decision becomes an explicit stochastic branch in the program: sample which branch a cell takes, then run a branch-specific continuous flow, possibly branching again. The branch structure comes from an existing fibroblast nomenclature, so both the decision probabilities and the within-fate responses can be predicted, supervised, and checked separately.
The core bet is scientific, not a speed claim. Making fate an explicit, sampled branch point should predict held-out fate proportions and the bimodal shape of responses better than a single flow does. It should also do this without collapsing within-fate variation, which a simple compositional regression would do. Stochastic control flow is the modeling language that makes this natural. Native branch operators are what let the model train over millions of cells when the branch tree is deep. Both claims are tested, and the systems claim is allowed to fail.
Why this gap is real
The closest work, scDFM, uses conditional flow matching to learn a velocity field that carries the unperturbed cell population to the perturbed one. Flow matching is a generator trained to follow straight-line paths between paired samples. scDFM adds a distribution-matching penalty and a gene-gene attention mask built from static Pearson correlations, and it reports a 19.6% MSE reduction over CellFlow on combinatorial genetic perturbations. scDFM motivates our proposal: its own ablations show that distribution-level losses matter most, and its authors warn that "the mean is a trap." It also supplies our base method, since each branch in our model is an scDFM-style flow. It differs from our proposal in that it has one path family and one fixed gene graph for every cell. It therefore cannot say what fraction of cells chose which fate, and it cannot condition the gene graph on that choice.
The biology supplies the branch structure. The cross-tissue skin fibroblast atlas defines healthy subtypes F1–F5 and disease subtypes F6–F8, and shows that F2, F3, F6 and F7 recur across lung, gut, synovium, heart and other organs. Its 58,823-cell human wound time course has F6 inflammatory myofibroblasts peaking near day 7 before F7 myofibroblasts appear by day 30, and F6 enrichment tracks scarring risk. Guerrero-Juarez et al. show a further divergence, in which wound myofibroblasts can become regenerative adipocytes. The atlas authors flag that their subtype assignment depends on scPoli uncertainty estimates that may blur tissue-specific differences. Our model treats subtype membership as a latent branch variable with a posterior, rather than a hard label, which speaks directly to that concern.
On the systems side, Control Flow Operators in PyTorch supplies compiler-visible cond, while_loop, map and scan operators, and notes that autograd through while_loop is unfinished. TensorFlow Fold's dynamic batching supplies a way to batch variable-structure computations: identical operations from different inputs are grouped, and gather/concat steps move data between them. It is also a cautionary result, since it runs up to 60% slower than static batching when structures happen to be uniform. Rockmate constrains our memory planning. Its block-wise re-materialization reaches 2–5x activation savings, but only on traceable, sequential graphs, which our sampled branch paths are not.
Core Claim
A cell's response to a condition $c$ (perturbation, disease, or wound day) is modeled as a path through a fate tree $T$ with nodes $v$. At each internal node the model samples a child with probability $\pi_\theta(v' \mid v, x, c)$, where $x$ is the cell's current expression. Along the chosen edge it applies a branch-specific flow $u_{\phi_{v'}}(x, t, c)$, a learned velocity field. The predicted population is
$$ p(x_{\text{out}} \mid c) = \sum_{\text{paths } \gamma \in T} \prod_{(v \to v') \in \gamma} \pi_\theta(v' \mid v, x_v, c)\; \cdot \; \text{flow}_{\gamma}(x_{\text{in}}), $$
where $\gamma$ is a root-to-leaf path and $\text{flow}_\gamma$ composes the edge flows along it. Paths have different lengths: a quiescent F2 cell may stop at the root while another passes through F6 to F7. This variable depth is why the program needs real control flow rather than a fixed set of output heads. The claim is that this factorization predicts held-out composition and held-out within-fate distributions better than scDFM's single flow, and better than a compositional regression with per-fate means.
Research Program
The tree is first built from the atlas hierarchy: a root with healthy states, an F2/F3 to F6 edge, an F6 to F7 edge, an F7 to F8 edge, and a branch toward the adipocyte-like fate where data support it. Leaf supervision comes from atlas annotations, softened by their uncertainty. Intermediate branch choices stay latent and are trained with a straight-through relaxation of the discrete sample, with a REINFORCE estimator as a control. Each edge flow is trained with scDFM's flow-matching-plus-MMD objective, where MMD is a kernel distance between generated and observed cell populations. The edge flows may use edge-specific gene masks, which tests whether a fate-conditioned gene graph helps over scDFM's single static one.
For execution, cells in a minibatch are grouped by their sampled path prefix, and each edge flow runs once per group via cond/map, in the manner of Fold's depth-wise batching. Variable depth is handled with a bounded scan, not while_loop, because autograd for the latter is incomplete. This version is compared against a dense version that evaluates every branch for every cell and masks the unused ones.
Baselines
The naive reference has two parts. The first is a no-change predictor that returns the control population. The second is a per-condition mean shift: the average treated-minus-control expression applied to every cell. scDFM warns that the mean shift can look deceptively strong on MSE, so we report it under every metric.
The strongest existing method is scDFM. The file reports only its relative result, a 19.6% MSE reduction over CellFlow on Norman combinatorial perturbations, and no absolute score. We will rerun it from its released configuration on identical splits, with the same backbone width, GPU-hours and hyperparameter search budget as our model. We also run a second scDFM variant that receives the atlas subtype label as an extra input, so that any gain from our model cannot be attributed to label information alone. Beating scDFM means a lower energy distance on held-out conditions with non-overlapping bootstrap intervals, together with lower error on predicted fate proportions. It also means an MSE no worse than scDFM's.
The third baseline is compositional regression. It predicts subtype proportions from the condition with a multinomial model, then samples cells from each subtype's empirical or Gaussian conditional distribution. This is the cheapest model that "knows about fates."
Two ablations isolate the key ingredient. The first, a soft-mixture model with identical parameters and no sampled branch, blends edge velocities by their probabilities. The second, a flat-mixture model, replaces the tree with one level of K leaves, which removes variable depth.
Why not just…?
Why not just use scDFM, which already matches distributions? In principle a single flow can match a bimodal target, so the model may not lose on population-level distance. Our claim is narrower. A single flow has no handle on fate proportions, and it uses one gene graph for all fates. If scDFM with a subtype-label input matches our model on both proportions and within-fate energy distance on the held-out wound day and held-out diseases, the explicit branch adds nothing, and we will report that as the result.
Why not just regress subtype proportions and sample from per-subtype distributions? This is the most serious threat to the composition claim, since proportions may be all that matters for clinical readouts such as F6-linked scarring risk. It cannot, however, move cells within a fate under a new condition. The test is the within-fate energy distance on held-out conditions, where cells of the same subtype express genes differently across diseases. If compositional regression ties our model there too, we would recommend it as the tool.
Why not just evaluate all branches densely with masks instead of real control flow? For a tree with a handful of leaves, dense evaluation costs a small constant factor and avoids the gather/concat overhead that slowed Fold down by up to 60%. It may well win, and the soft-versus-hard ablation already separates the modeling question from this execution question. We will report wall-clock time and peak memory for both. The control-flow version only earns its place if it wins as the tree deepens or widens, for example in a cross-tissue tree with per-organ sub-branches.
Why not just use a standard probabilistic programming language? Discrete branch sampling is native to languages like Stan or WebPPL, but they do not scale to millions of cells. The array-compiled memo is restricted to small discrete domains, and Edward needs static graphs. We will include a small-subset MCMC fit of the gate model only as a check on our posterior over branches, not as a competitor.
Proposed Experiments
The first test is temporal holdout on the 58,823-cell wound time course. The model is trained on baseline and early time points and asked to predict the population at day 30. A time-consistent model must assign rising mass to the F6 to F7 edge. Metrics are energy distance, MMD, MSE and total-variation error of subtype proportions. The file has no reported result on Lacuna for this task.
The second test is disease holdout across the 5.8-million-cell cross-tissue compendium. Each run withholds one disease, with condition encoded by tissue and disease metadata, and asks for the held-out disease's F6/F7 composition and within-subtype expression. The file has no reported result on Lacuna for this task either.
The third test establishes comparability with scDFM on its own ground. On the Norman combinatorial split, we infer the tree from data by clustering responses, rather than using the fibroblast nomenclature. Here the target is to match or beat scDFM's reported margin over CellFlow, and the subset of perturbations with bimodal responses is reported separately.
For external plausibility, the arthrofibrosis cohort of Li et al. (DPP4⁺ and TNC⁺ expansion) and the periodontitis IL-6⁺ fibroblast data of Chen et al. are mapped onto the learned tree. We check whether the expanded populations land on inflammatory or myofibroblast branches. These cohorts are small (6 discovery patients, about 22,000 cells), so this check is qualitative only.
Systems measurements cover throughput and peak memory versus tree depth and width, comparing grouped control flow, dense masking and full unrolling, on one GPU type.
Two outcomes are decisive. If the hard-gated tree beats both scDFM-with-labels and compositional regression on within-fate distance and on proportions for held-out conditions, the modeling claim holds. If only the soft mixture is needed, the claim reduces to "mixtures help" and the control-flow framing is dropped.
References
- scDFM: Distributional Flow Matching Model for Robust Single-Cell Perturbation Prediction
- A single-cell and spatial genomics atlas of human skin fibroblasts reveals shared disease-related fibroblast subtypes across tissues
- Single-cell analysis reveals fibroblast heterogeneity and myeloid-derived adipocyte progenitors in murine skin wounds
- Control Flow Operators in PyTorch
- Deep Learning with Dynamic Computation Graphs
- Rockmate: an Efficient, Fast, Automatic and Generic Tool for Re-materialization in PyTorch
- A Domain-Specific Probabilistic Programming Language for Reasoning about Reasoning (Or: A Memo on memo)
- Deep Probabilistic Programming
- CCN2 mediates fibroblast-macrophage interaction in knee arthrofibrosis based on single-cell RNA-seq analysis
- IL-6+ fibroblasts contribute to shaping the pro-inflammatory microenvironment in severe periodontitis after non-surgical periodontal therapy