Skip to main content
QUICK REVIEW

[Paper Review] Einsum Networks: Fast and Scalable Learning of Tractable Probabilistic Circuits

Robert Peharz, Steven Lang|arXiv (Cornell University)|Apr 13, 2020
Machine Learning and Data ClassificationComputer Science34 references27 citations
TL;DR

This paper introduces Einsum Networks (EiNets), a novel implementation of tractable probabilistic circuits that accelerates learning and inference by replacing sparse computational graphs with monolithic einsum operations. By leveraging efficient tensor contraction and automatic differentiation, EiNets achieve up to two orders of magnitude speedup and memory reduction over prior methods, enabling scalable training on large datasets like SVHN and CelebA while supporting exact, efficient inference for complex conditional queries.

ABSTRACT

Probabilistic circuits (PCs) are a promising avenue for probabilistic modeling, as they permit a wide range of exact and efficient inference routines. Recent ``deep-learning-style'' implementations of PCs strive for a better scalability, but are still difficult to train on real-world data, due to their sparsely connected computational graphs. In this paper, we propose Einsum Networks (EiNets), a novel implementation design for PCs, improving prior art in several regards. At their core, EiNets combine a large number of arithmetic operations in a single monolithic einsum-operation, leading to speedups and memory savings of up to two orders of magnitude, in comparison to previous implementations. As an algorithmic contribution, we show that the implementation of Expectation-Maximization (EM) can be simplified for PCs, by leveraging automatic differentiation. Furthermore, we demonstrate that EiNets scale well to datasets which were previously out of reach, such as SVHN and CelebA, and that they can be used as faithful generative image models.

Motivation & Objective

  • To address the poor scalability and high computational cost of existing probabilistic circuit (PC) implementations due to their sparsely connected, log-domain computational graphs.
  • To enable efficient training and exact inference for large-scale real-world datasets such as SVHN and CelebA, which were previously infeasible for PC models.
  • To simplify EM-based learning for PCs by leveraging automatic differentiation, reducing implementation complexity.
  • To design a new PC architecture that unifies product and sum operations via efficient tensor operations, improving both speed and memory efficiency.

Proposed method

  • EiNets represent probabilistic circuits using a hierarchy of monolithic einsum operations that combine multiple sum and product operations into a single, highly optimized tensor contraction.
  • The model uses a novel 'log-einsum-exp' trick to maintain numerical stability during training, extending the standard log-sum-exp trick to the einsum setting.
  • For sum nodes with multiple children, EiNets decompose them into a two-stage process: first computing individual sum operations via einsum, then applying element-wise convex mixtures using a dedicated 'mixing layer'.
  • The architecture supports arbitrary PC structures, including non-binary trees, by over-parameterizing multi-child sum nodes into cascaded simple sum nodes followed by a mixing layer.
  • Training is accelerated via automatic differentiation, simplifying the implementation of Expectation-Maximization (EM) by directly computing gradients of the log-likelihood.
  • Inference and learning are performed in the natural domain, avoiding the performance penalties of log-domain computations used in prior PC frameworks.

Experimental results

Research questions

  • RQ1Can monolithic einsum operations significantly improve the speed and memory efficiency of probabilistic circuit inference and training?
  • RQ2Can EiNets scale to large-scale image datasets like SVHN and CelebA, which were previously out of reach for tractable probabilistic models?
  • RQ3Does the use of automatic differentiation simplify the implementation of EM for probabilistic circuits compared to traditional approaches?
  • RQ4How does the performance of EiNets compare to existing PC frameworks like LibSPN and SPFlow in terms of training time, inference speed, and memory consumption?

Key findings

  • EiNets achieve up to two orders of magnitude speedup and memory reduction compared to prior implementations such as LibSPN and SPFlow, particularly on large-scale datasets.
  • The model successfully trains on SVHN and CelebA, demonstrating that EiNets can serve as faithful generative image models despite the complexity of these datasets.
  • Inference time for EiNets is up to three orders of magnitude faster than SPFlow, with significant improvements even at high network depths.
  • The use of a single einsum operation per layer enables highly efficient computation on both CPU and GPU, with minimal overhead from tensor reshaping and zero-padding in the mixing layer.
  • The log-einsum-exp trick ensures numerical stability during training, enabling reliable optimization in the natural domain without performance penalties.
  • Automatic differentiation simplifies EM training by eliminating the need for manual gradient derivation, making the learning process more robust and easier to implement.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.