KGAnet: a knowledge graph attention network for enhancing natural language inference

Meina Song, Wen Zhao, Haihong ENeural Computing and Applications 2020 · DOI

Abstract

Natural Language Inference (NLI) is a fundamental task in natural language processing that requires determining the logical relationship between a premise and a hypothesis. While deep learning models have achieved significant success in NLI, they often struggle with lexical semantics and common-sense reasoning. This paper presents KGAnet, a plug-and-play framework that utilizes a modified Graph Attention Network to incorporate structured external knowledge from WordNet. By introducing a "Relationship Importance" mechanism, KGAnet effectively filters noise and highlights task-relevant semantic connections. Experimental results on the SNLI and MultiNLI datasets demonstrate that KGAnet consistently improves the performance of various baseline models, setting new benchmarks for knowledge-enhanced NLI.

Introduction

Natural Language Inference (NLI) involves classifying the relationship between two sentences—a premise and a hypothesis—into categories of entailment, contradiction, or neutrality. Despite the prowess of modern neural architectures, these models frequently fail when the inference depends on lexical knowledge not explicitly present in the training corpus. For instance, recognizing that "man" implies "male" or that "round" is synonymous with "circular" requires access to external semantic structures that define these relationships.

An NLI example where external knowledge of lexical relations (e.g., synonymy between 'round' and 'circular') facilitates the entailment label.

Existing methods for injecting external knowledge often suffer from two primary limitations: low sufficiency in capturing complex graph structures and poor applicability across different model architectures. KGAnet addresses these by providing a flexible, attention-based knowledge injection layer that can be integrated into existing NLI pipelines.

The KGAnet Framework

The core of the proposed framework is the Knowledge Graph Attention Network (KGAnet), which processes subgraphs from WordNet to generate context-aware knowledge vectors.

Relationship-Aware Attention

Unlike standard Graph Attention Networks (GATs) that rely solely on node similarity, KGAnet introduces a dual-weighting mechanism to refine the influence of neighboring entities:

  1. Similarity ($S_{ij}$): Measures the semantic closeness between the target word and its neighbors.
  2. Relationship Importance ($I_{ij}$): Learns the utility of specific edge types (e.g., synonymy, antonymy, hypernymy) for the NLI task.

By fusing these scores, the model can prioritize informative relationships—such as synonymy for entailment—while downweighting less relevant connections, thereby reducing noise in the knowledge representation.

Model Integration

KGAnet is designed to be model-agnostic. For every word in the input sentences, the system retrieves its corresponding entity and neighbors from WordNet. The resulting knowledge vector is concatenated with the original word embedding (e.g., GloVe) before being passed to the primary NLI model (such as ESIM or BiMPM).

The KGAnet architecture illustrates how knowledge vectors ($h'$) are derived from the graph and integrated with word embeddings ($w$) to form the final input representation ($Q$).

Experimental Results

The framework was evaluated using the SNLI and MultiNLI benchmarks, utilizing a WordNet subgraph containing 14,216 entities and six relationship types.

Performance Gains

Integration of KGAnet led to consistent accuracy improvements across multiple baseline architectures:

  • ESIM + KGAnet: Achieved a test accuracy of 88.92% on SNLI, surpassing the previous state-of-the-art knowledge-enhanced model, KIM (88.64%).
  • Universal Boost: The framework improved the accuracy of DecAtt by ~0.63% and BiMPM by ~0.59%.

Qualitative Insights

Visualization of the attention weights revealed that KGAnet successfully captures indirect semantic links. For example, it can associate "man" and "male" through shared neighbors in the graph structure. Furthermore, the model demonstrated robust performance on the "mismatched" MultiNLI set, indicating that external knowledge significantly aids generalization across different linguistic genres and domains.

Conclusion

KGAnet provides a robust and flexible method for enhancing NLI models with structured lexical knowledge. By explicitly modeling relationship importance within a graph attention framework, it effectively bridges the gap between pattern-matching neural networks and human-like semantic reasoning. Future work will explore higher-order graph neighbors and the integration of dynamic, evolving knowledge sources.

Summary updated

BibTeX
@article{song2020kganet,
  author = {Meina Song and Wen Zhao and Haihong E},
  title = {{KGAnet: a knowledge graph attention network for enhancing natural language inference}},
  journal = {Neural Computing and Applications},
  year = {2020},
  doi = {10.1007/s00521-020-04851-5},
}
Figure