TL;DR
Neurosymbolic learning combines neural networks with symbolic logic, but it suffers from a hidden trap: the logical rules themselves can cause severe learning imbalances across different classes, even with perfectly balanced data. This paper theoretically characterizes this phenomenon and introduces novel training- and testing-time algorithms that mitigate these imbalances, boosting classification accuracy by up to 14% over strong baselines.
What Problem Does This Paper Address?
Neurosymbolic Learning (NSL) integrates neural networks (excellent at perception) with symbolic logic (excellent at reasoning). A popular paradigm involves training a neural network on a vector of inputs (e.g., pairs of images) where the only supervision is a "weak label" produced by a logical function $\sigma$ applied to the true, hidden labels. For example, given two handwritten digit images, the training label might simply be the maximum value of the two digits, while the individual identities of the digits remain completely unknown to the learner.
While standard machine learning heavily studies data imbalances (like long-tailed datasets), this paper uncovers a unique challenge native to NSL: learning imbalances—where a model performs drastically worse on some classes than others—can be driven entirely by the symbolic component $\sigma$, even when the underlying data is perfectly uniform.
In a "maximum of two digits" task, a uniform distribution of true digits inherently skews the distribution of the weak labels. This structural property of the logic makes certain classes much harder for the neural network to learn than others, leading to highly uneven performance across categories.
Methods
The authors tackle this problem with a three-pronged approach spanning theory, training, and inference:
- Theoretical Characterization: They develop a novel nonlinear programming formulation to compute class-specific risk upper bounds. This mathematically demonstrates how the symbolic function $\sigma$ dictates learning difficulty.
- Label Ratio Solver (Algorithm 1): Traditional long-tailed mitigation techniques require knowing the true class distribution (marginals). Because gold labels are hidden in NSL, the authors propose a statistically consistent method to estimate the true hidden label distribution from observed weak labels by solving a system of polynomial equations via cross-entropy optimization.
- Training-Time Mitigation (LP): They introduce a linear programming (LP) formulation that assigns pseudolabels to training batches. By using the Tseytin transformation, they translate weak logical constraints into linear constraints, ensuring the pseudolabels respect both the logical rules and the estimated class marginals.
- Testing-Time Mitigation (CAROT): For inference, they propose Confidence-Adjustment via Robust semi-constrained Optimal Transport (CAROT). This algorithm adjusts the raw softmax scores of a test batch so that the aggregate predictions match the estimated true label distribution, utilizing a robust semi-Sinkhorn algorithm to handle noisy estimates.
Datasets
The methods were evaluated on several challenging neurosymbolic benchmarks:
- MAX-M / SUM-M: Tuples of $M$ MNIST digits where the weak label is the maximum or sum of the digits.
- HWF-M (Handwritten Formula): Sequences of handwritten digits and mathematical operators evaluating to a target value.
- Smallest Parent: A newly introduced benchmark using CIFAR-10 images organized into a semantic hierarchy. The weak label provided during training is the most immediate common ancestor of an image pair.
Key Insights and Ideas
- Logic as an Inherent Source of Bias: The most striking finding is that the symbolic structure $\sigma$ inherently creates learning imbalances. As shown in Figure 1, even with uniform hidden labels, per-class accuracy varies wildly during training.
- Asymmetric Supervision Strength: Different weak labels provide vastly different amounts of information. For instance, knowing the maximum of two digits is
0gives direct supervision (both must be0). Conversely, a maximum of9leaves a massive space of candidate pairs, providing much weaker supervision for the underlying classifier. - Batch-Level Optimization Overcomes Hidden Labels: Because individual gold labels are missing, enforcing constraints at the batch level via optimal transport and linear programming allows the model to leverage global distribution properties that instance-level methods completely miss.
Key Results
- Substantial Accuracy Gains: The proposed training-time (LP) and testing-time (CAROT) mitigation strategies consistently outperformed standard Semantic Loss (SL) and long-tailed baselines like RECORDS and Logit Adjustment (LA).
- Smallest Parent Benchmark: With an imbalance ratio of $\rho = 5$, standard Semantic Loss achieved 67.94% accuracy, which jumped to 81.27% when using the LP training mitigation.
- MAX-4 Benchmark: In this highly complex scenario, accuracy improved from 55.48% (SL) to 78.56% (LP), representing a massive performance boost of over 23% absolute accuracy.
- Robust Marginal Estimation: Algorithm 1 proved highly effective, providing accurate estimations of hidden label marginals even under severe data imbalance.
Limitations and Future Work
- Computational Overhead: Solving the linear program (LP) for training-time mitigation can become computationally expensive for very large batch sizes or highly complex logical constraints, as the number of variables scales with the size of the pre-image of $\sigma$.
- Sensitivity to Marginal Estimates: Testing-time mitigation (CAROT) can be sensitive to the quality of the estimated label ratios. If the estimated marginals diverge significantly from the true test distribution, the performance gains can degrade.
- Future Directions: Promising avenues of future work include exploring more efficient optimization techniques (such as making the LP layer fully differentiable) and designing testing-time mitigation strategies that are more robust to distribution shifts between training and testing data.
Summary updated