API Reranking for Automatic Code Completion: Leveraging Explicit Intent and Implicit Cues from Code Context
Abstract: Large Language Models (LLMs) have significantly advanced software development, particularly in automatic code completion, where selecting suitable API documents from vast third-party libraries plays a critical role. However, current solutions either focus on recommending APIs based on user queries or code context, without considering both aspects simultaneously. To bridge this gap, we propose a novel framework APIRanker to rerank candidate API documents based on both the explicit developer intent and implicit cues embedded in the incomplete code context. To automatically construct ranking data, we introduce a self-supervised ranking framework that automatically constructs data by assessing the relevance of API documents to code context with a perplexity-driven approach via comments. To enhance API relevance detection, we propose a novel reranking model that predicts relevance scores by capturing a hidden reasoning state to detect relevance. The experimental results show the effectiveness of our approach, providing more accurate API recommendations and enhancing automatic code completion.
Paper Type: Long
Research Area: NLP Applications
Research Area Keywords: code generation and understanding
Contribution Types: NLP engineering experiment, Approaches to low-resource settings
Languages Studied: English,Programming language
Submission Number: 5876
Loading