Injecting discrete logical constraints into neural network learning is one of the main challenges in neuro-symbolic AI. We find that a straight-through-estimator, a method introduced to train binary neural networks, could effectively be applied to incorporate logical constraints into neural network learning. More specifically, we design a systematic way to represent discrete logical constraints as a loss function; minimizing this loss using gradient descent via a straight-through-estimator updates the neural network's weights in the direction that the binarized outputs satisfy the logical constraints. The experimental results show that by leveraging GPUs and batch training, this method scales significantly better than existing neuro-symbolic methods that require heavy symbolic computation for computing gradients. Also, we demonstrate that our method applies to different types of neural networks, such as MLP, CNN, and GNN, making them learn with no or fewer labeled data by learning directly from known constraints.
翻译:将离散逻辑约束注入神经网络学习是神经符号AI的主要挑战之一。我们发现,最初用于训练二值神经网络的直通估计器方法可有效应用于将逻辑约束融入神经网络学习。具体而言,我们设计了一种系统化方法,将离散逻辑约束表示为损失函数;通过直通估计器采用梯度下降法最小化该损失函数,可沿二值化输出满足逻辑约束的方向更新神经网络权重。实验结果表明,借助GPU和批量训练,该方法在扩展性上显著优于需要复杂符号计算梯度的现有神经符号方法。此外,我们证明该方法适用于MLP、CNN、GNN等不同类型的神经网络,使其能够直接通过学习已知约束,在无标注数据或少量标注数据条件下进行学习。