70亿参数模型在代码补全上超越更大模型,兼顾高效与准确。
aiXcoder-7B: A Lightweight and Effective Large Language Model for Code Processing
- 多目标训练结合结构化填空任务,提升语法理解能力。
- 使用1.2万亿唯一标记训练,覆盖广泛代码模式。
- 轻量高效,适合开发工具集成,开源后获2226个星标。
大型语言模型(LLM)在代码补全中广泛应用,但模型越大,推理效率越低,影响开发者体验。本文提出轻量高效的代码补全模型aiXcoder-7B,仅70亿参数,却在多个基准测试中超越六款同规模及四款更大模型(如StarCoder2-15B和CodeLlama-34B)。其优势源于三点:(1)多目标训练,引入新方法结构化填空中间(SFIM),强化代码语法结构理解;(2)多样数据采样策略,捕捉跨文件上下文关系;(3)1.2万亿唯一标记的高质量数据训练,使模型学习到广泛的代码分布。在五个主流及一个新构建的基准测试中表现优异。aiXcoder-7B已开源,截至2025年1月获2226个GitHub星标,为学术界与工业界提供高效代码生成方案。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have been widely used in code completion, and researchers are focusing on scaling up LLMs to improve their accuracy. However, larger LLMs have lower inference efficiency, affecting developers' experience and productivity. In this paper, we propose a lightweight and effective LLM for code completion named aiXcoder-7B. Compared to existing LLMs, aiXcoder-7B achieves higher code completion accuracy while having smaller scales (i.e., 7 billion parameters). We attribute the superiority of aiXcoder-7B to three key factors: (1) Multi-objective training. We employ three training objectives, one of which is our proposed Structured Fill-In-the-Middle (SFIM). SFIM considers the syntax structures in code and effectively improves the performance of LLMs for code. (2) Diverse data sampling strategies. They consider inter-file relationships and enhance the capability of LLMs in understanding cross-file contexts. (3) Extensive high-quality data. We establish a rigorous data collection pipeline and consume a total of 1.2 trillion unique tokens for training aiXcoder-7B. This vast volume of data enables aiXcoder-7B to learn a broad distribution of code. We evaluate aiXcoder-7B in five popular code completion benchmarks and a new benchmark collected by this paper. The results show that aiXcoder-7B outperforms the latest six LLMs with similar sizes and even surpasses four larger LLMs (e.g., StarCoder2-15B and CodeLlama-34B), positioning aiXcoder-7B as a lightweight and effective LLM for academia and industry. Finally, we summarize three valuable insights for helping practitioners train the next generations of LLMs for code. aiXcoder-7B has been open-souced and gained significant attention. Until January 2025, aiXcoder-7B has received 2,226 GitHub Stars.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。