mlsanityData to 14 Oct 2026

LLM Program Optimization via Retrieval Augmented Search

arXiv 2501.18916 ↗First posted 31 Jan 2025cs.LGcited by 4

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

Abstract (arXiv)

Recent work has demonstrated the potential of large language models (LLMs) for program optimization, a key challenge in programming languages. We propose a blackbox adaptation method called Retrieval Augmented Search (RAS) that performs beam search over candidate optimizations; at each step, it retrieves in-context examples from a given training dataset of slow-fast program pairs to guide the LLM. Critically, we find that performing contextual retrieval based on an LLM-generated natural language description significantly outperforms retrieval based on the source code. We also propose AEGIS, a method for improving interpretability by decomposing training examples into ''atomic edits'' that are significantly more incremental in nature. We show that RAS performs up to 2.06× better than prior state-of-the-art blackbox adaptation strategies on optimizing C++ programs, and that AEGIS performs up to 1.37× better while making significantly smaller edits. We also show that using RAS improves the mean runtime percentile of Python programs by 10.27 compared to baselines.

Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 15 of its 23 references that are in the map. First posted on arXiv 31 Jan 2025.

Builds on

15 of 23 references.

Closest ancestors · 1

Same direction, newest first

  1. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?20 Jun

Other references · 14

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  3. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  5. 2022Competition-Level Code Generation with AlphaCodecited by 1,462
  6. 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 200
  7. 2024MapCoder: Multi-Agent Code Generation for Competitive Problem Solvingcited by 177
  8. 2021Reframing Instructional Prompts to GPTk's Languagecited by 176
  9. 2022Synchromesh: Reliable code generation from pre-trained language modelscited by 156
  10. 2023Learning Performance-Improving Code Editscited by 106
  11. 2024How Efficient is LLM-Generated Code? A Rigorous & High-Standard Benchmarkcited by 43
  12. 2024Search-Based LLMs for Code Optimizationcited by 28
2 more
  1. 2019CoaCor: Code Annotation for Code Retrieval with Reinforcement Learningcited by 22
  2. 2024Finding Missed Code Size Optimizations in Compilers using LLMscited by 5

Built on by

Cited by year (2026 to 14 Oct)

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

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025FasterPy: An LLM-based Code Execution Efficiency Optimization Framework
  2. 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
  3. 2026Overcoming the Weakest-Link Effect in LLM-Driven Program Optimization via Heterogeneous Edit Recombination
  4. 2024Retrieval-augmented code completion for local projects using large language models
  5. 2026Can LLMs Beat Classical Hyperparameter Optimization Algorithms? A Study on autoresearch
  6. 2024Symbolic Prompt Program Search: A Structure-Aware Approach to Efficient Compile-Time Prompt Optimization
  7. 2023CRAFT: Customizing LLMs by Creating and Retrieving from Specialized Toolsets
  8. 2026AdaptEval: A Benchmark for Evaluating Large Language Models on Code Snippet Adaptation