arrow
Return

A syntax-guided multi-task learning approach for Turducken-style code generation

delete2023-10-14
delete3
PRE
AI
G
Guang Yang
周
周余 (Yu Zhou) *
陈翔 cover
陈翔 (Xiang Chen)
X
Xiangyu Zhang
Y
Yiran Xu
T
Tingting Han
T
Taolue Chen
DOI:10.1007/s10664-023-10372-1delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Due to the development of pre-trained language models, automated code generation techniques have shown great promise in recent years. However, the generated code will not always adhere to syntactic constraints of the target language, especially in the case of Turducken-style code, where declarative code snippets are embedded within imperative programs. In this study, we summarize three significant challenges in regards to syntactic constraints: (1) the efficient representation of syntactic constraints, (2) the effective integration of syntactic information, and (3) the scalable syntax-first decoding algorithm. To address these challenges, we propose a syntax-guided multi-task learning approach TurduckenGen. Specifically, we first explicitly append the type information to the code tokens to capture the representation of syntactic constraints. Then we formalize code generation with syntactic constraint representation as an auxiliary task to enable the model to learn the syntactic constraints of the code. Finally, the syntactically correct code is selected accurately from the multiple candidates with the help of the compiler feedback. Extensive experiments and comprehensive analysis demonstrate the effectiveness and general applicability of our approach after being compared with six state-of-the-art baselines on two Turducken-style code datasets. Finally, we conducted a human study and found the code quality generated by our approach is better than baselines in terms of code readability and semantic similarity.
Keywords:
Syntactically-constrained code generation
Turducken-style code
Multi-task learning
CodeT5
Abstract syntax tree

Journal

Empirical Software Engineering cover
Empirical Software Engineering
IF:
3.6
Papers:
2.0K
Citations:
5.3K

Organization

U
university of london
Scholars:
21.5W
Papers: 19.7W
Citations: 305
N
Nantong University
Scholars:
1.9W
Papers: 1.1W
Citations: 2.0W
Cited Papers

Cited Papers

A method to optimize the regenerator parameters of a thermoacoustic engine
err2017-09-01
err0
errOAAI
errMarialuisa Napolitano; Raffaele Dragonetti; Rosario Romano
errShare
errSave
ExploitGen: Template-augmented exploit code generation based on CodeBERT
err2023-03-01
err31
PREAI
errYang, Guang; Zhou, Yu; Chen, Xiang; Zhang, Xiangyu; Han, Tingting; Chen, Taolue
errShare
errSave
errShare
errSave
Effects of a restrictive fluid regimen in pediatric patients undergoing major abdominal surgery
err2014-12-11
err0
PREAI
errSahatsa Mandee; Wassana Butmangkun; Naiyana Aroonpruksakul; Niramol Tantemsapya; Benno von Bormann; Suwannee Suraseranivongse
errShare
errSave
Firefighting Acutely Increases Airway Responsiveness
err1989-07-01
err0
PREAI
errCharles B. Sherman; Scott Barnhart; Mary F. Miller; Mark R. Segal; Moira Aitken; Robert Schoene; William Daniell; Linda Rosenstock
errShare
errSave
Caveolin-1 and -2 regulate cell motility in castration-resistant prostate cancer
err2018-10-01
err0
errOAAI
errToyoharu Kamibeppu; Koji Yamasaki; Kozue Nakahara; Takahiro Nagai; Naoki Terada; Hiromasa Tsukino; Shoichiro Mukai; Toshiyuki Kamoto
errShare
errSave
researcher View more