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
- 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.
- 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\).
- 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.
- Entropy penalty: a term with weight \(\alpha > 0\) tightens the lower bound and favors outputs close to 0 or 1:
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.SumProductNetworkreads sum-product networks from DeeProb-kit JSON files. The repository has three inexamples/networks/spn/(ad,nltcs, andplants). - Hidden variables: pass
unobs_ratioorunobs_varstoQueryDataset.from_split. The trainer, ITSELF, and the discretizers then sum these variables out. NeuPI supports this forSumProductNetworkonly. Use the same query and hidden variables for the test queries, and ignore the returned values of the hidden variables. - Training:
neupi.SelfSupervisedTrainerwithneupi.mpe_log_likelihood_loss. Itsentropy_weightis 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.SinglePassInferenceEnginewithneupi.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.