RAPGen: An Approach for Fixing Code Inefficiencies in Zero-Shot

Spandan Garg, Roshanak Zilouchian Moghaddam, Neel Sundaresan
6/29/2023
cs.SEcs.AI

No confident code implementation found for this paper.

Abstract

Performance bugs are non-functional bugs that can even manifest in well-tested commercial products. Fixing these performance bugs is an important yet challenging problem.

Show full abstract

In this work, we address this challenge and present a new approach called Retrieval-Augmented Prompt Generation (RAPGen). Given a code snippet with a performance issue, RAPGen first retrieves a prompt instruction from a pre-constructed knowledge-base of previous performance bug fixes and then generates a prompt using the retrieved instruction. It then uses this prompt on a Large Language Model (such as Codex) in zero-shot to generate a fix. We compare our approach with the various prompt variations and state of the art methods in the task of performance bug fixing. Our evaluation shows that RAPGen can generate performance improvement suggestions equivalent or better than a developer in ~60% of the cases, getting ~42% of them verbatim, in an expert-verified dataset of past performance changes made by C# developers.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{garg2023rapgen,
  title  = {RAPGen: An Approach for Fixing Code Inefficiencies in Zero-Shot},
  author = {Spandan Garg and Roshanak Zilouchian Moghaddam and Neel Sundaresan},
  year   = {2023},
  eprint = {2306.17077},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2306.17077v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2306.17077.svg)](https://codeofpaper.com/paper/2306.17077)

Discussion