RAPRSUM: Retrieval-Augmented Code Summarization with Advanced Prototype Refinement
Code summarization aims to automatically generate natural language descriptions for code snippets, thereby enhancing programmers’ comprehension of the code and significantly improving code maintainability and development efficiency. Code reuse is a prevalent practice in software development, and information retrieval approaches, which leverage similar summaries from a corpus, have shown promising results. However, these approaches often heavily rely on the quality of the corpus, and discrepancies between retrieved and target summaries may result in inaccuracies or incomplete descriptions. In this paper, we propose RAPRSUM, a retrieval-augmented code summarization framework that integrates information retrieval and deep learning techniques. Specifically, RAPRSUM refines retrieved summary prototypes using a deep learning model to preserve essential information while eliminating redundancy. A pretrained large language model is then employed to generate the final summary by jointly considering the input code and the refined prototype. We evaluated RAPRSUM on three public datasets, demonstrating its significant improvement over existing baseline methods. Additional ablation studies confirm the effectiveness of the proposed modules. Finally, through case analysis and robustness verification, we highlight RAPRSUM’s superior performance in generating high-quality code summaries.
Authors
- X. J. Wang (ORCID: https://orcid.org/0000-0002-3689-0581)
- Yangbo Lin
- Bin Chen
- Shanggui Zhan
- Dan Wei (ORCID: https://orcid.org/0000-0002-8077-7623)
Institutions
- Hangzhou Dianzi University (CN)
- Zhejiang University of Technology (CN)
Publication Details
- Journal
- International Journal of Software Engineering and Knowledge Engineering
- Published
- 2025-06-27
- DOI
- https://doi.org/10.1142/s0218194025500317
- Primary Topic
- Natural Language Processing Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00