AI RESEARCH

An Empirical Analysis of Static Analysis Methods for Detection and Mitigation of Code Library Hallucinations

arXiv CS.CL

ArXi:2604.07755v1 Announce Type: new Despite extensive research, Large Language Models continue to hallucinate when generating code, particularly when using libraries. On NL-to-code benchmarks that require library use, we find that LLMs generate code that uses non-existent library features in 8.1-40% of responses. One intuitive approach for detection and mitigation of hallucinations is static analysis. In this paper, we analyse the potential of static analysis tools, both in terms of what they can solve and what they cannot.