Rewriting the Code: A Simple Method for Large Language Model Augmented Code Search
Not on the map. Why?
Abstract (arXiv)
In code search, the Generation-Augmented Retrieval (GAR) framework, which generates exemplar code snippets to augment queries, has emerged as a promising strategy to address the principal challenge of modality misalignment between code snippets and natural language queries, particularly with the demonstrated code generation capabilities of Large Language Models (LLMs). Nevertheless, our preliminary investigations indicate that the improvements conferred by such an LLM-augmented framework are somewhat constrained. This limitation could potentially be ascribed to the fact that the generated codes, albeit functionally accurate, frequently display a pronounced stylistic deviation from the ground truth code in the codebase. In this paper, we extend the foundational GAR framework and propose a simple yet effective method that additionally Rewrites the Code (ReCo) within the codebase for style normalization. Experimental results demonstrate that ReCo significantly boosts retrieval accuracy across sparse (up to 35.7%), zero-shot dense (up to 27.6%), and fine-tuned dense (up to 23.6%) retrieval settings in diverse search scenarios. To further elucidate the advantages of ReCo and stimulate research in code style normalization, we introduce Code Style Similarity, the first metric tailored to quantify stylistic similarities in code. Notably, our empirical findings reveal the inadequacy of existing metrics in capturing stylistic nuances. The source code and data are available at urlhttps://github.com/Alex-HaochenLi/ReCo.
Key facts. Cited by 17 papers in the map (data through 14 Oct 2026). Builds on 29 of its 49 references that are in the map. First posted on arXiv 9 Jan 2024.
Builds on
29 of 49 references.
References · 29
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2018Representation Learning with Contrastive Predictive Codingcited by 7,777
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2021Unsupervised Dense Information Retrieval with Contrastive Learningcited by 1,216
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2021Measuring Coding Challenge Competence With APPScited by 902
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
17 more
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2022Precise Zero-Shot Dense Retrieval without Relevance Labelscited by 517
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 333
- 2023Large Language Models are Effective Text Rankers with Pairwise Ranking Promptingcited by 307
- 2020Generation-Augmented Retrieval for Open-domain Question Answeringcited by 186
- 2018Learning to Mine Aligned Code and Natural Language Pairs from Stack Overflowcited by 165
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
- 2021CoSQA: 20,000+ Web Queries for Code Search and Question Answeringcited by 75
- 2019When Deep Learning Met Code Searchcited by 46
- 2017Query Expansion Based on Crowd Knowledge for Code Searchcited by 18
- 2023Rethinking Negative Pairs in Code Searchcited by 14
- 2021Multimodal Representation for Neural Code Searchcited by 11
- 2018Revisiting the tree edit distance and its backtracing: A tutorialcited by 8
- 2022Exploring Representation-Level Augmentation for Code Searchcited by 8
- 2022Soft-Labeled Contrastive Pre-training for Function-level Code Representationcited by 7
Built on by
Citing papers per year: 2024: 3; 2025: 10; 2026: 4.
17 papers.
Sort:
By area:
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2025EpiCoder: Encompassing Diversity and Complexity in Code Generationcited by 20
- 2024SRA-MCTS: Self-driven Reasoning Augmentation with Monte Carlo Tree Search for Code Generationcited by 10
- 2025SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrievalcited by 5
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localizationcited by 4
- 2025Function-to-Style Guidance of LLMs for Code Translationcited by 4
- 2025Functional Consistency of LLM Code Embeddings: A Self-Evolving Data Synthesis Framework for Benchmarkingcited by 4
- 2025GiFT: Gibbs Fine-Tuning for Code Generationcited by 3
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgetscited by 3
- 2024Icing on the Cake: Automatic Code Summarization at Ericssoncited by 2
- 2024AddrLLM: Address Rewriting via Large Language Model on Nationwide Logistics Datacited by 2
- 2025Natural Language Summarization Enables Multi-Repository Bug Localization by LLMs in Microservice Architecturescited by 1
5 more
- 2025URECA: The Chain of Two Minimum Set Cover Problems exists behind Adaptation to Shifts in Semantic Code Searchcited by 0
- 2026Do not copy and paste! Rewriting strategies for code retrievalcited by 0
- 2026Recall Before Rerank: Benchmarking Deep Learning Models for Large-Scale Code-to-Code Retrievalcited by 0
- 2026Towards Fully Automated Medical Imaging Code Generation via Validation-based Context Engineeringcited by 0
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Qualitycited by 0
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Quality22 Sep 2026
- 2026Towards Fully Automated Medical Imaging Code Generation via Validation-based Context Engineering29 Aug 2026
- 2026Recall Before Rerank: Benchmarking Deep Learning Models for Large-Scale Code-to-Code Retrieval24 Jun 2026
- 2026Do not copy and paste! Rewriting strategies for code retrieval8 May 2026
- 2025Natural Language Summarization Enables Multi-Repository Bug Localization by LLMs in Microservice Architectures5 Dec 2025
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgets23 Oct 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025Functional Consistency of LLM Code Embeddings: A Self-Evolving Data Synthesis Framework for Benchmarking27 Aug 2025
- 2025SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrieval1 Aug 2025
- 2025Function-to-Style Guidance of LLMs for Code Translation15 Jul 2025
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization25 Jun 2025
- 2025GiFT: Gibbs Fine-Tuning for Code Generation17 Feb 2025
5 more
- 2025URECA: The Chain of Two Minimum Set Cover Problems exists behind Adaptation to Shifts in Semantic Code Search11 Feb 2025
- 2025EpiCoder: Encompassing Diversity and Complexity in Code Generation8 Jan 2025
- 2024AddrLLM: Address Rewriting via Large Language Model on Nationwide Logistics Data17 Nov 2024
- 2024SRA-MCTS: Self-driven Reasoning Augmentation with Monte Carlo Tree Search for Code Generation17 Nov 2024
- 2024Icing on the Cake: Automatic Code Summarization at Ericsson19 Aug 2024
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localizationcited by 4
- 2024AddrLLM: Address Rewriting via Large Language Model on Nationwide Logistics Datacited by 2
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization25 Jun 2025
- 2024AddrLLM: Address Rewriting via Large Language Model on Nationwide Logistics Data17 Nov 2024
- 2025EpiCoder: Encompassing Diversity and Complexity in Code Generationcited by 20
- 2025SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrievalcited by 5
- 2025Function-to-Style Guidance of LLMs for Code Translationcited by 4
- 2025GiFT: Gibbs Fine-Tuning for Code Generationcited by 3
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgetscited by 3
- 2024Icing on the Cake: Automatic Code Summarization at Ericssoncited by 2
- 2025Natural Language Summarization Enables Multi-Repository Bug Localization by LLMs in Microservice Architecturescited by 1
- 2025URECA: The Chain of Two Minimum Set Cover Problems exists behind Adaptation to Shifts in Semantic Code Searchcited by 0
- 2026Do not copy and paste! Rewriting strategies for code retrievalcited by 0
- 2026Recall Before Rerank: Benchmarking Deep Learning Models for Large-Scale Code-to-Code Retrievalcited by 0
- 2026Towards Fully Automated Medical Imaging Code Generation via Validation-based Context Engineeringcited by 0
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Qualitycited by 0
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Quality22 Sep 2026
- 2026Towards Fully Automated Medical Imaging Code Generation via Validation-based Context Engineering29 Aug 2026
- 2026Recall Before Rerank: Benchmarking Deep Learning Models for Large-Scale Code-to-Code Retrieval24 Jun 2026
- 2026Do not copy and paste! Rewriting strategies for code retrieval8 May 2026
- 2025Natural Language Summarization Enables Multi-Repository Bug Localization by LLMs in Microservice Architectures5 Dec 2025
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgets23 Oct 2025
- 2025SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrieval1 Aug 2025
- 2025Function-to-Style Guidance of LLMs for Code Translation15 Jul 2025
- 2025GiFT: Gibbs Fine-Tuning for Code Generation17 Feb 2025
- 2025URECA: The Chain of Two Minimum Set Cover Problems exists behind Adaptation to Shifts in Semantic Code Search11 Feb 2025
- 2025EpiCoder: Encompassing Diversity and Complexity in Code Generation8 Jan 2025
- 2024Icing on the Cake: Automatic Code Summarization at Ericsson19 Aug 2024