# SPFlow: An Easy and Extensible Library for Deep Probabilistic Learning using Sum-Product Networks

arXiv: https://arxiv.org/abs/1901.03704 · HTML: https://mlsanity.com/paper/1901.03704/

## Key facts

- Cited by 26 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 11 Jan 2019.

## Built on by (most cited first, 26 of 26)

- [Concrete Score Matching: Generalized Score Matching for Discrete Data](https://mlsanity.com/paper/2211.00802/) (2022)
- [Tractable Control for Autoregressive Language Generation](https://mlsanity.com/paper/2304.07438/) (2023)
- [Training and Inference on Any-Order Autoregressive Models the Right Way](https://mlsanity.com/paper/2205.13554/) (2022)
- [Tractable Regularization of Probabilistic Circuits](https://mlsanity.com/paper/2106.02264/) (2021)
- [Scaling Up Probabilistic Circuits by Latent Variable Distillation](https://mlsanity.com/paper/2210.04398/) (2022)
- [Scaling Tractable Probabilistic Circuits: A Systems Perspective](https://mlsanity.com/paper/2406.00766/) (2024)
- [Understanding the Distillation Process from Deep Generative Models to Tractable Probabilistic Circuits](https://mlsanity.com/paper/2302.08086/) (2023)
- [Acquisition Conditioned Oracle for Nongreedy Active Feature Acquisition](https://mlsanity.com/paper/2302.13960/) (2023)
- [Sparse Probabilistic Circuits via Pruning and Growing](https://mlsanity.com/paper/2211.12551/) (2022)
- [A Survey on Active Feature Acquisition Strategies](https://mlsanity.com/paper/2502.11067/) (2025)
- [Tractable Boolean and Arithmetic Circuits](https://mlsanity.com/paper/2202.02942/) (2022)
- [A Compositional Atlas of Tractable Circuit Operations: From Simple Transformations to Complex Information-Theoretic Queries](https://mlsanity.com/paper/2102.06137/) (2021)
- [Probabilistic Circuits That Know What They Don't Know](https://mlsanity.com/paper/2302.06544/) (2023)
- [Generating Likely Counterfactuals Using Sum-Product Networks](https://mlsanity.com/paper/2401.14086/) (2024)
- [Rethinking Probabilistic Circuit Parameter Learning](https://mlsanity.com/paper/2505.19982/) (2025)
- [Exchangeability-Aware Sum-Product Networks](https://mlsanity.com/paper/2110.05165/) (2021)
- [Certified Data Removal in Sum-Product Networks](https://mlsanity.com/paper/2210.01451/) (2022)
- [DeeProb-kit: a Python Library for Deep Probabilistic Modelling](https://mlsanity.com/paper/2212.04403/) (2022)
- [Explaining Deep Tractable Probabilistic Models: The sum-product network case](https://mlsanity.com/paper/2110.09778/) (2021)
- [Variational Flow Graphical Model](https://mlsanity.com/paper/2207.02722/) (2022)
- [Fast Private Parameter Learning and Inference for Sum-Product Networks](https://mlsanity.com/paper/2104.07353/) (2021)
- [Outlier Explanation via Sum-Product Networks](https://mlsanity.com/paper/2207.08414/) (2022)
- [Counterfactual Explanations in Medical Imaging: Exploring SPN-Guided Latent Space Manipulation](https://mlsanity.com/paper/2507.19368/) (2025)
- [Tractable Probabilistic Models for Investment Planning](https://mlsanity.com/paper/2511.13888/) (2025)
- [The Expressivity Boundary of Probabilistic Circuits: A Comparison with Large Language Models](https://mlsanity.com/paper/2605.12940/) (2026)
- [Diverse and Plausible Algorithmic Recourse via Tractable Recourse Distributions](https://mlsanity.com/paper/2608.04677/) (2026)

## Abstract (arXiv)

We introduce SPFlow, an open-source Python library providing a simple interface to inference, learning and manipulation routines for deep and tractable probabilistic models called Sum-Product Networks (SPNs). The library allows one to quickly create SPNs both from data and through a domain specific language (DSL). It efficiently implements several probabilistic inference routines like computing marginals, conditionals and (approximate) most probable explanations (MPEs) along with sampling as well as utilities for serializing, plotting and structure statistics on an SPN. Moreover, many of the algorithms proposed in the literature to learn the structure and parameters of SPNs are readily available in SPFlow. Furthermore, SPFlow is extremely extensible and customizable, allowing users to promptly distill new inference and learning routines by injecting custom code into a lightweight functional-oriented API framework. This is achieved in SPFlow by keeping an internal Python representation of the graph structure that also enables practical compilation of an SPN into a TensorFlow graph, C, CUDA or FPGA custom code, significantly speeding-up computations.
