arXiv:2501.04694cs.CLcs.AI2025-01ICML被引 23

用特征树生成更复杂多样的代码,支持从函数到项目级的合成。

EpiCoder: Encompassing Diversity and Complexity in Code Generation

  • 基于代码高层抽象构建特征树,迭代优化以提升多样性。
  • 在函数和文件级基准上达到当前最佳性能,可生成项目级代码数据。
  • 适合需要高质量、多样化代码训练数据的研究与开发人员。

现有代码生成方法依赖代码片段作为种子数据,限制了生成数据的复杂性和多样性。本文提出一种基于特征树的合成框架,通过从原始数据中提取并迭代优化的层次化代码特征,捕捉代码中更复杂的模式与关系。通过调整采样子树的深度与广度,该框架可精确控制生成代码的复杂度,支持从函数级到多文件场景的功能。我们对多个通用基础模型进行微调,得到EpiCoder系列模型,在多个基准测试中实现函数级和文件级的领先性能。实证表明,该方法在生成项目级代码数据方面具有显著潜力。代码与数据已公开于https://github.com/microsoft/EpiCoder。

原文摘要 · Abstract (English)

Existing methods for code generation use code snippets as seed data, restricting the complexity and diversity of the synthesized data. In this paper, we introduce a novel feature tree-based synthesis framework, which revolves around hierarchical code features derived from high-level abstractions of code. The feature tree is constructed from raw data and refined iteratively to increase the quantity and diversity of the extracted features, which captures and recognizes more complex patterns and relationships within the code. By adjusting the depth and breadth of the sampled subtrees, our framework provides precise control over the complexity of the generated code, enabling functionalities that range from function-level operations to multi-file scenarios. We fine-tuned widely-used base models to obtain EpiCoder series, achieving state-of-the-art performance on multiple benchmarks at both the function and file levels. In particular, empirical evidence indicates that our approach shows significant potential in the synthesizing of repository-level code data. Our code and data are publicly available at https://github.com/microsoft/EpiCoder.

代码生成特征树多样性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。