Skip to content

Study replicates package name hallucination across five frontier models: 127 common hallucinated package names across models, 53 still registerableThe Range Shrinks, the Threat Remains: Re-evaluating LLM Package Hallucinations on the 2026 Frontier-Model Cohort

Paper Tracker· arXiv:2605.17062· Aleksandr Churilov·Indexed by this site · 2026-10-09· Originally publishedSelected AttacksSelectedAttention39

Quick read

Evaluation and benchmarks

Based on the paper PDF (generated by Gemini); refer to the original

The authors reproduce code package hallucination evaluations on 5 frontier 2026 models, measure an overall hallucination rate of 4.62% to 6.10%, and find 127 cross-model common hallucinated package names.

Threat modelThe attacker is an unprivileged actor, requiring only the ability to register packages on PyPI and npm. The attack goal is to exploit hallucinated package names referenced by model-generated code to publish malicious packages, inducing downstream developers to install them to execute code in the developer environment. The assumption is that the attacker has not compromised the LLM provider, has not fine-tuned the model, has no privileged system access, and the registry has no other involvement beyond its public interface.

Questions
Code generation large language models may hallucinate non-existent package names when generating code, and attackers can squat on the same malicious package names on PyPI or npm to carry out poisoning (slopsquatting). The paper aims to evaluate the incidence and threat evolution of such code package hallucinations in 2026 frontier models.
Methods
The authors reused Spracklen's 199,845 Python and JavaScript prompts on 5 2026 frontier models to generate code, extracted package names via regex, compared them against the official package name master list, calculated hallucination rates and inter-model overlap, and verified registrability in coordination with registry security teams.
Experiments and results
Across 5 models, overall hallucination rates range from 4.62% to 6.10%, with narrower gaps between models; Python hallucination rates are all higher than JavaScript; all models jointly hallucinate 127 common package names, and after filtering by registry rules, 53 remain that attackers could register.
Limitations and future work
The experiment only evaluated 5 frontier models and did not test smaller open-source models or agentic configurations; prompts may have been included in pretraining data; GPT-5.4-mini was only tested at minimal reasoning effort with a 32.14% refusal rate; DeepSeek API metadata showed version drift.
Experimental setupClaude Sonnet 4.6、Claude Haiku 4.5 et al. · Stack Overflow prompts (SO_AT and SO_LY subsets)、LLM-synthesized prompts (LLM_AT and LLM_LY subsets) et al. · Hallucination rate、Pairwise difference (Δ) et al.
Evaluated models
Claude Sonnet 4.6Claude Haiku 4.5GPT-5.4-miniGemini 2.5 ProDeepSeek V3.2
Benchmarks
Stack Overflow prompts (SO_AT and SO_LY subsets)LLM-synthesized prompts (LLM_AT and LLM_LY subsets)PyPI package-name master list (pypi_package_names.csv)npm package-name master list (npm_package_names.csv)
Metrics
Hallucination ratePairwise difference (Δ)Refusal rateJaccard similarity
AI summaryand selection rationaleIndependent researcher Aleksandr Churilov replicated Spracklen et al.'s package name hallucination measurement method on Claude Sonnet 4.6, Claude Haiku 4.5, GPT-5.4-mini, Gemini 2.5 Pro, and DeepSeek V3.2, measuring hallucination rates between 4.62% (Claude Haiku 4.5) and 6.10% (GPT-5.4-mini) across 199,845 Python and JavaScript prompts, with the inter-model gap compressed from 5.2%–21.7% in 2024 to 1.48 percentage points.

Independent researcher Aleksandr Churilov replicated Spracklen et al.'s package name hallucination measurement method on Claude Sonnet 4.6, Claude Haiku 4.5, GPT-5.4-mini, Gemini 2.5 Pro, and DeepSeek V3.2, measuring hallucination rates between 4.62% (Claude Haiku 4.5) and 6.10% (GPT-5.4-mini) across 199,845 Python and JavaScript prompts, with the inter-model gap compressed from 5.2%–21.7% in 2024 to 1.48 percentage points.

Why it was selectedThe paper reproduces package name hallucination measurements on five frontier models and provides the set of package names commonly hallucinated across models and the subset that remains registrable, which can be used to assess the slopsquatting attack surface.

Related events and news

0 events · 1 news mentions

News that mentions this paper

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Evaluate the package hallucination rate of 2026 frontier code models to test whether the typosquatting attack surface is eliminated as model capability improves.

    The paper aims to evaluate package hallucination in code generation by the latest frontier large models in 2026 and the resulting software supply chain squatting (slopsquatting) attack risk.

    • Problem background and importance: Modern software development relies on centralized registries such as PyPI and npm. When developers adopt model-generated installation or import instructions, if the model references a fictitious package name, an attacker can register that name on the public registry and embed malicious code, thereby obtaining arbitrary code execution when the developer installs it.
    • Observations and limitations of existing research: Spracklen et al. (USENIX Security '25) measured a hallucination rate of 21.7% for open-source models and 5.2% for commercial models on the 2024 model cohort; however, in the subsequent 18 months, frontier models underwent iterations in training data, safety post-training, and inference controls, and whether the risk of code package hallucination has been eliminated lacks empirical verification.
    • Core entry point and hypothesis of the paper: The authors hypothesize that improvements in model capability may narrow the hallucination rate differences across models, but a residual hallucination rate of 4% to 7% is still sufficient to maintain the economic viability of attackers, and hallucinated outputs overlapping across multiple models may form a cross-model supply chain attack surface.
    • Threat model:
      • Attacker goals and capabilities: The attacker is an unprivileged actor, requiring only the ability to register public packages on PyPI and npm, without privileged access or model fine-tuning permissions.
      • Attack trigger chain: The attacker samples models offline to extract hallucinated package names and registers malicious packages in advance on the registry; victim developers subsequently issue similar code generation queries to the model and execute installation commands.
      • Attack cost assumptions: The cost of registering public packages is zero, and only a small amount of API query cost is needed to enumerate candidate package names; the authors estimate that a scan of the same scale costs only 860.90 USD.
      • Victim system scope: The victim systems are downstream developers' local or CI/CD environments that trust the public registry and run package management tools.
  2. What related research exists?

    Reviewing research on package confusion attacks and code model hallucinations, we conduct a time-spanning replication based on the evaluation baseline of Spracklen et al.

    Related research mainly focuses on package confusion attacks in the software supply chain, security flaws and hallucination phenomena in code generation models, and benchmark metrics for package hallucination.

    • Package Confusion Attacks
      • Neupane et al. (2023) and Birsan (2021): analyzed traditional package confusion attacks predating large models, including Typosquatting attacks that exploit developer input typos, and Dependency Confusion attacks that use public registry names to override internal private package names.
      • Aboukhadijeh (2025): proposed and discussed Slopsquatting attacks derived from large model hallucination, noting that attackers do not need to wait for typos but instead pre-register fictional package names that model-generated behavior induces developers to install.
    • Code Generation Model Hallucination and Security Vulnerabilities
      • Pearce et al. (2022): in the Asleep at the Keyboard study, evaluated the security risks of GitHub Copilot generating vulnerable code, establishing the foundation for code generation security metrics.
      • Huang et al. (2023) and Ji et al. (2023): surveyed taxonomies of factual conflicts and hallucinations in large language model natural language generation; the paper positions package name hallucination as the security manifestation of this phenomenon in the software dependency domain.
    • Package Hallucination Metric Research
      • Spracklen et al. (USENIX Security '25): the paper's direct baseline work, evaluated 16 large models from 2023 to 2024, reporting open-source model hallucination rates of 21.7% and commercial model minimum of 5.2%, and publicly released an evaluation dataset and package name master list composed of Stack Overflow and synthetic prompts.
      • Krishna et al. (2025, Importing Phantoms): independently conducted package hallucination metric work in parallel with Spracklen, reporting similar hallucination rates on a partially overlapping model set.
    • Baseline Method and Dataset
      • This paper adopts the evaluation protocol publicly released by Spracklen et al. (2025) as the baseline method, directly reusing its 20,163 Stack Overflow prompts and 19,806 synthetic prompts (39,969 in total), as well as the verification master lists for PyPI (500,565 package names) and npm (approximately 3,000,000 package names).

    The authors position this paper as a precise replication study over time, aiming to compare the 2026 frontier model cohort with the 2024 baseline models under the same method and prompt benchmark, and to explore cross-model common hallucination as an attack vector not previously identified in prior work.

  3. How does the paper address this problem?

    Reusing the baseline protocol to perform regex extraction and main list verification on code generated by 5 frontier models, and jointly verifying the attack surface with registries.

    The authors follow the end-to-end measurement pipeline of Spracklen et al., extracting third-party package names from nearly 200,000 code samples generated by 5 frontier models from 2026, filtering and judging hallucinations against the official PyPI and npm master lists, and isolating the practically exploitable attack surface through cross-model intersection and registry coordinated disclosure.

    Evaluated Models and Prompt Inputs

    • Frontier model cohort: 5 representative models released from October 2025 to March 2026, covering Anthropic's Claude Sonnet 4.6 and Claude Haiku 4.5, OpenAI's GPT-5.4-mini, Google's Gemini 2.5 Pro, and DeepSeek's DeepSeek V3.2.
    • Prompt composition: Strictly reuse the 39,969 prompts from the Spracklen benchmark, including 20,163 Stack Overflow programming questions (SO_AT and SO_LY subsets) and 19,806 program synthesis questions (LLM_AT and LLM_LY subsets), with Python and JavaScript each accounting for half.
    • Sampling parameter configuration: Record API endpoints and snapshot identifiers, using default temperature, top-p, and thinking settings by default; GPT-5.4-mini is set to reasoning_effort=minimal for cost considerations, with a single sample per prompt per model, generating a total of 199,845 code samples.

    Code Package Name Extraction and Noise Filtering

    • Heuristic regex extraction: Follow the Spracklen extraction rules, matching pip install and npm install commands, as well as Python import/from and JavaScript require()/import statements, supporting npm namespace and Python submodule import resolution.
    • Standard library and noise filtering: Use the CPython standard library list and Node.js core module list to remove system built-in libraries; add noise filters to remove regex extraction artifacts such as Dart syntax prefixes, Node built-in prefixes, Webpack path aliases, and template placeholders.

    Hallucination Determination and Statistical Metrics

    • Two-stage truth determination: Normalize the extracted package names and compare them against the PyPI (500,565) and npm (approximately 3,000,000) master lists provided by Spracklen; those not in the master lists and not in the known false positive list are judged as hallucinated packages.
    • Formal definition of hallucination rate: Define the empirical hallucination rate as p̂ = |H| / |R|, where R is the multiset of all package references generated by the model, H is the subset of references not resolved in the registry master lists, and compute the 95% Wilson confidence interval.
    • Statistical testing setup: Use Pearson's chi-square test to compare hallucination rate differences between model pairs, and apply the Holm-Bonferroni method for multiple comparison correction across 10 paired comparisons (family-wise significance level set to 0.05), supplemented by 10,000 permutation tests as a robustness check.

    Universal Hallucination Set Construction and Registry Coordinated Verification

    • Universal hallucination intersection extraction: Compute the intersection of the hallucinated package name sets generated by each of the 5 models to identify universal hallucinations that all models independently generate.
    • Registry exploitability verification: Disclose the intersected package names to PyPI Security and Socket.dev, and based on PyPI's automated blocklist and ultranormalization rules, as well as npm scope and placeholder status, remove entries that cannot be registered, locking down the final attack surface that attackers can squat.
  4. What experiments did the paper conduct?

    The overall hallucination rate of the 5 models was compressed to 4.62%–6.10%, with 127 cross-model common package names, of which 53 were verified as registrable.

    Experimental Setup

    • Target models: 5 frontier models from 2026 were tested: Claude Sonnet 4.6 (claude-sonnet-4-6), Claude Haiku 4.5 (claude-haiku-4-5-20251001), GPT-5.4-mini (gpt-5.4-mini-2026-03-17), Gemini 2.5 Pro (gemini-2.5-pro), and DeepSeek V3.2 (deepseek-chat).
    • Dataset and scale: reuse Spracklen et al.'s 39,969 prompts, comprising 20,163 Stack Overflow prompts and 19,806 LLM-synthesized prompts, split evenly between Python and JavaScript.
    • Baseline and comparison objects: the data from 16 models evaluated by Spracklen in 2024 serves as the historical baseline (commercial models minimum 5.2%, open-source models maximum 21.7%).
    • Metrics: package hallucination rate on valid responses (p_hat = |H| / |R|), cross-language difference (Δ), inter-model Jaccard overlap, and refusal rate.
    • Determination method and sample size: comparison via regex extraction against the PyPI (500,565 names) and npm (about 3,000,000 names) master lists, with no LLM judge needed; each model samples once per prompt, for 199,845 generations over the full corpus.

    Main Results

    Swipe horizontally to read the table

    ModelPython (%)JavaScript (%)Δ (Py−JS) (pp)Overall hallucination rate (%)
    Claude Haiku 4.55.492.76+2.734.62
    Claude Sonnet 4.66.632.62+4.015.41
    Gemini 2.5 Pro6.753.61+3.145.80
    DeepSeek V3.26.693.78+2.915.89
    GPT-5.4-mini7.273.14+4.136.10

    (Per Table 2 and Figure 2, the 95% Wilson confidence intervals for each model are Haiku [4.39–4.86], Sonnet [5.18–5.66], Gemini [5.56–6.06], DeepSeek [5.61–6.18], GPT [5.77–6.44])

    • Narrowing gap between models: the overall hallucination rates of the 5 frontier models range from 4.62% to 6.10%, a range of 1.48 percentage points, which the authors say is about 11 times narrower than the 16.5 percentage points in 2024 (Figure 2).
    • Paired significance results: among the 10 model pairs, 5 reach significance after Holm-Bonferroni correction, with the largest difference between Claude Haiku 4.5 and GPT-5.4-mini (Δ = 1.48 pp, chi^2 = 52.49, corrected p = 4.32×10⁻¹²); the remaining four models form a statistically hard-to-distinguish cluster in the 5.4% to 6.1% range (Table 3).
    • Comparison with historical levels: the authors state that none of the 5 frontier models from 2026 surpasses the low of 3.6% achieved by GPT-4 Turbo in 2024 (dashed baseline in Figure 2).

    Cross-Model Universal Hallucinations and Exploitable Attack Surface

    • Test content: test the intersection of the hallucinated package-name sets of the 5 models, and coordinate with PyPI Security and Socket.dev to check their registrability and exploitation conditions in the public registries.
    • Results: the 5 models jointly generated 127 universal package names (109 on PyPI, 18 on npm; Table 4 lists the top 10 by frequency); after registry rule review, PyPI retains 41 registrable names (e.g., git is blocked by a disallowed rule), npm retains 12 registrable names (4 @ember/* are unregistrable due to organization scope, ssh-keys already exists, metro-evaluator is a security placeholder), leaving 53 package names that an attacker could actually register and exploit (§6).
    • Authors' interpretation: the authors state that universal hallucinations constitute a supply-chain attack surface independent of any single model; an attacker needs only one registration to cover downstream developers using different LLM providers, breaking the assumption that the effectiveness of a single-model attack scales linearly with the model.

    Distribution Differences by Language and Prompt Type

    • Test content: compare hallucination rates for Python and JavaScript code generation across prompt sources (Stack Overflow and LLM-synthesized).
    • Results: in all 5 models the Python hallucination rate is higher than JavaScript, by +2.73 percentage points (Haiku 4.5) to +4.13 percentage points (GPT-5.4-mini) (Table 2); meanwhile, LLM-synthesized prompts generally yield higher hallucination rates than curated Stack Overflow prompts (§5.2).
    • Authors' interpretation: the authors state that this result reverses the 2024 conclusion that JavaScript is more prone to hallucination, conjecturing that 2026 models are more fully trained on web front-end corpora and that Python package naming rules allow more freedom; synthesized prompts expose greater susceptibility to hallucination when deviating from the training distribution.

    Intra-Family Inversion and Model Overlap Analysis

    • Test content: analyze the relationship between hallucination rates of higher- and lower-parameter models within the Anthropic family, and compute the Jaccard similarity of hallucinated package-name sets across the 10 model pairs.
    • Results: Claude Haiku 4.5's overall hallucination rate (4.62%) is lower than Claude Sonnet 4.6's (5.41%), with a significant paired difference (Δ = 0.79 pp, corrected p < 10⁻⁵, Table 3); the mean inter-model Jaccard similarity is 0.222, with the lowest similarity between Haiku 4.5 and Sonnet 4.6 (J = 0.179) and the highest between DeepSeek V3.2 and GPT-5.4-mini (J = 0.343, Figure 3).
    • Authors' interpretation: the authors state that Haiku outperforming Sonnet reverses the traditional belief that smaller models hallucinate more, possibly related to Haiku having thinking capability enabled and targeted post-training for instruction following; the high overlap between DeepSeek and GPT suggests possible shared training data sources or convergent confabulation patterns.

    Other Ablations and Analyses

    • Proximity of high-frequency hallucinations: 8 of the top 10 PyPI high-frequency hallucinations are within edit distance 2 of an existing real package (Table 4).
    • Model refusal rate differences: Claude Haiku 4.5 is 1.27%, DeepSeek V3.2 is 2.08%, Gemini 2.5 Pro is 8.14%, Claude Sonnet 4.6 is 18.79%, and GPT-5.4-mini reaches 32.14% (Table 1).
    • Total experimental API spend: the 5 models ran 199,845 generations in total, at a total cost of $860.90 (Table B.1).
  5. What are some points that can be further explored?

    The authors note that the evaluation is limited to 5 frontier models and does not test agent configurations, and that data leakage and refusal bias need to be controlled in future work.

    Limitations and future directions noted by the authors

    • Limited model coverage: Only 5 frontier commercial and open-source models were evaluated; smaller open-source models, fine-tuned variants, and locally deployed quantized checkpoints are outside the scope of the study (§8).
    • Static test time point: Only time-point measurements from April 22 to April 28, 2026 are reported; due to opaque model updates, results may not reflect performance at other times (§8).
    • Possible training data leakage: The Spracklen prompt corpus released in January 2025 may have been partially included in the pretraining data of 2026 models; the authors did not collect held-out 2026 prompts after the knowledge cutoff for leakage verification, which needs to be supplemented in future work (§8).
    • Asymmetric reasoning effort settings and refusal denominator: GPT-5.4-mini was only evaluated at the minimal reasoning effort and produced a 32.14% refusal rate, creating an asymmetric bias in the denominator; the authors did not scan across the four reasoning effort levels, leaving this for future research (§8).
    • Model version not pinned: The DeepSeek public API did not pin the model version; during the experiment, metadata returned the deepseek-v4-flash identifier, indicating possible drift in the underlying model (§8).
    • Agentic configurations not evaluated: No evaluation was conducted in agentic configurations with tool calls (e.g., Claude Code or GPT-5.4-mini's Responses API); whether retrieval mechanisms can in principle completely eliminate package hallucination remains to be explored (§8).

    Experimental coverage

    • Number of models tested: 5 frontier models were actually evaluated (Claude Sonnet 4.6, Claude Haiku 4.5, GPT-5.4-mini, Gemini 2.5 Pro, DeepSeek V3.2); the paper did not test open-source models of other parameter sizes.
    • Programming languages and prompt scale: The experiment covered Python and JavaScript, with a total of 39,969 prompts, half for each language.
    • Registry verification baseline: Package name verification used the PyPI (500,565 entries) and npm (approximately 3,000,000 entries) main lists from the Spracklen 2025 artifact; the paper notes this predates the experimental window, so a small number of packages newly registered during the interval would be counted as non-existent.
    • Sampling budget and repetitions: Each model generated a single code sample per prompt, collecting a total of 199,845 generations across the full corpus.
    • Registry verification subject: The determination of 53 registrable names combined PyPI Security's automated rules and Socket.dev's manual review of 18 npm candidates; the two registries did not use identical filtering processes.
  6. Summarize the main content of the paper

    The evaluation shows that frontier models' package hallucination rates have narrowed but the threat remains; the authors identify a common attack surface across models and call for joint defense.
    • Paper positioning: The paper is a replication and extension of Spracklen et al.'s 2024 code package hallucination research on the latest frontier model cohort in 2026, focusing on assessing the risk of squatting attacks in the software supply chain.
    • Problem addressed: Code LLMs frequently fabricate non-existent package names when generating code, and attackers can register malicious packages with the same name in public registries to launch attacks; the paper aims to investigate whether frontier models after 18 months of evolution still have this attack surface.
    • Core method: Run 39,969 standardized prompts on 5 frontier models to generate 199,845 code samples, extract package names using regular expressions, compare against the official PyPI and npm master lists, then compute the cross-model overlapping intersection and have registry security teams verify registrability.
    • Key experimental results:
      • The overall hallucination rates of the 5 models range from 4.62% (Claude Haiku 4.5) to 6.10% (GPT-5.4-mini), with the gap between models narrowing from 16.5 percentage points in 2024 to 1.48 percentage points (Figure 2).
      • All models have higher Python hallucination rates than JavaScript, with differences of +2.73 to +4.13 percentage points (Table 2); Claude Haiku 4.5 has a lower hallucination rate than the larger Claude Sonnet 4.6 (Table 3).
      • The 5 models collectively generated 127 universal hallucinated package names, and after PyPI and npm review filtering, 53 remain practically registrable for exploitation (§6).
    • Authors' conclusions and implications: The authors state that although the capability leap of frontier models has significantly narrowed the performance gap between models, the residual hallucination rate of 4% to 7% is economically sufficient to maintain the effectiveness of squatting attacks; the existence of universal hallucinations means a single registration can target users of multiple vendor models, so future supply chain defenses must be coordinated across models.
Read originalarxiv.org