Abstract
Large Language Models (LLMs) have demonstrated significant potential in zero-shot tasks, yet Relation Extraction (RE) remains challenging due to the need for nuanced context and diverse examples. This paper introduces "Self-Prompting," a framework that enables LLMs to generate high-quality synthetic datasets to serve as in-context demonstrations. By employing a three-stage diversification strategy—synonym generation, entity filtering, and sentence rephrasing—the framework significantly enhances zero-shot RE performance across multiple benchmarks, outperforming existing state-of-the-art methods while remaining cost-effective.
Introduction
Relation Extraction (RE) is the task of identifying semantic relationships between entities in text, such as identifying that "Steve Jobs" has a founder of relationship with "Apple." While LLMs excel in many zero-shot scenarios, they often struggle with the complexity of RE without specific demonstrations. Current methods typically treat RE as a simple Question Answering (QA) task, which often fails to provide enough context for "long-tail" or complex relations. Traditional solutions rely on expensive human-labeled data. The Self-Prompting framework addresses this by leveraging the LLM's internal knowledge to create its own "hints" or in-context examples, bypassing the need for human intervention.
The Self-Prompting Framework
The core of the proposed approach is the automated construction of a synthetic dataset used for In-Context Learning (ICL). Instead of relying on human-annotated examples, the system prompts an LLM to build a synthetic dataset from scratch. To prevent the LLM from generating repetitive or biased data, a three-stage diversification strategy is implemented:
- Relation Synonyms: The model generates multiple semantic equivalents for a target relation (e.g., "situated at" for "Location") to broaden its linguistic reach.
- Entity Filtering: To avoid over-representation of common entities like "John" or "London," the framework tracks and filters high-frequency subjects and objects.
- Sentence Rephrase: Generated sentences are rewritten into various syntactic forms (simple, compound, complex) while keeping the underlying relation intact.
During inference, when a new test sentence arrives, the system uses a text embedding model to retrieve the most semantically similar synthetic examples. These are formatted as ICL demonstrations, providing the LLM with a clear, relevant template for how to extract the relation.
Experimental Evaluation
The framework was evaluated on four major RE benchmarks: FewRel, Wiki-ZSL, TACRED, and SemEval. The authors tested the models on varying numbers of "unseen" relations ($m = 5, 10, 15$) to measure how well the system scales to increasingly difficult tasks where the model must disambiguate between many possible choices.
Results and Discussion
Self-Prompting consistently achieved state-of-the-art performance, outperforming existing zero-shot RE methods like RE-Matching and QA4RE across almost all datasets. A key finding was the framework's ability to significantly boost smaller models; for instance, Qwen-1.8B saw an F1 increase of up to 14.57%. This suggests that Self-Prompting is an excellent way to make smaller, cheaper models perform like much larger ones.
The ablation study (Figure 5) confirms that each component of the diversification strategy—synonyms, entity filtering, and rephrasing—is essential. Removing any single stage leads to a measurable drop in F1 scores, highlighting that semantic breadth and linguistic complexity are critical for high-quality synthetic data. Furthermore, the approach is highly cost-effective, with synthetic data generation costing approximately $0.26 per relation using the GPT-3.5 API, orders of magnitude cheaper than hiring human annotators.
Conclusion and Future Directions
The Self-Prompting framework demonstrates that LLMs already possess the knowledge required for RE; they simply need a structured way to externalize that knowledge into a format they can use to guide their own reasoning. While highly effective, the system remains sensitive to the quality of the initial synthetic generation and the accuracy of the retrieval mechanism. Future work will focus on mitigating error propagation from noisy synthetic samples and extending the framework to highly specialized domains such as medical or legal text.
Summary updated