Integrating first-order logic constraints (FOLCs) with neural networks is a crucial but challenging problem since it involves modeling intricate correlations to satisfy the constraints. This paper proposes a novel neural layer, LogicMP, whose layers perform mean-field variational inference over an MLN. It can be plugged into any off-the-shelf neural network to encode FOLCs while retaining modularity and efficiency. By exploiting the structure and symmetries in MLNs, we theoretically demonstrate that our well-designed, efficient mean-field iterations effectively mitigate the difficulty of MLN inference, reducing the inference from sequential calculation to a series of parallel tensor operations. Empirical results in three kinds of tasks over graphs, images, and text show that LogicMP outperforms advanced competitors in both performance and efficiency.
翻译:将一阶逻辑约束与神经网络相集成是一个关键但具有挑战性的问题,因为其涉及建模复杂的相关性以满足约束。本文提出了一种新型神经层LogicMP,其各层通过对马尔可夫逻辑网络执行平均场变分推断实现功能。该层可嵌入任何现成神经网络中以编码一阶逻辑约束,同时保持模块化与高效率。通过利用马尔可夫逻辑网络中的结构与对称性,我们从理论上证明,所设计的、高效的平均场迭代有效缓解了马尔可夫逻辑网络推断的难度,将推断从序列计算降低为一系列并行张量操作。在图、图像和文本三类任务上的实验结果表明,LogicMP在性能与效率上均优于先进竞争对手。