Efficient Text-to-Code Retrieval with Cascaded Fast and Slow Transformer Models
Akhilesh Deepak Gotmare, Junnan Li, Shafiq Joty, Steven C. H. Hoi
摘要
The goal of semantic code search or text-to-code search is to retrieve a semantically relevant code snippet from an existing code database using a natural language query. When constructing a practical semantic code search system, existing approaches fail to provide an optimal balance between retrieval speed and the relevance of the retrieved results. We propose an efficient and effective text-to-code search framework with cascaded fast and slow models, in which a fast transformer encoder model is learned to optimize a scalable index for fast retrieval followed by learning a slow classification-based re-ranking model to improve the accuracy of the top K results from the fast retrieval. To further reduce the high memory cost of deploying two separate models in practice, we propose to jointly train the fast and slow model based on a single transformer encoder with shared parameters. Empirically our cascaded method is not only efficient and scalable, but also achieves state-of-the-art results with an average mean reciprocal ranking (MRR) score of 0.7795 (across 6 programming languages) on the CodeSearchNet benchmark as opposed to the prior state-of-the-art result of 0.744 MRR. Our codebase can be found at this link.
问问这篇 Paper
问问你的智能体。
Lune 读过与它相关的顶会 Paper,每个回答都会注明依据哪几篇。
引用它的顶会 Paper1
问问它们各自怎么用它相关 Paper
- Accelerating Code Search with Deep Hashing and Code ClassificationWenchao Gu, Yanlin Wang, Lun Du, Hongyu Zhang 等ACL 2022
- NS3: Neuro-symbolic Semantic Code SearchShushan Arakelyan, Anna Hakhverdyan, Miltiadis Allamanis, Luis Garcia 等NeurIPS 2022 · 被引用 15 次
- Thinking Fast and Slow: Efficient Text-to-Visual Retrieval With TransformersAntoine Miech, Jean-Baptiste Alayrac, Ivan Laptev, Josef Sivic 等CVPR 2021
- XSearch: Explainable Code Search via Concept-to-Code AlignmentYiming Liu, Ruofan Liu, Yun Lin, Zicong Zhang 等ISSTA 2026 · 被引用 1 次
- Compact Token Representations with Contextual Quantization for Efficient Document Re-rankingYingrui Yang, Yifan Qiao, Tao YangACL 2022 · 被引用 8 次
