English

Addressing Leakage in Self-Supervised Contextualized Code Retrieval

Software Engineering 2022-04-26 v1 Information Retrieval Machine Learning

Abstract

We address contextualized code retrieval, the search for code snippets helpful to fill gaps in a partial input program. Our approach facilitates a large-scale self-supervised contrastive training by splitting source code randomly into contexts and targets. To combat leakage between the two, we suggest a novel approach based on mutual identifier masking, dedentation, and the selection of syntax-aligned targets. Our second contribution is a new dataset for direct evaluation of contextualized code retrieval, based on a dataset of manually aligned subpassages of code clones. Our experiments demonstrate that our approach improves retrieval substantially, and yields new state-of-the-art results for code clone and defect detection.

Keywords

Cite

@article{arxiv.2204.11594,
  title  = {Addressing Leakage in Self-Supervised Contextualized Code Retrieval},
  author = {Johannes Villmow and Viola Campos and Adrian Ulges and Ulrich Schwanecke},
  journal= {arXiv preprint arXiv:2204.11594},
  year   = {2022}
}

Comments

4 pages, 5 figures

R2 v1 2026-06-24T10:57:40.834Z