Research map / Label-efficient and robust learning / Recognition and long-tail
AdaCCD: Adaptive Semantic Contrasts Discovery Based Cross Lingual Adaptation for Code Clone Detection
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes AdaCCD, a cross-lingual adaptation method that trains CodeBERT/GraphCodeBERT on labeled C/C++ code clones and adapts them to unlabeled languages (Rust, Ruby, JavaScript, Go, C#) via clustering-based contrast discovery, semantic-preserving transformations, and an adaptive preference schedule.
Problem
Code clone detection for low-resource programming languages lacks annotated data, and self-supervised multilingual code representations perform much worse than supervised fine-tuning for clone retrieval.
Approach
Discover semantic positive/negative contrasts in unlabeled target-language code by K-means clustering and top-k neighbor search with a source-trained model, mix these with transformation-based positives (identifier renaming, back-translation via CodeGeeX) using a linearly decaying preference alpha_t, and iterate contrastive training with alternating data splits.
Key results
- On GraphCodeBERT trained on POJ-104, AdaCCD-BT reaches 72.48 average MAP@R over C#, Rust, JavaScript and Go, versus 62.50 for the Whiten baseline and 60.27 for zero-shot transfer (with validation tuning, 74.28 vs. 80.44 for supervised GraphCodeBERT-FT average across five languages).
- AdaCCD-BT on CodeBERT (POJ-104 source) improves average MAP@R from 48.93 zero-shot to 66.38 without target labels.
- Ablation on GCB-BT shows removing adaptive preference lowers Go from 69.74 to 63.77 and removing transformed contrasts lowers C# from 67.28 to 64.53.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| add back translation instead of identifier renaming | AdaCCD · cross-lingual adaptation (CodeBERT and GraphCodeBERT) | MAP@R | Mixed |
| remove adaptive control and use a constant preference (ablation) | CB-IR · C# | MAP@R: 57.74 -> 57.66 | Hurt |
| remove adaptive control and use a constant preference (ablation) | CB-IR · Rust | MAP@R: 56.91 -> 53.11 | Hurt |
| remove adaptive control and use a constant preference (ablation) | CB-BT · C# | MAP@R: 64.37 -> 62.38 | Hurt |
| remove adaptive control and use a constant preference (ablation) | GCB-BT · Rust | MAP@R: 82.35 -> 81.09 | Hurt |
| remove adaptive control and use a constant preference (ablation) | GCB-IR · C# | MAP@R: 64.40 -> 63.42 | Hurt |
| remove adaptive control and use a constant preference (ablation) | GCB-IR · Rust | MAP@R: 73.50 -> 70.37 | Hurt |
| remove adaptive control and use a constant preference (ablation) | GCB-IR · JavaScript | MAP@R: 68.84 -> 67.75 | Hurt |
| remove adaptive control and use a constant preference (ablation) | GCB-IR · Go | MAP@R: 70.13 -> 68.43 | Hurt |
| remove transformed contrasts and train only on discovered contrasts (ablation) | CB-IR · C# | MAP@R: 57.74 -> 56.89 | Hurt |
| remove transformed contrasts and train only on discovered contrasts (ablation) | CB-BT · Rust | MAP@R: 72.86 -> 54.77 | Hurt |
| remove transformed contrasts and train only on discovered contrasts (ablation) | GCB-BT · Rust | MAP@R: 82.35 -> 75.47 | Hurt |
Surprising findings
- Removing transformed contrasts or adaptive control occasionally improves GraphCodeBERT with identifier renaming, which the authors attribute to GraphCodeBERT's def-use pretraining making identifier renaming uninformative.
- Doubling the number of clusters C slightly outperformed the default setting on some languages (e.g., Go 71.80 vs 69.74).
Limitations
- Back translation via CodeGeeX cannot be applied to Ruby because CodeGeeX does not support Ruby translation.
- Requires the number of target-language problems (cluster count) for default setup, and uses validation labels for best reported numbers.
- Evaluated only on a single source-target setup of C/C++ datasets (POJ-104/GCJ) with two encoder backbones.
Experimental setup
Datasets: POJ-104 GCJ CodeNet
Benchmarks: CodeNet-derived clone benchmark (Ruby, C#, Rust, JavaScript, Go)
Metrics: MAP@R NMI
Baselines: Text-embedding-ada-002 ContraCode-FT CodeBERT-FT GraphCodeBERT-FT ZeroTrans Whiten BM25
Builds on: CodeBERT GraphCodeBERT BERT-Whitening InfoNCE
Closest papers by meaning
- Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewriting (AAAI 2025 · similarity 0.86)
- NextCoder: Robust Adaptation of Code LMs to Diverse Code Edits (ICML 2025 · similarity 0.85)
- CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking (ICLR 2025 · similarity 0.85)
- CONSIDER: Commonalities and Specialties Driven Multilingual Code Retrieval Framework (AAAI 2024 · similarity 0.84)
- CodeSync: Synchronizing Large Language Models with Dynamic Code Evolution at Scale (ICML 2025 · similarity 0.84)
- CPRet: A Dataset, Benchmark, and Model for Retrieval in Competitive Programming (NeurIPS 2025 · similarity 0.84)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
