Importing Phantoms: Measuring LLM Package Hallucination Vulnerabilities

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Krishna, Arjun, Galinkin, Erick, Derczynski, Leon, Martin, Jeffrey
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866913673036955648
author Krishna, Arjun
Galinkin, Erick
Derczynski, Leon
Martin, Jeffrey
author_facet Krishna, Arjun
Galinkin, Erick
Derczynski, Leon
Martin, Jeffrey
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2501_19012
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Importing Phantoms: Measuring LLM Package Hallucination Vulnerabilities
Krishna, Arjun
Galinkin, Erick
Derczynski, Leon
Martin, Jeffrey
Machine Learning
Computation and Language
Cryptography and Security
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.
title Importing Phantoms: Measuring LLM Package Hallucination Vulnerabilities
topic Machine Learning
Computation and Language
Cryptography and Security
url https://arxiv.org/abs/2501.19012