ERICA: Improving Entity and Relation Understanding for Pre-trained Language Models via Contrastive Learning

Yujia Qin, Yankai Lin, Ryuichi Takanobu, Zhiyuan Liu, Peng Li, Heng Ji, Minlie Huang, Maosong Sun, Jie Zhou

Introduction

Pre-trained Language Models (PLMs) like BERT and RoBERTa have revolutionized NLP by capturing general linguistic patterns. However, they often struggle with deep relational reasoning, particularly at the document level. Standard pre-training objectives like Masked Language Modeling (MLM) focus on local word co-occurrences, neglecting the broader relational graph inherent in text.

Understanding a document often requires "connecting the dots" across multiple sentences. For instance, determining that "Guadalajara is in Mexico" might require linking information about Culiacán's location in Mexico with its geographical relationship to Guadalajara via the Panamerican Highway. Existing models often fail to capture these intrinsic relational facts buried in the text itself.

Relational reasoning example: Inferring Guadalajara's location requires linking multiple entities across a document.

The ERICA Framework

To address these limitations, the authors introduce ERICA (Entity and RelatIon understanding via ContrAstive learning). ERICA enhances PLMs by incorporating two novel self-supervised tasks designed to capture relational structures without relying on external Knowledge Graphs (KGs).

1. Entity Discrimination (ED)

The ED task requires the model to identify the correct "tail" entity given a "head" entity and a specific relation within a document. This forces the model to represent entities based on their functional roles in relational contexts.

2. Relation Discrimination (RD)

The RD task challenges the model to determine if two different entity pairs—potentially spanning different sentences or documents—express the same semantic relation.

The Relation Discrimination (RD) task uses contrastive learning to align representations of similar semantic relations across different contexts.

ERICA utilizes contrastive learning for these tasks. By pushing representations of "positive" pairs (similar relations or entities) closer together and pulling "negative" pairs apart, ERICA creates a more structured embedding space that facilitates complex reasoning.

Experimental Setup

The model was pre-trained on a dataset of 1 million Wikipedia documents, distantly supervised by Wikidata to provide over 4,000 unique relation types. Evaluation spanned several critical NLP tasks, including document-level Relation Extraction (DocRED), Entity Typing (FIGER), and multi-hop Question Answering (WikiHop).

Key Findings

  • Superior Low-Resource Performance: ERICA demonstrates significant gains when training data is scarce. On the 1% split of the DocRED dataset, ERICABERT achieved an F1 score of 37.8, compared to the baseline BERT's 30.4.
  • Enhanced Reasoning Capabilities: On the WikiHop dataset, where entity names are masked, ERICA significantly outperformed baselines. This suggests the model relies on learned relational logic rather than simple string matching.
  • Robustness: ERICA improves entity and relation understanding without degrading performance on general linguistic tasks, as evidenced by stable GLUE scores.
  • Structured Embeddings: t-SNE visualizations confirm that ERICA produces tighter, more distinct clusters for specific relations compared to vanilla PLMs, which often appear random.

Conclusion

ERICA provides a powerful framework for baking relational knowledge directly into the pre-training phase of language models. By moving beyond local co-occurrences to document-level relational structures, it enables models to perform the kind of multi-hop reasoning necessary for advanced NLP applications. Future work may involve extending this approach to specialized domains like medicine or law.

Summary updated

BibTeX
@inproceedings{qin2021erica,
  author = {Yujia Qin and Yankai Lin and Ryuichi Takanobu and Zhiyuan Liu and Peng Li and Heng Ji and Minlie Huang and Maosong Sun and Jie Zhou},
  title = {{ERICA: Improving Entity and Relation Understanding for Pre-trained Language Models via Contrastive Learning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.260},
}
Figure