LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-based Code Completion

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Wang, Chong, Huang, Kaifeng, Zhang, Jian, Feng, Yebo, Zhang, Lyuye, Liu, Yang, Peng, Xin
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866912230679773184
author Wang, Chong
Huang, Kaifeng
Zhang, Jian
Feng, Yebo
Zhang, Lyuye
Liu, Yang
Peng, Xin
author_facet Wang, Chong
Huang, Kaifeng
Zhang, Jian
Feng, Yebo
Zhang, Lyuye
Liu, Yang
Peng, Xin
contents 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 28,125 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 LLM-driven software development.
format Preprint
id arxiv_https___arxiv_org_abs_2406_09834
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-based Code Completion
Wang, Chong
Huang, Kaifeng
Zhang, Jian
Feng, Yebo
Zhang, Lyuye
Liu, Yang
Peng, Xin
Software Engineering
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 28,125 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 LLM-driven software development.
title LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-based Code Completion
topic Software Engineering
url https://arxiv.org/abs/2406.09834