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

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Garg, Spandan, Moghaddam, Roshanak Zilouchian, Sundaresan, Neel
Formato: Preprint
Publicado: 2023
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866917887369805824
author Garg, Spandan
Moghaddam, Roshanak Zilouchian
Sundaresan, Neel
author_facet Garg, Spandan
Moghaddam, Roshanak Zilouchian
Sundaresan, Neel
contents 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. 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.
format Preprint
id arxiv_https___arxiv_org_abs_2306_17077
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle RAPGen: An Approach for Fixing Code Inefficiencies in Zero-Shot
Garg, Spandan
Moghaddam, Roshanak Zilouchian
Sundaresan, Neel
Software Engineering
Artificial Intelligence
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. 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.
title RAPGen: An Approach for Fixing Code Inefficiencies in Zero-Shot
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2306.17077