Open source

Borch

A deep universal probabilistic programming language. Built on PyTorch, designed for production.

Write hierarchical Bayesian models, or convert any PyTorch neural network into a Bayesian model in a single line. Every prediction comes with calibrated uncertainty, as a property of the model rather than a post-hoc patch.

Quick start

Install from PyPI, then write your first Bayesian model in three lines. The same API scales from a hierarchical regression to a probabilistic deep neural network with billions of parameters.

Borch makes the uncertainty explicit. You can sample from the posterior, marginalise, or optimise the point estimate, whichever fits your production pipeline.

Install
pip install borch
Convert any PyTorch model to Bayesian
import torch
import borch

# A plain PyTorch network.
net = torch.nn.Sequential(
    torch.nn.Linear(10, 64),
    torch.nn.ReLU(),
    torch.nn.Linear(64, 1),
)

# Make it Bayesian in one line.
bnet = borch.nn.bayesianize(net)

# Sampled forward pass; posterior predictive out of the box.
preds = torch.stack([bnet(x) for _ in range(100)])
mean, std = preds.mean(0), preds.std(0)

Why Borch exists

Most deep learning in production gives you a point prediction with no notion of how confident the model is. In high-stakes domains that's not good enough.

Uncertainty as a primitive

Priors, likelihoods, posteriors, and KL divergences are first-class objects, not optional extras. Calibrated uncertainty on every forward pass.

Deep learning scale

Because Borch is built on PyTorch, the same model can scale from a small hierarchical regression to a probabilistic deep neural network with billions of parameters.

Production pipelines

Export to TorchScript, deploy via standard PyTorch tooling, monitor drift and calibration over time. Borch fits your existing ML infrastructure.

Used in production

Where Borch runs today

Borch is the engine under everything Desupervised ships, plus a growing list of client systems.

Our products

  • ▸Alviss AI: real-time probabilistic forecasting for commercial decisioning.
  • ▸AIChemy: equivariant deep probabilistic GNNs for drug-discovery virtual screening.
Research

Paper and citation

The Borch paper is on arXiv. If you use Borch in your own research, please cite it.

Ready for the next step?

Tell us the decision you need to make with confidence. We'll tell you honestly whether a model can help.