Contextual API Completion for Unseen Repositories Using LLMs
Noor Nashid, Taha Shabani, Parsa Alian, Ali Mesbah

TL;DR
This paper presents LANCE, a novel approach leveraging contextual information within repositories to improve API code completion for unseen projects, significantly outperforming existing tools like Copilot.
Contribution
Introduces LANCE, a context-aware API completion method that enhances accuracy for unseen repositories without requiring language-specific training or fine-tuning.
Findings
Achieves 82.6% accuracy in API token completion.
Surpasses Copilot by over 140% in both API token and conversational completions.
Demonstrates effectiveness across multiple programming languages.
Abstract
Large language models have made substantial progress in addressing diverse code-related tasks. However, their adoption is hindered by inconsistencies in generating output due to the lack of real-world, domain-specific information, such as for intra-repository API calls for unseen software projects. We introduce a novel technique to mitigate hallucinations by leveraging global and local contextual information within a code repository for API completion tasks. Our approach is tailored to refine code completion tasks, with a focus on optimizing local API completions. We examine relevant import statements during API completion to derive insights into local APIs, drawing from their method signatures. For API token completion, we analyze the inline variables and correlate them with the appropriate imported modules, thereby allowing our approach to rank the most contextually relevant…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSemantic Web and Ontologies · Scientific Computing and Data Management · Digital Rights Management and Security
