Page 353 - 《软件学报》2026年第3期
P. 353

软件学报 ISSN 1000-9825, CODEN RUXUEW                                        E-mail: jos@iscas.ac.cn
                 2026,37(3):1316−1339 [doi: 10.13328/j.cnki.jos.007567] [CSTR: 32375.14.jos.007567]  http://www.jos.org.cn
                 ©中国科学院软件研究所版权所有.                                                          Tel: +86-10-62562563



                                                                 *
                 检索增强生成在软件工程中的应用综述

                 张犬俊  1,2 ,    谢    杨  1,2 ,    房春荣  1,2 ,    虞圣呈  1,2 ,    赵    源  1,2 ,    陈振宇  1,2


                 1
                  (计算机软件新技术全国重点实验室 (南京大学), 江苏 南京 210093)
                 2
                  (南京大学 软件学院, 江苏 南京 210093)
                 通信作者: 房春荣, E-mail: fangchunrong@nju.edu.cn

                 摘 要: 检索增强生成       (retrieval-augmented generation, RAG) 通过融合信息检索与语言生成模型, 显著提升代码生
                 成、补全、程序修复等软件工程下游任务的性能. 随着                  RAG  在软件工程领域的迅速发展, 研究者难以全面掌握其
                 最新的进展、面临的挑战及未来的潜在机遇. 为此, 系统性地综述                    2021–2024  年间  RAG  在软件工程中的应用, 围
                 绕  RAG  的核心架构及其在软件工程中的应用, 对            108  篇相关高质量研究进行汇总与深入分析. 首先, 探讨软件工
                 程领域中   RAG  架构的关键组成部分, 详细总结检索器和生成器的通用分类, 并概述二者的集成方式. 其次, 重点分
                 析  RAG  在各类软件工程下游任务中的应用, 包括代码生成、测试生成、程序修复等, 梳理其在不同任务场景下的
                 实践方法与技术趋势. 最后, 讨论当前          RAG  应用所面临的挑战, 涉及知识库构建、检索和生成这                 3  个阶段, 并探讨
                 未来的研究方向与潜在发展路径. 总体而言, 为软件工程社区提供一份全面的                         RAG  研究综述, 旨在帮助研究者系
                 统了解现有成果, 洞察关键问题, 并推动该领域的进一步发展.
                 关键词: 检索增强生成; 软件工程; 大语言模型
                 中图法分类号: TP311

                 中文引用格式: 张犬俊,  谢杨,  房春荣,  虞圣呈,  赵源,  陈振宇.  检索增强生成在软件工程中的应用综述.  软件学报,  2026,  37(3):
                 1316–1339. http://www.jos.org.cn/1000-9825/7567.htm
                 英文引用格式: Zhang QJ, Xie Y, Fang CR, Yu SC, Zhao Y, Chen ZY. Survey on Application of Retrieval-augmented Generation in
                 Software Engineering. Ruan Jian Xue Bao/Journal of Software, 2026, 37(3): 1316–1339 (in Chinese). http://www.jos.org.cn/1000-9825/
                 7567.htm

                 Survey on Application of Retrieval-augmented Generation in Software Engineering
                                        1,2
                              1,2
                                                                                   1,2
                                                                       1,2
                                                        1,2
                 ZHANG Quan-Jun , XIE Yang , FANG Chun-Rong , YU Sheng-Cheng , ZHAO Yuan , CHEN Zhen-Yu 1,2
                 1
                 (State Key Laboratory for Novel Software Technology (Nanjing University), Nanjing 210093, China)
                 2
                 (Software Institute, Nanjing University, Nanjing 210093, China)
                 Abstract:  Retrieval-augmented generation (RAG) significantly enhances the performance of downstream software engineering tasks such as
                 code  generation,  code  completion,  and  program  repair  by  combining  information  retrieval  with  language  generation  models.  As  RAG
                 develops  rapidly  in  software  engineering,  it  is  difficult  for  researchers  to  comprehensively  grasp  its  current  achievements,  challenges,  and
                 future  potential  opportunities.  This  study  presents  the  first  systematic  review  of  the  application  of  RAG  in  software  engineering  from  2021
                 to  2024,  summarizing  and  deeply  analyzing  108  relevant  high-quality  studies  from  the  perspectives  of  RAG’s  core  architecture  and  its
                 applications  in  software  engineering.  Firstly,  the  key  architectural  components  of  RAG  in  the  field  of  software  engineering  are  discussed,
                 and  a  detailed  summary  of  common  types  of  retrievers  and  generators  is  provided,  with  the  integration  methods  of  both  summarized.
                 Secondly,  the  application  of  RAG  in  various  downstream  software  engineering  tasks  is  mainly  analyzed,  such  as  code  generation,  code
                 completion,  and  program  repair.  Additionally,  a  systematic  review  is  provided  for  RAG’s  practical  methods  and  technical  trends  under
                 different  task  scenarios.  Finally,  the  challenges  that  the  current  RAG  application  faces  are  discussed,  covering  three  stages  of  knowledge


                 *    基金项目: 国家自然科学基金  (U24A20337, 62372228); 中央高校基本科研业务费专项资金  (14380029)
                  收稿时间: 2025-03-14; 修改时间: 2025-06-11, 2025-10-06; 采用时间: 2025-10-29; jos 在线出版时间: 2025-12-24
                  CNKI 网络首发时间: 2025-12-25
   348   349   350   351   352   353   354   355   356   357   358