A Problem-Oriented Perspective and Anchor Verification for Code Optimization

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Ye, Tong, Ma, Tengfei, Zhang, Xuhong, Yu, Hang, Yin, Jianwei, Wang, Wenhai
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917292892225536
author Ye, Tong
Ma, Tengfei
Zhang, Xuhong
Yu, Hang
Yin, Jianwei
Wang, Wenhai
author_facet Ye, Tong
Ma, Tengfei
Zhang, Xuhong
Yu, Hang
Yin, Jianwei
Wang, Wenhai
contents Large Language Models (LLMs) have shown remarkable capabilities in solving various programming tasks, such as code generation. However, their potential for code optimization, particularly in performance enhancement, remains largely unexplored. This paper investigates the capabilities of LLMs in optimizing code for minimal execution time, addressing a critical gap in current research. The recently proposed code optimization methods construct program optimization pairs based on iterative submissions from the same programmer for the same problem. However, this approach confines LLMs to local performance improvements, neglecting global algorithmic innovation. To overcome this limitation, we adopt a completely different perspective by reconstructing the optimization pairs into a problem-oriented approach. This allows for the integration of various ideas from multiple programmers tackling the same problem. Furthermore, we observe that code optimization presents greater challenges compared to code generation, often accompanied by "optimization tax". Recognizing the inherent trade-offs in correctness and efficiency, we introduce a novel anchor verification framework to mitigate this "optimization tax". Ultimately, the problem oriented perspective combined with the anchor verification framework significantly enhances both the correct optimization ratio and speedup to new levels.
format Preprint
id arxiv_https___arxiv_org_abs_2406_11935
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle A Problem-Oriented Perspective and Anchor Verification for Code Optimization
Ye, Tong
Ma, Tengfei
Zhang, Xuhong
Yu, Hang
Yin, Jianwei
Wang, Wenhai
Programming Languages
Artificial Intelligence
Software Engineering
Large Language Models (LLMs) have shown remarkable capabilities in solving various programming tasks, such as code generation. However, their potential for code optimization, particularly in performance enhancement, remains largely unexplored. This paper investigates the capabilities of LLMs in optimizing code for minimal execution time, addressing a critical gap in current research. The recently proposed code optimization methods construct program optimization pairs based on iterative submissions from the same programmer for the same problem. However, this approach confines LLMs to local performance improvements, neglecting global algorithmic innovation. To overcome this limitation, we adopt a completely different perspective by reconstructing the optimization pairs into a problem-oriented approach. This allows for the integration of various ideas from multiple programmers tackling the same problem. Furthermore, we observe that code optimization presents greater challenges compared to code generation, often accompanied by "optimization tax". Recognizing the inherent trade-offs in correctness and efficiency, we introduce a novel anchor verification framework to mitigate this "optimization tax". Ultimately, the problem oriented perspective combined with the anchor verification framework significantly enhances both the correct optimization ratio and speedup to new levels.
title A Problem-Oriented Perspective and Anchor Verification for Code Optimization
topic Programming Languages
Artificial Intelligence
Software Engineering
url https://arxiv.org/abs/2406.11935