mlsanityData to 7 Oct 2026

SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrieval

arXiv 2508.00546 ↗First posted 1 Aug 2025cs.SE cs.AIcited by 5

Not on the map. Why?

Abstract (arXiv)

Code retrieval aims to provide users with desired code snippets based on users' natural language queries. With the development of deep learning technologies, adopting pre-trained models for this task has become mainstream. Considering the retrieval efficiency, most of the previous approaches adopt a dual-encoder for this task, which encodes the description and code snippet into representation vectors, respectively. However, the model structure of the dual-encoder tends to limit the model's performance, since it lacks the interaction between the code snippet and description at the bottom layer of the model during training. To improve the model's effectiveness while preserving its efficiency, we propose a framework, which adopts Self-AdaPtive Model Distillation for Efficient CodE Retrieval, named SPENCER. SPENCER first adopts the dual-encoder to narrow the search space and then adopts the cross-encoder to improve accuracy. To improve the efficiency of SPENCER, we propose a novel model distillation technique, which can greatly reduce the inference time of the dual-encoder while maintaining the overall performance. We also propose a teaching assistant selection strategy for our model distillation, which can adaptively select the suitable teaching assistant models for different pre-trained models during the model distillation to ensure the model performance. Extensive experiments demonstrate that the combination of dual-encoder and cross-encoder improves overall performance compared to solely dual-encoder-based models for code retrieval. Besides, our model distillation technique retains over 98% of the overall performance while reducing the inference time of the dual-encoder by 70%.

Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 46 of its 66 references that are in the map. First posted on arXiv 1 Aug 2025.

Builds on

46 of 66 references.

References · 46

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  2. 2014Adam: A Method for Stochastic Optimizationcited by 36,960
  3. 2015Distilling the Knowledge in a Neural Networkcited by 10,076
  4. 2018Representation Learning with Contrastive Predictive Codingcited by 7,662
  5. 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,482
  6. 2017Billion-scale similarity search with GPUscited by 2,477
  7. 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,168
  8. 2018Unsupervised Feature Learning via Non-Parametric Instance-level Discriminationcited by 1,838
  9. 2014FitNets: Hints for Thin Deep Netscited by 1,619
  10. 2016Enriching Word Vectors with Subword Informationcited by 1,578
  11. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  12. 2020ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERTcited by 1,160
34 more
  1. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  2. 2019Relational Knowledge Distillationcited by 873
  3. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  4. 2017Deep Mutual Learningcited by 621
  5. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  6. 2018Born Again Neural Networkscited by 539
  7. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  8. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  9. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
  10. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
  11. 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
  12. 2019Distilling Task-Specific Knowledge from BERT into Simple Neural Networkscited by 152
  13. 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 87
  14. 2020Densely Guided Knowledge Distillation using Multiple Teacher Assistantscited by 82
  15. 2020Contrastive Code Representation Learningcited by 76
  16. 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
  17. 2018Ranking Distillation: Learning Compact Ranking Models With High Performance for Recommender Systemcited by 60
  18. 2021Online Knowledge Distillation for Efficient Pose Estimationcited by 55
  19. 2020Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformationscited by 49
  20. 2019When Deep Learning Met Code Searchcited by 45
  21. 2022SPT-Code: Sequence-to-Sequence Pre-Training for Learning Source Code Representationscited by 35
  22. 2024REPOFUSE: Repository-Level Code Completion with Fused Dual Contextcited by 32
  23. 2017Neural Models for Information Retrievalcited by 29
  24. 2019CoaCor: Code Annotation for Code Retrieval with Reinforcement Learningcited by 22
  25. 2022CoCoSoDa: Effective Contrastive Learning for Code Searchcited by 21
  26. 2022Compressing Pre-trained Models of Code into 3 MBcited by 21
  27. 2020A Multi-Perspective Architecture for Semantic Code Searchcited by 20
  28. 2024Rewriting the Code: A Simple Method for Large Language Model Augmented Code Searchcited by 17
  29. 2020Neural Code Search Revisited: Enhancing Code Snippet Retrieval through Natural Language Intentcited by 16
  30. 2021GraphSearchNet: Enhancing GNNs via Capturing Global Dependencies for Semantic Code Searchcited by 15
  31. 2020CRaDLe: Deep Code Retrieval Based on Semantic Dependency Learningcited by 12
  32. 2019The Pupil Has Become the Master: Teacher-Student Model-Based Word Embedding Distillation with Ensemble Learningcited by 5
  33. 2024Code Hallucinationcited by 5
  34. 2024"You still have to study" -- On the Security of LLM generated codecited by 3

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 1; 2026: 4.

5 papers.