HittER: Hierarchical Transformers for Knowledge Graph Embeddings

Sanxing Chen, Xiaodong Liu, Jianfeng Gao, Jian Jiao, Ruofei Zhang, Yangfeng Ji

Introduction

Knowledge Graphs (KGs) such as Freebase and WordNet serve as foundational structures for storing factual information in the form of (subject, relation, object) triplets. Despite their utility, these graphs are often incomplete. Knowledge Graph Embedding (KGE) methods aim to address this by mapping entities and relations into a continuous vector space to predict missing links. Traditional approaches like TransE or RotatE typically represent entities as static vectors, which often fails to capture the rich relational context provided by an entity's local neighborhood. HittER addresses this limitation by leveraging a hierarchical Transformer architecture to aggregate neighborhood information effectively.

Methods

HittER treats the local neighborhood of an entity as a sequence of structured data, processing it through a two-tier Transformer hierarchy:

  1. Entity Transformer (Bottom Block): This layer extracts features from individual entity-relation pairs within the neighborhood, learning the specific interactions between a neighbor and its connecting relation.
  2. Context Transformer (Top Block): This layer aggregates the outputs from the Entity Transformer. It utilizes a global context token ([GCLS]) to pool information from the entire neighborhood into a single, context-aware representation.
HittER Architecture Overview

To prevent the model from over-relying on the source entity embedding and ignoring the neighborhood context, the authors introduce Masked Entity Prediction (MEP). Similar to masked language modeling in BERT, MEP involves randomly masking or replacing the source entity during training. This forces the model to reconstruct the entity using only the surrounding graph context, ensuring that the neighborhood information is meaningfully integrated into the final embedding.

Key Results

The performance of HittER was evaluated on standard link prediction benchmarks: FB15K-237 and WN18RR. The model achieved state-of-the-art (SOTA) results across both datasets, demonstrating its superiority over previous geometric and graph-based embedding methods.

Link Prediction Performance Comparison

On the dense FB15K-237 dataset, HittER achieved a Mean Reciprocal Rank (MRR) of 0.373. On the sparser WN18RR dataset, it reached an MRR of 0.503. These results indicate that the hierarchical attention mechanism is particularly effective at capturing structural patterns, even in graphs with lower connectivity.

Downstream Applications: Factoid QA

Beyond link prediction, HittER embeddings were used to enhance pre-trained language models for factoid question answering. By integrating HittER's structured graph knowledge into BERT via cross-attention, the authors observed significant performance gains. On the FreebaseQA dataset, accuracy improved from 30.8% (BERT alone) to 37.1% (BERT + HittER), proving that high-quality KGEs can provide valuable external knowledge to NLP models.

Conclusion

HittER represents a significant step forward in KGE by successfully adapting the Transformer architecture to structured graph data. By utilizing hierarchical attention and a masked training objective, it captures relational context more effectively than previous methods. Future work may involve extending the model to capture multi-hop paths or global graph topology to further enhance its reasoning capabilities.

Summary updated

BibTeX
@inproceedings{chen2021hitter,
  author = {Sanxing Chen and Xiaodong Liu and Jianfeng Gao and Jian Jiao and Ruofei Zhang and Yangfeng Ji},
  title = {{HittER: Hierarchical Transformers for Knowledge Graph Embeddings}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.812},
}
Figure