APICom: Automatic API Completion via Prompt Learning and Adversarial Training-based Data Augmentation

09/13/2023
by   Yafeng Gu, et al.
0

Based on developer needs and usage scenarios, API (Application Programming Interface) recommendation is the process of assisting developers in finding the required API among numerous candidate APIs. Previous studies mainly modeled API recommendation as the recommendation task, which can recommend multiple candidate APIs for the given query, and developers may not yet be able to find what they need. Motivated by the neural machine translation research domain, we can model this problem as the generation task, which aims to directly generate the required API for the developer query. After our preliminary investigation, we find the performance of this intuitive approach is not promising. The reason is that there exists an error when generating the prefixes of the API. However, developers may know certain API prefix information during actual development in most cases. Therefore, we model this problem as the automatic completion task and propose a novel approach APICom based on prompt learning, which can generate API related to the query according to the prompts (i.e., API prefix information). Moreover, the effectiveness of APICom highly depends on the quality of the training dataset. In this study, we further design a novel gradient-based adversarial training method for data augmentation, which can improve the normalized stability when generating adversarial examples. To evaluate the effectiveness of APICom, we consider a corpus of 33k developer queries and corresponding APIs. Compared with the state-of-the-art baselines, our experimental results show that APICom can outperform all baselines by at least 40.02%, 13.20%, and 16.31% in terms of the performance measures EM@1, MRR, and MAP. Finally, our ablation studies confirm the effectiveness of our component setting (such as our designed adversarial training method, our used pre-trained model, and prompt learning) in APICom.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
12/23/2021

Revisiting, Benchmarking and Exploring API Recommendation: How Far Are We?

Application Programming Interfaces (APIs), which encapsulate the impleme...
research
12/14/2022

API-Spector: an API-to-API Specification Recommendation Engine

When designing a new API for a large project, developers need to make sm...
research
02/04/2020

Boosting API Recommendation with Implicit Feedback

Developers often need to use appropriate APIs to program efficiently, bu...
research
08/03/2022

API Usage Recommendation via Multi-View Heterogeneous Graph Representation Learning

Developers often need to decide which APIs to use for the functions bein...
research
04/27/2023

Answering Uncertain, Under-Specified API Queries Assisted by Knowledge-Aware Human-AI Dialogue

Developers' API needs should be more pragmatic, such as seeking suggesti...
research
04/02/2021

Plot2API: Recommending Graphic API from Plot via Semantic Parsing Guided Neural Network

Plot-based Graphic API recommendation (Plot2API) is an unstudied but mea...
research
01/20/2022

APIRO: A Framework for Automated Security Tools API Recommendation

Security Orchestration, Automation, and Response (SOAR) platforms integr...

Please sign up or login with your details

Forgot password? Click here to reset