Introduction
Relation Extraction (RE)—the task of identifying factual relationships like "Stephen Curry plays for the Warriors" from unstructured text—is fundamental for constructing and maintaining knowledge bases. Traditionally, high-performance RE systems have relied on extensive human-labeled datasets to train specialized models. While modern large language models (LMs) like RoBERTa possess significant internal knowledge, leveraging them for precise extraction from specific contexts remains challenging.
Directly querying an LM often leads to "hallucinations," where the model answers based on its internal memory rather than the provided text. Conversely, existing unsupervised methods often struggle with noise or require complex, weakly-supervised training cycles that can inadvertently degrade performance. The authors propose RE-Flex, a framework that utilizes an LM’s generative power for factual extraction through "constrained cloze completion," requiring no task-specific fine-tuning.
The RE-Flex Framework
RE-Flex transforms off-the-shelf LMs into effective relation extractors by imposing constraints during the inference process. The framework consists of three primary stages:
- Context Rejection: To ensure the provided text actually contains the target relation, RE-Flex employs an information-theoretic scoring function based on Pointwise Mutual Information (PMI). It compares tokens in a "cloze template" (e.g., "[X] was created by [Y]") against the context tokens, filtering out irrelevant snippets that might lead to false positives.
- Relation Extraction (Constrained Inference): Instead of allowing the LM to select any word from its entire vocabulary, RE-Flex restricts the output space to only those words present in the provided context. It reassigns the LM's probability mass to these context tokens by calculating their semantic compatibility with the "masked" position in the query, using the LM's own contextual embeddings to identify an "anchor token."
- Anchor Token Expansion: Because LMs typically predict single tokens (e.g., "Curry"), RE-Flex utilizes an off-the-shelf Named Entity Recognition (NER) tool to expand the identified anchor into a complete entity (e.g., "Stephen Curry").
Experimental Setup and Datasets
The authors evaluated RE-Flex across four major benchmarks to test its versatility and robustness:
- LAMA (T-REx and Google-RE): Standard probes for assessing the factual knowledge captured within LMs.
- ZSRE (Zero-Shot Relation Extraction): Evaluates the model's ability to generalize to relations not seen during any prior training.
- TACRED: A large-scale dataset adapted into a "slot-filling" format to specifically test the model's ability to handle "no relation" cases through context rejection.
Key Results and Discussion
RE-Flex demonstrates significant improvements over existing unsupervised and even some supervised baselines.
- Performance Gains: RE-Flex outperformed the next-best unsupervised method by a substantial 27.8 F1 points on the T-REx dataset.
- Competitive with Supervision: On the LAMA benchmarks, RE-Flex achieved an F1 of 87.2 on Google-RE, surpassing supervised baselines like BiDAF (74.8).
- The Power of Constraints: The results suggest that LMs are more effective at extraction when their choices are limited to the provided context, effectively eliminating the hallucination problem.
- Robustness via Rejection: On the TACRED dataset, the "Context Rejection" step was crucial, boosting the F1 score by over 10 points by correctly identifying instances where no relation was present.
Insights
The success of RE-Flex highlights that constraint is a feature. By forcing the model to ground its predictions in the provided text, it avoids the pitfalls of purely generative approaches. Furthermore, the fact that this unsupervised framework often beats "weakly-supervised" models suggests that training on noisy, automatically generated data can be less effective than using a pre-trained model with intelligent inference-time constraints. Finally, RE-Flex avoids the length bias often found in supervised models, as it does not "learn" expected answer lengths but rather finds the most semantically fitting token.
Limitations and Future Work
Despite its success, RE-Flex has limitations:
- Template Sensitivity: Performance is dependent on the quality of manually written cloze templates. Automating template generation is a key area for future research.
- Domain-Specific Complexity: The model can struggle with highly specialized relations (e.g., astronomical data) where the relation's intent is difficult to capture in simple natural language.
- NER Dependency: The final entity expansion relies on external NER models; failures in NER recognition can lead to partial or incorrect answers.
Future work will explore deeper integration of "intent" into the generation process to handle more nuanced, multi-token relations.
Summary updated