【网安大模型专题10.19】※论文5:ChatGPT+漏洞定位+补丁生成+补丁验证+APR方法+ChatRepair+不同修复场景+修复效果(韦恩图展示)

news/2024/7/6 0:11:02 标签: chatgpt, 安全, 论文阅读, ppt, 代码复审, 学习, 大模型

Keep the Conversation Going: Fixing 162 out of 337 bugs for $0.42 each using ChatGPT

  • 写在最前面
  • 背景介绍
    • 自动程序修复流程Process of APR (automated program repair)
      • 1、漏洞程序
      • 2、漏洞定位模块
      • 3、补丁生成
      • 4、补丁验证
    • (可以学习的PPT设计)经典的APR方法traditional APR tools
    • learning-based APR tools
  • 方法Methodology
    • Methodology - gap差距
      • 当前的方法current method
      • 局限性
    • 方法概述overview
      • ① 建立初始 prompt,得到第一个 patch
      • ②通过 test suite 判断 patch 是否成立
      • ③ 输入已经获取的 plausible patch 及相关信息,获取更多 plausible patch
      • 最后两个步骤
  • 评估Evaluation
    • 基线Baseline
    • 基准Benchmark:
    • 研究问题Research questions
      • RQ1:ChatRepair与最先进的APR技术相比,其性能如何
        • 韦恩图(展示不同方法修复的集合)
      • RQ2: ChatRepair在不同的修复场景下是如何执行的?
      • RQ3: ChatRepair的不同组成部分对改进修复效果的贡献是什么

写在最前面

本文为邹德清教授的《网络安全专题》课堂笔记系列的文章,本次专题主题为大模型

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的流程、常见方法,我之前没接触过但也有了一定的了解
分享论文循序渐进,这种阅读论文的步骤之后或许可以尝试

之后自己可以常回顾、多学习学习

背景介绍

自动程序修复流程Process of APR (automated program repair)

在这里插入图片描述

1、漏洞程序

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

2、漏洞定位模块

Fault Localization
(TSE 23) Effective Isolation of Fault-Correlated Variables via Statistical and Mutation Analysis

3、补丁生成

Patch Generation

4、补丁验证

Patch Correctness Checking
(FSE 23) A Large-scale Empirical Review of Patch Correctness Checking Approaches

(可以学习的PPT设计)经典的APR方法traditional APR tools

在这里插入图片描述

  1. 启发式搜索(GenProg)
    insight:重用项目中的代码产生正确的修复补丁
    method:通过交叉和变异操作实现已有代码的重新组合
  2. 基于历史修复
    insight:不同软件中 bug 会重复出现,可以作为后续修复的指导
    method:通过历史信息指导启发式搜索
  3. 利用相似代码
    insight:与缺陷代码相似的代码可能存在同样的错误
    method:通过相似信息指导启发式搜索
  4. 基于修复模版
    insight:特定漏洞修复是可以总结的一些模式
    method:专家总结定义修复模版,直接进行应用
  5. 基于语义约束
    insight:修复 bug 就是改变程序使得满足 test case 的约束
    method:搜索约束并转换为约束求解问题

learning-based APR tools

  1. 补丁排序模型
    method:通过提取补丁特征给补丁排序
  2. 补丁模版获取
    method:聚类收集最常见的修复方式(模板)
  3. 端到端补丁生成模型(模型选择与训练数据的差别)
  • NMT-based
  • LLM-based

方法Methodology

Methodology - gap差距

当前的方法current method

有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

方法概述overview

这页PPT:将总览图黑色虚线框出
在这里插入图片描述
建立初始 prompt,得到第一个 patch

通过 test suite 判断 patch 是否成立

  1. 如果成立进入下一阶段
  2. 如果不成立持续询问 Chatgpt 直到获取一个 plausible patch

输入已经获取的 plausible patch 及相关信息,获取更多 plausible patch
在这里插入图片描述
可信的补丁:通过测试套件的补丁
plausible patches: patches that pass the test suite

① 建立初始 prompt,得到第一个 patch

初始输入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

在这里插入图片描述
在这里插入图片描述

②通过 test suite 判断 patch 是否成立

  1. 如果成立进入下一阶段
  2. 如果不成立持续询问 Chatgpt 直到获取一个 plausible patch

