Please use this identifier to cite or link to this item: http://bura.brunel.ac.uk/handle/2438/30909
Title: SkCoder: A Sketch-based Approach for Automatic Code Generation
Authors: Li, J
Li, Y
Li, G
Jin, Z
Hao, Y
Hu, X
Keywords: code generation;deep learning
Issue Date: 14-May-2023
Publisher: Institute of Electrical and Electronics Engineers (IEEE)
Citation: Li, J. et al. (2023) 'SkCoder: A Sketch-based Approach for Automatic Code Generation', 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), Melbourne, Australia, 14-20 May, pp. 2124 - 2135. doi: 10.1109/icse48619.2023.00179.
Abstract: Recently, deep learning techniques have shown great success in automatic code generation. Inspired by the code reuse, some researchers propose copy-based approaches that can copy the content from similar code snippets to obtain better performance. Practically, human developers recognize the content in the similar code that is relevant to their needs, which can be viewed as a code sketch. The sketch is further edited to the desired code. However, existing copy-based approaches ignore the code sketches and tend to repeat the similar code without necessary modifications, which leads to generating wrong results. In this paper, we propose a sketch-based code generation approach named Skcoderto mimic developers' code reuse behavior. Given a natural language requirement, Skcoderretrieves a similar code snippet, extracts relevant parts as a code sketch, and edits the sketch into the desired code. Our motivations are that the extracted sketch provides a well-formed pattern for telling models “how to write”. The post-editing further adds requirement-specific details into the sketch and outputs the complete code. We conduct experiments on two public datasets and a new dataset collected by this work. We compare our approach to 20 baselines using 5 widely used metrics. Experimental results show that (1) Skcodercan generate more correct programs, and outperforms the state-of-the-art -CodeT5-base by 30.30%, 35.39%, and 29.62% on three datasets. (2) Our approach is effective to multiple code generation models and improves them by up to 120.1% in Pass@l. (3) We investigate three plausible code sketches and discuss the importance of sketches. (4) We manually evaluate the generated code and prove the superiority of our Skcoderin three aspects.
Description: The accepted manuscript is available at arXiv, arXiv:2302.06144v4 [cs.SE] for this version (https://doi.org/10.48550/arXiv.2302.06144). Comments: Accepted by the 45th IEEE/ACM International Conference on Software Engineering (ICSE 2023)
URI: https://bura.brunel.ac.uk/handle/2438/30909
DOI: https://doi.org/10.1109/icse48619.2023.00179
ISBN: 978-1-6654-5701-9 (ebk)
978-1-6654-5702-6 (PoD)
ISSN: 0270-5257
Other Identifiers: ORCiD: Yongmin Li https://orcid.org/0000-0003-1668-2440
arXiv:2302.06144v4 [cs.SE]
Appears in Collections:Dept of Computer Science Research Papers

Files in This Item:
File Description SizeFormat 
FullText.pdfCopyright © 2023 The Author(s). arXiv.org - Non-exclusive license to distribute: The URI http://arxiv.org/licenses/nonexclusive-distrib/1.0/ is used to record the fact that the submitter granted the following license to arXiv.org on submission of an article: I grant arXiv.org a perpetual, non-exclusive license to distribute this article. I certify that I have the right to grant this license. I understand that submissions cannot be completely removed once accepted. I understand that arXiv.org reserves the right to reclassify or reject any submission.665.45 kBAdobe PDFView/Open


Items in BURA are protected by copyright, with all rights reserved, unless otherwise indicated.