REVIEW 3 major objections 5 minor 5 cited by
CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking
T0 review · 3 major / 5 minor · reviewed 2026-08-12 · deepseek-v4-flash
Pith's one-line read The paper claims that a carefully filtered contrastive dataset of text-code pairs, not bigger model capacity, is what makes code retrieval and reranking work.
desk verdict CoRNStack is a solid, artifact-heavy contribution to code retrieval; the main open question is semantic leakage from The Stack into the benchmarks, which the authors themselves flag. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The load-bearing mechanism is a three-stage data pipeline. First, dual consistency filtering: using a proxy embedding model over the whole corpus, a (text, code) pair is kept only if the code ranks in the top two most similar snippets for its text and the similarity exceeds 0.7. Second, hard-negative mining: negatives are drawn from a precomputed similarity matrix with softmax-based sampling, and false negatives are removed by a relative threshold; a curriculum anneals the sampling temperature from 0.05 to 0.001 so that negatives get progressively harder. Third, contrastive training with InfoNCE loss for the retriever, and listwise training where a larger teacher LLM orders the positive and top negatives for a 7B student reranker. The same curated triplets carry both training stages, so the mechanism is one dataset reused for retriever and reranker rather than two separate annotation efforts.
What would settle it
Look for near-duplicate training pairs: embed every training query and code snippet, embed every evaluation query and code snippet, then remove any training pair whose cosine similarity to an evaluation example exceeds a chosen threshold and retrain the retriever from scratch. If the benchmark scores fall back toward the baselines, the claim that curation quality drives the gains is falsified; if they hold, the quality explanation is supported.
Extended reading notes
Core claim
CoRNStack is the discovery: a large-scale contrastive dataset for code where each <query, positive, negatives> triple has been cleaned by dual consistency filtering and augmented with curriculum-mined hard negatives. The paper's experiments claim that training a 137M bi-encoder on this data reaches MRR@1000 77.9 average on CodeSearchNet and 59.5 on AdvTest, surpassing a 1.3B-parameter prior model at 71.2 and 52.7, despite zero-shot evaluation; on CoIR it reaches nDCG@10 60.1. The same dataset yields a listwise reranker that improves MRR@100 from 77.7 to 80.5 on CodeSearchNet and from 56.9 to 69.1 on AdvTest, and the combined retriever-plus-reranker improves function-level localization Top-5 from 50.0% to 67.5% on the retained 274 SWE-Bench-Lite examples. The mechanism is dataset quality: an LLM judge rates CoRNStack pairs 77.1% correct versus 52.9% for the unfiltered source, and ablations show that removing consistency filtering or hard negatives causes a large drop in performance.
Load-bearing premise
The argument stands on the assumption that removing exact string matches keeps evaluation samples out of the training set; if semantic near-duplicates linger, the performance gains could be leakage rather than dataset quality.
Editorial extensions
If this is right
- A 137M-parameter retriever trained only on text-to-code pairs surpasses prior models up to ten times larger on standard text-to-code retrieval benchmarks in zero-shot evaluation.
- Training a 7B-parameter listwise reranker on the same curated triples improves ranking over the retriever's output on both benchmark sets.
- Combining retriever and reranker lifts function localization on a real-world GitHub-issue benchmark from 50.0% to 67.5% at Top-5 on the retained 274 examples.
- Existing text encoders can be fine-tuned on the dataset to become competitive code retrievers, so supervised text-ranking pretraining appears to transfer to code.
Reading between the lines
- If the gains are real rather than leakage, the same curation recipe should transfer to private or enterprise codebases, where large language models have not memorized the code during pretraining; this is a natural extension the paper leaves untested.
- The paper's limitation note concedes that exact-match removal may leave semantic near-duplicates; an immediate test is to re-run training after similarity-based deduplication against the evaluation corpora.
- A testable extension of the reranker result is to wire retriever-plus-reranker into a full repair loop rather than stopping at localization, and to see whether localization gains translate into resolved issues.
- Since the data converts text-pretrained encoders into strong code retrievers, the same contrastive recipe could be applied to other structured domains with abundant weakly paired text and objects, such as tables or diagrams.
Signed reviews
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper introduces CoRNStack, a large-scale (21M pairs) contrastive dataset for code retrieval, built from The Stack v2. Pairs are filtered by a dual consistency criterion using a pretrained embedding model (Jina-Code-v2) and enriched with hard negatives mined via softmax sampling with curriculum temperature decay. The authors finetune a 137M bi-encoder (from Arctic-Embed-M) on this data and a 7B listwise reranker (from Qwen-2.5-Coder) using teacher-ranked examples from Qwen-2.5-32B. They report state-of-the-art results on CodeSearchNet, AdvTest, and CoIR, and improved function localization on 274 SWE-Bench-Lite instances, with the retriever outperforming CodeSage-Large (1.3B) and CodeT5+ despite being smaller.
Significance. The claimed contribution is a public dataset, models, and evidence that data curation by consistency filtering and hard-negative mining can produce a compact retriever that beats much larger models, plus the first LLM-based listwise code reranker that improves function localization. If the results hold, this is a valuable practical contribution for code retrieval and repository-level localization, and the released artifacts (dataset, code, models) are a strength that supports reproducibility. The ablations isolate the benefit of each component, which is useful. However, the central claim that the gains stem from dataset quality is at risk because CoRNStack is derived from the same upstream GitHub corpus as the evaluation benchmarks, and the paper's own Limitations section concedes that only exact-match filtering was used; semantic near-duplicates may remain. This makes the 'state-of-the-art' claims provisional until contamination is quantified or ruled out.
major comments (3)
- [Limitations] The paper explicitly states that 'Heuristic filtering in CoRNStack removed exact matches with evaluation datasets, but additional semantic filtering is needed to catch similar queries and code.' Since CoRNStack is built from The Stack v2, the same broad GitHub source underlying CodeSearchNet, AdvTest, and the SWE-Bench-Lite repositories, the zero-shot gains in Table 3 (e.g., CSN 77.9 vs. 74.2 for CodeT5+) and the function-localization improvements in Table 6 could be inflated by semantic near-duplicates between training pairs and test items. This is load-bearing for the central claim that dataset quality, rather than architecture or scale, drives performance. Please quantify the residual overlap (e.g., by computing embedding-based similarity between training instances and evaluation queries/code), and ideally retrain or re-evaluate with near-duplicate training pairs removed to show the gains persist.
- [2.2] The dual consistency filter uses Jina-Code-v2 to select pairs that are top-k and above a similarity threshold. This procedure may preferentially retain popular, well-documented functions that also dominate the evaluation benchmarks. The paper should analyze the distribution of the retained pairs (e.g., by repository, star count, or function popularity) and examine whether the measured gains concentrate on functions from repositories that overlap with the test sets. Without such an analysis, the dataset-quality interpretation of the ablation results in Table 4 remains ambiguous.
- [4.3] The function-localization experiment compares against a single run of Agentless using released logs. The paper hypothesizes that GPT-4o may have memorized the SWE-Bench-Lite codebases, but the same concern applies to the proposed retriever and reranker, given that CoRNStack is derived from The Stack v2 and the evaluation repositories are public. Please report results on a subset of SWE-Bench-Lite repositories that are verified absent from the training data (or from The Stack v2), or otherwise control for training/evaluation overlap, before claiming that the framework 'significantly improves' localization in real-world settings.
minor comments (5)
- [Table 3] The header 'CodeSeachNet' is a typo for 'CodeSearchNet'.
- [3.1 (Eq. 1)] In Equation (1), the negative set H_B ∪ H is not well-defined; for a given query, the positive h_i^+ should be excluded from H. Please clarify the notation to avoid the impression that the current positive is treated as a negative.
- [3] The first paragraph of Section 3 contains 'CONTRA STACK', which should be 'CoRNStack'; the paper also alternates inconsistently between 'CoRNStack' and 'CORNS TACK'.
- [4.2.1] The sentence 'Although the code LLM (Qwen-2.5-Text) performs worse in a zero-shot setting' appears to refer to Qwen-2.5-Code; please correct the model name.
- [1] The claim 'We are the first to finetune LLMs as code rerankers' is strong; please either provide a reference to prior code-reranking work or soften the claim.
Circularity Check
No significant circularity: the paper's claims are empirical benchmark results from training on a released dataset; no derivation step reduces to its own inputs.
full rationale
The central claims are empirical: training retrievers and rerankers on CoRNStack and measuring zero-shot performance on CodeSearchNet, AdvTest, CoIR, and SWE-Bench-Lite. No equation in the paper defines a predicted quantity in terms of the benchmark target. The dual consistency filter (Section 2.2) selects training pairs by similarity under the external Jina-Code-v2 model with k=2 and delta=0.7; this is a data-curation choice, not a fitted parameter renamed as a prediction. The LLM-judged correctness table (Table 2) is an auxiliary quality probe, not the claimed state-of-the-art result. The reranker (Section 3.2) is trained with teacher rankings from Qwen-2.5-32B-Instruct and evaluated on separate benchmarks; the teacher/student comparison in Appendix A.6 is a measurement, not an identity. Self-citations (contrastors package, FIRST listwise reranking) are implementation and related-work references and are not load-bearing. The Limitations section explicitly acknowledges that only exact-match overlap was removed; this is a potential data-leakage and validity threat, but it is not a circularity in the derivation chain. No circular steps are identified.
Assumptions & free parameters
free parameters (7)
- similarity threshold delta =
0.7
- top-k rank cutoff =
2
- false-negative filter ratio gamma =
0.95
- softmax temperature tau_prime =
linearly decayed from 0.05 to 0.001
- contrastive temperature tau =
0.07
- number of hard negatives per query M =
15
- reranker training set size =
50k triples augmented to 250k instances
assumptions (6)
- domain assumption Jina-Code-v2 embeddings capture semantic relevance between code and docstrings accurately enough to filter positives.
- domain assumption Qwen2.5-Coder-7B-Instruct's LLM judgment of (text, code) correctness is a valid proxy for human correctness.
- domain assumption Qwen2.5-32B-Instruct teacher ordering is reliable enough to supervise listwise reranker training.
- ad hoc to paper The Stack v2 dedup is an appropriate source and exact-match removal suffices to prevent evaluation contamination.
- domain assumption Tree-sitter parseability guarantees syntactic correctness of retained code.
- domain assumption Standard evaluation benchmarks (CSN, AdvTest, CoIR, SWE-Bench-Lite) measure the code retrieval capabilities claimed.
Cite this review
Pith. "Pith review of CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking." pith.science (2026). https://pith.science/paper/LJSRK6U4
@misc{pith2026241201007,
author = {Pith},
title = {Pith review of: CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking},
year = {2026},
howpublished = {\url{https://pith.science/paper/LJSRK6U4}},
note = {Machine review of arXiv:2412.01007}
}
read the original abstract
Effective code retrieval plays a crucial role in advancing code generation, bug fixing, and software maintenance, particularly as software systems increase in complexity. While current code embedding models have demonstrated promise in retrieving code snippets for small-scale, well-defined tasks, they often underperform in more demanding real-world applications such as bug localization within GitHub repositories. We hypothesize that a key issue is their reliance on noisy and inconsistent datasets for training, which impedes their ability to generalize to more complex retrieval scenarios. To address these limitations, we introduce CoRNStack, a large-scale, high-quality contrastive training dataset for code that spans multiple programming languages. This dataset is curated using consistency filtering to eliminate noisy positives and is further enriched with mined hard negatives, thereby facilitating more effective learning. We demonstrate that contrastive training of embedding models using CoRNStack leads to state-of-the-art performance across a variety of code retrieval tasks. Furthermore, the dataset can be leveraged for training code reranking models, a largely underexplored area compared to text reranking. Our finetuned code reranking model significantly improves the ranking quality over the retrieved results. Finally, by employing our code retriever and reranker together, we demonstrate significant improvements in function localization for GitHub issues, an important component of real-world software development.
Figures
Forward citations
Cited by 5 Pith papers
-
IssueExec: A Test-Driven Approach for Localizing Software Engineering Issues
IssueExec localizes issue-relevant code by retrieving related tests and following their execution traces, beating prior localization methods on SWE-bench Lite.
-
jina-embeddings-v4: Universal Embeddings for Multimodal Multilingual Retrieval
jina-embeddings-v4 is a multimodal embedding model built on Qwen2.5-VL with LoRA adapters and dual single/multi-vector outputs, and it introduces the Jina-VDR benchmark for visually rich retrieval.
-
FreshStack: Building Realistic Benchmarks for Evaluating Retrieval on Technical Documents
A framework that builds realistic, refreshable IR and RAG benchmarks on niche technical topics, with five datasets and large measured headroom for retrieval models.
-
CRANE: Reasoning with constrained LLM generation
CRANE switches between unconstrained and constrained LLM decoding, increasing functional accuracy on GSM-symbolic and FOLIO while keeping outputs syntactically valid.
-
CodeXEmbed: A Generalist Embedding Model Family for Multiligual and Multi-task Code Retrieval
A family of code embedding models (400M to 7B) trained with multi-stage LoRA achieves top CoIR scores and competitive BEIR text scores, improving code RAG.
Reference graph
Works this paper leans on
-
[4]
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick
URL https://arxiv.org/abs/2009.08366. Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9729–9738,
arXiv 2009
-
[5]
Binyuan Hui, Jian Yang, Zeyu Cui, Jiaxi Yang, Dayiheng Liu, Lei Zhang, Tianyu Liu, Jiajun Zhang, Bowen Yu, Kai Dang, et al. Qwen2. 5-coder technical report. arXiv preprint arXiv:2409.12186,
-
[6]
Codesearchnet challenge: Evaluating the state of semantic code search
Hamel Husain, Ho-Hsiang Wu, Tiferet Gazit, Miltiadis Allamanis, and Marc Brockschmidt. Codesearchnet challenge: Evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436,
arXiv 1909
-
[8]
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, and Nan Duan. Coderetriever: A large scale contrastive pre-training method for code search. In Proceedings of the 2022 Conference on Empirical Methods in Natural Lan- guage Processing, pp. 2898–2910, 2022a. 11 Published as a conference paper at IC...
arXiv 2022
-
[10]
Arctic-embed: Scalable, efficient, and accurate text embedding models
Luke Merrick, Danmei Xu, Gaurav Nuti, and Daniel Campos. Arctic-embed: Scalable, efficient, and accurate text embedding models. arXiv preprint arXiv:2405.05374,
-
[11]
Nv-retriever: Improving text embedding models with effective hard-negative mining
Gabriel de Souza P Moreira, Radek Osmulski, Mengyao Xu, Ronay Ak, Benedikt Schifferer, and Even Oldridge. Nv-retriever: Improving text embedding models with effective hard-negative mining. arXiv preprint arXiv:2407.15831,
-
[15]
First: Faster improved listwise reranking with single token decoding
Revanth Gangi Reddy, JaeHyeok Doo, Yifei Xu, Md Arafat Sultan, Deevya Swain, Avirup Sil, and Heng Ji. First: Faster improved listwise reranking with single token decoding. arXiv preprint arXiv:2406.15657,
-
[16]
Sentence-BERT: Sentence embeddings using Siamese BERT- networks
Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese BERT- networks. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan (eds.), Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th In- ternational Joint Conference on Natural Language Processing (EMNLP-IJCNLP) , pp. 3982– 3992...
work page 2019
Show all 24 references
-
[17]
doi: 10.18653/v1/D19-1410
Association for Computational Linguistics. doi: 10.18653/v1/D19-1410. URL https://aclanthology.org/D19-1410. Weiwei Sun, Lingyong Yan, Xinyu Ma, Shuaiqiang Wang, Pengjie Ren, Zhumin Chen, Dawei Yin, and Zhaochun Ren. Is chatgpt good at search? investigating large language mode...
-
[18]
Is the watermarking of llm-generated code robust?,
12 Published as a conference paper at ICLR 2025 Tarun Suresh, Shubham Ugare, Gagandeep Singh, and Sasa Misailovic. Is the watermarking of llm-generated code robust?,
2025
-
[19]
James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal
URL https://arxiv.org/abs/2403.17983. James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. FEVER: a large- scale dataset for fact extraction and VERification. In NAACL-HLT,
-
[20]
Itergen: Iterative structured llm generation, 2024a
Shubham Ugare, Rohan Gumaste, Tarun Suresh, Gagandeep Singh, and Sasa Misailovic. Itergen: Iterative structured llm generation, 2024a. URL https://arxiv.org/abs/2410.07295. Shubham Ugare, Tarun Suresh, Hangoo Kang, Sasa Misailovic, and Gagandeep Singh. Syn- code: Llm generatio...
-
[21]
Improv- ing text embeddings with large language models
Liang Wang, Nan Yang, Xiaolong Huang, Linjun Yang, Rangan Majumder, and Furu Wei. Improv- ing text embeddings with large language models. arXiv preprint arXiv:2401.00368, 2023a. Liang Wang, Nan Yang, Xiaolong Huang, Linjun Yang, Rangan Majumder, and Furu Wei. Im- proving text ...
-
[22]
Qwen2 technical report
An Yang, Baosong Yang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Zhou, Chengpeng Li, Chengyuan Li, Dayiheng Liu, Fei Huang, Guanting Dong, Haoran Wei, Huan Lin, Jialong Tang, Jialin Wang, Jian Yang, Jianhong Tu, Jianwei Zhang, Jianxin Ma, Jin Xu, Jingren Zhou, Jinze Bai, Jinzheng...
-
[23]
Hotpotqa: A dataset for diverse, explainable multi-hop question answering
Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D Manning. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Proces...
2018
-
[24]
Beyond yes and no: Improving zero-shot llm rankers via scoring fine-grained relevance labels
Honglei Zhuang, Zhen Qin, Kai Hui, Junru Wu, Le Yan, Xuanhui Wang, and Michael Berdersky. Beyond yes and no: Improving zero-shot llm rankers via scoring fine-grained relevance labels. arXiv preprint arXiv:2310.14122, 2023a. 13 Published as a conference paper at ICLR 2025 Hongl...
2024 arXiv
-
[2016]
Codegen: An open large language model for code with multi-turn program synthesis
Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. Codegen: An open large language model for code with multi-turn program synthesis. In The Eleventh International Conference on Learning Representations. Rodrigo Nogueira...
2020
-
[2018]
Rankzephyr: Effective and robust zero- shot listwise reranking is a breeze! arXiv preprint arXiv:2312.02724,
Ronak Pradeep, Sahel Sharifymoghaddam, and Jimmy Lin. Rankzephyr: Effective and robust zero- shot listwise reranking is a breeze! arXiv preprint arXiv:2312.02724,
-
[2019]
Coir: A comprehensive benchmark for code information retrieval models
Xiangyang Li, Kuicai Dong, Yi Quan Lee, Wei Xia, Yichun Yin, Hao Zhang, Yong Liu, Yasheng Wang, and Ruiming Tang. Coir: A comprehensive benchmark for code information retrieval models. arXiv preprint arXiv:2407.02883,
-
[2021]
Llm-enhanced reranking in recommender systems
Jingtong Gao, Bo Chen, Xiangyu Zhao, Weiwen Liu, Xiangyang Li, Yichao Wang, Zijian Zhang, Wanyu Wang, Yuyang Ye, Shanru Lin, et al. Llm-enhanced reranking in recommender systems. arXiv preprint arXiv:2406.12433,
-
[2022]
Starcoder 2 and the stack v2: The next generation
Anton Lozhkov, Raymond Li, Loubna Ben Allal, Federico Cassano, Joel Lamy-Poirier, Nouamane Tazi, Ao Tang, Dmytro Pykhtar, Jiawei Liu, Yuxiang Wei, et al. Starcoder 2 and the stack v2: The next generation. arXiv preprint arXiv:2402.19173,
-
[2023]
Large language models are effective text rankers with pairwise ranking prompting
Zhen Qin, Rolf Jagerman, Kai Hui, Honglei Zhuang, Junru Wu, Jiaming Shen, Tianqi Liu, Jialu Liu, Donald Metzler, Xuanhui Wang, et al. Large language models are effective text rankers with pairwise ranking prompting. arXiv preprint arXiv:2306.17563,
-
[2024]
Jina embeddings: A novel set of high-performance sentence embedding models
Michael G¨unther, Georgios Mastrapas, Bo Wang, Han Xiao, and Jonathan Geuter. Jina embeddings: A novel set of high-performance sentence embedding models. InProceedings of the 3rd Workshop for Natural Language Processing Open Source Software (NLP-OSS 2023), pp. 8–18,
2023
-
[2025]
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde De Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al
URL https://arxiv.org/abs/ 2502.09061. Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde De Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374,
Reviewed August 12, 2026 · model on record in the stance chip above.
Discussion (0). Continue with ORCID to comment.