本文为邹德清教授的《网络安全专题》课堂笔记系列
的文章,本次专题主题为大模型。
Keep the Conversation Going: Fixing 162 out of 337 bugs for $0.42 each using ChatGPT
arXiv 2023.4.1
https://arxiv.org/pdf/2304.00385.pdf
Chunqiu Steven Xia, University of Illinois Urbana-Champaign
Lingming Zhang, University of Illinois Urbana-Champaign
记录一位同学的分享
PPT简约大方、重点突出,学到了一些很巧妙的小设计
同时梳理了自动程序修复APR的流程、常见方法,我之前没接触过但也有了一定的了解
分享论文循序渐进,这种阅读论文的步骤之后或许可以尝试
※ 之后自己可以常回顾、多学习学习
Vulnerability Detection
(NDSS 18)Vuldeepecker: A deep learning-based system for vulnerability detection
(security 22)Mining Node.js Vulnerabilities via Object Dependence Graph and Query
Fault Localization
(TSE 23) Effective Isolation of Fault-Correlated Variables via Statistical and Mutation Analysis
Patch Generation
Patch Correctness Checking
(FSE 23) A Large-scale Empirical Review of Patch Correctness Checking Approaches
有bug的代码被移除,LLM直接预测正确的代码
buggy code is removed and a LLM directly predicts correct code
给定前缀和后缀上下文
given the prefix and suffix context
现有基于llm的APR工具的局限性:
limitation of existing LLM-based APR tools:
1.丢失测试失败信息
missing test failure information
2.重复抽样
repeated sampling
3.对合理补丁的无知
ignorance of plausible patches
可信的补丁:通过测试套件的补丁
plausible patches: patches that pass the test suite
这页PPT:将总览图黑色虚线框出
建立初始 prompt,得到第一个 patch
通过 test suite 判断 patch 是否成立
输入已经获取的 plausible patch 及相关信息,获取更多 plausible patch
可信的补丁:通过测试套件的补丁
plausible patches: patches that pass the test suite
初始输入initial input(通过红色虚线方框突出重点)
1、初始提示符:您是一个自动程序修复工具
初始 prompt:You are an Automated Program Repair Tool
2、在同一个bug项目中包含一些历史bug修复的例子
include a few examples of historical bug fixes within the same buggy project
少样本通过这样做,我们将模型调整到修复任务并允许它
few-shot examples By doing so, we gear the model towards the repair task and allow it
学习任务的所需输出格式(即补丁)。
to learn the desired output format (i.e. a patch) of the task.
3、用填充的位置指示器替换函数中有错误的代码完全≪≫
replace the buggy code within the function with an infill location indicator (≫ [ INFILL ] ≪)
4、提供原始的bug行
provide the original buggy line
5、失败的测试1)它的名称,2)触发测试失败的相关代码行,以及3)产生的错误信息
failing test(s) 1) its name, 2) the relevant code line(s) triggering the test failure, and 3) the error message produced
可信的补丁:通过测试套件的补丁
plausible patches: patches that pass the test suite
可信的补丁:通过测试套件的补丁
plausible patches: patches that pass the test suite
1、8个最近的基于学习和llm的APR基线
8 recent learning-based and LLM-based APR baselines
2、12个精选的传统方法
12 selected traditional techniques
3、BaseChatGPT
BaseChatGPT
4j和QuixBugs的缺陷
Defects4j and QuixBugs
1、RQ1:ChatRepair与最先进的APR技术相比,其性能如何?
• RQ1: How does the performance of ChatRepair compare against the state-of-the-art techniques for APR?
2、RQ2: ChatRepair在不同的修复场景下是如何执行的?
• RQ2: How does ChatRepair perform when used in different repair scenarios?
3、RQ3: ChatRepair的不同组成部分对改进修复效果的贡献是什么
• RQ3: What are the contributions of different components of ChatRepair in improving repair effectiveness?
1.ChatRepair可以比仅使用ChatGPT模型的基线,分别在Defects4j 1.2和2.0上,提高修复了34和23个bug
ChatRepair can improve over the baseline of just using the ChatGPT model with 34 and 23 more bug fixes on Defects4j 1.2 and 2.0 respectively.
2.比目前最先进的APR工具多15和17个。
with 15 and 17 more than the current state-of-the-art APR tool.
ChatRepair能够正确地修复quixbugs中的所有bug——java和python数据集,击败所有性能最好的技术
ChatRepair is able to correctly fix all bugs within the QuixBugs-Java and-Python datasets, beating out all top-performing techniques.
基线:BaseChatGPT / CodexRepair
baseline: BaseChatGPT / CodexRepair
BaseChatGPT没有产生令人印象深刻的改进
BaseChatGPT not yield impressive improvements