about
Rethinking Code Refinement: Learning to Judge Code Efficiency (arxiv.org)
2 points by PaulHoule on Nov 9, 2024 | hide | past | pdf | 1 comment on HN

In plain words: A trained code model looks at two versions of a program and predicts which one runs more efficiently, or how much better it is, without running either. It picked the faster version correctly across several programming languages and refinement rounds.

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.

Minju Seo, Jinheon Baek, Sung Ju Hwang
arXiv:2410.22375 · cs.SE, cs.AI, cs.CL · submitted Oct 29, 2024
abstract · pdf · html

add comment on HN

Re: costed opcodes in BPF, eWASM (like EVM) https://news.ycombinator.com/item?id=40475509 :

> Costed opcodes incentivize energy efficiency.

Aren't these all fitness scoring methods for what GA calls mutation, crossover, and selection?

And do the functions under test stably coverage on the same output even if not exactly functionally isomorphic? When are less costly approximate solutions sufficient?

Big O, Dynamic tracing and instrumentation, costed opcodes, OPS/kWHr/$

https://news.ycombinator.com/item?id=41333249 :

> codefuse-ai/Awesome-Code-LLM > Analysis of AI-Generated Code, Benchmarks: https://github.com/codefuse-ai/Awesome-Code-LLM#6-analysis-o...