PackMonitor: Enabling Zero Package Hallucinations Through Decoding-Time Monitoring
Xiting Liu, Yuetong Liu, Yitong Zhang, Jia Li, Shi-Min Hu

TL;DR
PackMonitor is a novel, decoding-time monitoring approach that guarantees zero package hallucinations in LLMs during dependency recommendations by leveraging authoritative package lists and real-time intervention.
Contribution
This work introduces PackMonitor, the first method to fundamentally eliminate package hallucinations in LLMs through continuous monitoring and intervention during decoding.
Findings
Achieves zero package hallucinations across five LLMs.
Maintains low latency and model capabilities.
Scalable to millions of packages with negligible overhead.
Abstract
As Large Language Models (LLMs) are increasingly integrated into software development workflows, their trustworthiness has become a critical concern. However, in dependency recommendation scenarios, the reliability of LLMs is undermined by widespread package hallucinations, where models often recommend hallucinated packages. Recent studies have proposed a range of approaches to mitigate this issue. Nevertheless, existing approaches typically merely reduce hallucination rates rather than eliminate them, leaving persistent software security risks. In this work, we argue that package hallucinations are theoretically preventable based on the key insight that package validity is decidable through finite and enumerable authoritative package lists. Building on this, we propose PackMonitor, the first approach capable of fundamentally eliminating package hallucinations by continuously…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSecurity and Verification in Computing · Adversarial Robustness in Machine Learning · Software Engineering Research
