Institute of Systems for Advanced Computing Fudan University
被引用0|浏览2
摘要
Code generation has largely improved development efficiency in the era of large language models (LLMs). With the ability to follow instructions, current LLMs can be prompted to generate and optimize code solutions given detailed descriptions in natural language. Many research efforts are devoted to improving the correctness of LLM-generated code by proposing different benchmarks. Despite the focus on correctness, the time efficiency of LLM-generated code solutions is underexplored. Current correctness benchmarks are not suitable for time efficiency evaluation since their test cases cannot well distinguish the time efficiency of different code solutions. Besides, the current execution time measurement is not stable and comprehensive, threatening the validity of the time efficiency evaluation. To address the challenges in the time efficiency evaluation, we propose COFFE, a benchmark for evaluating the time efficiency of LLM-generated code solutions in code generation and code optimization. COFFE contains 398 and 358 problems for functionlevel and file-level code generation, respectively. To improve the distinguishability, we design a novel stressful test case generation approach with contracts and two new formats of test cases to improve the accuracy of generation. To improve the robustness, we also design a test case input scale mutation method to generate test cases with different input scales. For the time evaluation metric, we propose efficienct@k based on CPU instruction count to ensure a stable and solid comparison between different solutions. We evaluate 19 popular LLMs and 7 LLM-based code optimization methods on COFFE and identify 10 findings. Based on the findings, we draw some implications for LLM researchers and software practitioners to facilitate future research and usage of LLMs in code generation and optimization.