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

被引:2
|
作者
Yang, Guang [1 ]
Zhou, Yu [1 ]
Chen, Xiang [2 ]
Zhang, Xiangyu [1 ]
Xu, Yiran [1 ]
Han, Tingting [3 ]
Chen, Taolue [3 ]
机构
[1] Nanjing Univ Aeronaut & Astronaut, Coll Comp Sci & Technol, Nanjing, Peoples R China
[2] Nantong Univ, Sch Informat Sci & Technol, Nantong, Peoples R China
[3] Birkbeck Univ London, Dept Comp Sci, London, England
基金
中国国家自然科学基金;
关键词
Syntactically-constrained code generation; Turducken-style code; Multi-task learning; CodeT5; Abstract syntax tree;
D O I
10.1007/s10664-023-10372-1
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页数:35
相关论文
共 50 条
  • [31] An attention-guided and prior-embedded approach with multi-task learning for shadow detection
    Zhang, Shihui
    Li, He
    Kong, Weihang
    Zhang, Xiaowei
    Ren, Weidong
    KNOWLEDGE-BASED SYSTEMS, 2020, 194
  • [32] A Multi-Task Learning Approach for Delayed Feedback Modeling
    Huangfu, Zhigang
    Zhang, Gong-Duo
    Wu, Zhengwei
    Wu, Qintong
    Zhang, Zhiqiang
    Gu, Lihong
    Zhou, Jun
    Gu, Jinjie
    COMPANION PROCEEDINGS OF THE WEB CONFERENCE 2022, WWW 2022 COMPANION, 2022, : 116 - 120
  • [33] ROM: A Robust Online Multi-Task Learning Approach
    Zhang, Chi
    Zhao, Peilin
    Hao, Shuji
    Soh, Yeng Chai
    Lee, Bu Sung
    2016 IEEE 16TH INTERNATIONAL CONFERENCE ON DATA MINING (ICDM), 2016, : 1341 - 1346
  • [34] Multi-task Learning Approach for Intracranial Hemorrhage Prognosis
    Cobo, Miriam
    Perez del Barrio, Amaia
    Menendez Fernandez-Miranda, Pablo
    Sanz Bellon, Pablo
    Lloret Iglesias, Lara
    Silva, Wilson
    MACHINE LEARNING IN MEDICAL IMAGING, PT II, MLMI 2024, 2025, 15242 : 12 - 21
  • [35] A Multi-Task Learning Approach to Personalized Progression Modeling
    Ghalwash, Mohamed
    Dow, Daby
    2020 8TH IEEE INTERNATIONAL CONFERENCE ON HEALTHCARE INFORMATICS (ICHI 2020), 2020, : 92 - 100
  • [36] Analysis on Compressed Domain: A Multi-Task Learning Approach
    Zhang, Yuefeng
    Jia, Chuanmin
    Chang, Jianhui
    Ma, Siwei
    DCC 2022: 2022 DATA COMPRESSION CONFERENCE (DCC), 2022, : 494 - 494
  • [37] An Information-Theoretic Approach for Multi-task Learning
    Yang, Pei
    Tan, Qi
    Xu, Hao
    Ding, Yehua
    ADVANCED DATA MINING AND APPLICATIONS, PROCEEDINGS, 2009, 5678 : 386 - 396
  • [38] A Kernel Approach to Multi-Task Learning with Task-Specific Kernels
    武威
    李航
    胡云华
    金榕
    Journal of Computer Science & Technology, 2012, 27 (06) : 1289 - 1301
  • [39] A Kernel Approach to Multi-Task Learning with Task-Specific Kernels
    Wei Wu
    Hang Li
    Yun-Hua Hu
    Rong Jin
    Journal of Computer Science and Technology, 2012, 27 : 1289 - 1301
  • [40] A Kernel Approach to Multi-Task Learning with Task-Specific Kernels
    Wu, Wei
    Li, Hang
    Hu, Yun-Hua
    Jin, Rong
    JOURNAL OF COMPUTER SCIENCE AND TECHNOLOGY, 2012, 27 (06) : 1289 - 1301