Cascaded Fast and Slow Models for Efficient Semantic Code Search
Not on the map. Why?
Abstract (arXiv)
The goal of natural language semantic code search is to retrieve a semantically relevant code snippet from a fixed set of candidates using a natural language query. Existing approaches are neither effective nor efficient enough towards a practical semantic code search system. In this paper, we propose an efficient and accurate semantic 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 performance 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. The proposed cascaded approach 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) as opposed to the previous state-of-the-art result of 0.713 MRR on the CodeSearchNet benchmark.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 20 of its 24 references that are in the map. First posted on arXiv 15 Oct 2021.
Builds on
20 of 24 references.
References · 20
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 12,049
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2021Align before Fuse: Vision and Language Representation Learning with Momentum Distillationcited by 1,619
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021Frozen in Time: A Joint Video and Image Encoder for End-to-End Retrievalcited by 1,177
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
8 more
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2021Unified Pre-training for Program Understanding and Generationcited by 366
- 2020IntelliCode Compose: Code Generation Using Transformercited by 227
- 2021Thinking Fast and Slow: Efficient Text-to-Visual Retrieval with Transformerscited by 93
- 2021CoSQA: 20,000+ Web Queries for Code Search and Question Answeringcited by 75
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2019When Deep Learning Met Code Searchcited by 46
- 2021In-IDE Code Generation from Natural Language: Promise and Challengescited by 42
Built on by
Citing papers per year: 2023: 3; 2024: 0; 2025: 0; 2026: 1.
4 papers.
- 2023CrossCodeBench: Benchmarking Cross-Task Generalization of Source Code Modelscited by 16
- 2023CCT-Code: Cross-Consistency Training for Multilingual Clone Detection and Code Searchcited by 4
- 2023Searching by Code: a New SearchBySnippet Dataset and SnippeR Retrieval Model for Searching by Code Snippetscited by 1
- 2026SynH-Rank: Quality-Aware Code Search via Diverse Data Synthesis and Hierarchical Ranking Trainingcited by 0
- 2026SynH-Rank: Quality-Aware Code Search via Diverse Data Synthesis and Hierarchical Ranking Training19 Jul 2026
- 2023CCT-Code: Cross-Consistency Training for Multilingual Clone Detection and Code Search19 May 2023
- 2023Searching by Code: a New SearchBySnippet Dataset and SnippeR Retrieval Model for Searching by Code Snippets19 May 2023
- 2023CrossCodeBench: Benchmarking Cross-Task Generalization of Source Code Models8 Feb 2023