arrow
Return

Syntax-aware on-the-fly code completion

delete2024-01-01
delete3
delete
OA
AI
W
Wannita Takerngsaksiri
Chakkrit Tantithamthavorn cover
Chakkrit Tantithamthavorn (Chakkrit Tantithamthavorn) *
Y
Yuan-Fang Li
DOI:10.1016/j.infsof.2023.107336delete
deleteOriginal
deleteShare
deleteSave
View PDF
Abstract

Abstract

En 中文
Context: Code completion aims to help improve developers' productivity by suggesting the next code tokens from a given context. Various approaches have been proposed to incorporate abstract syntax tree (AST) information for model training, ensuring that code completion is aware of the syntax of the programming languages. However, existing syntax-aware code completion approaches are not on-the-fly, as we found that for every two-thirds of characters that developers type, AST fails to be extracted because it requires the syntactically correct source code, limiting its practicality in real-world scenarios. On the other hand, existing on-the-fly code completion does not consider syntactic information yet. Objective: In this paper, we propose PyCoder to leverage token types, a kind of lightweight syntactic information, which is readily available and aligns with the natural order of source code. Method: Our PyCoder is trained in a multi-task training manner so that by learning the supporting task of predicting token types during the training phase, the models achieve better performance on predicting tokens and lines of code without the need for token types in the inference phase. Results: Comprehensive experiments show that PyCoder achieves the first rank on the CodeXGLUE leaderboard with an accuracy of 77.12% for the token-level predictions, which is 0.43%-24.25% more accurate than baselines. In addition, PyCoder achieves an exact match of 43.37% for the line-level predictions, which is 3.63%-84.73% more accurate than baselines. Conclusions: These results lead us to conclude that token type information (an alternative to syntactic information) that is rarely used in the past can greatly improve the performance of code completion approaches, without requiring the syntactically correct source code like AST-based approaches do. Our PyCoder is publicly available on HuggingFace and GitHub.
Keywords:
Code completion
Multi-task learning
A unified multi-task learning model for AST-level and token-level code completion
err2022-04-18
err17
PREAI
errLiu, Fang; Li, Ge; Wei, Bolin; Xia, Xin; Fu, Zhiyi; Jin, Zhi
errShare
errSave
errShare
errSave
A syntax-guided multi-task learning approach for Turducken-style code generation
err2023-10-14
err3
PREAI
errYang, Guang; Zhou, Yu; Chen, Xiang; Zhang, Xiangyu; Xu, Yiran; Han, Tingting; Chen, Taolue
errShare
errSave
Does Your Neural Code Completion Model Use My Code? A Membership Inference Approach
err2026-03-01
err0
PREAI
errWan, Yao; Wan, Guanghua; Zhang, Shijie; Zhang, Hongyu; Sui, Yulei; Zhou, Pan; Jin, Hai; Sun, Lichao
errShare
errSave
Learning to Predict Code Review Completion Time In Modern Code Review
err2023-05-20
err5
PREAI
errChouchen, Moataz; Ouni, Ali; Olongo, Jefferson; Mkaouer, Mohamed Wiem
errShare
errSave
An Empirical Study on the Usage of Transformer Models for Code Completion
err2021-01-01
err39
errOAAI
errCiniselli, Matteo; Cooper, Nathan; Pascarella, Luca; Mastropaolo, Antonio; Aghajani, Emad; Poshyvanyk, Denys; Di Penta, Massimiliano; Bavota, Gabriele
errShare
errSave
Esale: Enhancing Code-Summary Alignment Learning for Source Code Summarization
err2024-08-01
err2
PREAI
errFang, Chunrong; Sun, Weisong; Chen, Yuchen; Chen, Xiao; Wei, Zhao; Zhang, Quanjun; You, Yudu; Luo, Bin; Liu, Yang; Chen, Zhenyu
errShare
errSave

Journal

Information and Software Technology cover
Information and Software Technology
IF:
4.3
Papers:
3.8K
Citations:
9.5K

Organization

M
monash university
Scholars:
3.6K
Papers: 1.4K
Citations: 4.5W
Cited Papers

Cited Papers

A unified multi-task learning model for AST-level and token-level code completion
err2022-04-18
err17
PREAI
errLiu, Fang; Li, Ge; Wei, Bolin; Xia, Xin; Fu, Zhiyi; Jin, Zhi
errShare
errSave
Meta-analysis of bariatric surgery versus non-surgical treatment for type 2 diabetes mellitus
err2016-09-10
err0
errOAAI
errGuo-zhong Wu; Bing Cai; Feng Yu; Zheng Fang; Xing-li Fu; Hai-sen Zhou; Wen Zhang; Zhi-qiang Tian
errShare
errSave
Comparison of sub‐ versus suprafascially raised anterolateral thigh free flaps with regard to donor‐site morbidity, function and aesthetics
err2017-11-20
err0
PREAI
errSebastian Fischer; Yannick Diehm; Christoph Hirche; Thomas Kremer; Adrien Daigeler; Ulrich Kneser; J. Frederick Hernekamp
errShare
errSave
On the Naturalness of Software
err2016-04-26
err164
PREAI
errHindle, Abram; Barr, Earl T.; Gabel, Mark; Su, Zhendong; Devanbu, Premkumar
errShare
errSave
What are the most important factors determining different vegetation types in the Chapada Diamantina, Brazil?
err2016-03-01
err0
errOAAI
errS. P. S. Neves; R. Funch; A. A. Conceição; L. A. P. Miranda; L. S. Funch
errShare
errSave
Understanding the Family Business
err
IF0
err2011-04-22
err0
PREAI
errKeanon Alderson
errShare
errSave
Rapid Inflammation in Mice Lacking Both SOCS1 and SOCS3 in Hematopoietic Cells
err2016-09-01
err0
errOAAI
errTakashi Ushiki; Nicholas D. Huntington; Stefan P. Glaser; Hiu Kiu; Angela Georgiou; Jian-Guo Zhang; Donald Metcalf; Nicos A. Nicola; Andrew W. Roberts; Warren S. Alexander
errShare
errSave
researcher View more