arrow
返回

Project-specific code summarization with in-context learning

delete2024-10-01
delete1
PRE
AI
S
S M Yun
S
S.-J. LIN
X
Xiaodong Gu
B
Beijun Shen *
DOI:10.1016/j.jss.2024.112149delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
Automatically generating summaries for source code has emerged as a valuable task in software development. While state-of-the-art (SOTA) approaches have demonstrated significant efficacy in summarizing general code, they seldom concern code summarization for a specific project. Project-specific code summarization (PCS) poses special challenges due to the scarce availability of training data and the unique styles of different projects. In this paper, we empirically analyze the performance of Large Language Models (LLMs) on PCS tasks. Our study reveals that using appropriate prompts is an effective way to solicit LLMs for generating project-specific code summaries. Based on these findings, we propose a novel project-specific code summarization approach called P-CodeSum. P-CodeSum gathers a repository-level pool of (code, summary) examples to characterize the project-specific features. Then, it trains a neural prompt selector on a high-quality dataset crafted by LLMs using the example pool. The prompt selector offers relevant and high-quality prompts for LLMs to generate project- specific summaries. We evaluate against a variety of baseline approaches on six PCS datasets. Experimental results show that the P-CodeSum improves the performance by 5.9% (RLPG) to 101.51% (CodeBERT) on BLEU-4 compared to the state-of-the-art approaches in project-specific code summarization.
Keyword:
Prompt generation
Project-specific code summarization
Large language model
In-context learning

期刊

Journal of Systems and Software 封面图
Journal of Systems and Software
IF:
4.1
论文数:
5.4K
被引数:
8.4K

机构

S
shanghai jiao tong university
学者数:
15.7W
论文数: 11.7W
被引数: 159
C
Carnegie Mellon University
学者数:
1.4W
论文数: 1.4W
被引数: 2.7W
引用论文

引用论文

err分享
err收藏
Long-Term Stability of Novel Crucible Systems for the Growth of Oxygen-Free Czochralski Silicon Crystals
err2022-12-22
err0
errOAAI
errFelix Sturm; Matthias Trempa; Gordian Schuster; Rainer Hegermann; Philipp Goetz; Rolf Wagner; Gilvan Barroso; Patrick Meisner; Christian Reimann; Jochen Friedrich
err分享
err收藏
Few-shot code translation via task-adapted prompt learning
err2024-06-01
err5
PREAI
errLi, Xuan; Yuan, Shuai; Gu, Xiaodong; Chen, Yuting; Shen, Beijun
err分享
err收藏
err分享
err收藏
err
IF0
err
err0
PREAI
err
err分享
err收藏
The HadGEM2-ES implementation of CMIP5 centennial simulationsCMIP5百年模拟的HadGEM2-ES实现
err
IF0
err2011-03-31
err0
errOAAI
errC. D. Jones; J. K. Hughes; N. Bellouin; S. C. Hardiman; G. S. Jones; J. Knight; S. Liddicoat; F. M. O'Connor; R. J. Andres; C. Bell; K.-O. Boo; A. Bozzo; N. Butchart; P. Cadule; K. D. Corbin; M. Doutriaux-Boucher; P. Friedlingstein; J. Gornall; L. Gray; P. R. Halloran; G. Hurtt; W. Ingram; J.-F. Lamarque; R. M. Law; M. Meinshausen; S. Osprey; E. J. Palin; L. Parsons Chini; T. Raddatz; M. Sanderson; A. A. Sellar; A. Schurer; P. Valdes; N. Wood; S. Woodward; M. Yoshioka; M. Zerroukat
err分享
err收藏
没有更多内容