利用(模糊测试)测试用例理解程序
Understanding Programs by Exploiting (Fuzzing) Test Cases
AI总结:
本研究针对程序语义理解问题,提出将模糊测试生成的代表性输入对应的输入-输出/行为关系融入预训练LLM的学习,通过模糊调优提升代码表示与理解性能,在两项任务上大幅超越现有最优水平。
摘要:
程序的语义理解已引起学界广泛关注。受大语言模型(LLMs)近期在自然语言理解领域取得的成功启发,研究人员将编程语言视为另一种自然语言,并在程序代码语料上训练LLMs,已取得了巨大进展。但程序本质上终究与文本不同,因为它们通常具有高度结构化且语法严格的特点。具体而言,程序及其基本单元(即函数和子例程)的设计目标是在给定不同输入时展现出多种行为和/或提供可能的输出。输入与可能的输出/行为之间的关系代表了函数/子例程的功能,并整体勾勒出程序的特征。因此,我们提出将这种关系融入学习过程,以实现对程序更深层次的语义理解。为了获取足够具有代表性、能够触发大部分代码执行的输入,我们借助模糊测试(fuzz testing),并提出了模糊调优(fuzz tuning)方法,在给定预训练LLM的情况下提升程序理解和代码表示学习的性能。我们在代码克隆检测和代码分类这两项程序理解任务上验证了所提方法的有效性,其性能以较大幅度优于当前最先进方法。代码可在https://github.com/rabbitjy/FuzzTuning获取。
英文摘要:
Semantic understanding of programs has attracted great attention in the community. Inspired by recent successes of large language models (LLMs) in natural language understanding, tremendous progress has been made by treating programming language as another sort of natural language and training LLMs on corpora of program code. However, programs are essentially different from texts after all, in a sense that they are normally heavily structured and syntax-strict. In particular, programs and their basic units (i.e., functions and subroutines) are designed to demonstrate a variety of behaviors and/or provide possible outputs, given different inputs. The relationship between inputs and possible outputs/behaviors represents the functions/subroutines and profiles the program as a whole. Therefore, we propose to incorporate such a relationship into learning, for achieving a deeper semantic understanding of programs. To obtain inputs that are representative enough to trigger the execution of most part of the code, we resort to fuzz testing and propose fuzz tuning to boost the performance of program understanding and code representation learning, given a pre-trained LLM. The effectiveness of the proposed method is verified on two program understanding tasks including code clone detection and code classification, and it outperforms current state-of-the-arts by large margins. Code is available at https://github.com/rabbitjy/FuzzTuning.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。