一句话:首次系统评估 LLM 代码补全中弃用 API 的使用现状与成因,并提出两种轻量修复基线方法。
大语言模型在代码补全中表现良好,但库的快速演化使其难以使用正确且最新的 API。已有研究关注错误 API 预测,而基于 LLM 的代码补全中弃用 API 使用问题尚未被充分研究。本文开展首个针对该问题的评估研究,涉及 7 个先进 LLM、来自 8 个流行 Python 库的 145 组 API 映射以及 28,125 条补全提示。研究从模型、提示和库三个视角揭示了弃用 API 与替代 API 使用的现状(API 使用合理性与弃用率),并指出背后的根本原因。基于这些发现,作者提出两种轻量修复方法 Replaceapi 与 InsertPrompt,可作为未来缓解弃用 API 使用研究的基线方法,并为将库演化融入 LLM 驱动的软件开发提供启示。
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$\mathbf{2 8, 1 2 5}$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.
DOI 原文 ·
@inproceedings{paperbot8788,
title = {LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-Based Code Completion},
author = {Chong Wang and Kaifeng Huang and Jian Zhang and Yebo Feng and Lyuye Zhang and Yang Liu and Xin Peng},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00245}
}