通过上下文与课程学习改进FIM代码补全
Improving FIM Code Completions via Context & Curriculum Based Learning
AI总结:
针对FIM代码补全中低延迟与准确性的矛盾,提出基于上下文与课程学习的微调方法。通过构建困难模式课程数据集并利用静态分析生成上下文,有效提升了小模型的补全性能,在A/B测试中实现了CAR和CPR的显著提升且零延迟影响。
摘要:
Fill-in-the-Middle (FIM) 模型在代码补全任务中发挥着至关重要的作用,它利用前缀和后缀上下文来提供更准确且与上下文相关的建议。本文提出了在保持实时编码辅助低延迟挑战的同时改进 FIM 代码补全的方法。我们通过在训练过程中引入上下文和课程示例来增强 FIM 代码补全。我们识别了补全建议更容易失败的代码模式,揭示了较小语言模型难以处理的复杂性。为了应对这些挑战,我们通过从代码仓库中提取难以补全的模式开发了一个课程数据集,并使用语义和静态分析工具(例如 TSC 编译器)生成上下文示例。我们在这个增强的数据集上对各种规模的模型进行了微调,包括 StarCoder 和 DeepSeek。我们的评估包含三个关键维度:Santa Coder FIM 任务、Amazon CCEval 基准,以及一个从 SWE-bench 派生出的新的 Multi-Line Infilling 评估基准。跨多种模型规模的全面消融研究表明,虽然所有微调模型均有所改善,但较小参数模型的性能提升更为显著;并且将难以补全的示例作为课程学习的一部分纳入,提高了代码补全性能。鉴于代码补全任务的延迟限制,这一发现尤为重要。虽然像 GPT 和 Claude 这样的大型模型在多行补全中表现良好,但由于高延迟导致难以实际应用,而我们的微调模型在性能和延迟之间实现了平衡。最后,我们通过在线 A/B 测试验证了我们的方法,证明了补全接受率 (CAR) 和补全持续率 (CPR) 的切实提升,且对零延迟产生影响。
英文摘要:
Fill-in-the-Middle (FIM) models play a vital role in code completion tasks, leveraging both prefix and suffix context to provide more accurate and contextually relevant suggestions. This paper presents approaches to improve FIM code completion while addressing the challenge of maintaining low latency for real-time coding assistance. We enhance FIM code completion by incorporating context and curriculum examples in the training process. We identify patterns where completion suggestions fail more frequently, revealing complexities that smaller language models struggle with. To address these challenges, we develop a curriculum dataset by extracting hard-to-complete patterns from code repositories and generate context examples using semantic and static analysis tools (e.g. TSC compiler). We fine-tune various sized models, including StarCoder and DeepSeek, on this enhanced dataset. Our evaluation encompasses three key dimensions: the Santa Coder FIM task, the Amazon CCEval benchmark, and a new Multi-Line Infilling evaluation benchmark derived from SWE-bench. Comprehensive ablation studies across multiple model sizes reveal that while all fine-tuned models show improvements, the performance gains are more pronounced for smaller parameter models and incorporating difficult-to-complete examples, as part of curriculum learning, improves the code completion performance. This finding is particularly significant given the latency constraints of code completion tasks. While larger models like GPT and Claude perform well in multi-line completions but are prohibitively challenging to use given high latency, and our fine-tuned models achieve a balance between performance and latency. Finally, we validate our approach through online A/B testing, demonstrating tangible improvements in Completion Acceptance Rate (CAR) and Completion Persistence Rate (CPR), with zero latency impact.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。