Introduction
Probabilistic Circuits (PCs) are a powerful class of models used to represent complex probability distributions while remaining mathematically "tractable." This tractability means we can calculate marginal probabilities or generate samples relatively easily, making PCs increasingly popular in fields like healthcare and AI planning where reliability is paramount.
However, a major challenge arises after training: How do we know if the model we learned is actually close to the distribution we intended? This paper introduces Teq, the first efficient algorithm to test if two Probabilistic Circuits represent nearly identical probability distributions. By leveraging approximate counting and sampling, Teq provides a mathematically grounded way to determine if two models are "close enough" in terms of Total Variation (TV) distance.
The Challenge of Closeness Testing
While "equivalence testing" (checking if two models are exactly identical) has been studied extensively, it is often too rigid for real-world applications. In practice, two models might differ slightly due to noise or varying training methodologies, yet still be functionally equivalent for all practical purposes.
This paper shifts the focus to closeness testing: deciding whether the Total Variation distance between two distributions is below a small, acceptable threshold ($\epsilon$) or above a larger, unacceptable threshold ($\eta$).
The Teq Algorithm
The authors propose a probabilistic algorithm called Teq (Testing Equivalence). Instead of comparing the entire exponential space of the distributions, Teq relies on two fundamental queries that many PCs support:
- Approximate Counting: Estimating the total weight of all satisfying assignments in the circuit.
- Approximate Sampling: Generating a random assignment from the distribution represented by the circuit.
Teq takes a small number of samples from one distribution ($P$) and calculates the ratio of their probabilities in the second distribution ($Q$). By averaging these ratios, the algorithm estimates the TV distance. The core theoretical innovation is proving that this approach works—and runs in polynomial time relative to circuit size and desired precision—even when the underlying counters and samplers are approximate rather than exact.
Experimental Evaluation
The authors evaluated a Python prototype of Teq across two main settings to verify its accuracy and scalability.
Synthetic Benchmarks
The first evaluation used 375 randomly generated 3-CNF formulas (14 to 18 variables). Because these circuits are small, the authors could use brute-force calculations to determine the true TV distance and verify Teq's accuracy.
Real-world Benchmarks
The second evaluation used 100 larger d-DNNF (deterministic Decomposable Negation Normal Form) circuits derived from actual sampling and counting tasks. To test these, the authors used a "one variable perturbation" technique to create pairs of circuits with known distances.
Key Insights and Results
- 100% Accuracy: Teq correctly decided the closeness of all 475 benchmark pairs evaluated.
- Efficiency and Speed: All tests finished well within a 3600-second timeout. On synthetic benchmarks, tests usually completed in under 10 seconds. On the larger, real-world d-DNNF benchmarks, runtimes ranged from roughly 22 seconds to 414 seconds.
- Sample Efficiency: For the chosen parameters ($\epsilon=0.01, \eta=0.2$), the algorithm required only 294 samples to make a high-confidence decision, regardless of the size of the distribution's support.
- Tractability is Contagious: The paper demonstrates a powerful theoretical link: if a PC fragment allows for efficient approximate counting and sampling, it automatically allows for efficient closeness testing.
- Robustness to Approximation: A key takeaway is that perfect samples are not required for a reliable closeness test. By carefully managing the error bounds of the approximate components, Teq maintains high confidence in its final "Accept" or "Reject" decisions.
Limitations and Future Directions
The primary limitation of Teq is its prerequisite: the PC must support both approximate counting and sampling. While many popular PC fragments (like d-DNNFs and SDNNFs) meet this criteria, others (like general DNNFs or Prime Implicates) do not, leaving them currently outside the reach of this tool.
The authors note that mapping the complete complexity landscape for PC testing remains an ongoing task, with several "Unknown" entries regarding whether poly-time tests exist for certain fragments. Closing these theoretical gaps, alongside scaling the implementation to handle even larger "Deep" Probabilistic Circuits, represent exciting next steps for the field.
Summary updated