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

Abstract

Scaling language models have revolutionized widespread NLP tasks, yet little research has comprehensively explored few-shot relation extraction (RE) with large language models (LLMs). In this paper, we investigate principal methodologies—in-context learning and data generation—for few-shot RE via GPT-3.5 through exhaustive experiments. To enhance few-shot performance, we propose task-related instructions and schema-constrained data generation. We observe that in-context learning can achieve performance on par with previous prompt learning approaches, and data generation with LLMs can boost previous solutions to obtain new state-of-the-art few-shot results on four widely-studied RE datasets.

Introduction

Relation Extraction (RE) is the task of identifying semantic relationships between entities in a sentence (e.g., identifying the org:founded_by relation in "Steve Jobs co-founded Apple"). While fine-tuning "small" language models (SLMs) like RoBERTa has been the standard approach, these models often struggle in "few-shot" scenarios where labeled data is scarce.

Large Language Models (LLMs) like GPT-3.5 offer a promising alternative through in-context learning (ICL). However, RE presents unique challenges for LLMs due to its complex schemas and the need for structural understanding. This research explores how to maximize LLM performance for few-shot RE, proposing strategies that allow LLMs to act as both standalone extractors and synthetic data generators.

Methodologies

The study investigates two primary strategies for leveraging LLMs in the few-shot RE domain:

1. In-Context Learning (ICL)

ICL involves providing the model with a few examples within the prompt to guide its output. The researchers tested three prompting variations:

  • Text Prompt: Basic context and examples without additional guidance.
  • Instruct Prompt: Includes a clear description of the RE task to set the context.
  • Schema-constrained Prompting: Explicitly provides entity types (e.g., "Head Entity is a PERSON") to help the model navigate the predefined label space and avoid logical errors.

2. Data Generation

Instead of using the LLM as the final extractor, this method uses GPT-3.5 as a "teacher" to generate synthetic training data. By prompting the model to "generate more samples like these" for specific relations, the researchers created high-quality synthetic datasets. These datasets were then used to fine-tune smaller, more efficient specialized models such as KnowPrompt or TYP Marker.

Experimental Setup

The methodologies were evaluated across four benchmark RE datasets:

  • TACRED: A large-scale dataset featuring 42 relation types.
  • TACREV & RE-TACRED: Refined versions of TACRED with improved label consistency.
  • SciERC: A specialized dataset focused on scientific relations (e.g., "HYPONYM-OF") derived from AI paper abstracts.

Key Insights and Findings

The Power of Instructions

Simple text prompts are often insufficient for RE. The inclusion of "Task-related Instructions" significantly boosts performance by helping the model understand the structural rules and constraints of the extraction task.

The "More is Less" Paradox

Counter-intuitively, increasing the number of examples in an ICL prompt does not always lead to better results. Performance often peaks at 2 or 3 examples and declines thereafter. This suggests that excessive examples may confuse the model or make it difficult to identify the most relevant patterns.

LLMs as Data Engines

The most significant performance gains came from using LLMs for data generation. Synthetic data generated by GPT-3.5 outperformed traditional augmentation techniques like WordNet-based synonym substitution. This approach allowed smaller models to achieve new state-of-the-art (SOTA) results.

Schema Constraints and Directionality

LLMs occasionally struggle with the directionality of relations (e.g., confusing A is the parent of B with B is the parent of A). Providing explicit schema constraints—defining the expected entity types for each relation—helps the model ground its predictions and maintain logical consistency.

Results

The proposed methods achieved impressive results across all benchmarks:

  • New State-of-the-Art: Fine-tuning smaller models with LLM-generated data set new SOTA benchmarks on all four datasets.
  • Significant Performance Jumps: On the scientific SciERC dataset, the data generation approach improved 16-shot performance by 10.7%. On RE-TACRED, a 6.6% improvement was observed.
  • Efficiency: One-shot ICL (using only a single example) achieved performance comparable to the full-parameter fine-tuning of smaller models, highlighting the inherent power of LLMs even without specialized training.

Conclusion and Future Work

While LLMs demonstrate immense potential for few-shot RE, challenges remain. Models still struggle with entity confusion (when head and tail entities are the same word) and long-distance dependencies within sentences. Furthermore, while GPT-3.5 is a powerful generalist, its performance in highly technical domains like SciERC still lags behind its performance on general news text.

Future research will explore the capabilities of open-source models (like Llama) and investigate black-box optimization techniques to further refine prompts without requiring access to internal model weights. This work serves as a foundation for utilizing LLMs to overcome the data scarcity bottleneck in relation extraction.

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