Imagine a weather station that records temperature and humidity. Today, its humidity sensor is missing. We would still like to ask how plausible the temperature reading is, or what humidity values are likely given the temperature we observed.

A model of the joint distribution contains the information we need. The remaining question is whether we can extract it efficiently. Evaluating one complete observation and integrating over every possible missing value are different computations.

In Probabilistic Flow Circuits, we explored a way to make a probabilistic model more expressive while preserving a useful way to answer these questions. The idea is to give a probabilistic circuit flexible, one-dimensional flow distributions at its leaves.

This is joint work with Kristian Kersting and Sriraam Natarajan, presented at UAI 2023. I’ll use a small, deliberately transparent model to explain the idea before returning to what we built and evaluated in the paper.

A distribution built from small pieces

A probabilistic circuit describes a distribution through a computation graph. Its leaves model small sets of variables. A product combines factors over disjoint variables. A sum forms a weighted mixture of alternatives.

For two variables, a small example looks like this:

p(x,y)=w1f1x(x)f1y(y)+w2f2x(x)f2y(y),w1+w2=1.p(x,y)=w_1 f_{1x}(x)f_{1y}(y)+w_2 f_{2x}(x)f_{2y}(y),\qquad w_1+w_2=1.
A mixture of two factorized components

Within each component, the two variables factorize. Mixing components can still create dependence. One component might explain warmer, more humid conditions; another might explain cooler, drier ones. These are imagined conditions for intuition, rather than a weather experiment from the paper.

Two structural properties keep the arithmetic useful. Smoothness asks every child of a sum to describe the same variables. Decomposability asks the children of a product to describe disjoint variable sets. With normalized leaves, these conditions give us an efficient recursive procedure for marginal and conditional probabilities.

The useful part becomes visible when humidity goes missing. A normalized density integrates to one. We can therefore replace each humidity leaf’s contribution by one, then evaluate the products and sums as usual.

p(x)=∫p(x,y) dy=w1f1x(x)+w2f2x(x).p(x)=\int p(x,y)\,dy=w_1 f_{1x}(x)+w_2 f_{2x}(x).
Marginalizing a missing scalar feature

The circuit organizes the larger integral into small calculations that its leaves know how to perform.

A flow at a single leaf

Gaussian leaves are convenient, but a single Gaussian has a particular shape. A feature can have several common ranges, a skewed distribution, or other structure that a simple leaf captures poorly. A circuit can add components to represent this complexity; we asked what happens when the leaves themselves become more flexible.

A normalizing flow gives us one way to do that. Start with a simple base distribution and use an invertible transformation to reshape its density. In the direction used below, the transformation maps an observed value into the base distribution’s coordinates.

f(x)=ϕ(g(x)) ∣g′(x)∣.f(x)=\phi(g(x))\,|g'(x)|.
Change of variables for a one-dimensional leaf

Here, the base density is a standard normal, written as phi. The derivative accounts for how the transformation stretches or compresses the coordinate axis. Including it preserves probability mass.

Try changing the amount of reshaping. The reference Gaussian stays fixed while the flow leaf changes.

Interactive illustration

Give a leaf a more flexible shape

A flow reshapes a familiar density while keeping its total probability equal to one. Move the slider to see the leaf change.

Gaussian and transformed leaf densitiesTwo density curves over X from minus four to four. At zero shape strength they coincide. The transformed curve develops two peaks as shape strength increases. Both normalized densities integrate to one over the whole real line.
Gaussian leafTransformed leaf

Horizontal axis: X, −4 to 4. Vertical axis: probability density, 0 to 0.65. The plotted window is finite.

Shape 0.65: density at the center is 0.1396. At shape zero, the flow is a Gaussian. For every slider setting, the full density integrates to 1.

Here g(x) = x − (a / 2.5) sin(2.5x). The density is φ(g(x)) g′(x). The derivative stays positive because a is at most 0.85.

This hand-built analytic flow illustrates the idea. The paper learns linear-rational spline flows; this slider is not a trained model or an experimental result.

