Retrieval-Augmented Code Generation for Universal Information Extraction

Yucan Guo, Zixuan Li, Xiaolong Jin, Yantao Liu, Yutao Zeng +6 more
11/6/2023
cs.AIcs.CLcs.IR

No official code found. Best implementation: YucanGuo/Code4UIE (6 stars, last commit 2024-03-14).

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.

View on arXivView PDF

Code Implementations(1)

YucanGuo/Code4UIECommunity66%

Retrieval-Augmented Code Generation for Universal Information Extraction

61PythonMar 12, 20242 years ago

Similar Papers

Cite this paper

@article{guo2023retrievalaugmented,
  title  = {Retrieval-Augmented Code Generation for Universal Information Extraction},
  author = {Yucan Guo and Zixuan Li and Xiaolong Jin and Yantao Liu and Yutao Zeng and Wenxuan Liu and Xiang Li and Pan Yang and Long Bai and Jiafeng Guo and Xueqi Cheng},
  year   = {2023},
  eprint = {2311.02962},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2311.02962v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2311.02962.svg)](https://codeofpaper.com/paper/2311.02962)

Discussion