Pop Quiz! Do Pre-trained Code Models Possess Knowledge of Correct API
Names?
- URL: http://arxiv.org/abs/2309.07804v1
- Date: Thu, 14 Sep 2023 15:46:41 GMT
- Title: Pop Quiz! Do Pre-trained Code Models Possess Knowledge of Correct API
Names?
- Authors: Terry Yue Zhuo, Xiaoning Du, Zhenchang Xing, Jiamou Sun, Haowei Quan,
Li Li, Liming Zhu
- Abstract summary: Recent breakthroughs in pre-trained code models, such as CodeBERT and Codex, have shown their superior performance in various downstream tasks.
Recent studies reveal that even state-of-the-art pre-trained code models struggle with suggesting the correct APIs during code generation.
- Score: 28.86399157983769
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: Recent breakthroughs in pre-trained code models, such as CodeBERT and Codex,
have shown their superior performance in various downstream tasks. The
correctness and unambiguity of API usage among these code models are crucial
for achieving desirable program functionalities, requiring them to learn
various API fully qualified names structurally and semantically. Recent studies
reveal that even state-of-the-art pre-trained code models struggle with
suggesting the correct APIs during code generation. However, the reasons for
such poor API usage performance are barely investigated. To address this
challenge, we propose using knowledge probing as a means of interpreting code
models, which uses cloze-style tests to measure the knowledge stored in models.
Our comprehensive study examines a code model's capability of understanding API
fully qualified names from two different perspectives: API call and API import.
Specifically, we reveal that current code models struggle with understanding
API names, with pre-training strategies significantly affecting the quality of
API name learning. We demonstrate that natural language context can assist code
models in locating Python API names and generalize Python API name knowledge to
unseen data. Our findings provide insights into the limitations and
capabilities of current pre-trained code models, and suggest that incorporating
API structure into the pre-training process can improve automated API usage and
code representations. This work provides significance for advancing code
intelligence practices and direction for future studies. All experiment
results, data and source code used in this work are available at
\url{https://doi.org/10.5281/zenodo.7902072}.
Related papers
- A Systematic Evaluation of Large Code Models in API Suggestion: When, Which, and How [53.65636914757381]
API suggestion is a critical task in modern software development.
Recent advancements in large code models (LCMs) have shown promise in the API suggestion task.
arXiv Detail & Related papers (2024-09-20T03:12:35Z) - FANTAstic SEquences and Where to Find Them: Faithful and Efficient API Call Generation through State-tracked Constrained Decoding and Reranking [57.53742155914176]
API call generation is the cornerstone of large language models' tool-using ability.
Existing supervised and in-context learning approaches suffer from high training costs, poor data efficiency, and generated API calls that can be unfaithful to the API documentation and the user's request.
We propose an output-side optimization approach called FANTASE to address these limitations.
arXiv Detail & Related papers (2024-07-18T23:44:02Z) - WorldAPIs: The World Is Worth How Many APIs? A Thought Experiment [49.00213183302225]
We propose a framework to induce new APIs by grounding wikiHow instruction to situated agent policies.
Inspired by recent successes in large language models (LLMs) for embodied planning, we propose a few-shot prompting to steer GPT-4.
arXiv Detail & Related papers (2024-07-10T15:52:44Z) - A Solution-based LLM API-using Methodology for Academic Information Seeking [49.096714812902576]
SoAy is a solution-based LLM API-using methodology for academic information seeking.
It uses code with a solution as the reasoning method, where a solution is a pre-constructed API calling sequence.
Results show a 34.58-75.99% performance improvement compared to state-of-the-art LLM API-based baselines.
arXiv Detail & Related papers (2024-05-24T02:44:14Z) - Are Human Rules Necessary? Generating Reusable APIs with CoT Reasoning and In-Context Learning [14.351476383642016]
We propose a novel approach, named Code2API, to automatically perform APIzation for Stack Overflow code snippets.
Code2API does not require additional model training or any manual crafting rules.
It can be easily deployed on personal computers without relying on other external tools.
arXiv Detail & Related papers (2024-05-06T14:22:17Z) - Exploring the Impact of Source Code Linearity on the Programmers Comprehension of API Code Examples [0.0]
We investigated whether the (a) linearity and (b) length of the source code in API code examples affect users performance in terms of correctness and time spent.
We conducted an online controlled code comprehension experiment with 61 Java developers.
arXiv Detail & Related papers (2024-04-03T00:40:38Z) - APICom: Automatic API Completion via Prompt Learning and Adversarial
Training-based Data Augmentation [6.029137544885093]
API 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, 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.
We propose a novel approach APICom based on prompt learning, which can generate API related to the query according to the prompts.
arXiv Detail & Related papers (2023-09-13T15:31:50Z) - Private-Library-Oriented Code Generation with Large Language Models [52.73999698194344]
This paper focuses on utilizing large language models (LLMs) for code generation in private libraries.
We propose a novel framework that emulates the process of programmers writing private code.
We create four private library benchmarks, including TorchDataEval, TorchDataComplexEval, MonkeyEval, and BeatNumEval.
arXiv Detail & Related papers (2023-07-28T07:43:13Z) - When Language Model Meets Private Library [25.610036042971043]
In practice, it is common for programmers to write code using private libraries.
This is a challenge for language models since they have never seen private APIs during training.
We propose a novel framework with two modules: the APIRetriever finds useful APIs, and then the APICoder generates code using these APIs.
arXiv Detail & Related papers (2022-10-31T11:42:06Z) - Binding Language Models in Symbolic Languages [146.3027328556881]
Binder is a training-free neural-symbolic framework that maps the task input to a program.
In the parsing stage, Codex is able to identify the part of the task input that cannot be answerable by the original programming language.
In the execution stage, Codex can perform versatile functionalities given proper prompts in the API calls.
arXiv Detail & Related papers (2022-10-06T12:55:17Z) - On the Effectiveness of Pretrained Models for API Learning [8.788509467038743]
Developers frequently use APIs to implement certain functionalities, such as parsing Excel Files, reading and writing text files line by line, etc.
Developers can greatly benefit from automatic API usage sequence generation based on natural language queries for building applications in a faster and cleaner manner.
Existing approaches utilize information retrieval models to search for matching API sequences given a query or use RNN-based encoder-decoder to generate API sequences.
arXiv Detail & Related papers (2022-04-05T20:33:24Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.