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

Coding-PTMs:如何在漏洞检测中为代码嵌入寻找最优代码预训练模型?

Coding-PTMs: How to Find Optimal Code Pre-trained Models for Code Embedding in Vulnerability Detection?

Yu Zhao, Lina Gong, Zhiqiu Huang, Yongwei Wang, Mingqiang Wei, Fei Wu

AI总结:

针对漏洞检测中代码预训练模型选择缺乏依据的问题,本文评估十种 PTM 的嵌入特征,提出含十三项指标与 Random Forest 推荐器的 Coding-PTMs 框架。

摘要:

漏洞检测正受到软件工程领域越来越多的关注,因为代码漏洞可能带来重大安全影响。近来,复用各种代码预训练模型来生成代码嵌入已十分常见,但在漏洞检测中并未给出合理依据。随意使用预训练模型(PTM)的前提是,不同 PTM 生成的代码嵌入会对性能产生相似影响。事实果真如此吗?为回答这一重要问题,我们系统研究了十种不同代码 PTM 生成的代码嵌入对漏洞检测性能的影响,并得出答案:事实并非如此。我们观察到,不同代码 PTM 生成的代码嵌入确实会影响性能,而且依据参数规模和嵌入维度选择嵌入技术并不可靠。我们的发现强调,有必要量化并评估各种代码 PTM 所生成代码嵌入的特征,以理解其影响。为实现这一目标,我们分析不同 PTM 生成代码嵌入的数值表示和数据分布,以评估差异与特征。基于这些洞见,我们提出 Coding-PTMs,这是一个推荐框架,用于帮助工程师为其特定漏洞检测任务选择最优代码 PTM。具体而言,我们围绕三个维度(即统计量、范数和分布)定义了十三个代码嵌入指标,以构建专门的代码 PTM 推荐数据集。随后,我们采用 Random Forest 分类器训练推荐模型,并从候选模型库中识别最优代码 PTM。

英文摘要:

Vulnerability detection is garnering increasing attention in software engineering, since code vulnerabilities possibly pose significant security. Recently, reusing various code pre-trained models has become common for code embedding without providing reasonable justifications in vulnerability detection. The premise for casually utilizing pre-trained models (PTMs) is that the code embeddings generated by different PTMs would generate a similar impact on the performance. Is that TRUE? To answer this important question, we systematically investigate the effects of code embedding generated by ten different code PTMs on the performance of vulnerability detection, and get the answer, i.e., that is NOT true. We observe that code embedding generated by various code PTMs can indeed influence the performance and selecting an embedding technique based on parameter scales and embedding dimension is not reliable. Our findings highlight the necessity of quantifying and evaluating the characteristics of code embedding generated by various code PTMs to understand the effects. To achieve this goal, we analyze the numerical representation and data distribution of code embedding generated by different PTMs to evaluate differences and characteristics. Based on these insights, we propose Coding-PTMs, a recommendation framework to assist engineers in selecting optimal code PTMs for their specific vulnerability detection tasks. Specifically, we define thirteen code embedding metrics across three dimensions (i.e., statistics, norm, and distribution) for constructing a specialized code PTM recommendation dataset. We then employ a Random Forest classifier to train a recommendation model and identify the optimal code PTMs from the candidate model zoo.

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

↑