Exploring Entity Interactions for Few-Shot Relation Learning (Student Abstract)

Yi Liang, Shuai Zhao, Bo Cheng, Yuwei Yin, Hao Yang

Abstract

Knowledge Graph (KG) completion often faces the challenge of few-shot relation learning, where models must predict new facts based on minimal support examples. Traditional metric-learning approaches often fail to capture the nuanced interactions between entities within and across triples. This paper presents TransAM (Transformer Appending Matcher), a novel architecture that treats few-shot learning as a sequence modeling task. By utilizing a specialized Transformer with local-global attention and rotary position embeddings, TransAM captures fine-grained semantic interactions, significantly outperforming existing baselines on standard benchmarks.

Introduction

Knowledge Graphs (KGs) represent facts as triples in the form of (head entity, relation, tail entity). Despite their scale, KGs are frequently incomplete. Few-shot relation learning aims to address this by predicting the validity of a "query" triple given only a small set of "support" triples.

Most existing methodologies rely on metric learning, which computes similarity scores between the embeddings of entity pairs. However, these methods often treat entity pairs as isolated points, ignoring the "fine-grained semantic meanings" inherent in how entities interact within a single triple (intra-triple) and how different triples in a support set relate to one another (inter-triple). TransAM addresses these limitations by shifting the paradigm from simple pair-matching to comprehensive sequence modeling.

Methodology: The TransAM Framework

TransAM introduces several architectural innovations to better model the structural dependencies of KG triples.

1. Serialization and Entity Encoding

Instead of processing triples independently, TransAM serializes the support triples and the query pair into a single continuous sequence: [CLS], h1, t1, ..., hK, tK, hq, tq. To ensure the model understands the underlying graph structure, entity representations are first processed through a heterogeneous graph encoder. This encoder enriches entity embeddings by aggregating information from their neighbors in a background knowledge graph.

2. Local-Global Attention

The core of TransAM is its dual-purpose attention mechanism:

  • Local Attention: A block attention mask restricts entities to focus primarily on their partners within the same triple. This forces the model to capture the internal structure and specific semantics of the relationship before looking elsewhere.
  • Global Attention: This allows the model to attend across different triples in the sequence, identifying broader patterns and commonalities between the support set and the query.

3. Role Awareness and Position Encoding

To model asymmetric relations (e.g., distinguishing "parent of" from "child of"), TransAM employs rotary embeddings. These embeddings allow the model to distinguish whether an entity is acting as a "head" or a "tail" within the sequence. Furthermore, the model uses a separated triple position encoding to decouple an entity's identity from its specific position in the sequence, ensuring the model respects the triple structure without being biased by the arbitrary ordering of support examples.

Experimental Results

The model was evaluated on two primary benchmarks for few-shot KG completion: NELL-One and Wiki-One, focusing on the 1-shot setting.

Performance on NELL-One

TransAM demonstrated a substantial performance leap over previous state-of-the-art models like FAAN and GMatching. It achieved a Mean Reciprocal Rank (MRR) of 0.225, compared to FAAN’s 0.187. Notably, it saw a nearly 30% improvement in Hits@1 (0.152 vs. GMatching’s 0.119).

Performance on Wiki-One

The results were mirrored on the Wiki-One dataset, where TransAM reached an MRR of 0.242 (surpassing FAAN’s 0.215) and a Hits@1 of 0.184 (surpassing FAAN’s 0.146).

These results validate the hypothesis that capturing entity-level interactions through sequence modeling is more effective for few-shot learning than traditional pair-level metric comparisons.

Conclusion and Future Work

TransAM successfully demonstrates that treating few-shot relation learning as a sequence modeling problem allows for a deeper understanding of entity interactions. By incorporating structural priors like local attention and role-aware rotary embeddings, the model achieves superior accuracy on competitive benchmarks.

Future research may explore the scalability of this sequence-based approach as the number of support triples ($K$) increases, as well as the integration of even more sophisticated structural biases to handle highly complex or multi-modal relations. Additionally, investigating the computational trade-offs between the Transformer's self-attention mechanism and simpler metric-learning models remains a key area for optimization.

Summary updated

BibTeX
@inproceedings{liang2022exploring,
  author = {Yi Liang and Shuai Zhao and Bo Cheng and Yuwei Yin and Hao Yang},
  title = {{Exploring Entity Interactions for Few-Shot Relation Learning (Student Abstract)}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.1609/aaai.v36i11.21638},
}
Figure