arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.10716cs.CL
收藏

结构化代码表示实现代码语言模型的数据高效适配

Structured Code Representations Enable Data-Efficient Adaptation of Code Language Models

MIT-IBM Watson AI Lab, IBM Research MIT(MIT-IBM沃森人工智能实验室,IBM研究院MIT)

Mayank Agarwal, Yikang Shen, Bailin Wang, Yoon Kim, Jie Chen

AI总结:

本文提出将程序表示为序列化具体语法树(CST),并在不改变架构的前提下对代码模型进行少量持续预训练与微调,从而在多种代码任务、尤其低数据场景下显著提升性能。

摘要:

当前为代码任务定制的语言模型通常采用自然语言处理中的“先预训练、再微调”范式,将源代码建模为纯文本。然而,这种做法忽视了编程语言固有的明确结构。在本工作中,我们通过利用程序结构对预训练代码模型进行进一步预训练和微调,探索其数据高效适配。具体而言,我们将程序表示为解析树——也称为具体语法树(CST)——并在序列化的 CST 上适配预训练模型。尽管我们所适配的模型此前仅在程序的表面形式上进行过预训练,但我们发现,在不改变模型架构的情况下,在 CST 上进行少量持续预训练和微调,即可在多种代码任务上相较基线方法取得提升。我们还发现,当训练样本有限时,这种提升尤为显著,这证明了即使所用骨干模型未曾在包含结构的信息上进行预训练,将程序结构与纯文本表示相集成仍然有效。

英文摘要:

Current language models tailored for code tasks often adopt the pre-training-then-fine-tuning paradigm from natural language processing, modeling source code as plain text. This approach, however, overlooks the unambiguous structures inherent in programming languages. In this work, we explore data-efficient adaptation of pre-trained code models by further pre-training and fine-tuning them with program structures. Specifically, we represent programs as parse trees -- also known as concrete syntax trees (CSTs) -- and adapt pre-trained models on serialized CSTs. Although the models that we adapt have been pre-trained only on the surface form of programs, we find that a small amount of continual pre-training and fine-tuning on CSTs without changing the model architecture yields improvements over the baseline approach across various code tasks. The improvements are found to be particularly significant when there are limited training examples, demonstrating the effectiveness of integrating program structures with plain-text representation even when working with backbone models that have not been pre-trained with structures.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