Skip to content

ProbPipe logo ProbPipe logo

Connect the Tools You Already Use into a Unified, Reliable Workflow

ProbPipe is a probabilistic workflow language (PWL) designed for building traceable, reproducible, scalable, and flexible pipelines for data analysis, forecasting, and prediction.

ProbPipe makes it easy to describe a statistical workflow in terms of standard mathematical operations while still using the tools you're familiar with (PyMC, JAX, pandas, xarray, ...). But when you use ProbPipe, it handles all of the computational workflow aspects such as random key management, provenance tracking, and execution backends, which, when done right, lead to reliable, high-quality pipelines. And, because it's based on mathematical operations, ProbPipe also provides a uniform interface to operations like conditioning, sampling, and evaluation, no matter what package is being used to implement the operation (Stan, NumPyro, BlackJAX, ...). This leads to simpler, easier to read, and more maintainable code.

The tools you already use, such as Stan, PyMC, BlackJAX, NumPy, pandas, and ArviZ, joined together by ProbPipe, which provides provenance tracking, random key management, model format conversion, uncertainty propagation, and swappable execution backends and inference algorithms

What you can do

Carrying out a probabilistic analysis means translating its mathematics into a computational procedure. In practice you have to choose among algorithms with different trade-offs and convert between the formats that different tools expect. ProbPipe streamlines and automates those tasks, so you can:

  • Switch and compare algorithms without rewriting the model. The condition_on(...) operation computes a model posterior with an algorithm it selects, based on that model's capabilities (e.g., log density evaluation or forward sampling). Calling condition_on.using(method=method)(...) swaps in another algorithm named method, such as stochastic-gradient Langevin dynamics (for large data sets) or random-walk Metropolis (for a log density without gradients).
  • Use the models and data you already have. A model written in PyMC or Stan can be wrapped as a ProbPipe object that operations like condition_on can be used with. Data can be in pandas or xarray objects.
  • Push uncertainty through any Python function. Write a forecast or a decision rule in plain Python as a function of known inputs, such as one value of each parameter, and decorate it with @function to make it a ProbPipe-native function. Called on a posterior, or on any other distribution of its inputs, the function returns the distribution of its output, which ProbPipe computes by evaluating the function at draws from that distribution.
  • Get exact answers when feasible. ProbPipe computes a result exactly when a formula or an exact algorithm applies, such as the update to a discrete distribution, and approximately otherwise.
  • Know how each result was computed. Every result records how it was computed and whether that computation is exact. Moreover, uniform random seed control helps improve reproducibility.

At the same time, ProbPipe manages random number seeds, provides end-to-end provenance tracking, batched and parallel evaluation, and automatic conversion between data and distribution representations.

How it works

ProbPipe keeps the mathematics separate from the computation. A model states only the mathematics, and each operation chooses how to compute its result, so changing the algorithm never changes the model. Six ideas make this work:

  1. Mathematical objects: distributions, conditional distributions, functions, and values are ProbPipe objects, and each one names its outputs, such as the coefficients and the response of a regression. A batch holds several objects of one kind, such as a set of scenarios, on named axes.
  2. One vocabulary of operations: & merges a conditional distribution with a distribution into their joint distribution, condition_on conditions, and summaries such as mean and quantile describe a law. Each operation applies to every object that supports it mathematically and returns another ProbPipe object, so results compose.
  3. Computation from capabilities: an operation computes its result from what its inputs can do, by a closed form where one exists, and otherwise by an exact algorithm or an approximate method from a registry of backends such as BlackJAX, Stan, and PyMC. The choice is automatic, check reports it before a call runs, and using overrides it.
  4. Lifting: an ordinary Python function applied to distributions returns the distribution of its output, and applied to a batch it returns the batch of its outputs.
  5. Traceable, reproducible results: every result records the operation, the route, and the inputs that produced it, and workflow_run(seed=...) makes its random draws reproducible.
  6. Native Python and existing packages: functions are plain Python, typically JAX code, and data can arrive in pandas or xarray objects. A model written in PyMC or Stan becomes a ProbPipe object, and a sampler's draws are available as ArviZ data.

A short example

Consider a Bayesian logistic regression for the Challenger O-ring data, which consists of temperatures of 23 shuttle launches and an indicator as to whether an O-ring was damaged. In January 1986, the Space Shuttle Challenger broke apart shortly after launch because an O-ring seal in one of its rocket boosters failed during unusually cold weather. Given the data from the 23 earlier launches, we forecast the probability of O-ring damage at the estimated temperature of 31°F near the rocket booster at the time of that launch.

First, we specify the model and condition it on the data:

import jax.numpy as jnp
import pandas as pd

from probpipe import Normal, condition_on, mean, workflow_run
from probpipe.families import BernoulliFamily, glm_likelihood

# One row per launch: the temperature, and whether an O-ring was damaged.
data = pd.read_csv("docs/tutorials/data/challenger.csv")
temperature = jnp.asarray(data["temperature"], dtype=jnp.float32)
damage = jnp.asarray(data["damage"], dtype=jnp.int32)

# The design matrix: a column of ones for the intercept, and the temperatures for the slope.
X = jnp.stack([jnp.ones_like(temperature), temperature], axis=1)

