Aligning Instruction Tasks Unlocks Large Language Models as Zero-Shot Relation Extractors

Kai Zhang, Bernal Jimenez Gutierrez, Yu Su

Introduction

Relation Extraction (RE) is a fundamental task in natural language processing, requiring a model to identify the semantic relationship between two entities within a given text. For example, in the sentence "Steve Jobs co-founded Apple," a model should identify the org:founded_by relationship between Steve Jobs and Apple.

Despite the remarkable zero-shot capabilities of instruction-tuned Large Language Models (LLMs) like GPT-3.5 and FLAN-T5, they have historically struggled to outperform much smaller models (under 1B parameters) that were specifically fine-tuned for Natural Language Inference (NLI) on RE benchmarks. This paper investigates this discrepancy and introduces QA4RE, a framework designed to unlock the latent RE capabilities of LLMs by addressing task misalignment.

The Problem: Task Misalignment

The authors hypothesize that the poor performance of LLMs on zero-shot RE is not due to a lack of reasoning ability, but rather a mismatch between the task format and the model's training history. Analysis of common instruction-tuning datasets reveals that RE tasks typically constitute less than 1% of the training data. In contrast, Question Answering (QA) tasks are far more prevalent, making up 12-15% of the datasets.

Because LLMs are heavily optimized to follow QA instructions, asking them to perform RE in a standard classification format—often referred to as "Vanilla RE"—leads to sub-optimal results. The models are essentially being asked to operate in an "interface" they haven't mastered during their instruction-tuning phase.

Methodology: The QA4RE Framework

To bridge this gap, the authors introduce QA4RE (Question Answering for Relation Extraction). This framework reformulates the RE classification problem into a multiple-choice QA task, a format that aligns with the model's strongest learned behaviors.

Comparison of NLI RE, Vanilla RE, and QA4RE approaches. QA4RE reformulates the task into a multiple-choice format that matches common instruction-tuning patterns.

The QA4RE process involves three key steps:

  1. Template Generation: Every possible relation in the schema is converted into a natural language template. For instance, the relation per:city_of_birth is transformed into "Entity 1 was born in the city Entity 2."
  2. Type Constraints: To improve efficiency and accuracy, the system filters out relations that are semantically impossible based on the entity types (e.g., a "Person" cannot have a "headquarters").
  3. Multiple-Choice Prompting: The LLM is presented with the original sentence and a list of options (A, B, C, D...) corresponding to the valid templates, plus a "no relation" option. The model is then prompted to select the single best letter.

Key Results and Insights

The shift to a QA format yielded dramatic improvements in performance. QA4RE achieved an average absolute F1 improvement of 8.2% for text-davinci-003 and 8.6% for FLAN-T5 XXL across major benchmarks like TACRED and SemEval.

Average RE Performance (F1) comparing Vanilla RE and QA4RE against the prior State-of-the-Art (SoTA). QA4RE allows LLMs to significantly surpass previous benchmarks.

Crucially, this approach allowed instruction-tuned LLMs to finally surpass the previous zero-shot State-of-the-Art (SoTA), which was held by a specialized, fine-tuned DeBERTa model. Beyond raw performance, the authors found that QA4RE is remarkably robust. While previous NLI-based methods are sensitive to the specific wording of templates, the multiple-choice QA format maintained high performance even when using "low-quality" or non-expert templates. This suggests that the QA "interface" itself provides a more stable foundation for model reasoning.

Conclusion

The success of QA4RE demonstrates that the performance of LLMs on specific tasks is heavily dependent on how those tasks are presented. By aligning the "interface" of Relation Extraction with the more common Question Answering format, researchers can unlock significant latent performance without additional fine-tuning. This "alignment" logic could potentially be applied to other underrepresented tasks in instruction-tuning datasets, such as named entity recognition or event extraction.

Summary updated

BibTeX
@inproceedings{zhang2023aligning,
  author = {Kai Zhang and Bernal Jimenez Gutierrez and Yu Su},
  title = {{Aligning Instruction Tasks Unlocks Large Language Models as Zero-Shot Relation Extractors}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.50},
}
Figure