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在性能和效率上均优于先进对比方法。