Relation Extraction — Semantic Relations Between Entities

Machine Learning
Type
NLP information-extraction task

What does it do?

Relation extraction is a natural-language-processing task that detects and classifies the semantic relations between entities mentioned in text.

Early work used kernel-based methods (Zelenko and colleagues), and later approaches learn neural relation representations (Baldini Soares and colleagues, 2019). The task turns free-form text into structured entity–relation–entity facts.

The intuition behind the method

A sentence can name two things — a person and a company, a drug and a disease — and quietly state how they are connected. Relation extraction is about reading that connection out of the text and labelling it. Rather than only spotting which entities appear, the method asks what relationship links a given pair of entities, and assigns each pair a relation type drawn from a defined set.

History

Zelenko, Aone and Richardella applied kernel methods to relation extraction, an early machine-learning approach to the task. Baldini Soares and colleagues (2019) introduced 'Matching the Blanks', which builds task-agnostic relation representations solely from entity-linked text using BERT. They report that these representations significantly outperform previous work on exemplar-based relation extraction (FewRel), even without using that task's training data. They also report that models initialised with these representations and then tuned on supervised relation extraction datasets significantly outperform previous methods on SemEval 2010 Task 8, KBP37 and TACRED.

When to use it

Choose relation extraction when the question concerns how specific entities in text are connected, not merely which entities appear. It needs text data, NER output for that same text, and a labelled relation dataset to train and check the classifier. If you only need the entities, NER alone is sufficient; if no labelled relation data exist, the supervised setup described here does not apply. Relation classification is usually framed at sentence level, where both entities occur in the same sentence; relations that span several sentences require a broader scope and are not covered by the classifiers described on this page. The amount of labelled data needed cannot be fixed by a universal count. Judge it from validation results on labelled data from your own domain.

Limitations and considerations

  • Requires a labelled relation dataset to train and evaluate the classifier, so the cost of annotation must be met before the method can be applied.
  • Depends on named-entity recognition as a prerequisite, so NER errors (missed or wrongly typed entities) propagate into the extracted relations.
  • Reliable classification needs enough labelled examples for each relation type. The amount required varies with the domain and the number of relation types, and should be judged from validation results rather than a fixed count.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Turns unstructured text into structured entity–relation–entity facts that can be loaded into knowledge bases or used in later analysis.
  • Assigns a semantic type to the link between two entities, which goes beyond detecting that both entities occur in the same text.
  • Its output can be checked directly against labelled relation data during evaluation.

Applications

  • Populating knowledge bases with entity–relation–entity facts extracted from documents.
  • Extracting typed links such as person–organisation or drug–disease relations from text.
  • Supplying typed relations, rather than raw entity mentions, to downstream information-extraction pipelines.

How it works

How it works

1

The raw text is cleaned and normalised so that the entity detector and the relation classifier receive consistent input. Inconsistent text units can make both downstream steps less reliable.

2

Named-entity recognition (NER) locates the entities in the text, and its output is the prerequisite for the rest of the pipeline. Candidate entity pairs are then formed from the recognised entities, so that each pair can be examined for a possible relation.

3

Each candidate entity pair is classified into a semantic relation type by a model trained on a labelled relation dataset. The direction of the relation (which entity is the subject and which is the object) is encoded explicitly, because the same pair can stand in different relations depending on order. Early work used kernel-based methods (Zelenko and colleagues); later approaches use neural encoders such as BERT, with task-agnostic relation representations learned from entity-linked text (Baldini Soares and colleagues, 2019). Pairs that do not express a defined relation must also be handled by this step, so the output is a set of typed relations linking entity pairs.

4

Predicted relations are compared against labelled relation data on a held-out test set, so classification quality is measured before the extracted relations are used downstream. Relation classification is typically scored with precision, recall and F1 for each relation type, with the no-relation class reported separately. Aggregate scores can hide poor performance on rare relation types, so per-type results should be inspected.

Common pitfalls

  • Skipping text preprocessing leaves noisy, inconsistent units that degrade both entity detection and relation classification.
  • Treating NER as optional: relation extraction depends on entity detection, so weak NER output undermines the whole pipeline.
  • Training on too few labelled examples, especially for rare relation types, yields unreliable classification. Check learning curves or validation scores on data from your own domain.
  • Assuming a relation exists for every entity pair; many pairs carry no defined relation and should be classified as such.

Frequently asked questions

How is relation extraction different from named-entity recognition?

NER finds the entities in text, such as people, organisations and places. Relation extraction goes a step further and classifies how a pair of entities is related. NER output is a prerequisite: relation extraction operates on the entities that NER has already detected.

Do I need labelled data?

Yes, in the supervised setup described on this page. A labelled relation dataset is used to train the relation classifier and to evaluate its predictions.

How much text do I need?

No fixed minimum is established for this method. The sufficient amount depends on the number of labelled examples available for each relation type and on the domain. Judge it from classification quality on held-out labelled data from your own domain, and check how scores change as more labelled data are added.

What does the output look like?

The output is a set of typed semantic relations between entity pairs: structured entity–relation–entity facts extracted from the text and checked against labelled relation data during evaluation.

Related methods

Sources

  1. Zelenko, D., Aone, C. & Richardella, A. (2003). Kernel Methods for Relation Extraction. Journal of Machine Learning Research, 3, 1083-1106.

    Open publication reference
  2. Soares, L. B., FitzGerald, N., Ling, J. & Kwiatkowski, T. (2019). Matching the Blanks: Distributional Similarity for Relation Learning. Proceedings of ACL 2019.

    Open DOI reference