The large transformer-based language models demonstrate excellent performance in natural language processing. By considering the transferability of the knowledge gained by these models in one domain to other related domains, and the closeness of natural languages to high-level programming languages, such as C/C++, this work studies how to leverage (large) transformer-based language models in detecting software vulnerabilities and how good are these models for vulnerability detection tasks. In this regard, firstly, a systematic (cohesive) framework that details source code translation, model preparation, and inference is presented. Then, an empirical analysis is performed with software vulnerability datasets with C/C++ source codes having multiple vulnerabilities corresponding to the library function call, pointer usage, array usage, and arithmetic expression. Our empirical results demonstrate the good performance of the language models in vulnerability detection. Moreover, these language models have better performance metrics, such as F1-score, than the contemporary models, namely bidirectional long short-term memory and bidirectional gated recurrent unit. Experimenting with the language models is always challenging due to the requirement of computing resources, platforms, libraries, and dependencies. Thus, this paper also analyses the popular platforms to efficiently fine-tune these models and present recommendations while choosing the platforms.
翻译:以变压器为基础的大型变压器语言模型在自然语言处理方面表现优异。 通过考虑这些模型在一个领域获得的知识能否转移到其他相关领域,以及自然语言与C/C+++等高级编程语言的接近性,本项工作研究如何利用(大)变压器语言模型发现软件脆弱性,以及这些脆弱性检测模型的好坏。首先,介绍了一个系统化(连锁)框架,详细介绍源代码翻译、模型编制和推断。然后,对C/C++源代码的软件脆弱性数据集进行了经验性分析,该软件脆弱性数据集具有与图书馆功能调用、指针使用、阵列使用和算术表达等相对应的多重脆弱性。我们的经验性结果展示了语言模型在脆弱性检测方面的良好性能。此外,这些语言模型比当代模型有更好的性能衡量标准,即双向短期存留存和双向闭锁的经常单元。与语言模型的实验总是具有挑战性,因为需要精确计算资源、平台、图书馆和依赖性平台。因此,还分析了纸质模型。