paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Cross-domain deep code search with meta learning

基于元学习的跨领域深度代码搜索
ICSE Proceedings of the 44th International Conference on Software Engineering2022匹配度 2/10 · 论文聚焦跨领域代码搜索,利用元学习迁移预训练代码模型,属于机器学习与程序语言交叉,但并非静态分析、形式化验证,也不涉及 LLM/Agent 作为工具改进分析,或浮点、贝叶斯程序分析等核心方向。引用 49 inbox
Yitian Chai, Hongyu Zhang, Beijun Shen, Xiaodong Gu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 CDCS,用元学习将通用语言预训练模型迁移到数据稀缺的领域特定语言,实现高效跨领域代码搜索。

预训练编程语言模型如 Code-BERT 在代码搜索上表现优异,但其依赖大量查询-代码平行数据来微调语义映射,导致在 Solidity、SQL 等数据稀缺且昂贵的领域特定语言上实用性受限。本文提出 CDCS,一个面向领域特定语言的代码搜索迁移学习框架:先在大规模通用语言(如 Java、Python)语料上预训练程序表示模型,再通过少样本元学习算法 MAML 学习一组可被目标语言良好复用的模型参数初始化,从而适配到目标领域语言,而非像跨语言 CodeBERT 那样直接在目标语言上微调。作者在 Solidity 和 SQL 两种领域特定语言上、以 Python 和 Java 为源语言进行实验,结果表明 CDCS 显著优于直接在领域特定语言上微调的常规预训练代码模型,且在训练数据稀缺时尤为有效。

问题
领域特定语言(如 Solidity、SQL)的查询-代码平行数据稀缺且昂贵,导致通用预训练代码模型难以直接微调出有效的领域代码搜索模型。
方法
采用迁移学习框架:先在 Java、Python 等通用语言大规模语料上预训练程序表示模型,再用少样本元学习算法 MAML 学习可在目标领域语言中最佳复用的参数初始化,并适配到 Solidity/SQL。
评估
在两个领域特定语言 Solidity 和 SQL 上,分别从 Python 和 Java 迁移模型,与直接在目标语言上微调的常规预训练代码模型进行对比,验证了 CDCS 的显著优势及在数据稀缺场景下的有效性。
原文摘要(Abstract)

Recently, pre-trained programming language models such as Code-BERT have demonstrated substantial gains in code search. Despite their success, they rely on the availability of large amounts of parallel data to fine-tune the semantic mappings between queries and code. This restricts their practicality in domain-specific languages with relatively scarce and expensive data. In this paper, we propose CDCS, a novel approach for domain-specific code search. CDCS employs a transfer learning framework where an initial program representation model is pre-trained on a large corpus of common programming languages (such as Java and Python), and is further adapted to domain-specific languages such as Solidity and SQL. Un-like cross-language CodeBERT, which is directly fine-tuned in the target language, CDCS adapts a few-shot meta-learning algorithm called MAML to learn the good initialization of model parameters, which can be best reused in a domain-specific language. We evaluate the proposed approach on two domain-specific languages, namely Solidity and SQL, with model transferred from two widely used languages (Python and Java). Experimental results show that CDCS significantly outperforms conventional pre-trained code models that are directly fine-tuned in domain-specific languages, and it is particularly effective for scarce data.

链接与引用

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

BibTeX
@inproceedings{ChaiZSG22,
  title = {Cross-domain deep code search with meta learning},
  author = {Yitian Chai and Hongyu Zhang and Beijun Shen and Xiaodong Gu},
  booktitle = {ICSE},
  year = {2022},
  doi = {10.1145/3510003.3510125}
}