Context-Aware API Reranking for Custom Developer Requirements in Code Completion

ACL ARR 2026 January Submission2609 Authors

03 Jan 2026 (modified: 20 Mar 2026)ACL ARR 2026 January SubmissionEveryoneRevisionsBibTeXCC BY 4.0
Keywords: code understanding, API Recommendations
Abstract: Large Language Models (LLMs) have made significant advancements in automatic code completion. Given the rapid pace of API updates and the restricted proprietary documentation of enterprise environments, selecting suitable APIs for automatic code completion from vast third-party and private libraries plays a critical role. However, existing solutions struggle to accurately recommend APIs when developers present customized requirements within an incomplete code context. To bridge this gap, we propose a context-aware approach APIRANKER to rerank candidate API documents based on both the explicit developer intent and implicit cues in the incomplete code context. To generate training data for this task, 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 estimate relevance. The experimental results show the effectiveness of our approach in recommending more accurate APIs.
Paper Type: Long
Research Area: Code Models
Research Area Keywords: code models,code retrieval, code generation and understanding,re-ranking
Contribution Types: NLP engineering experiment, Approaches to low-resource settings, Publicly available software and/or pre-trained models, Data resources
Languages Studied: enligsh,Programming language
Submission Number: 2609
Loading