arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.08098cs.SEcs.AIcs.LG
收藏

所见未必即所得:评估GPT对源代码的理解能力

What You See Is Not Always What You Get: Evaluating GPT's Comprehension of Source Code

The University of Sydney(悉尼大学)

Jiawen Wen, Bangshuo Zhu, Huaming Chen

AI总结:

本文针对大语言模型易受字符级不可感知代码扰动误导的问题,划分四类攻击并在多模型上开展系统性评估,验证了扰动对模型代码理解性能的负面影响,凸显研发鲁棒大语言模型的迫切性。

摘要:

近期研究表明,大语言模型(LLM)在包括代码生成与理解在内的软件工程任务中展现出了出色能力。尽管LLM在辅助编码方面表现出巨大潜力,但它们易受对抗攻击影响。本文研究了LLM对不可感知攻击的脆弱性,这类攻击在字符层面操纵源代码,使修改对人类审查者不可见,却能有效误导LLM的行为。我们将这类攻击划分为四个不同类别,分析其对代码分析与理解任务的影响,这四类不可感知字符攻击分别为编码重排序、不可见编码字符、代码删除、代码同形异义字。为评估当前最优LLM的鲁棒性,我们使用扰动和干净的代码片段对多个模型开展系统性评估,引入了基于响应对数概率的模型置信度、响应正确性两个评估指标。结果显示,LLM易受不可感知代码扰动影响,不同LLM的性能下降程度存在差异;此外我们观察到扰动幅度与模型性能存在稳定负相关。这些结果凸显了研发能在不可感知对抗条件下稳定运行的鲁棒LLM的迫切需求。

英文摘要:

Recent studies have demonstrated outstanding capabilities of large language models (LLMs) in software engineering tasks, including code generation and comprehension. While LLMs have shown significant potential in assisting with coding, LLMs are vulnerable to adversarial attacks. In this paper, we investigate the vulnerability of LLMs to imperceptible attacks. This class of attacks manipulate source code at the character level, which renders the changes invisible to human reviewers yet effective in misleading LLMs' behaviour. We devise these attacks into four distinct categories and analyse their impacts on code analysis and comprehension tasks. These four types of imperceptible character attacks include coding reordering, invisible coding characters, code deletions, and code homoglyphs. To assess the robustness of state-of-the-art LLMs, we present a systematic evaluation across multiple models using both perturbed and clean code snippets. Two evaluation metrics, model confidence using log probabilities of response and response correctness, are introduced. The results reveal that LLMs are susceptible to imperceptible coding perturbations, with varying degrees of degradation highlighted across different LLMs. Furthermore, we observe a consistent negative correlation between perturbation magnitude and model performance. These results highlight the urgent need for robust LLMs capable of manoeuvring behaviours under imperceptible adversarial conditions.

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

↑