mlsanityData to 7 Oct 2026

PERC: Plan-As-Query Example Retrieval for Underrepresented Code Generation

arXiv 2412.12447 ↗First posted 17 Dec 2024cs.SE cs.AI cs.CLcited by 2

On the map: Retrieval-augmented generation → RAG for code

Abstract (arXiv)

Code generation with large language models has shown significant promise, especially when employing retrieval-augmented generation (RAG) with few-shot examples. However, selecting effective examples that enhance generation quality remains a challenging task, particularly when the target programming language (PL) is underrepresented. In this study, we present two key findings: (1) retrieving examples whose presented algorithmic plans can be referenced for generating the desired behavior significantly improves generation accuracy, and (2) converting code into pseudocode effectively captures such algorithmic plans, enhancing retrieval quality even when the source and the target PLs are different. Based on these findings, we propose Plan-as-query Example Retrieval for few-shot prompting in Code generation (PERC), a novel framework that utilizes algorithmic plans to identify and retrieve effective examples. We validate the effectiveness of PERC through extensive experiments on the CodeContests, HumanEval and MultiPL-E benchmarks: PERC consistently outperforms the state-of-the-art RAG methods in code generation, both when the source and target programming languages match or differ, highlighting its adaptability and robustness in diverse coding environments.

Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 7 of its 11 references that are in the map. First posted on arXiv 17 Dec 2024.

Builds on

7 of 11 references.

Closest ancestors · 2

Same direction, newest first

  1. 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
  2. 2021Retrieval Augmented Code Generation and Summarization26 Aug

Other references · 5

  1. 2021Program Synthesis with Large Language Modelscited by 3,509
  2. 2020MPNet: Masked and Permuted Pre-training for Language Understandingcited by 973
  3. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
  4. 2023Skill-Based Few-Shot Selection for In-Context Learningcited by 46
  5. 2024UniCoder: Scaling Code Large Language Model via Universal Codecited by 18

Built on by

Cited by year

Citing papers per year: 2025: 2.

2 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
  2. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?
  3. 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
  4. 2024Evaluating the Effectiveness and Efficiency of Demonstration Retrievers in RAG for Coding Tasks
  5. 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation
  6. 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
  7. 2025What Makes In-Context Examples Effective for Code Generation? ↗
  8. 2025CODEPROMPTZIP: Code-specific Prompt Compression for Retrieval-Augmented Generation in Coding Tasks with LMs