Revisiting Code Search in a Two-Stage Paradigm

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Hu, Fan, Wang, Yanlin, Du, Lun, Li, Xirong, Zhang, Hongyu, Han, Shi, Zhang, Dongmei
Format: Preprint
Publié: 2022
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866913287123238912
author Hu, Fan
Wang, Yanlin
Du, Lun
Li, Xirong
Zhang, Hongyu
Han, Shi
Zhang, Dongmei
author_facet Hu, Fan
Wang, Yanlin
Du, Lun
Li, Xirong
Zhang, Hongyu
Han, Shi
Zhang, Dongmei
contents With a good code search engine, developers can reuse existing code snippets and accelerate software development process. Current code search methods can be divided into two categories: traditional information retrieval (IR) based and deep learning (DL) based approaches. DL-based approaches include the cross-encoder paradigm and the bi-encoder paradigm. However, both approaches have certain limitations. The inference of IR-based and bi-encoder models are fast, however, they are not accurate enough; while cross-encoder models can achieve higher search accuracy but consume more time. In this work, we propose TOSS, a two-stage fusion code search framework that can combine the advantages of different code search methods. TOSS first uses IR-based and bi-encoder models to efficiently recall a small number of top-k code candidates, and then uses fine-grained cross-encoders for finer ranking. Furthermore, we conduct extensive experiments on different code candidate volumes and multiple programming languages to verify the effectiveness of TOSS. We also compare TOSS with six data fusion methods. Experimental results show that TOSS is not only efficient, but also achieves state-of-the-art accuracy with an overall mean reciprocal ranking (MRR) score of 0.763, compared to the best baseline result on the CodeSearchNet benchmark of 0.713. Our source code and experimental data are available at: https://github.com/fly-dragon211/TOSS.
format Preprint
id arxiv_https___arxiv_org_abs_2208_11274
institution arXiv
publishDate 2022
record_format arxiv
spellingShingle Revisiting Code Search in a Two-Stage Paradigm
Hu, Fan
Wang, Yanlin
Du, Lun
Li, Xirong
Zhang, Hongyu
Han, Shi
Zhang, Dongmei
Software Engineering
With a good code search engine, developers can reuse existing code snippets and accelerate software development process. Current code search methods can be divided into two categories: traditional information retrieval (IR) based and deep learning (DL) based approaches. DL-based approaches include the cross-encoder paradigm and the bi-encoder paradigm. However, both approaches have certain limitations. The inference of IR-based and bi-encoder models are fast, however, they are not accurate enough; while cross-encoder models can achieve higher search accuracy but consume more time. In this work, we propose TOSS, a two-stage fusion code search framework that can combine the advantages of different code search methods. TOSS first uses IR-based and bi-encoder models to efficiently recall a small number of top-k code candidates, and then uses fine-grained cross-encoders for finer ranking. Furthermore, we conduct extensive experiments on different code candidate volumes and multiple programming languages to verify the effectiveness of TOSS. We also compare TOSS with six data fusion methods. Experimental results show that TOSS is not only efficient, but also achieves state-of-the-art accuracy with an overall mean reciprocal ranking (MRR) score of 0.763, compared to the best baseline result on the CodeSearchNet benchmark of 0.713. Our source code and experimental data are available at: https://github.com/fly-dragon211/TOSS.
title Revisiting Code Search in a Two-Stage Paradigm
topic Software Engineering
url https://arxiv.org/abs/2208.11274