一句话:提出面向 Android 的上下文增强 RAG 代码补全框架,并设计微调损失以更好利用上下文。
Android 开发大量依赖生命周期回调、UI 组件等特有代码,现有基于 RAG 的代码补全难以为 Code LLM 检索到足够有效的上下文。为此,本文提出 DroidCoder:利用 Android 开发特征与代码片段上下文信息增强 RAG,并设计专用损失函数微调模型,使其更好地利用上下文增强的检索结果。作者在三个基座模型和不同类型应用上,与两种先进代码补全方法比较;结果表明,DroidCoder 在行级与多行级补全上显著优于基线,并提升补全代码质量。
Android is the most popular mobile operating system. However, Android development requires extensive coding, especially for unique features such as lifecycle callbacks and UI widgets. Existing code completion methods typically utilize Retrieval-Augmented Generation (RAG) to provide contextual information for pre-trained code large language models (Code LLMs) to perform completion. Despite considerable progress in these methods, their effectiveness in Android development remains limited. This is because the features of Android development make it challenging for existing retrieval mechanisms to extract sufficient context effectively. In response, we propose DroidCoder, a novel Android code completion framework that employs Android development features and contextual information of code snippets to enrich RAG. It also incorporates a specifically designed loss function to fine-tune the model, enabling it to better utilize context-enhanced RAG for Android code completion. We evaluated our method on three base models and different types of applications, comparing it with two state-of-the-art code completion methods. The experimental results demonstrate that our method significantly outperforms the baselines at line-level and multi-line-level code completion and improves the quality of the completed code.
DOI 原文 ·
@inproceedings{paperbot8342,
title = {DroidCoder: Enhanced Android Code Completion with Context-Enriched Retrieval-Augmented Generation},
author = {Xinran Yu and Chun Li and Minxue Pan and Xuandong Li},
booktitle = {ASE},
year = {2024},
doi = {10.1145/3691620.3695063}
}