Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Acharya, Manish, Zhang, Yifan, Leach, Kevin, Huang, Yu
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866913668734648320
author Acharya, Manish
Zhang, Yifan
Leach, Kevin
Huang, Yu
author_facet Acharya, Manish
Zhang, Yifan
Leach, Kevin
Huang, Yu
contents Optimizing software performance through automated code refinement offers a promising avenue for enhancing execution speed and efficiency. Despite recent advancements in LLMs, a significant gap remains in their ability to perform in-depth program analysis. This study introduces AUTOPATCH, an in-context learning approach designed to bridge this gap by enabling LLMs to automatically generate optimized code. Inspired by how programmers learn and apply knowledge to optimize software, AUTOPATCH incorporates three key components: (1) an analogy-driven framework to align LLM optimization with human cognitive processes, (2) a unified approach that integrates historical code examples and CFG analysis for context-aware learning, and (3) an automated pipeline for generating optimized code through in-context prompting. Experimental results demonstrate that AUTOPATCH achieves a 7.3% improvement in execution efficiency over GPT-4o across common generated executable code, highlighting its potential to advance automated program runtime optimization.
format Preprint
id arxiv_https___arxiv_org_abs_2501_16692
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation
Acharya, Manish
Zhang, Yifan
Leach, Kevin
Huang, Yu
Software Engineering
Artificial Intelligence
Optimizing software performance through automated code refinement offers a promising avenue for enhancing execution speed and efficiency. Despite recent advancements in LLMs, a significant gap remains in their ability to perform in-depth program analysis. This study introduces AUTOPATCH, an in-context learning approach designed to bridge this gap by enabling LLMs to automatically generate optimized code. Inspired by how programmers learn and apply knowledge to optimize software, AUTOPATCH incorporates three key components: (1) an analogy-driven framework to align LLM optimization with human cognitive processes, (2) a unified approach that integrates historical code examples and CFG analysis for context-aware learning, and (3) an automated pipeline for generating optimized code through in-context prompting. Experimental results demonstrate that AUTOPATCH achieves a 7.3% improvement in execution efficiency over GPT-4o across common generated executable code, highlighting its potential to advance automated program runtime optimization.
title Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2501.16692