arXiv:2504.00019cs.CLcs.AI2025-04ICLR被引 6

通过混淆代码训练,让编程语言模型更懂代码语义。

ObscuraCoder: Powering Efficient Code LM Pre-Training Via Obfuscation Grounding

  • 用代码混淆作为预训练目标,引导模型关注语义而非表面语法。
  • 在2720亿词数据上训练,2.8B参数模型在多任务测试中显著提升。
  • 适合追求高效、跨语言代码生成与理解的研究者和开发者。

编程语言模型已成为代码生成的重要工具,但其预训练方法多年未有突破,尤其在提升数据效率与解耦语法语义方面研究较少。本文提出基于代码混淆的预训练新范式,构建了包含约5500万对源代码与混淆代码的ObscuraX数据集,覆盖七种语言。在此基础上,使用2720亿词的语料训练了规模从255M到2.8B参数的ObscuraCoder模型。实验表明,相较于传统自回归预训练及现有去混淆目标,该方法在语法与语义理解、多语言代码补全、提交摘要生成及面向库的通用代码生成等任务中均取得显著提升。

原文摘要 · Abstract (English)

Language models (LMs) have become a staple of the code-writing toolbox. Their pre-training recipe has, however, remained stagnant over recent years, barring the occasional changes in data sourcing and filtering strategies. In particular, research exploring modifications to Code-LMs' pre-training objectives, geared towards improving data efficiency and better disentangling between syntax and semantics, has been noticeably sparse, especially compared with corresponding efforts in natural language LMs. In this work, we examine grounding on obfuscated code as a means of helping Code-LMs look beyond the surface-form syntax and enhance their pre-training sample efficiency. To this end, we compile ObscuraX, a dataset of approximately 55M source and obfuscated code pairs in seven languages. Subsequently, we pre-train ObscuraCoder models, ranging in size from 255M to 2.8B parameters, on a 272B-token corpus that includes ObscuraX and demonstrate that our obfuscation-based pre-training recipe leads to consistent improvements in Code-LMs' abilities compared to both vanilla autoregressive pre-training as well as existing de-obfuscation (DOBF) objectives. ObscuraCoder demonstrates sizeable gains across multiple tests of syntactic and semantic code understanding, along with improved capabilities in multilingual code completion, multilingual code commit summarization, and multi-purpose library-oriented code generation.

代码生成预训练语义理解多语言

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