iCodeReviewer:利用混合提示词改进安全代码审查
iCodeReviewer: Improving Secure Code Review with Mixture of Prompts
AI总结:
针对安全代码审查自动化方法精确度和覆盖率有限的问题,提出基于LLM的iCodeReviewer,采用混合提示词架构和路由算法减少误报,在安全问题识别与定位上取得63.98%的F1分数,生产环境中审查评论接受率达84%。
摘要:
代码审查是确保软件质量的重要过程,可在软件开发的早期阶段识别潜在的软件问题。在所有软件问题中,安全问题是最需要识别的,因为它们很容易导致严重的软件崩溃和服务中断。最近的研究致力于自动化方法,以减少安全代码审查过程中所需的人工工作量。尽管取得了进展,但目前的安全代码审查自动化方法,包括静态分析、深度学习模型和提示词方法,仍面临精确度和覆盖率有限以及缺乏全面评估的挑战。为了缓解这些挑战,我们提出了iCodeReviewer,这是一种基于大型语言模型(LLMs)的自动化安全代码审查方法。iCodeReviewer利用一种新颖的混合提示词架构,整合了许多提示词专家来提高安全问题的覆盖率。每个提示词专家都是一个动态提示词管道,用于检查特定安全问题的存在。iCodeReviewer还实现了一种有效的路由算法,仅根据输入程序中的代码特征激活必要的提示词专家,从而减少LLM幻觉引起的误报。在我们内部数据集上的实验结果证明了iCodeReviewer在安全问题识别和定位方面的有效性,其F1分数达到63.98%。iCodeReviewer生成的审查评论在生产环境中部署时也实现了高达84%的高接受率。
英文摘要:
Code review is an essential process to ensure the quality of software that identifies potential software issues at an early stage of software development. Among all software issues, security issues are the most important to identify, as they can easily lead to severe software crashes and service disruptions. Recent research efforts have been devoted to automated approaches to reduce the manual efforts required in the secure code review process. Despite the progress, current automated approaches on secure code review, including static analysis, deep learning models, and prompting approaches, still face the challenges of limited precision and coverage, and a lack of comprehensive evaluation. To mitigate these challenges, we propose iCodeReviewer, which is an automated secure code review approach based on large language models (LLMs). iCodeReviewer leverages a novel mixture-of-prompts architecture that incorporates many prompt experts to improve the coverage of security issues. Each prompt expert is a dynamic prompt pipeline to check the existence of a specific security issue. iCodeReviewer also implements an effective routing algorithm to activate only necessary prompt experts based on the code features in the input program, reducing the false positives induced by LLM hallucination. Experiment results in our internal dataset demonstrate the effectiveness of iCodeReviewer in security issue identification and localization with an F1 of 63.98%. The review comments generated by iCodeReviewer also achieve a high acceptance rate up to 84% when it is deployed in production environments.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。