Research algorithm

SSMP

Neural Network Approximators for Marginal MAP in Probabilistic Circuits

Self-supervised neural solver for marginal MAP queries over probabilistic circuits. The trained network answers a query in one forward pass.

A probabilistic circuit beside the query-specific circuit used to evaluate a marginal MAP assignment
Research area
Neuro-Symbolic Reasoning and Probabilistic Inference
Tasks
Marginal MAP
Built with
PyTorch
License
MIT

SSMP is a self-supervised neural solver for marginal MAP (MMAP) queries in probabilistic circuits (PCs), such as sum-product networks. It trains a network from the circuit alone, without solved queries. The trained network then answers a query in one forward pass.

The task

The variables are split into evidence \(\mathbf{E}\), query \(\mathbf{Q}\), and hidden variables \(\mathbf{H}\). MMAP asks for the query assignment with the highest probability after the hidden variables are summed out:

\[\mathrm{MMAP}(\mathbf{Q}, \mathbf{e}) = \arg\max_{\mathbf{q}} \sum_{\mathbf{h} \in \{0,1\}^{|\mathbf{H}|}} p_{\mathcal{M}}(\mathbf{e}, \mathbf{q}, \mathbf{h})\]

Without hidden variables this is the Most Probable Explanation (MPE) task. Both are NP-hard in smooth and decomposable PCs, although marginal inference in them takes linear time.

How it works

  1. Network: takes the evidence assignment as input and outputs a value in [0, 1] for each query variable. The method does not depend on a particular architecture.
  2. Query-specific circuit (QPC): the circuit’s leaves for the query variables become continuous and take the network’s outputs \(q_j^c\) and \(1 - q_j^c\).
  3. Loss: the negative logarithm of the QPC’s root value. It is the negative log of a multilinear function, and its gradient can be computed in time that scales linearly with the size of the circuit.
  4. Entropy penalty: a term with weight \(\alpha > 0\) tightens the lower bound and favors outputs close to 0 or 1:
\[\ell(\mathbf{q}^c) = -\ln v'(r, (\mathbf{e}, \mathbf{q}^c)) - \alpha \sum_{j=1}^{M} \left[ q_j^c \log q_j^c + (1 - q_j^c) \log (1 - q_j^c) \right]\]

Training examples are evidence assignments, which can be sampled from the circuit, so no MMAP problem has to be solved. At test time, outputs above 0.5 become 1 and the others 0.

Results in the paper

The table counts the test sets, out of 154 per task (22 circuits and 7 query ratios), on which each method had the higher average log-likelihood (Table 1 of the paper). Ties make up the rest.

Task Compared with SSMP higher Other method higher
MPE Max (max-product) 88 64
MPE ML (max-marginal) 96 49
MPE Seq (sequential) 77 63
MMAP Max (max-product) 97 46
MMAP ML (max-marginal) 102 34
MMAP Seq (sequential) 82 53
  • Query size: SSMP is competitive with Max for small query sets and generally better for large ones, with some exceptions (Figure 2).
  • Local search: as the starting point for 100 iterations of stochastic hill climbing, SSMP had the higher score on 87 to 99 of 154 MPE test sets and 86 to 100 of 154 MMAP test sets, depending on the baseline.
  • Image data (MPE): with one circuit per class and 70% of the variables as query variables, SSMP beat each baseline on 9 of 10 circuits for CIFAR-10 and MNIST, and on 7 of 10 for EMNIST. It lost to all of them on one MNIST and one EMNIST circuit (Table 2). CIFAR-10 was first reduced to 512 bits with a variational autoencoder.
  • Speed: about 7 to 10 microseconds for MMAP inference on an NVIDIA A40 GPU, compared with 7 milliseconds for Max and roughly 400 to 600 milliseconds for Seq and ML. SSMP’s inference time depends on the size of the network, not of the circuit.

Scope

  • The evidence and query sets are fixed before training and stay the same at test time. ITSELF and GUIDE remove this restriction for MPE queries.
  • The experiments train a separate network for each circuit and query ratio.
  • The method is described for binary variables. The paper notes that it is easy to extend to multi-valued ones.

Use it in NeuPI

Follow the NeuPI quick start with these changes:

  • Model: neupi.SumProductNetwork reads sum-product networks from DeeProb-kit JSON files. The repository has three in examples/networks/spn/ (ad, nltcs, and plants).
  • Hidden variables: pass unobs_ratio or unobs_vars to QueryDataset.from_split. The trainer, ITSELF, and the discretizers then sum these variables out. NeuPI supports this for SumProductNetwork only. Use the same query and hidden variables for the test queries, and ignore the returned values of the hidden variables.
  • Training: neupi.SelfSupervisedTrainer with neupi.mpe_log_likelihood_loss. Its entropy_weight is the paper’s \(\alpha\). The default is 0 (no penalty), so set a positive value.
  • Data and network: replace the quick start’s random evidence values with samples from the circuit or its dataset, and its small network with the paper’s four hidden layers (128, 256, 512, 1024).
  • Answers: neupi.SinglePassInferenceEngine with neupi.ThresholdDiscretizer() is the paper’s single forward pass with a 0.5 threshold.

neupi.default_hparams("ssmp", "pc") is an alternative, but not the paper’s settings. In NeuPI 1.5.0 it gives three hidden layers (128, 256, 512) and a negative entropy_weight, which rewards soft outputs.

Publications

Cite

@inproceedings{arya_2024_networkapproximatorsa,
  author = {Arya, Shivvrat and Rahman, Tahrima and Gogate, Vibhav},
  title = {Neural {{Network Approximators}} for {{Marginal MAP}} in {{Probabilistic Circuits}}},
  journal = {Proceedings of the AAAI Conference on Artificial Intelligence (Oral)},
  year = {2024},
  month = mar,
  doi = {10.1609/aaai.v38i10.28966},
  url = {https://ojs.aaai.org/index.php/AAAI/article/view/28966},
  volume = {38},
  number = {10},
  pages = {10918--10926},
  issn = {2374-3468},
  urldate = {2024-03-27},
  copyright = {Copyright (c) 2024 Association for the Advancement of Artificial Intelligence},
  langid = {english},
}