NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Exploring Task Difficulty for Few-Shot Relation Extraction

Jiale Han, Bo Cheng, Wei Lu

Abstract

Few-shot relation extraction (FSRE) aims to identify relationships between entities using limited labeled data. While existing models perform well on standard benchmarks, they often struggle with "hard" tasks involving semantically similar relations. This paper introduces the Hybrid Contrastive Relation-Prototype (HCRP) framework. HCRP enhances discriminative power through hybrid prototype learning and relation-prototype contrastive learning. Furthermore, it introduces a task-adaptive focal loss to prioritize difficult training episodes. Experimental results on FewRel 1.0 and 2.0 demonstrate that HCRP achieves state-of-the-art performance, particularly in challenging scenarios.

Introduction

Relation Extraction (RE) is a fundamental task in natural language processing, involving the identification of semantic relationships between entity pairs in text. Few-Shot Relation Extraction (FSRE) extends this to scenarios where only a few examples per relation are available.

A critical observation made by the authors is the variance in Task Difficulty. In meta-learning for FSRE, models are trained on various "episodes." However, standard approaches treat all episodes as equally informative. In reality, some tasks are "easy"—distinguishing between vastly different relations like capital_of and platform—while others are "hard," requiring the model to differentiate between fine-grained, semantically similar relations such as father, child, and spouse.

Comparison of easy and hard tasks in few-shot relation extraction.

Current models often fail to capture the subtle features necessary for hard tasks because they are dominated by the simpler patterns found in easy tasks during training.

The HCRP Framework

The HCRP framework addresses these challenges through three integrated components:

Architecture of the Hybrid Contrastive Relation-Prototype (HCRP) framework.

1. Hybrid Prototype Learning

Traditional models represent a relation class by averaging sentence embeddings. HCRP improves this by combining Global Features (the [CLS] token from BERT) with Local Features. Local features are derived using an attention mechanism that highlights tokens most relevant to the relation's name and description, allowing the model to focus on discriminative keywords.

2. Relation-Prototype Contrastive Learning (RPCL)

To ensure prototypes are well-separated in the embedding space, HCRP employs the semantic embedding of the relation's description as an "anchor." Through contrastive learning, the model pulls the prototype of a class toward its corresponding anchor while pushing it away from others.

3. Task Adaptive Focal Loss

To mitigate "easy task bias," the authors propose a modification to the standard Focal Loss. By calculating inter-class similarity within a task, the model estimates task difficulty and dynamically assigns higher weights to harder tasks. This forces the model to prioritize learning from the most challenging examples.

Experimental Results

The model was evaluated on FewRel 1.0 (Wikipedia-based) and FewRel 2.0 (Domain Adaptation to PubMed).

  • FewRel 1.0: In the 10-way 1-shot setting, HCRP improved accuracy by 5.86 percentage points over previous non-pre-trained baselines.
  • FewRel 2.0: HCRP showed robust generalization, outperforming the BERT-PAIR baseline by nearly 9 points in the 5-way 1-shot setup.
  • Hard Task Evaluation: On a specialized test set of similar relations (e.g., mother, child, spouse), HCRP achieved 62.40% accuracy, significantly higher than the 38.21% achieved by BERT-PAIR.

Conclusion

HCRP demonstrates that explicitly modeling task difficulty and leveraging relation descriptions as semantic anchors can significantly improve FSRE performance. While the model relies on high-quality descriptions, its success in domain adaptation suggests strong potential for real-world applications. Future research may explore curriculum learning to further optimize task selection during training.

Summary updated

BibTeX
@inproceedings{han2021exploring,
  author = {Jiale Han and Bo Cheng and Wei Lu},
  title = {{Exploring Task Difficulty for Few-Shot Relation Extraction}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.204},
}
Figure