On Hardware-efficient Inference in Probabilistic Circuits

Lingyun Yao, Martin Trapp, Jelin Leslin, Gaurav Singh, Peng Zhang, Karthekeyan Periasamy, Martin Andraud

Introduction

Probabilistic Circuits (PCs) have emerged as a powerful class of generative models that guarantee tractable inference for complex queries. By representing joint probability distributions as computational graphs, PCs allow for exact answers to queries like marginals and Maximum A-Posteriori (MAP) states. However, the practical deployment of these models on edge devices—such as IoT sensors and battery-powered wearables—is significantly limited by their computational overhead.

In a standard PC, inference involves a sequence of multiplications and additions. As these operations progress through the circuit, probability values often decay exponentially, leading to numerical underflow. While software implementations typically mitigate this by performing calculations in the log-domain, this approach is inefficient on custom hardware (FPGAs or ASICs) due to the high cost of log-sum-exp operations. Consequently, hardware accelerators often resort to high-precision linear-domain arithmetic (30-40 bits), which consumes excessive energy and silicon area. This paper proposes a hardware-efficient framework that replaces costly multiplications with a low-power approximation technique.

The Addition As Int (AAI) Framework

The core innovation of this work is the application of Addition As Int (AAI) to probabilistic inference. AAI is an approximate computing technique that treats floating-point bit strings as integers. Instead of performing a standard floating-point multiplication—which requires adding exponents and a complex multiplication of mantissas—AAI simply adds the bit strings together.

This approximation is rooted in Mitchell’s approximation, which assumes that $\log_2(1 + m) \approx m$ for a mantissa $m \in [0, 1)$. By treating the floating-point representation as a fixed-point value in the log-domain, AAI effectively replaces a hardware-intensive multiplier with a single integer adder.

Theoretical Safety and Error Correction

To ensure that this approximation does not compromise the model's integrity, the authors developed a multi-layered safety framework:

  1. Information Loss Analysis: The researchers derived theoretical bounds for the Information Loss (measured via KL-divergence) introduced by AAI for various query types.
  2. Safe Multiplier Replacement: Not all nodes in a PC are equally sensitive to approximation errors. The authors implemented a greedy algorithm that identifies and preserves exact multipliers in critical sections of the circuit while replacing the rest with AAI units.
  3. Monte-Carlo Compensation: Because AAI tends to systematically underestimate the true product, a Monte-Carlo-based error correction mechanism is used to shift the results back toward the true distribution, further narrowing the accuracy gap.

Experimental Evaluation

The framework was evaluated using PC structures learned via the LearnSPN algorithm on four benchmark datasets: NLTCS (National Long Term Care Survey), Jester (joke ratings), DNA (genetic sequences), and Book (user data). The researchers compared the AAI-based hardware implementation against standard 64-bit exact floating-point arithmetic.

Hardware Performance

When implemented on an FPGA, the AAI approach demonstrated transformative efficiency gains:

  • Energy Reduction: The framework achieved a 357x reduction in energy for marginal queries and a 649x reduction for MAP queries compared to exact 64-bit baselines.
  • Resource Utilization: The AAI implementation utilized zero DSP blocks (specialized hardware units typically required for multiplication), allowing for a more compact and flexible chip design.
  • Throughput: The simplified arithmetic logic enabled a 50% increase in clock frequency, significantly improving inference speed.

Accuracy and Robustness

Despite the aggressive approximation, the accuracy remained remarkably high. The authors observed a "Mantissa Paradox": in low-precision settings, AAI often outperformed exact floating-point math. This occurs because exact floating-point arithmetic requires a normalization step that can introduce more noise than the AAI approximation itself. Furthermore, MAP queries proved exceptionally robust to AAI, as they primarily depend on the relative ordering of paths through the circuit rather than the exact numerical values.

Conclusion and Future Work

This research demonstrates that probabilistic reasoning can be performed with extreme energy efficiency by leveraging hardware-friendly approximations. By replacing multipliers with integer adders and employing a selective replacement strategy, the authors have paved the way for deploying sophisticated probabilistic models on the extreme edge.

Future research directions include extending the safe replacement heuristics to more complex, non-tree-shaped circuit structures and exploring the application of AAI to a broader range of probabilistic model classes beyond smooth and decomposable circuits.

Summary updated

BibTeX
@inproceedings{yao2024hardware,
  author = {Lingyun Yao and Martin Trapp and Jelin Leslin and Gaurav Singh and Peng Zhang and Karthekeyan Periasamy and Martin Andraud},
  title = {{On Hardware-efficient Inference in Probabilistic Circuits}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=XOlD2SyjQl},
}
Figure