atlas

Research map / Large language models / Retrieval and knowledge

CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking

ICLR 2025 · Large language models › Retrieval and knowledge · approach: Retrieval-augmented reasoning

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.

Builds CoRNStack, a 21M-example contrastive code dataset from The Stack v2 using dual consistency filtering and curriculum softmax hard-negative mining, then trains a 137M code retriever (CodeRankEmbed) and a 7B listwise code reranker (CodeRankLLM) for code retrieval and GitHub function localization.

Problem

Code embedding models trained on noisy, unfiltered (text, code) pairs with few hard negatives underperform on real-world code retrieval such as GitHub issue function localization, and code reranking is largely unexplored.

Approach

Filter heuristically mined docstring-code pairs with dual consistency filtering (top-k plus similarity threshold using a proxy embedding model), mine hard negatives offline with false-negative removal, sample them online via a temperature-annealed softmax curriculum, and distill listwise reranking supervision from a 32B teacher into a 7B code reranker.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Fine-tune Arctic-Embed-M on CoRNStackArctic-Embed-M · CodeSearchNetMRR@1000: 53.4 -> 77.7 (+24.3)Helped
Fine-tune Arctic-Embed-M on CoRNStackArctic-Embed-M · AdvTestMRR@1000: 34.1 -> 57.8 (+23.7)Helped
Fine-tune Arctic-Embed-M on CoRNStackArctic-Embed-M · CoIRnDCG@10: 43.0 -> 59.7 (+16.7)Helped
Fine-tune Qwen-2.5-Coder-7B-Instruct on CoRNStack code listwise dataQwen-2.5-Coder-7B-Instruct · CodeSearchNetMRR@100: 70.2 -> 80.5Helped
Rerank retrieved results with CodeRankLLMCodeRankEmbed · SWE-Bench-LiteFunction localization Top-5: 50.0 -> 67.5Helped
Remove curriculum learning (ablation)CoRNStack retriever training · CodeSearchNetscore: 72.7 -> 72.3Hurt
Remove curriculum learning (ablation)CoRNStack retriever training · AdvTestscore: 50.8 -> 49.4Hurt
Use softmax sampling instead of Top-K selection for hard negatives (ablation)CoRNStack retriever training · CodeSearchNetscore: 71.4 -> 72.3Helped
Use softmax sampling instead of Top-K selection for hard negatives (ablation)CoRNStack retriever training · AdvTestscore: 48.6 -> 49.4Helped
Add hard negatives (ablation)CoRNStack retriever training · CodeSearchNetscore: 63.3 -> 72.7Helped
Add hard negatives (ablation)CoRNStack retriever training · AdvTestscore: 39.2 -> 50.8Helped
Add consistency filtering (ablation)CoRNStack retriever training · CodeSearchNetscore: 56.7 -> 63.3Helped

Surprising findings

Limitations

Experimental setup

Datasets: CoRNStack The Stack v2 CodeSearchNet CosQA SWE-Bench-Lite MS MARCO

Benchmarks: CodeSearchNet AdvTest CoIR SWE-Bench-Lite

Metrics: MRR@1000 nDCG@10 MRR@100 top-k localization accuracy

Baselines: CodeSage CodeT5+ Jina-Code-v2 E5-Mistral OpenAI-Ada-002 Voyage-Code-002 Agentless Qwen-2.5-Coder-7B-Instruct zero-shot

Builds on: Arctic-Embed-M Jina-Code-v2 The Stack v2 contrastors

Closest papers by meaning

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.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy