mlsanityData to 7 Oct 2026

LLM Ghostbusters: Surgical Package Hallucination Suppression via Adaptive Unlearning

arXiv 2605.01047 ↗First posted 1 May 2026cs.CR cs.AI cs.CLcited by 0

On the map: LLM safety and security → Backdoor and data poisoning attacks

Abstract (arXiv)

Hallucinations remain an unsolved problem for LLMs, and package hallucinations are a particularly dangerous instance of this phenomenon. Package hallucinations occur during code generation when a model fabricates non-existent software packages, recommending imports and installation commands for fictional libraries. This creates a critical supply-chain vulnerability; an attacker can proactively register such packages on public registries with malicious payloads that are subsequently installed and executed by developers or autonomous agents. These hallucinations enable a class of package confusion attack known as slopsquatting. To address this issue, we present Adaptive Unlearning (AU), a post-deployment framework that surgically suppresses package hallucinations while preserving general model utility. AU introduces a hybrid token-level objective that simultaneously reinforces valid outputs and suppresses hallucinated ones. Combined with an adaptive discovery loop that continuously surfaces new hallucination-inducing contexts without human supervision, AU enables generalization to unseen prompts and hallucinations. We demonstrate that AU reduces package hallucination rates by 88%, while maintaining performance on standard coding benchmarks. Our analysis shows that distributional changes are concentrated on package-related generations, leaving general coding behavior largely unaffected and confirming that AU's effect is isolated to the targeted distribution. AU relies entirely on model-generated data and requires no human annotation, representing a post-deployment hallucination mitigation framework.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. Builds on 42 of its 74 references that are in the map. First posted on arXiv 1 May 2026.

Builds on

42 of 74 references.

References · 42

  1. 2022Training language models to follow instructions with human feedbackcited by 15,712
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  3. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
  6. 2020Scaling Laws for Neural Language Modelscited by 6,411
  7. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
  8. 2021Program Synthesis with Large Language Modelscited by 3,509
  9. 2022Locating and Editing Factual Associations in GPTcited by 2,609
  10. 2022Survey of Hallucination in Natural Language Generationcited by 2,056
  11. 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,582
  12. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
30 more
  1. 2023FActScore: Fine-grained Atomic Evaluation of Factual Precision in Long Form Text Generationcited by 1,259
  2. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  3. 2022Mass-Editing Memory in a Transformercited by 976
  4. 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 965
  5. 2025Does Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model?cited by 948
  6. 2023SelfCheckGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Modelscited by 787
  7. 2021Deduplicating Training Data Makes Language Models Bettercited by 705
  8. 2023Siren's Song in the AI Ocean: A Survey on Hallucination in Large Language Modelscited by 695
  9. 2019Certified Data Removal from Machine Learning Modelscited by 512
  10. 2024Negative Preference Optimization: From Catastrophic Collapse to Effective Unlearningcited by 484
  11. 2022Knowledge Unlearning for Mitigating Privacy Risks in Language Modelscited by 424
  12. 2023DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Modelscited by 367
  13. 2023HaluEval: A Large-Scale Hallucination Evaluation Benchmark for Large Language Modelscited by 329
  14. 2023A Pretrainer's Guide to Training Data: Measuring the Effects of Data Age, Domain Coverage, Quality, & Toxicitycited by 180
  15. 2024Is Model Collapse Inevitable? Breaking the Curse of Recursion by Accumulating Real and Synthetic Datacited by 143
  16. 2020On Exposure Bias, Hallucination and Domain Shift in Neural Machine Translationcited by 127
  17. 2023On the Stability of Iterative Retraining of Generative Models on their own Datacited by 98
  18. 2023SAC3: Reliable Hallucination Detection in Black-Box Language Models via Semantic-aware Cross-check Consistencycited by 89
  19. 2024Strong Model Collapsecited by 62
  20. 2024We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMscited by 61
  21. 2020Learn to Forget: Machine Unlearning via Neuron Maskingcited by 56
  22. 2024Offset Unlearning for Large Language Modelscited by 33
  23. 2024EFUF: Efficient Fine-grained Unlearning Framework for Mitigating Hallucinations in Multimodal Large Language Modelscited by 16
  24. 2025Importing Phantoms: Measuring LLM Package Hallucination Vulnerabilitiescited by 15
  25. 2025Analyzing and Mitigating Object Hallucination: A Training Bias Perspectivecited by 12
  26. 2025Model Collapse Is Not a Bug but a Feature in Machine Unlearning for LLMscited by 7
  27. 2025Wisdom is Knowing What not to Say: Hallucination-Free LLMs Unlearning via Attention Shiftingcited by 5
  28. 2025ForTIFAI: Fending Off Recursive Training Induced Failure for AI Model Collapsecited by 1
  29. 2025HFuzzer: Testing Large Language Models for Package Hallucinations via Phrase-based Fuzzingcited by 1
  30. 2026Forget-It-All: Multi-Concept Machine Unlearning via Concept-Aware Neuron Maskingcited by 1

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026Harmless Yet Harmful: Neutral Prompting Attacks for Stealthy Hallucination Steering in Agent Skills
  2. 2026Evaluating Inference-Time Defenses Against Package Hallucination in LLM-Generated Code
  3. 2026Package Hallucination Attacks on Coding Agents through Prompt Injection in Rule Files
  4. 2026Refusing the Impossible: A Taxonomy and Benchmark for Code Hallucination in Large Language Models ↗
  5. 2026HalluClear: Diagnosing, Evaluating and Mitigating Hallucinations in GUI Agents
  6. 2026Bayesian-Calibrated Detection of Hallucinated Package Imports in AI-Assisted Code ↗
  7. 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigation
  8. 2026Understanding and Mitigating Hallucination Escape in Tool-Using LLM Agents