Cross-Domain Deep Code Search with Meta Learning

Yitian Chai, Hongyu Zhang, Beijun Shen, Xiaodong Gu
1/1/2022
cs.SE

Official code: fewshotcdcs/CDCS (12 stars, Python, last commit 2023-07-05).

Abstract

Recently, pre-trained programming language models such as CodeBERT have demonstrated substantial gains in code search. Despite showing great performance, they rely on the availability of large amounts of parallel data to fine-tune the semantic mappings between queries and code.

Show full abstract

This restricts their practicality in domain-specific languages with relatively scarce and expensive data. In this paper, we propose CroCS, a novel approach for domain-specific code search. CroCS 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 SQL and Solidity. Unlike cross-language CodeBERT, which is directly fine-tuned in the target language, CroCS 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, SQL and Solidity, 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.

View on arXivView PDF

Code Implementations(1)

fewshotcdcs/CDCSOfficial100%

Cross-Domain Deep Code Search with Few-Shot Learning

1210PythonSep 4, 20213 years ago

Similar Papers

Cite this paper

@article{chai2022crossdomain,
  title  = {Cross-Domain Deep Code Search with Meta Learning},
  author = {Yitian Chai and Hongyu Zhang and Beijun Shen and Xiaodong Gu},
  year   = {2022},
  eprint = {2201.00150},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2201.00150}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2201.00150.svg)](https://codeofpaper.com/paper/2201.00150)

Discussion