mlsanityData to 14 Oct 2026

XSearch: Explainable Code Search via Concept-to-Code Alignment

arXiv 2605.16046 ↗First posted 15 May 2026cs.SE cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

Semantic code search has been widely adopted in both academia and industry. These approaches embed natural-language queries and code snippets into a shared embedding space and retrieve results based on vector similarity. Despit strong performance on benchmark datasets, they often suffer from poor explainability and generalization. Retrieved code may appear semantically similar yet miss critical functional requirements of the query, while providing no explanation of why the result was retrieved. Moreover, such failures become more severe under distribution shift, where models struggle to generalize to unseen benchmarks. In this work, we propose XSearch, an intrinsically explainable code search framework. Our key insight is that by relying on global embedding similarity, existing retrievers inherently take an inductive view. They learn statistical patterns rather than truly understanding the query's functional requirements. We address this problem by reformulating code search as a deductive concept alignment problem. XSearch (i) identifies functional concepts in the query and (ii) explicitly aligns them with corresponding code statements. This explain-then-predict design produces inherent concept-level explanations and mitigates shortcut learning that harms out-of-distribution generalization. We train an encoder with explicit concept-alignment objectives and perform retrieval through explicit matching between query concepts and code statements. Experiments show that, trained on CodeSearchNet using GraphCodeBERT (125M parameters), XSearch improves performance on out-of-distribution benchmarks from 0.02 to 0.33 (15x) over eight state-of-the-art retrievers, and consistently outperforms both encoder- and decoder-based baselines with up to 7B parameters. A user study demonstrates that concept-alignment explanations enable users to evaluate retrieved results faster and more accurately.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 62 of its 100 references that are in the map. First posted on arXiv 15 May 2026.

Builds on

62 of 100 references.

References · 62

  1. 2018Representation Learning with Contrastive Predictive Codingcited by 7,777
  2. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  3. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  4. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  5. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  6. 2020MPNet: Masked and Permuted Pre-training for Language Understandingcited by 981
  7. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  8. 2023StarCoder: may the source be with you!cited by 799
  9. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  10. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
  11. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
  12. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 333
38 more
  1. 2020Pretrained Transformers Improve Out-of-Distribution Robustnesscited by 294
  2. 2020Unsupervised Translation of Programming Languagescited by 263
  3. 2023LEVER: Learning to Verify Language-to-Code Generation with Executioncited by 239
  4. 2020A Transformer-based Approach for Source Code Summarizationcited by 133
  5. 2018Tree-to-tree Neural Networks for Program Translationcited by 93
  6. 2018SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilitiescited by 92
  7. 2021Leveraging Automated Unit Tests for Unsupervised Code Translationcited by 82
  8. 2021Break-It-Fix-It: Unsupervised Learning for Program Repaircited by 71
  9. 2022Automated Repair of Programs from Large Language Modelscited by 71
  10. 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
  11. 2022Using Pre-Trained Models to Boost Code Review Automationcited by 63
  12. 2022An Empirical Study of Deep Learning Models for Vulnerability Detectioncited by 46
  13. 2023Enhancing Large Language Models in Coding Through Multi-Perspective Self-Consistencycited by 46
  14. 2022Code Translation with Compiler Representationscited by 42
  15. 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Modelcited by 40
  16. 2024ReGAL: Refactoring Programs to Discover Generalizable Abstractionscited by 36
  17. 2024CodeAgent: Autonomous Communicative Agents for Code Reviewcited by 34
  18. 2022Fault-Aware Neural Code Rankerscited by 33
  19. 2023Distilled GPT for Source Code Summarizationcited by 31
  20. 2024Is Programming by Example solved by LLMs?cited by 27
  21. 2022AUGER: Automatically Generating Review Comments with Pre-training Modelscited by 23
  22. 2020Opportunities and Challenges in Code Search Toolscited by 22
  23. 2022CoCoSoDa: Effective Contrastive Learning for Code Searchcited by 22
  24. 2023Domain Knowledge Matters: Improving Prompts with Fix Templates for Repairing Python Type Errorscited by 22
  25. 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
  26. 2024CodeRosetta: Pushing the Boundaries of Unsupervised Code Translation for Parallel Programmingcited by 19
  27. 2017Query Expansion Based on Crowd Knowledge for Code Searchcited by 18
  28. 2018EXS: Explainable Search Using Local Model Agnostic Interpretabilitycited by 18
  29. 2022Code Search: A Survey of Techniques for Finding Codecited by 18
  30. 2021CommitBERT: Commit Message Generation Using Pre-Trained Programming Language Modelcited by 16
  31. 2023From Commit Message Generation to History-Aware Commit Message Completioncited by 16
  32. 2020Review4Repair: Code Review Aided Automatic Program Repairingcited by 13
  33. 2024MPCODER: Multi-user Personalized Code Generator with Explicit and Implicit Style Representation Learningcited by 12
  34. 2015SWIM: Synthesizing What I Meancited by 10
  35. 2022Accelerating Code Search with Deep Hashing and Code Classificationcited by 10
  36. 2023Program Translation via Code Distillationcited by 10
  37. 2024Automated Commit Message Generation with Large Language Models: An Empirical Study and Beyondcited by 10
  38. 2022Exploring Representation-Level Augmentation for Code Searchcited by 8

50 most cited of 62 All 62 (JSON)

Built on by

Not cited yet.