Abstract
In-context learning (ICL) for relational triple extraction (RTE) has achieved promising performance but still encounters two key challenges: (1) how to design effective prompts and (2) how to select proper demonstrations. Existing methods often recast the RTE task into text-to-text prompting formats, which is unnatural and results in a mismatch between the output format at pre-training time and inference time for large language models (LLMs). Furthermore, they typically utilize surface natural language features and lack consideration of triple semantics in sample selection. To address these issues, we propose TableIE, a tabular prompting method that frames RTE as a table generation task to incorporate explicit structured information. We also introduce Instructive In-Context Learning (I²CL), which selects and annotates samples based on internal triple semantics. Specifically, we use off-the-shelf LLMs for schema-agnostic pre-extraction of triples in unlabeled data, then train a sample retrieval model based on a novel triple-level similarity metric. Experimental results on two RTE benchmarks show that I²CL with TableIE achieves state-of-the-art performance compared to other methods under various few-shot settings.
Introduction
Relational Triple Extraction (RTE) is the foundational task of identifying structured information in the form of (Subject, Predicate, Object) triples from raw text. For example, from the sentence "Lionel Messi was born in Argentina," a model should extract (Lionel Messi, born_in, Argentina). While Large Language Models (LLMs) have demonstrated remarkable capabilities in In-Context Learning (ICL)—performing tasks with only a few examples provided in the prompt—they face significant hurdles in RTE.
Two primary challenges block improved performance: Format Mismatch and Poor Example Selection. Most current prompts use "text-to-text" formats like JSON or natural language strings, which can be verbose, expensive, and inconsistent with the model's pre-training data. Additionally, few-shot examples are often selected based on surface-level sentence similarity. However, sentences that sound similar may contain entirely different relationship types, making them poor demonstrations for the specific extraction task at hand.
Methodology
To tackle these challenges, we introduce a dual-pronged approach consisting of TableIE for prompt design and I²CL for sample selection.
1. TableIE: Tabular Prompting
Instead of asking models to generate complex code or nested strings, TableIE frames the extraction task as generating a Markdown-style table. The model is prompted to produce rows following a header such as: |step|predicate|subject type|subject|object type|object|.
This format is highly effective because Markdown tables are prevalent in LLM training corpora. TableIE is concise, enforces structure without the overhead of complex syntax (like JSON brackets), and is significantly more token-efficient—roughly 2.9x more efficient than CodeIE (which uses Python code formats).
2. I²CL: Instructive In-Context Learning
The I²CL framework is designed to identify the most "instructive" examples for a given query. It operates through three main stages:
- Silver Extraction: We employ an LLM in a zero-shot mode to perform "silver" extraction on a large pool of unlabeled data. While these triples may not be perfect, they capture the underlying semantic patterns of the dataset.
- Triple-Level Similarity: We introduce a novel similarity metric based on the Pompeiu-Hausdorff distance. This metric calculates the similarity between two sentences based on the sets of triples they contain, rather than just their surface-level vocabulary.
- Retriever Training: A smaller model (such as Sentence-BERT) is fine-tuned to predict this triple-based similarity using only raw text. This allows for rapid retrieval of the best demonstration examples for any new test sentence.
Experimental Evaluation
We evaluated our approach on two standard benchmarks: CoNLL04, which focuses on balanced entity types like people and locations, and NYT (New York Times), a large, imbalanced dataset with 24 relation types that tests a model's robustness to real-world noise.
Key Results
- State-of-the-Art Performance: I²CL with TableIE consistently outperformed existing methods like TextIE and CodeIE across various LLMs, including GPT-3, ChatGPT, and GPT-4.
- Selection Gains: On CoNLL04, our triple-level selection strategy improved performance by up to 6.74% compared to random selection.
- Efficiency: TableIE significantly reduces the number of tokens required per prompt, leading to faster inference and lower operational costs.
- Generalizability: The retriever trained on the NYT dataset showed significant performance boosts when tested on CoNLL04, indicating that the triple-level logic generalizes across different domains.
Conclusion
By prioritizing structure over syntax and semantic relevance over surface similarity, TableIE and I²CL provide a robust framework for relational triple extraction. Our findings suggest that for structural tasks, models benefit most from examples that share similar output structures. Future work will explore making the selection process more dynamic for real-time queries and extending the tabular format to handle more complex N-ary relations.
Summary updated