Logically Consistent Language Models via Neuro-Symbolic Integration
Diego Calanzone Stefano Teso Antonio Vergari
Large language models (LLMs) are a promising venue for natural language understanding and generation tasks. However, current LLMs are far from reliable: they are prone to generate non-factual information and, more crucially, to contradict themselves when prompted to reason about relations between real entities of the world. These problems are currently addressed with large scale fine-tuning or by delegating consistent reasoning to external tools. In this work, we strive for a middle ground and leverage a training objective based on a principled neuro-symbolic loss that teaches a LLM to be consistent with external knowledge in the form of a set of facts and rules. Fine-tuning with such a loss on a limited set of facts enables our LLMs to be more logically consistent than previous baselines for a given constraint. Our approach also allows to easily combine multiple logical constraints at once in a principled way, delivering LLMs that are more consistent w.r.t. all the selected rules. Moreover, our method allows LLMs to extrapolate to unseen but semantically similar factual knowledge, represented in unseen datasets, more systematically.
probabilistic reasoning, logical consistency, LLMs, neuro-symbolic, semantic loss
We show that principled probabilistic reasoning can teach an LLM to be logically consistent with a set of external facts and rules (and itself), allowing to extrapolate to unseen but semantically similar factual knowledge.