使用 ACEOB 测量代码效率优化能力
Measuring Code Efficiency Optimization Capabilities with ACEOB
AI总结:
针对代码效率优化研究匮乏与评估困难,提出包含95,359对代码的ACEOB基准及IOCCB、NPI两项新指标,实验证明引入NPI过滤器可提升模型效率,但ChatGPT等仍未达最优。
摘要:
随着摩尔定律收益递减,软件性能和效率变得愈发关键。即便对专业程序员而言,优化代码效率也颇具挑战。然而,相关研究仍相对匮乏,且严格评估模型的代码效率优化能力充满困难。为应对此挑战,我们首先深入分析模型训练数据集中的“代码模式”,细致探究人工编写的代码。其次,我们定义了一项代码效率优化任务,并引入自动代码效率优化基准(ACEOB),包含 95,359 对高效-低效代码,旨在评估代码效率优化能力。据我们所知,ACEOB 是首个专门针对 Python 代码效率优化的数据集。为评估模型优化代码效率的能力,我们提出两项新指标:同构最优比较 CodeBLEU(IOCCB)指标与归一化性能指数(NPI)指标,以衡量模型生成代码的效率。我们还在 ACEOB 上对 PolyCoder 和 CodeT5 等若干先进代码模型进行微调后加以评估,结果表明引入 NPI 过滤器后各模型的效率均有提升。然而观察发现,即便是 ChatGPT 在代码效率优化任务中也未达到最优表现。
英文摘要:
As Moore's Law gains diminish, software performance and efficiency become increasingly vital. Optimizing code efficiency is challenging, even for professional programmers. However, related research remains relatively scarce, and rigorously assessing models' abilities to optimize code efficiency is fraught with difficulties. In response to this challenge, we first conduct an in-depth analysis of "code patterns" in the model training dataset, meticulously exploring human-written code. Secondly, we define a task for optimizing code efficiency and introduce the Automatic Code Efficiency Optimization Benchmark (ACEOB), which consists of 95,359 pairs of efficient-inefficient code aimed at assessing code efficiency optimization capabilities. To our knowledge, ACEOB is the first dataset specifically targeting Python code efficiency optimization. To evaluate models' ability in optimizing code efficiency, we propose two new metrics: the Isomorphic Optimal Comparison CodeBLEU (IOCCB) metric and the Normalized Performance Index (NPI) metric, to assess the efficiency of model-generated code. We also evaluate several advanced code models, such as PolyCoder and CodeT5, after fine-tuning them on ACEOB and demonstrate that the efficiency of each model improves after introducing the NPI filter. However, it was observed that even ChatGPT does not perform optimally in code efficiency optimization tasks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。