NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning the Structure of Sum-Product Networks

Robert Gens, Pedro M. DomingosICML 2013

TL;DR

This paper introduces LearnSPN, the first general-purpose algorithm for automatically learning the structure of Sum-Product Networks (SPNs) from data. By recursively alternating between partitioning variables (independence) and clustering instances (mixtures), the algorithm builds deep probabilistic models that are as expressive as traditional graphical models but offer guaranteed, linear-time inference.

What Problem Does This Paper Address?

Probabilistic graphical models, like Bayesian and Markov Networks, are powerful tools for representing complex distributions. However, they face a fundamental "tractability-expressiveness" tradeoff: as models become more complex (higher treewidth), answering queries (inference) becomes NP-hard.

Sum-Product Networks (SPNs) were recently proposed to break this bottleneck. In an SPN, inference is always linear in the size of the network, regardless of its "treewidth." However, early SPN research relied on manually designed, rigid architectures. Before this paper, there was no robust way to learn the "architecture" of an SPN directly from a dataset, limiting their use to domains where human experts could pre-define the structure.

Methods

The authors propose LearnSPN, a top-down, recursive "divide-and-conquer" algorithm. The algorithm treats the data as a matrix (instances $\times$ variables) and builds the SPN by choosing one of three operations at each step:

  1. Decompose Variables (Product Node): The algorithm looks for subsets of variables that are approximately independent. If found, it creates a Product Node, splits the matrix by columns, and recurses on each subset. This captures the idea that some features don't influence each other.
  2. Technique: Pairwise independence is determined using a G-test.
  3. Cluster Instances (Sum Node): If variables are dependent, the algorithm tries to group similar data points together. It creates a Sum Node (representing a mixture model), splits the matrix by rows, and recurses on each cluster. This captures latent sub-populations in the data.
  4. Technique: Instances are grouped using hard EM clustering on a Naive Bayes mixture model.
  5. Base Case (Leaf Node): When only one variable remains, the algorithm returns a simple univariate distribution (e.g., a Bernoulli or Multinomial distribution) estimated from the data.

The result is a deep, rooted Directed Acyclic Graph (DAG) where internal nodes are sums and products, and leaves are simple distributions.

Visual representation of the LearnSPN algorithm

Datasets

The authors evaluated LearnSPN on 20 real-world datasets, a significantly larger benchmark than typical for the field at the time. These datasets spanned diverse domains, including:

  • Web & Social: MSNBC, 20 Newsgroups, BBC.
  • Collaborative Filtering: Netflix, EachMovie, Book.
  • Biological/Medical: DNA, Plants, NLTCS.
  • Financial/Retail: KDD Cup 2000, Retail.

The datasets varied in scale from 16 to 1,556 variables and up to 388,000 instances.

Key Insights and Ideas

  • Tractability by Construction: Unlike Bayesian networks, where you must carefully manage edges to keep inference feasible, LearnSPN builds a model that is guaranteed to be tractable. You never have to worry about "loops" or "high treewidth" making the model unusable.
  • Context-Specific Independence: By alternating between sums and products, the model can find dependencies that only exist in certain parts of the data. For example, variables $X$ and $Y$ might be dependent globally, but independent within a specific cluster (sum node) found by the algorithm.
  • Deep Learning for Probability: SPNs are essentially deep architectures. LearnSPN provides a way to "grow" these deep networks automatically, similar to how decision tree learners grow shallow structures, but for full joint probability distributions.

Key Results

  • Likelihood: The learned SPNs achieved test-set log-likelihoods comparable to state-of-the-art Bayesian networks (learned via WinMine) and Markov networks.
Log-likelihood and pseudo log-likelihood comparison across datasets
  • Inference Speed: This is where SPNs shined. Because SPNs perform exact inference, they were two orders of magnitude faster than the approximate inference methods (like Gibbs sampling or Loopy Belief Propagation) required for traditional graphical models.
  • Inference Accuracy: When answering partial queries (e.g., "What is the probability of $X$ given $Y$?"), SPNs were significantly more accurate. Approximate inference in traditional models often "stalls" or converges to poor local optima, whereas SPNs provide the exact answer instantly.

Limitations and Future Work

  • Greedy Search: LearnSPN is a greedy, top-down algorithm. While efficient, it may miss more optimal global structures that a more exhaustive search could find.
  • Discrete Focus: The primary evaluation focused on discrete variables. While the authors note that the framework generalizes to continuous data (using different leaf distributions), the specific implementation details for high-dimensional continuous spaces were left for future work.
  • Scalability: While faster than many alternatives, the authors noted that the current implementation could be further optimized through parallelization and more efficient count-reusing during the clustering steps.

Summary updated

BibTeX
@inproceedings{gens2013learning,
  author = {Robert Gens and Pedro M. Domingos},
  title = {{Learning the Structure of Sum-Product Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2013},
}
Figure