用语义范围自动定制大模型,让代码生成更贴合企业私有代码库。
Automated Customization of LLMs for Enterprise Code Repositories Using Semantic Scopes
- 基于代码语义范围构建训练数据,提升模型对私有代码风格的理解。
- 小规模定制模型的代码补全效果优于更大规模未定制模型。
- 适合需要提升内部代码生成准确率的企业研发团队使用。
代码补全(CC)是开发者在使用基于大语言模型(LLM)的编程助手时频繁执行的任务。尽管大模型在公开基准上表现优异,但未经定制的模型仍难以生成与未见过的私有代码库相匹配的代码。通过将代码大模型定制到私有代码仓库,可有效提升性能。本文提出一种基于代码语义范围的自动化定制方法,评估了在两个真实企业代码仓库上的两种策略:检索增强生成(RAG)与监督微调(FT)。我们设计的数据摄入机制和带语义范围的训练样本构造方法,使模型能学习到仓库特有的编码模式,从而为开发者提供更精准的代码建议,提升开发效率。实验表明,中等规模的定制模型在代码补全任务上显著优于更大规模的未定制模型。此外,我们在两个公开基准上进行了定制效果分析,并探讨了未来研究方向。
原文摘要 · Abstract (English)
Code completion (CC) is a task frequently used by developers when working in collaboration with LLM-based programming assistants. Despite the increased performance of LLMs on public benchmarks, out of the box LLMs still have a hard time generating code that aligns with a private code repository not previously seen by the model's training data. Customizing code LLMs to a private repository provides a way to improve the model performance. In this paper we present our approach for automated LLM customization based on semantic scopes in the code. We evaluate LLMs on real industry cases with two private enterprise code repositories with two customization strategies: Retrieval-Augmented Generation (RAG) and supervised Fine-Tuning (FT). Our mechanism for ingesting the repository's data and formulating the training data pairs with semantic scopes helps models to learn the underlying patterns specific to the repository, providing more precise code to developers and helping to boost their productivity. The code completions of moderately sized customized models can be significantly better than those of uncustomized models of much larger capacity. We also include an analysis of customization on two public benchmarks and present opportunities for future work.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。