arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.15154cs.SEcs.AI
收藏

RMCBench:评估大型语言模型对恶意代码的抵抗力基准测试

RMCBench: Benchmarking Large Language Models' Resistance to Malicious Code

Sun Yat-sen University(中山大学);Peng Cheng Laboratory(鹏城实验室);Tencent AI Lab(腾讯AI实验室);University of Electronic Science and Technology of China(电子科技大学)

Jiachi Chen, Qingyuan Zhong, Yanlin Wang, Kaiwen Ning, Yongkun Liu, Zenan Xu, Zhe Zhao, Ting Chen, Zibin Zheng

AI总结:

本文提出RMCBench,首个评估LLMs抵制恶意代码生成能力的基准,包含473个提示词和两种场景,对11个模型测试发现其平均拒绝率仅28.71%,揭示了当前模型在此方面的局限性。

摘要:

大型语言模型(LLMs)的出现显著影响了软件开发活动的各个方面。尽管具有诸多益处,LLMs也带来了显著的风险,包括生成有害内容的可能性以及被恶意开发者滥用来创建恶意代码。此前的一些研究关注LLMs抵制生成违反人类伦理标准的有害内容(如带有偏见或冒犯性的内容)的能力。然而,目前尚无研究评估LLMs抵制恶意代码生成的能力。为了填补这一空白,我们提出了RMCBench,这是首个包含473个提示词的基准,旨在评估LLMs抵制恶意代码生成的能力。该基准采用两种场景:一是文本到代码场景,即通过描述提示LLMs生成代码;二是代码到代码场景,即LLMs翻译或补全现有的恶意代码。基于RMCBench,我们对11个具有代表性的LLMs进行了实证研究,以评估它们抵制恶意代码生成的能力。研究结果表明,当前LLMs抵制恶意代码生成的能力有限,在文本到代码场景中的平均拒绝率为40.36%,在代码到代码场景中为11.52%。所有LLMs在RMCBench中的平均拒绝率仅为28.71%;ChatGPT-4的拒绝率仅为35.73%。我们还分析了影响LLMs抵制恶意代码生成能力的因素,并为开发者提升模型鲁棒性提供了启示。

英文摘要:

The emergence of Large Language Models (LLMs) has significantly influenced various aspects of software development activities. Despite their benefits, LLMs also pose notable risks, including the potential to generate harmful content and being abused by malicious developers to create malicious code. Several previous studies have focused on the ability of LLMs to resist the generation of harmful content that violates human ethical standards, such as biased or offensive content. However, there is no research evaluating the ability of LLMs to resist malicious code generation. To fill this gap, we propose RMCBench, the first benchmark comprising 473 prompts designed to assess the ability of LLMs to resist malicious code generation. This benchmark employs two scenarios: a text-to-code scenario, where LLMs are prompted with descriptions to generate code, and a code-to-code scenario, where LLMs translate or complete existing malicious code. Based on RMCBench, we conduct an empirical study on 11 representative LLMs to assess their ability to resist malicious code generation. Our findings indicate that current LLMs have a limited ability to resist malicious code generation with an average refusal rate of 40.36% in text-to-code scenario and 11.52% in code-to-code scenario. The average refusal rate of all LLMs in RMCBench is only 28.71%; ChatGPT-4 has a refusal rate of only 35.73%. We also analyze the factors that affect LLMs' ability to resist malicious code generation and provide implications for developers to enhance model robustness.

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

↑