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

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Suresh, Tarun, Reddy, Revanth Gangi, Xu, Yifei, Nussbaum, Zach, Mulyar, Andriy, Duderstadt, Brandon, Ji, Heng
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866916641938341888
author Suresh, Tarun
Reddy, Revanth Gangi
Xu, Yifei
Nussbaum, Zach
Mulyar, Andriy
Duderstadt, Brandon
Ji, Heng
author_facet Suresh, Tarun
Reddy, Revanth Gangi
Xu, Yifei
Nussbaum, Zach
Mulyar, Andriy
Duderstadt, Brandon
Ji, Heng
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2412_01007
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking
Suresh, Tarun
Reddy, Revanth Gangi
Xu, Yifei
Nussbaum, Zach
Mulyar, Andriy
Duderstadt, Brandon
Ji, Heng
Computation and Language
Information Retrieval
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.
title CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking
topic Computation and Language
Information Retrieval
url https://arxiv.org/abs/2412.01007