可信的补丁:通过测试套件的补丁
plausible patches: patches that pass the test suite

在这里插入图片描述

③ 输入已经获取的 plausible patch 及相关信息,获取更多 plausible patch

可信的补丁:通过测试套件的补丁
plausible patches: patches that pass the test suite

在这里插入图片描述

最后两个步骤

在这里插入图片描述

评估Evaluation

基线Baseline

1、8个最近的基于学习和llm的APR基线
8 recent learning-based and LLM-based APR baselines

2、12个精选的传统方法
12 selected traditional techniques

3、BaseChatGPT
BaseChatGPT

基准Benchmark:

4j和QuixBugs的缺陷
Defects4j and QuixBugs

研究问题Research questions

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?

RQ1:ChatRepair与最先进的APR技术相比,其性能如何

在这里插入图片描述

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.

韦恩图(展示不同方法修复的集合)

存在有些方法识别的漏洞,这篇文章不能识别
在这里插入图片描述
在这里插入图片描述

RQ2: ChatRepair在不同的修复场景下是如何执行的?

基线:BaseChatGPT / CodexRepair
baseline: BaseChatGPT / CodexRepair

在这里插入图片描述

BaseChatGPT没有产生令人印象深刻的改进
BaseChatGPT not yield impressive improvements

RQ3: ChatRepair的不同组成部分对改进修复效果的贡献是什么

在这里插入图片描述
在这里插入图片描述


http://www.niftyadmin.cn/n/5121164.html

相关文章

洲际酒店及度假村焕新开拓,缔造难以忘怀的非凡时刻

以数字创新技术,持续打造别开生面的奢华旅居体验 2023年10月18日,上海 - 近日,洲际酒店集团旗下奢华精品酒店品牌——洲际酒店及度假村宣布将在全球范围内启动品牌焕新计划,揭开激动人心的发展新篇章。多年来,品牌持续…

iOS .a类型静态库使用终端进行拆解和合并生成

项目中会用到许多第三方的.a类型的静态库,有时候会有一些静态库回包含相同文件而产生冲突,我们就需要对这个库进行去重的一个操作。一般有哪些文件冲突了,xcode报错都会有详细的提示。我们可以将这两个库合并,也可以其中一方中的文…

vue钩子函数以及例子

Vue.js 是一个基于组件化的前端框架,它提供了一些钩子函数,用于控制组件在不同阶段的行为和处理。以下是 Vue.js 常用的钩子函数以及它们的作用和示例: beforeCreate:在实例被创建之前调用。此时组件的数据、方法等还没有被初始化…

Android 小知识 修改页面高度

修改屏幕高度 全屏 Override protected void onCreate(Nullable Bundle savedInstanceState) {changeSystemUI();super.onCreate(savedInstanceState);}Override public void onWindowFocusChanged(boolean hasFocus) {super.onWindowFocusChanged(hasFocus);if (hasFocus) {g…

柯桥学俄语|商务俄语двое型与оба (обе) 型集合数词用法攻略

двое型集合数词 1. двое型集合数词与名词、形容词连用的规则与数词пять相同。用于第一格及同一格的第四格时,名词、形容词用复数二格;其他各格时,名词、形容词使用复数同格。 2. 仅有复数形式的名词表示2/3/4的数量用于一格及同一…

alibaba.fastjson的使用(三)-- Map、List ==》JSON字符串

目录 1.使用到的方法为: 2. Map转JSON字符串 3. List转JSON字符串 1.使用到的方法为: static String toJSONString(Object object) 2. Map转JSON字符串 /**

链动2+1模式 一秒教您扩充你自己的私域流量池

在当今高度互联的商业环境中,创新和适应性是企业家成功的关键。一种新型的商业模式——链动21模式,正以其独特的优势,吸引着越来越多的企业家关注和参与。 链动21模式的魅力在于其独特的社交互动机制。消费者可以通过平台购买商品或服务&…

Python 深浅拷贝使用与区别

什么是拷贝: python 中拷贝是指创建一个新的对象,其中包含了原始对象的值,以便于在不改变原始对象的情况下进行操作。拷贝在处理数据时非常有用,特别是当我们需要对数据进行修改而又不想影响原始数据时。 2.浅拷贝 浅拷贝的规则…