Better Context Makes Better Code Language Models: A Case Study on Function Call Argument Completion

06/01/2023
by   Hengzhi Pei, et al.
0

Pretrained code language models have enabled great progress towards program synthesis. However, common approaches only consider in-file local context and thus miss information and constraints imposed by other parts of the codebase and its external dependencies. Existing code completion benchmarks also lack such context. To resolve these restrictions we curate a new dataset of permissively licensed Python packages that includes full projects and their dependencies and provide tools to extract non-local information with the help of program analyzers. We then focus on the task of function call argument completion which requires predicting the arguments to function calls. We show that existing code completion models do not yield good results on our completion task. To better solve this task, we query a program analyzer for information relevant to a given function call, and consider ways to provide the analyzer results to different code completion models during inference and training. Our experiments show that providing access to the function implementation and function usages greatly improves the argument completion performance. Our ablation study provides further insights on how different types of information available from the program analyzer and different ways of incorporating the information affect the model performance.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
12/20/2022

CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Context

While pre-trained language models (LM) for code have achieved great succ...
research
11/27/2017

Code Completion with Neural Attention and Pointer Networks

Intelligent code completion has become an essential tool to accelerate m...
research
09/17/2021

Long-Range Modeling of Source Code Files with eWASH: Extended Window Access by Syntax Hierarchy

Statistical language modeling and translation with transformers have fou...
research
08/09/2020

Function completion in the time of massive data: A code embedding perspective

Code completion is an important feature of integrated development enviro...
research
06/11/2023

ARIST: An Effective API Argument Recommendation Approach

Learning and remembering to use APIs are difficult. Several techniques h...
research
03/22/2023

RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation

The task of repository-level code completion is to continue writing the ...
research
07/17/2023

In-IDE Generation-based Information Support with a Large Language Model

Understanding code is challenging, especially when working in new and co...

Please sign up or login with your details

Forgot password? Click here to reset