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.
翻译:将一阶逻辑约束(FOLCs)与神经网络集成是一项关键但具有挑战性的问题,因为它涉及建模复杂的相关性以满足这些约束。本文提出了一种新颖的神经网络层——LogicMP,其各层通过平均场变分推理在马尔可夫逻辑网络(MLN)上执行操作。该层可无缝嵌入任意现成神经网络中,在保持模块化与高效性的同时编码一阶逻辑约束。通过利用MLN的结构与对称性,我们从理论上证明,精心设计的高效平均场迭代有效缓解了MLN推理的难度,将推理过程从顺序计算简化为一系列并行的张量运算。针对图、图像与文本三类任务的实验结果表明,LogicMP在性能与效率上均优于先进对比方法。