利用大型语言模型生成有效见证程序以隔离编译器缺陷
Isolating Compiler Bugs by Generating Effective Witness Programs with Large Language Models
AI总结:
针对编译器缺陷隔离中测试程序变异低效的问题,提出 LLM4CBI,通过复杂度引导提示、强化学习提示选择和反馈验证生成有效见证程序,在 GCC/LLVM 真实缺陷上显著优于 DiWi 与 RecBi。
摘要:
编译器缺陷对安全关键型应用构成重大威胁,及时且有效地隔离这些缺陷对于保证编译器质量至关重要。然而,所报告缺陷可用的调试信息有限,使编译器缺陷隔离任务变得复杂。现有编译器缺陷隔离方法将该问题转化为测试程序变异问题,但它们仍受限于无效的变异策略或高昂的人工投入要求。受 ChatGPT 等预训练大型语言模型(LLM)近期在代码生成方面进展的启发,我们提出一种名为 LLM4CBI 的新方法,利用 LLM 生成用于编译器缺陷隔离的有效测试程序。但是,由于构造精确提示和选择专用提示存在挑战,直接使用 LLM 进行测试程序变异可能无法取得预期结果。为克服这些挑战,LLM4CBI 设计了三个新组件。首先,LLM4CBI 使用程序复杂度引导的提示生成组件,该组件利用数据流和控制流分析识别程序中最有价值的变量和位置以进行变异。其次,LLM4CBI 采用带记忆的提示选择组件,通过强化学习持续选择用于变异测试程序的专用提示。第三,提出测试程序验证组件,用于选择专用反馈提示,以避免在变异过程中重复相同错误。在来自 GCC 和 LLVM 的 120 个真实缺陷上与最先进方法相比,我们的评估证明了 LLM4CBI 的优势:在 Top-1/Top-5 排名结果中,它比 DiWi 和 RecBi 多隔离 69.70%/21.74% 和 24.44%/8.92% 的缺陷。我们还证明,LLM4CBI 中使用的 LLM 组件可以被轻松替换,同时仍能取得合理结果。
英文摘要:
Compiler bugs pose a significant threat to safety-critical applications, and promptly as well as effectively isolating these bugs is crucial for assuring the quality of compilers. However, the limited availability of debugging information on reported bugs complicates the compiler bug isolation task. Existing compiler bug isolation approaches convert the problem into a test program mutation problem, but they are still limited by ineffective mutation strategies or high human effort requirements. Drawing inspiration from the recent progress of pre-trained Large Language Models (LLMs), such as ChatGPT, in code generation, we propose a new approach named LLM4CBI to utilize LLMs to generate effective test programs for compiler bug isolation. However, using LLMs directly for test program mutation may not yield the desired results due to the challenges associated with formulating precise prompts and selecting specialized prompts. To overcome the challenges, three new components are designed in LLM4CBI. First, LLM4CBI utilizes a program complexity-guided prompt production component, which leverages data and control flow analysis to identify the most valuable variables and locations in programs for mutation. Second, LLM4CBI employs a memorized prompt selection component, which adopts reinforcement learning to select specialized prompts for mutating test programs continuously. Third, a test program validation component is proposed to select specialized feedback prompts to avoid repeating the same mistakes during the mutation process. Compared with state-of-the-art approaches over 120 real bugs from GCC and LLVM, our evaluation demonstrates the advantages of LLM4CBI: It can isolate 69.70%/21.74% and 24.44%/8.92% more bugs than DiWi and RecBi within Top-1/Top-5 ranked results. We also demonstrate that the LLMs component used in LLM4CBI can be easily replaced while still achieving reasonable results.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。