LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-Based Code Completion
Large language models (LLMs), pre-trained or fine-tuned on large code corpora, have shown effectiveness in generating code completions. However, in LLM-based code completion, LLMs may struggle to use correct and up-to-date Application Programming Interfaces (APIs) due to the rapid and continuous evolution of libraries. While existing studies have highlighted issues with predicting incorrect APIs, the specific problem of deprecated API usage in LLM-based code completion has not been thoroughly investigated. To address this gap, we conducted the first evaluation study on deprecated API usage in LLM-based code completion. This study involved seven advanced LLMs, 145 API mappings from eight popular Python libraries, and <tex xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">$\mathbf{2 8, 1 2 5}$</tex> completion prompts. The study results reveal the status quo (i.e., API usage plausibility and deprecated usage rate) of deprecated API and replacing API usage in LLM-based code completion from the perspectives of model, prompt, and library, and indicate the root causes behind. Based on these findings, we propose two lightweight fixing approaches, Replaceapi and InsertPrompt, which can serve as baseline approaches for future research on mitigating deprecated API usage in LLM-based completion. Additionally, we provide implications for future research on integrating library evolution with LLMdriven software development.
Authors
- Kaifeng Huang (ORCID: https://orcid.org/0009-0000-1513-8254)
- Yebo Feng (ORCID: https://orcid.org/0000-0002-7235-2377)
- Jian Zhang (ORCID: https://orcid.org/0000-0001-8316-1894)
- Lyuye Zhang (ORCID: https://orcid.org/0000-0003-3087-9645)
- Chong Wang (ORCID: https://orcid.org/0000-0003-1424-6290)
- Yang Liu (ORCID: https://orcid.org/0000-0001-7300-9215)
- Xin Peng (ORCID: https://orcid.org/0000-0003-3376-2581)
Institutions
- Tongji University (CN)
- Nanyang Technological University (SG)
- Fudan University (CN)
Publication Details
- Published
- 2025-04-26
- DOI
- https://doi.org/10.1109/icse55347.2025.00245
- Citations
- 2
- Primary Topic
- Digital Rights Management and Security
- Type
- article
- Field-Weighted Citation Impact
- 6.49
Funders
- Ministry of Higher Education and Scientific Research
- National Research Foundation
- DSO National Laboratories - Singapore
- National Natural Science Foundation of China
- National Key Research and Development Program of China