This illustration uses a smooth analytic transformation so its derivative and cumulative distribution are easy to inspect. Our paper uses linear-rational splines, a different family of learnable monotone transformations. The illustration explains the change-of-variables mechanism; it does not reproduce a trained spline or a published experiment.

The exact transformation in this illustration

We write u for the standardized input and use:

u=x−μs,g(x)=u−aωsin⁡(ωu),g′(x)=1−acos⁡(ωu)s.u=\frac{x-\mu}{s},\qquad g(x)=u-\frac{a}{\omega}\sin(\omega u),\qquad g'(x)=\frac{1-a\cos(\omega u)}{s}.
A transparent teaching flow

The scale s is positive and the control keeps a below one. The derivative is therefore positive everywhere. The transformation is strictly increasing, and its bounded sinusoidal adjustment leaves it onto the real line. Its cumulative distribution is the standard normal cumulative distribution evaluated at g(x). Setting a to zero recovers the original Gaussian.

Let one observation go missing

Now put these leaves into the two-component circuit. The coordinates in this example are dimensionless. They illustrate two features, without assigning physical units or claiming to fit weather observations.

Choose a point, then hide its second coordinate. Follow the leaf values into their products and the weighted sum. You can also trace the query one step at a time.

Interactive illustration

Follow a query through a small circuit

Two components each multiply an X leaf and a Y leaf. Their weighted sum is a joint density. Hide Y to ask the same circuit for a marginal.

Joint density of the two-component flow circuitA density heatmap over X and Y, each from minus four to four. Darker color marks higher density. A crosshair selects observed X 0.80 and Y 0.40.

X runs left to right; Y runs bottom to top. Both axes span −4 to 4. Color shows density relative to this plot’s peak.

What does observing X tell us about Y?

Conditional density of Y given observed XThe curve shows p of Y given X equals 0.80. It is a mixture of the two Y leaves with weights updated by the observed X. It integrates to one over the whole real line. The vertical plotting range is zero to 0.9.
Conditional density

Y spans −4 to 4. This curve conditions on X only; it does not change when you move the observed-Y slider.

After observing X, component weights become 0.0152 and 0.9848. At Y = 0, the conditional density is 0.2245.

Choose evidence, then trace how the circuit answers the query.

Component 1 · weight 0.50

X: location -1.30, scale 0.80. Y: location -1.05, scale 0.70.

Leaves

f1,X(X) = 0.0072

f1,Y(Y) = 0.0284

Product

0.0072 × 0.0284 = 2.04e-4

Weighted contribution: 1.02e-4

Component 2 · weight 0.50

X: location 1.30, scale 0.80. Y: location 1.05, scale 0.70.

Leaves

f2,X(X) = 0.4640

f2,Y(Y) = 0.6263

Product

0.4640 × 0.6263 = 0.2906

Weighted contribution: 0.1453

Sum at the root

1.02e-4 + 0.1453 = 0.1454

Joint density p(X = 0.80, Y = 0.40): 0.1454.

These are probability densities, not probabilities of individual continuous points. Their values can exceed one.

The full joint model integrates to 1. Its probability inside the displayed square is 99.92%; the plot is not renormalized to that window. Component shapes are fixed at 0.65 here.

This normalized, hand-built mixture uses analytic univariate flows. It illustrates exact density, marginal, and conditional formulas, evaluated numerically in the browser. It does not demonstrate exact MAP inference.

The missing leaf becomes one because we integrated its entire variable out. The remaining leaves can have richer shapes without changing that step.

Conditioning uses the same machinery. For a positive evidence density, the conditional density is a ratio of joint and marginal densities. We can also express it as a mixture with updated component weights:

p(y∣x)=∑kαk(x)fky(y),αk(x)=wkfkx(x)∑jwjfjx(x).p(y\mid x)=\sum_k\alpha_k(x)f_{ky}(y),\qquad \alpha_k(x)=\frac{w_k f_{kx}(x)}{\sum_j w_j f_{jx}(x)}.
Evidence changes the component weights

