Research map / Label-efficient and robust learning / Recognition and long-tail
CodeRetriever: A Large Scale Contrastive Pre-Training Method for Code Search
Xiaonan Li, Yeyun Gong, Yelong Shen, Xipeng Qiu, Hang Zhang, Bolun Yao, Weizhen Qi, Daxin Jiang, Weizhu Chen, Nan Duan
Fudan University · Microsoft
Read the paperPlace an idea next to itCheck your own paper ↗
AI-extracted. The measured effects below were read by AI from the paper's full text (no summary yet). Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
This paper tried a common change: Add a contrastive loss
add unimodal contrastive loss · Cross-language code search · MRR: 41.6 -> 48.4 Improved
What 1,541 accepted papers report for this change
- 1,463 improved
- 27 no clear effect
- 20 mixed
- 31 hurt
- Beyond Looking Up, Try Looking Around: Harmonizing Global Structure and Local Consistency in Optimal Transport for Short Text Clustering ICML 2026 · add contrastive learning · SearchSnippets · ACC: 56.65 -> 80.12Improved
- SleepLM: Natural-Language Intelligence for Human Sleep ICML 2026 · add contrastive objective to captioning (CoCa vs Cap) · sleep event IoU · IoU: 29.2 -> 27.4Hurt
- LIMSSR: LLM-Driven Sequence-to-Score Reasoning under Training-Time Incomplete Multimodal Observations ICML 2026 · add contrastive loss L_con · FS1000 average · Spearman correlation: 0.759 -> 0.789Improved
See this change in detailMatched by the wording of each paper's own result, read by AI from the full text. Papers report gains more often than failures, so this shows what gets published, not the chance a change works.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| contrastive pre-training (CodeRetriever, in-batch fine-tuning) instead of GraphCodeBERT | GraphCodeBERT · CodeSearch overall | MRR: 71.3 -> 75.3 | Improved |
| use AR2 adversarial hard-negative fine-tuning instead of in-batch negatives | CodeRetriever · CodeSearch overall | MRR: 75.3 -> 77.4 | Improved |
| use AR2 instead of hard negatives | CodeRetriever · CodeSearch overall | MRR: 75.9 -> 77.4 | Improved |
| use AR2 or hard negatives instead of in-batch negatives (ablation) | CodeRetriever · StaQC | MRR: 25.5 -> 24.2 (AR2); 24.6 (hard) | Hurt |
| add unimodal code-code pairs without denoising (ablation) | GraphCodeBERT · CodeSearch Java | MRR: 69.1 -> 68.9 | Hurt |
| add denoised code-code pairs (CrossModel filter) (ablation) | GraphCodeBERT · CodeSearch Java | MRR: 68.9 -> 71.1 | Improved |
| add doc-code bimodal pairs (ablation) | CodeRetriever · CodeSearch Java | MRR: 71.1 -> 72.2 | Improved |
| add comment-code bimodal pairs (ablation) | CodeRetriever · CodeSearch Java | MRR: 72.2 -> 74.0 | Improved |
| add unimodal contrastive loss (ablation) | GraphCodeBERT · Cross-language code search | MRR: 41.6 -> 48.4 | Improved |
| add bimodal loss on top of unimodal (ablation) | CodeRetriever (Luni) · Cross-language code search | MRR: 48.4 -> 53.3 | Improved |
| CodeRetriever pre-training with 500 CoSQA training examples | GraphCodeBERT · CoSQA low-resource | MRR: 43.2 -> 54.7 | Improved |
| CodeRetriever pre-training on code-to-code search | SynCoBERT · POJ-104 | MAP@R: 88.24 -> 88.85 | Improved |
Later papers that compared with this method
2 later accepted papers report CodeRetriever as a baseline in their results tables; 2 of them report a better number on most of the results they share with it.
- Uncertainty-Aware Contrastive Learning with Hard Negative Sampling for Code Search Tasks (AAAI 2025 · better on 1 of 1 shared result)
- Soft-Labeled Contrastive Pre-Training for Function-Level Code Representation (EMNLP 2022 · better on 3 of 3 shared results)
Matched by method name in results tables read by AI. Authors' own tables tend to favour the newer method, and a comparison can be missed when a method is renamed.
Closest papers by meaning
- CODE REPRESENTATION LEARNING AT SCALE (ICLR 2024 · similarity 0.90)
- Uncertainty-Aware Contrastive Learning with Hard Negative Sampling for Code Search Tasks (AAAI 2025 · similarity 0.89)
- Towards A Generalist Code Embedding Model Based On Massive Data Synthesis (NeurIPS 2025 · similarity 0.87)
- CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking (ICLR 2025 · similarity 0.87)
- Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewriting (AAAI 2025 · similarity 0.86)
- CodeMMR: Bridging Natural Language, Code, and Image for Unified Retrieval (CVPR 2026 · similarity 0.86)
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.
