Despite the superior performance of large language models to generate natural language texts, it is hard to generate texts with correct logic according to a given task, due to the difficulties for neural models to capture implied rules from free-form texts. In this paper, we propose a novel graph-based language model, Logical-GLM, to infuse logic into language models for more valid text generation and interpretability. Specifically, we first capture information from natural language instructions and construct logical bayes graphs that generally describe domains. Next, we generate logical skeletons to guide language model training, infusing domain knowledge into language models. Finally, we alternately optimize the searching policy of graphs and language models until convergence. The experimental results show that Logical-GLM is both effective and efficient compared with traditional language models, despite using smaller-scale training data and fewer parameters. Our approach can generate instructional texts with more correct logic owing to the internalized domain knowledge. Moreover, the usage of logical graphs reflects the inner mechanism of the language models, which improves the interpretability of black-box models.
翻译:尽管大型语言模型在生成自然语言文本方面表现出卓越性能,但由于神经模型难以从自由形式文本中捕获隐含规则,根据给定任务生成逻辑正确的文本仍面临挑战。本文提出一种新型基于图的语言模型Logical-GLM,旨在将逻辑注入语言模型以增强文本生成的正确性和可解释性。具体而言,我们首先从自然语言指令中捕获信息,构建描述领域通用规则的逻辑贝叶斯图;继而生成逻辑骨架以指导语言模型训练,将领域知识注入语言模型;最后交替优化图的搜索策略与语言模型直至收敛。实验结果表明,尽管使用更小规模的训练数据和更少的参数,Logical-GLM相比传统语言模型在效率和效果上均表现更优。由于内化了领域知识,我们的方法能够生成逻辑更正确的指令文本。此外,逻辑图的使用揭示了语言模型的内部机制,从而提升了黑箱模型的可解释性。