Machine learning (ML)-based API recommendation helps developers efficiently identify suitable APIs to complement the application code. However, code datasets used to train ML models often exhibit a long-tail distribution, leading to unreliable API recommendations, especially for infrequently used API methods at the tail of the distribution. To address this issue, we propose N-version API Recommendation (NvRec), which leverages N different versions of ML models to enhance the reliability of API sequence recommendations by suppressing unreliable outputs entailing tail APIs. NvRec leverages a set of available ML models and profiles their performance on individual API methods with their tail properties. The generated model profile is used at inference time to filter out unreliable API recommendations and determine the final output. We implement NvRec using five API recommendation models, including CodeBERT, CodeT5, MulaRec, UniXcoder, and CodeT5+, and evaluate it on a public benchmark dataset constructed from compilable Java projects. For the three-version NvRec, we find that the combination of CodeT5, MulaRec, and UniXcoder achieves the highest true accept rate of 83.8%, with a rejection rate of 80.7%, when majority voting is restricted to highly reliable candidates. In contrast, the five-version configuration achieves its highest true accept rate of 83.1% with simple majority voting, while reducing the rejection rate to 69.0%. Overall, the five-version configuration offers a better balance between true accept rate and rejection rate.
Q-ARE: An Evaluation Dataset for Query Based API Recommendation
College of Computer Science and Technology, National University of Defense Technology(国防科技大学计算机学院);State Key Laboratory of Complex & Critical Software Environment(复杂与关键软件环境国家重点实验室)
RACK: Automatic API Recommendation using Crowdsourced Knowledge
传统的代码搜索引擎通常不能很好地执行自然语言查询,因为它们主要应用关键字匹配。因此,这些引擎需要精心设计的查询,其中包含有关代码搜索编程API的信息。不幸的是,现有的研究表明,准备一个有效的代码搜索查询是既具有挑战性和耗时的开发人员。在本文中,我们提出了一种新的API推荐技术--RACK,它通过利用Stack Overflow的众包知识中的关键字-API关联,为代码搜索的自然语言查询推荐相关API列表。我们首先使用11个核心Java包和来自Stack Overflow的344 K Java帖子进行探索性研究来激励我们的技术。使用150个代码搜索查询随机选择的三个Java教程网站的实验表明,我们的技术建议正确的API类的前10名的结果约79%的查询,这是非常有前途的。与最先进技术的两个变体的比较还表明,RACK不仅在Top-K准确率方面,而且在平均平均精确率和平均召回率方面都大大优于它们。
Holistic Combination of Structural and Textual Code Information for Context based API Recommendation
Fudan University(复旦大学);Shanghai Institute of Intelligent Electronics & Systems(上海智能电子与系统研究院);Australian National University(澳大利亚国立大学);Singapore Management University(新加坡管理大学)
Diversity-aware Web APIs Recommendation with Compatibility Guarantee
China Agricultural University(中国农业大学);Weifang University of Science and Technology(潍坊科技学院);St. Francis Xavier University(圣弗朗西斯泽维尔大学);Macquarie University(麦考瑞大学);Persian Gulf University(波斯湾大学);Shiraz University of Technology(设拉子理工大学)
Don't Use a Cannon to Kill a Fly: Lightweight Model Editing for LLMs to Correct Deprecated API Recommendations
Department of Computer Science, City University of Hong Kong(香港城市大学计算机系);The State Key Laboratory of Blockchain and Data Security, Zhejiang University(浙江大学区块链与数据安全国家重点实验室);Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security(杭州高新技术开发区(滨江)区块链与数据安全研究院);Midea Group(美的集团)