arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2405.08848cs.SEcs.AI
收藏

基于大语言模型与形式化验证的AI代码自动修复

Automated Repair of AI Code with Large Language Models and Formal Verification

The University of Manchester(曼彻斯特大学);Federal University of Amazonas(亚马逊联邦大学)

Yiannis Charalambous, Edoardo Manino, Lucas C. Cordeiro

AI总结:

本研究针对AI代码的内存安全漏洞问题,通过程序变异扩展NeuroCodeBench数据集,结合ESBMC形式化验证工具与大语言模型实现漏洞自动修复,并对比了多种提示工程技术及迭代调用方法的修复性能。

摘要:

下一代AI系统需要强有力的安全保障。本报告聚焦神经网络的软件实现及相关内存安全属性,包括NULL指针解引用、越界访问、重复释放(double-free)和内存泄漏。我们的目标是检测这些漏洞,并借助大语言模型自动修复它们。为此,我们首先通过自动化程序变异流程,将现有神经网络代码数据集NeuroCodeBench的规模扩展至约8.1万个程序。随后,我们使用前沿软件验证工具ESBMC验证变异后神经网络实现的内存安全性。每当ESBMC发现漏洞,我们就调用大语言模型修复源代码。针对修复任务,我们对比了多种前沿提示工程技术的性能,以及一种反复调用大语言模型的迭代方法的效果。

英文摘要:

The next generation of AI systems requires strong safety guarantees. This report looks at the software implementation of neural networks and related memory safety properties, including NULL pointer deference, out-of-bound access, double-free, and memory leaks. Our goal is to detect these vulnerabilities, and automatically repair them with the help of large language models. To this end, we first expand the size of NeuroCodeBench, an existing dataset of neural network code, to about 81k programs via an automated process of program mutation. Then, we verify the memory safety of the mutated neural network implementations with ESBMC, a state-of-the-art software verifier. Whenever ESBMC spots a vulnerability, we invoke a large language model to repair the source code. For the latest task, we compare the performance of various state-of-the-art prompt engineering techniques, and an iterative approach that repeatedly calls the large language model.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