Identifying and Mitigating API Misuse in Large Language Models
Not on the map. Why?
Abstract (arXiv)
API misuse in code generated by large language models (LLMs) presents a serious and growing challenge in software development, as although LLMs demonstrate impressive code generation capabilities, their interactions with complex library APIs are often error-prone and can lead to software failures and vulnerabilities. In this paper, we conduct a large-scale study of API misuse patterns in LLM-generated code by analyzing both method selection and parameter usage across Python and Java, using three representative LLMs: StarCoder-7B, Qwen2.5-Coder-7B, and GitHub Copilot. Based on extensive manual annotation of 3,209 method-level and 3,492 parameter-level misuses, we identify and categorize four recurring misuse types by building on and refining prior API misuse taxonomies. Our evaluation of the three LLMs reveals persistent challenges in API usage, particularly hallucination and intent misalignment. To address these issues, we propose Dr.Fix, an LLM-based automatic repair approach guided by our taxonomy, which improves repair accuracy compared to baseline prompting and existing repair methods, achieving gains of up to 38.4 BLEU and 40% exact match on benchmark datasets. This work offers important insights into the current limitations of LLMs in API usage and points to directions for improving automated misuse repair in code generation systems.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). First posted on arXiv 28 Mar 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 1; 2026: 2.
3 papers.
- 2025SHIELDA: Structured Handling of Exceptions in LLM-Driven Agentic Workflowscited by 12
- 2026When Retrieval Hurts Code Completion: A Diagnostic Study of Stale Repository Contextcited by 1
- 2026Knowledge boundary probing and demand-guided intervention for LLM-based power system code generationcited by 1
- 2026Knowledge boundary probing and demand-guided intervention for LLM-based power system code generation29 May 2026
- 2026When Retrieval Hurts Code Completion: A Diagnostic Study of Stale Repository Context14 May 2026
- 2025SHIELDA: Structured Handling of Exceptions in LLM-Driven Agentic Workflows11 Aug 2025