paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Diet code is healthy: simplifying programs for pre-trained models of code

Diet code 有益健康:为代码预训练模型简化程序
FSE Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2022匹配度 2/10 · 该论文关注简化输入程序以降低 CodeBERT 的计算成本,属于代码预训练模型的效率优化,而非用户核心方向中的静态分析、Agentic 程序、浮点程序分析或贝叶斯程序分析。虽然涉及 PL 与 AI 的交叉,但更偏向提升代码模型效率,与用户'将静态分析用于 ML/Agent'或'用 LLM 改进静态分析'的问题不匹配。引用 39 inbox
Zhaowei Zhang, Hongyu Zhang, Beijun Shen, Xiaodong Gu
crossref: 2026-09-12

AI 速览

一句话:提出 DietCode,通过简化输入程序使 CodeBERT 在计算成本降低 40% 的同时保持性能相当。

预训练代码表示模型(如 CodeBERT)在多种软件工程任务中表现优异,但其计算复杂度随输入序列长度呈二次增长,难以轻量化部署。本文通过分析 CodeBERT 的注意力分布,发现模型更关注关键词和数据相关语句等特定词元与语句。基于此,作者提出 DietCode,采用词丢弃、频率过滤以及基于注意力的语句/词元选择三种策略来简化输入程序,从而在不损害模型性能的前提下大幅降低计算开销。在两个下游任务上的实验表明,DietCode 在微调和测试阶段减少 40% 计算成本的情况下,取得了与原始 CodeBERT 相当的性能。

问题
预训练代码模型(如 CodeBERT)性能优越,但计算复杂度随输入序列长度呈二次增长,导致微调与推理成本过高。
方法
通过分析 CodeBERT 的注意力分布,发现其更关注关键词和数据相关语句,据此提出 DietCode,利用词丢弃、频率过滤和基于注意力的语句/词元选择三种策略简化输入程序。
评估
在两个下游任务上进行实验,对比 CodeBERT,验证 DietCode 在微调和测试中计算成本降低 40% 的情况下仍能达到相当的性能。
原文摘要(Abstract)

Pre-trained code representation models such as CodeBERT have demonstrated superior performance in a variety of software engineering tasks, yet they are often heavy in complexity, quadratically with the length of the input sequence. Our empirical analysis of CodeBERT's attention reveals that CodeBERT pays more attention to certain types of tokens and statements such as keywords and data-relevant statements. Based on these findings, we propose DietCode, which aims at lightweight leverage of large pre-trained models for source code. DietCode simplifies the input program of CodeBERT with three strategies, namely, word dropout, frequency filtering, and an attention-based strategy that selects statements and tokens that receive the most attention weights during pre-training. Hence, it gives a substantial reduction in the computational cost without hampering the model performance. Experimental results on two downstream tasks show that DietCode provides comparable results to CodeBERT with 40% less computational cost in fine-tuning and testing.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot7082,
  title = {Diet code is healthy: simplifying programs for pre-trained models of code},
  author = {Zhaowei Zhang and Hongyu Zhang and Beijun Shen and Xiaodong Gu},
  booktitle = {FSE},
  year = {2022},
  doi = {10.1145/3540250.3549094}
}