# The prior: a normal distribution of the coefficients beta = (intercept, slope).
prior = Normal("beta", jnp.zeros(2), jnp.array([10.0, 1.0]), label="prior")

# The likelihood: the distribution of the 23 damage indicators given beta, a logistic regression.
likelihood = glm_likelihood("damage", BernoulliFamily(), X=X, label="likelihood")

# The model is the joint distribution of beta and the damage indicators.
model = likelihood & prior

# Conditioning the model on the observed damage gives the posterior of beta.
# The seed makes the sampler's random draws reproducible.
with workflow_run(seed=0):
    posterior = condition_on(model, {"damage": damage})

print("posterior mean of beta:", mean(posterior["beta"]).raw, "\n")

# Every result records how it was computed.
print("provenance of the prior's mean:")
print(mean(prior).provenance, "\n")
print("provenance of the posterior:")
print(posterior.provenance)
posterior mean of beta: [11.66378    -0.18358812]

provenance of the prior's mean:
1. mean(prior, given)  route closed_form, exact

provenance of the posterior:
1. likelihood & prior
2. condition_on(1, given)  route inference_methods, method blackjax_nuts, approximate

The prior and the likelihood are both ProbPipe objects: a distribution of the coefficients, and a conditional distribution of the data given the coefficients (constructed with glm_likelihood). Merging them with & constructs the joint model, labeled likelihood·prior, and condition_on computes the posterior. Printing a result's provenance lists each step that produced it, with how ProbPipe computed the step. The prior's mean has a formula, so mean computed it exactly. The posterior of a logistic regression has none, so condition_on generated approximate draws from the posterior using BlackJAX's No-U-Turn Sampler.

We can easily compare many different posterior inference algorithms:

from probpipe.diagnostics import add_mcmc_diagnostics

# Use the same code to get results from any available method.
# Each method is a different algorithm, so the fits run one at a time.
comparison = {}
for method in ["blackjax_nuts", "tfp_nuts", "blackjax_rwmh"]:
    with workflow_run(seed=0):
        method_posterior = condition_on.using(method=method)(model, {"damage": damage})
    # Adds R-hat and effective sample size diagnostics to the posterior object.
    add_mcmc_diagnostics(method_posterior)
    comparison[method] = {
        "slope mean": float(mean(method_posterior["beta"]).raw[1]),
        "largest R-hat": max(method_posterior.diagnostics.mcmc.rhat.values()),
    }
print(pd.DataFrame(comparison).T.round(3))
               slope mean  largest R-hat
blackjax_nuts      -0.184          1.005
tfp_nuts           -0.182          1.008
blackjax_rwmh      -0.181          1.130

BlackJAX and TensorFlow Probability's implementations of the No-U-Turn Sampler give similar inferences about the slope. Random-walk Metropolis gives a similar slope, but its largest R-hat of 1.13 is well above the usual threshold of 1.01, so its chains have not mixed and its draws need more iterations before they can be trusted.

Next, we illustrate how to forecast using the posterior. The probability of damage at 31°F is a function of the coefficients, which we write in plain JAX:

import jax

from probpipe import function, quantile


# The probability of damage at 31°F, for one pair of coefficients.
@function
def challenger_damage_probability(beta: jax.Array) -> jax.Array:
    return jax.nn.sigmoid(beta[0] + beta[1] * 31.0)


# Called on the posterior, which is a distribution, the function returns the
# distribution of the probability.
with workflow_run(seed=2):
    damage_prob = challenger_damage_probability(posterior["beta"])

print("P(damage at 31°F), posterior mean:", round(float(mean(damage_prob)), 3))
print("P(damage at 31°F), 90% interval:", quantile(damage_prob, jnp.array([0.05, 0.95])).raw, "\n")

# The forecast records each step from the posterior to it.
print("provenance of the forecast:")
print(damage_prob.provenance)
P(damage at 31°F), posterior mean: 0.974
P(damage at 31°F), 90% interval: [0.86161655 0.999984  ]

provenance of the forecast:
1. likelihood & prior
2. likelihood·prior = condition_on(1, given)         route inference_methods, method blackjax_nuts, approximate
3. broadcast(challenger_damage_probability, 2['beta'])  route sampling_lift, approximate

We wrote challenger_damage_probability for one pair of coefficients, and ProbPipe automatically lifted it to operate on the posterior distribution: it evaluated the function at draws from the posterior distribution, and returned the distribution of the results. Its provenance lists each step: 1. the merge with & that builds the model; 2. the fit, which gives approximate draws; 3. the function evaluated at those draws (sampling_lift), so the forecast is approximate too.

Where to go next

  • Installation gives the install commands, and the quickstart works through the example above in ten minutes.
  • The design assistant is a set of instructions for an AI coding agent, which designs and builds a ProbPipe pipeline for your own problem and data with you.
  • The tutorials follow one analysis of a moose population, from a first model through model checks and a revised model to forecasts with uncertainty. They start with Tutorial 1: A first look at ProbPipe.
  • The user guide explains one feature at a time on small examples, such as building a joint model, choosing an inference method, or reading a result's provenance.
  • The API reference documents every public name, grouped by topic.
  • Cite gives the citation, and Help says where to ask questions.

Human-validated by Jonathan Huggins on 2026-10-26.