Code4Struct: Code Generation for Few-Shot Event Structure Prediction
- URL: http://arxiv.org/abs/2210.12810v2
- Date: Thu, 25 May 2023 00:48:44 GMT
- Title: Code4Struct: Code Generation for Few-Shot Event Structure Prediction
- Authors: Xingyao Wang, Sha Li, Heng Ji
- Abstract summary: We propose Code4Struct to leverage text-to-structure translation capability to tackle structured prediction tasks.
We formulate Event Argument Extraction (EAE) as converting text into event-argument structures that can be represented as a class object using code.
Code4Struct is comparable to supervised models trained on 4,202 instances and outperforms current state-of-the-art (SOTA) trained on 20-shot data by 29.5% absolute F1.
- Score: 55.14363536066588
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: Large Language Model (LLM) trained on a mixture of text and code has
demonstrated impressive capability in translating natural language (NL) into
structured code. We observe that semantic structures can be conveniently
translated into code and propose Code4Struct to leverage such text-to-structure
translation capability to tackle structured prediction tasks. As a case study,
we formulate Event Argument Extraction (EAE) as converting text into
event-argument structures that can be represented as a class object using code.
This alignment between structures and code enables us to take advantage of
Programming Language (PL) features such as inheritance and type annotation to
introduce external knowledge or add constraints. We show that, with sufficient
in-context examples, formulating EAE as a code generation problem is
advantageous over using variants of text-based prompts. Despite only using 20
training event instances for each event type, Code4Struct is comparable to
supervised models trained on 4,202 instances and outperforms current
state-of-the-art (SOTA) trained on 20-shot data by 29.5% absolute F1.
Code4Struct can use 10-shot training data from a sibling event type to predict
arguments for zero-resource event types and outperforms the zero-shot baseline
by 12% absolute F1.
Related papers
- StrucText-Eval: Evaluating Large Language Model's Reasoning Ability in Structure-Rich Text [29.03935605732864]
We introduce StrucText-Eval, a benchmark to evaluate how well large language models understand and reason through structured text.
We show that while open-source LLMs achieve a maximum accuracy of 74.9% on the standard dataset, their performance drops significantly to 45.8% on the harder dataset.
In contrast, human participants reach an accuracy of 92.6% on StrucText-Eval-Hard, highlighting LLMs' current limitations in handling intricate structural information.
arXiv Detail & Related papers (2024-06-15T12:48:00Z) - Promptly Predicting Structures: The Return of Inference [31.442123334313035]
We present a framework for constructing zero- and few-shot linguistic structure predictors.
Our results show that enforcing consistency constructs not only structurally valid outputs, but also improves performance.
arXiv Detail & Related papers (2024-01-12T20:08:39Z) - Retrieval-Augmented Code Generation for Universal Information Extraction [66.68673051922497]
Information Extraction aims to extract structural knowledge from natural language texts.
We propose a universal retrieval-augmented code generation framework based on Large Language Models (LLMs)
Code4UIE adopts Python classes to define task-specific schemas of various structural knowledge in a universal way.
arXiv Detail & Related papers (2023-11-06T09:03:21Z) - COLLIE: Systematic Construction of Constrained Text Generation Tasks [33.300039566331876]
COLLIE is a grammar-based framework that allows the specification of rich, compositional constraints with diverse generation levels.
We develop tools for automatic extraction of task instances given a constraint structure and a raw text corpus.
We perform systematic experiments across five state-of-the-art instruction-tuned language models and analyze their performances to reveal shortcomings.
arXiv Detail & Related papers (2023-07-17T17:48:51Z) - Soft-Labeled Contrastive Pre-training for Function-level Code
Representation [127.71430696347174]
We present textbfSCodeR, a textbfSoft-labeled contrastive pre-training framework with two positive sample construction methods.
Considering the relevance between codes in a large-scale code corpus, the soft-labeled contrastive pre-training can obtain fine-grained soft-labels.
SCodeR achieves new state-of-the-art performance on four code-related tasks over seven datasets.
arXiv Detail & Related papers (2022-10-18T05:17:37Z) - DeepStruct: Pretraining of Language Models for Structure Prediction [64.84144849119554]
We pretrain language models on a collection of task-agnostic corpora to generate structures from text.
Our structure pretraining enables zero-shot transfer of the learned knowledge that models have about the structure tasks.
We show that a 10B parameter language model transfers non-trivially to most tasks and obtains state-of-the-art performance on 21 of 28 datasets.
arXiv Detail & Related papers (2022-05-21T00:58:22Z) - Contrastive Learning for Source Code with Structural and Functional
Properties [66.10710134948478]
We present BOOST, a novel self-supervised model to focus pre-training based on the characteristics of source code.
We employ automated, structure-guided code transformation algorithms that generate functionally equivalent code that looks drastically different from the original one.
We train our model in a way that brings the functionally equivalent code closer and distinct code further through a contrastive learning objective.
arXiv Detail & Related papers (2021-10-08T02:56:43Z) - GraphCodeBERT: Pre-training Code Representations with Data Flow [97.00641522327699]
We present GraphCodeBERT, a pre-trained model for programming language that considers the inherent structure of code.
We use data flow in the pre-training stage, which is a semantic-level structure of code that encodes the relation of "where-the-value-comes-from" between variables.
We evaluate our model on four tasks, including code search, clone detection, code translation, and code refinement.
arXiv Detail & Related papers (2020-09-17T15:25:56Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.