An observation changes which components are plausible. We can use these posterior component weights to sample a missing feature while keeping the observed value fixed. This is a different operation from finding the most probable completion.

The structure a transform must respect

The location of a flow matters. Consider a product whose first branch uses x and whose second branch uses y. A transformation that makes the first branch depend on both x and y changes the calculation we just used. Removing the second leaf no longer integrates y out, because y still appears inside the first factor.

Invertibility ensures a valid change of variables. It does not, by itself, preserve this local marginalization rule. For example, an invertible shear can mix x and y even when its Jacobian determinant is one. Some special transformed distributions still have analytic marginals; the circuit’s original factor-by-factor shortcut needs additional structure.

We call the relevant condition tau-decomposability. A transformation must respect the variable blocks at every product node to which it is pushed. Outputs in one block must depend only on inputs from that block. The Jacobian then separates into corresponding blocks, so its determinant factors along the same partition.

This lets compatible transformations move through products. They also distribute through sums, and consecutive transformations compose. The paper’s structural result pushes these transformations down to the leaves. In our proposed PFC construction, those leaves are flows over individual features.

That is the connection I find useful: the circuit’s organization tells us where added flexibility can preserve its query procedure.

What we built and measured

We implemented PFCs using Einsum Networks and learnable linear-rational spline leaves. The splines can represent richer one-dimensional distributions than affine transformations of Gaussian leaves. An affine-transformed Gaussian remains Gaussian; nonlinear transformations give us a broader family.

The paper’s comparison of a Gaussian-leaf circuit with flow leaves, including the distributions learned for a two-dimensional ring.
Figure from our UAI 2023 paper. The circuit structures are comparable; changing the leaf family changes the distributions they can represent. This is separate from the hand-built examples above.

In matched-circuit comparisons, we kept the circuit structure fixed while changing the leaf family. The flow models add learnable capacity, so this is not a comparison at equal total parameter count.

The paper reports better mean held-out log-likelihood with spline leaves on six synthetic three-dimensional datasets and six tabular or image datasets. A few entries from the latter comparison are shown below. Higher log-likelihood is better; values from different datasets should not be compared directly.

| Dataset | Gaussian-leaf EinsumNet | EinsumNet with spline leaves | | --- | --- | --- | | POWER | 0.20 ± 0.01 | 0.36 ± 0.01 | | GAS | 3.57 ± 0.08 | 4.79 ± 0.04 | | MINIBOONE | −35.93 ± 0.06 | −34.21 ± 0.01 |

These are the paper’s reported test log-likelihood means and standard deviations over three trials, rather than measurements generated by this page. The full results include the remaining datasets and additional model comparisons. They support the value of richer leaves in the evaluated settings, without establishing that PFCs are best for every distribution or computational budget.

Which questions remain different?

Exact marginal and conditional densities follow from the circuit’s structure and the required leaf computations. The cost includes evaluating the leaf transformations and their derivatives, in addition to the circuit’s arithmetic.

Exact MAP adds separate requirements. The paper gives conditions involving a deterministic circuit and a leaf family whose modes can be computed efficiently. A general mixture, including our small interactive example, does not gain an exact MAP algorithm from marginalization alone.

The scalar-leaf restriction also matters. Integrating out a whole normalized multivariate leaf gives one. Observing only part of that leaf requires a tractable partial marginal, which an arbitrary multivariate flow need not supply through its density evaluator.

For me, this work is about making a useful division of labor more expressive. The leaves learn richer distributions; the circuit keeps an organized way to combine them and answer probability questions. That same interest in useful queries leads to the next paper: when several sources disagree, what can a joint model tell us about each source’s contribution?

Sources and further reading

This explanation is based on our UAI 2023 paper and publisher record, the supplement, and the public implementation. The structural arguments appear in Section 3; experimental settings and full tables are in Section 4 and the supplement. The browser examples use the analytic teaching model described here, with no trained model or dataset downloaded.