Rethinking Code Refinement: Learning to Judge Code Efficiency

Minju Seo, Jinheon Baek, Sung Ju Hwang


Abstract
Large Language Models (LLMs) have demonstrated impressive capabilities in understanding and generating codes. Due to these capabilities, many recent methods are proposed to automatically refine the codes with LLMs. However, we should rethink that the refined codes (from LLMs and even humans) are not always more efficient than their original versions. On the other hand, running two different versions of codes and comparing them every time is not ideal and time-consuming. Therefore, in this work, we propose a novel method based on the code language model that is trained to judge the efficiency between two different codes (generated across humans and machines) by either classifying the superior one or predicting the relative improvement. We validate our method on multiple programming languages with multiple refinement steps, demonstrating that the proposed method can effectively distinguish between more and less efficient versions of code.
Anthology ID:
2024.findings-emnlp.645
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2024
Month:
November
Year:
2024
Address:
Miami, Florida, USA
Editors:
Yaser Al-Onaizan, Mohit Bansal, Yun-Nung Chen
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
11045–11056
Language:
URL:
https://aclanthology.org/2024.findings-emnlp.645
DOI:
Bibkey:
Cite (ACL):
Minju Seo, Jinheon Baek, and Sung Ju Hwang. 2024. Rethinking Code Refinement: Learning to Judge Code Efficiency. In Findings of the Association for Computational Linguistics: EMNLP 2024, pages 11045–11056, Miami, Florida, USA. Association for Computational Linguistics.
Cite (Informal):
Rethinking Code Refinement: Learning to Judge Code Efficiency (Seo et al., Findings 2024)
Copy Citation:
PDF:
https://aclanthology.org/2024.findings-emnlp.645.pdf