relation extraction
**Relation extraction** is the NLP task of identifying and classifying **semantic relationships** between entities mentioned in text. Given a sentence like "TSMC manufactures chips for Apple," relation extraction would identify the **manufactures_for** relationship between the entities **TSMC** and **Apple**.
**How Relation Extraction Works**
- **Input**: Text containing two or more identified entities (from named entity recognition).
- **Output**: The type of relationship between entity pairs, selected from a predefined set (e.g., works_at, located_in, manufactures, acquired_by).
- **Example**: "Jensen Huang founded NVIDIA in 1993" → (Jensen Huang, **founded**, NVIDIA)
**Approaches**
- **Supervised Classification**: Train a model (BERT + classification head) on labeled examples of entity pairs and their relations. High accuracy but requires extensive annotated data.
- **Distant Supervision**: Automatically generate training data by aligning a **knowledge base** (like Wikidata) with text. If (TSMC, headquartered_in, Hsinchu) is a known fact, any sentence mentioning both "TSMC" and "Hsinchu" is assumed to express that relation.
- **Few-Shot / Zero-Shot**: Use LLMs to extract relations with minimal or no training examples by providing instructions and demonstrations in the prompt.
- **Open Relation Extraction**: Extract relation phrases directly from text without constraining to a predefined schema (see **open information extraction**).
**Challenges**
- **Ambiguity**: The same entity pair can have multiple relations depending on context.
- **Long-Range Dependencies**: Relations may span multiple sentences or require coreference resolution.
- **Domain Adaptation**: Models trained on general text may not handle domain-specific relations (semiconductor manufacturing, legal contracts) without adaptation.
**Applications**
Relation extraction is essential for **knowledge graph construction**, **question answering**, **document understanding**, and **intelligence analysis**. It transforms unstructured text into structured knowledge that can be queried, reasoned over, and integrated into AI systems.