Retrieval-Augmented Code Generation for Universal Information Extraction
Preprint
Abstract
Information Extraction (IE) aims to extract structural knowledge (e.g., entities, relations, events) from natural language texts, which brings challenges to existing methods due to task-specific schemas and complex text expressions. Code, as a typical kind of formalized language, is capable of describing structural knowledge under various schemas in a universal way. On the other hand, Large Language Models (LLMs) trained on both codes and texts have demonstrated powerful capabilities of transforming texts into codes, which provides a feasible solution to IE tasks. Therefore, in this paper, we propose a universal retrieval-augmented code generation framework based on LLMs, called Code4UIE, for IE tasks. Specifically, Code4UIE adopts Python classes to define task-specific schemas of various structural knowledge in a universal way. By so doing, extracting knowledge under these schemas can be transformed into generating codes that instantiate the predefined Python classes with the information in texts. To generate these codes more precisely, Code4UIE adopts the in-context learning mechanism to instruct LLMs with examples. In order to obtain appropriate examples for different tasks, Code4UIE explores several example retrieval strategies, which can retrieve examples semantically similar to the given texts. Extensive experiments on five representative IE tasks across nine datasets demonstrate the effectiveness of the Code4UIE framework.Keywords
All Related Versions
This publication has 13 references indexed in Scilit:
- Universal Information Extraction as Unified Semantic MatchingProceedings of the AAAI Conference on Artificial Intelligence, 2023
- Code4Struct: Code Generation for Few-Shot Event Structure Prediction2023
- CodeIE: Large Code Generation Models are Better Few-Shot Information Extractors2023
- Intelligent Online Selling Point Extraction for E-commerce RecommendationProceedings of the AAAI Conference on Artificial Intelligence, 2022
- DEGREE: A Data-Efficient Generation-Based Event Extraction Model2022
- Packed Levitated Marker for Entity and Relation Extraction2022
- Unified Structure Generation for Universal Information Extraction2022
- Automated Concatenation of Embeddings for Structured Prediction2021
- Assertion-Based QA With Question-Aware Open Information ExtractionProceedings of the AAAI Conference on Artificial Intelligence, 2018
- Development of a benchmark corpus to support the automatic extraction of drug-related adverse effects from medical case reportsJournal of Biomedical Informatics, 2012