NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

How to Unleash the Power of Large Language Models for Few-shot Relation Extraction?

Xin Xu, Yuqi Zhu, Xiaohan Wang, Ningyu Zhang · DOI

Abstract

Relation Extraction (RE) identifies semantic relationships between entities in text. In few-shot scenarios, where labeled data is scarce, Large Language Models (LLMs) like GPT-3.5 offer a promising alternative to traditional fine-tuning. This paper investigates strategies to maximize LLM performance in RE, finding that while sophisticated prompting improves in-context learning, the most significant performance gains come from using LLMs to generate high-quality synthetic training data for smaller, specialized models.

Introduction

Relation Extraction (RE) is a fundamental task in information extraction, mapping entity pairs to predefined semantic relations. Traditional supervised models require extensive labeled datasets, which are often unavailable in niche or emerging domains. Few-shot RE aims to bridge this gap. While LLMs have shown remarkable zero-shot and few-shot capabilities, their application to the structured and constrained nature of RE remains challenging. This study explores how to effectively leverage GPT-3.5 to achieve state-of-the-art results in few-shot RE.

Methodology

The researchers evaluated two primary approaches: In-Context Learning (ICL) and LLM-driven Data Generation.

In-Context Learning (ICL)

ICL involves providing the LLM with a task description and a few labeled examples (demonstrations) within the prompt. Three prompting strategies were tested:

  1. TEXT PROMPT: Basic demonstrations of context and relations.
  2. INSTRUCT PROMPT: Incorporates natural language task instructions.
  3. Schema-Constrained Prompt: Includes entity type information to guide the model's classification within valid constraints.
Overview of the prompting strategies used for ICL and data generation.

Data Generation

Recognizing the limitations of ICL, such as context window constraints and sensitivity to demonstration selection, the authors utilized GPT-3.5 as a "data factory." By providing seed examples and schema constraints, the LLM generated synthetic training instances. These instances were then used to fine-tune smaller "student" models like KnowPrompt and TYP Marker, effectively distilling the LLM's knowledge into more efficient architectures.

Experimental Results

The study utilized four major benchmarks: TACRED, TACREV, RE-TACRED, and SciERC.

The Impact of Prompting and Demonstrations

Results indicated that explicit instructions and schema constraints are vital for guiding LLMs through complex relation schemas. However, a "More is Not Always Better" paradox was observed: increasing the number of demonstrations beyond 2-3 often led to performance degradation. This suggests that LLMs are sensitive to noise and the quality of selected examples in long contexts.

LLMs as Supercharged Annotators

The most striking results came from the data generation pipeline. Synthetic data allowed smaller models to significantly outperform previous state-of-the-art methods. Human evaluation confirmed that approximately 78% of the LLM-generated samples were accurately labeled, providing a high-quality signal for fine-tuning.

Comparison of GPT-3 based methods against various baselines across four datasets.

As shown in the results table above, the data generation approach achieved substantial gains. In the 16-shot setting, it improved F1 scores by 10.7% on SciERC and in the 8-shot setting by 6.6% on RE-TACRED compared to the strongest baselines.

Conclusion

This research demonstrates that the true power of LLMs for few-shot relation extraction lies in their ability to act as high-quality data generators rather than just end-to-end extractors. By combining schema-constrained generation with specialized smaller models, practitioners can overcome the limitations of in-context learning and achieve superior performance in data-scarce environments. Future work will explore the use of even larger models like GPT-4 and the integration of chain-of-thought reasoning to further refine the extraction of complex structural relationships.

Summary updated

BibTeX
@inproceedings{xu2023how,
  author = {Xin Xu and Yuqi Zhu and Xiaohan Wang and Ningyu Zhang},
  title = {{How to Unleash the Power of Large Language Models for Few-shot Relation Extraction?}},
  booktitle = {SustaiNLP},
  year = {2023},
  doi = {10.18653/v1/2023.sustainlp-1.13},
}
Figure