arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.19012cs.LGcs.CLcs.CR

引入幻影:测量 LLM 包幻觉漏洞

Importing Phantoms: Measuring LLM Package Hallucination Vulnerabilities

University of Waterloo(滑铁卢大学);NVIDIA Corporation(英伟达公司)

Arjun Krishna, Erick Galinkin, Leon Derczynski, Jeffrey Martin

AI总结:

本研究分析了LLM在多种编程语言中的包幻觉行为,发现幻觉率受模型选择、编程语言、模型规模和任务具体程度影响,且与代码生成性能存在权衡,为防御软件供应链攻击提供了基础。

摘要:

大型语言模型(LLMs)已成为程序员工具包中的必备工具,但其生成幻觉代码的倾向可能被恶意行为者利用,从而向大范围软件供应链引入漏洞。在本研究中,我们分析了 LLM 在流行编程语言中的包幻觉行为,考察了现有包引用和虚构依赖项。通过分析此包幻觉行为,我们发现了潜在攻击并提出防御策略以抵御这些攻击。我们发现,包幻觉率不仅取决于模型选择,还取决于编程语言、模型规模和编码任务请求的具体程度。代码生成性能与包幻觉之间的 Pareto 最优边界分布稀疏,表明编码模型未针对安全代码进行优化。此外,我们发现包幻觉率与 HumanEval 编码基准之间存在负相关,提供了一种评估模型包幻觉倾向的启发式方法。我们的指标、发现和分析为未来模型奠定基础,以保护 AI 辅助软件开发工作流免受包供应链攻击。

英文摘要:

Large Language Models (LLMs) have become an essential tool in the programmer's toolkit, but their tendency to hallucinate code can be used by malicious actors to introduce vulnerabilities to broad swathes of the software supply chain. In this work, we analyze package hallucination behaviour in LLMs across popular programming languages examining both existing package references and fictional dependencies. By analyzing this package hallucination behaviour we find potential attacks and suggest defensive strategies to defend against these attacks. We discover that package hallucination rate is predicated not only on model choice, but also programming language, model size, and specificity of the coding task request. The Pareto optimality boundary between code generation performance and package hallucination is sparsely populated, suggesting that coding models are not being optimized for secure code. Additionally, we find an inverse correlation between package hallucination rate and the HumanEval coding benchmark, offering a heuristic for evaluating the propensity of a model to hallucinate packages. Our metrics, findings and analyses provide a base for future models, securing AI-assisted software development workflows against package supply chain attacks.

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

↑