通过上下文感知的检索增强生成优化代码运行时性能
Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation
AI总结:
针对LLM在深度程序分析上的不足,本研究提出AUTOPATCH方法,结合类比驱动框架、CFG分析与历史代码示例的上下文感知学习,自动生成优化代码,在常见可执行代码上比GPT-4o实现7.3%的执行效率提升。
摘要:
通过自动化代码优化来提升软件性能,为增强执行速度和效率提供了一条有前景的途径。尽管 LLMs 最近取得了进展,但在进行深入的程序分析方面仍存在显著差距。本研究引入了 AUTOPATCH,这是一种上下文学习方法,旨在通过使 LLMs 自动生成优化代码来弥合这一差距。受程序员学习和应用知识来优化软件的启发,AUTOPATCH 包含三个关键组件:(1) 一个类比驱动的框架,将 LLM 优化与人类认知过程对齐;(2) 一种统一方法,整合历史代码示例和 CFG 分析以实现上下文感知学习;(3) 一个通过上下文提示生成优化代码的自动化流水线。实验结果表明,AUTOPATCH 在常见的可执行代码上,比 GPT-4o 实现了 7.3% 的执行效率提升,突显了其推进自动化程序运行时优化的潜力。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。