Reproduce “COFFE: A Code Efficiency Benchmark for Code Generation” on OpenResearch

Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Yun Peng, Jun Wan, Yichen Li, Xiaoxue Ren

COFFE introduces a benchmark for evaluating the time efficiency of large language model (LLM)-generated code, addressing the current focus on functional correctness. It proposes STGen for generating stressful test cases and defines `efficient@k`, a stable metric based on CPU instruction count, revealing that current LLMs often produce functionally correct but time-inefficient solutions.

Key insights

  • CPU instruction count is a stable and reliable measure for code time efficiency, demonstrating significantly less variability than traditional execution time.
  • LLMs struggle considerably with generating time-efficient code, particularly for complex file-level tasks, even when achieving functional correctness.
  • Simply increasing LLM parameter size does not consistently lead to proportional improvements in code efficiency, suggesting a need for different optimization strategies.
  • Contract-guided test case generation (STGen) effectively produces valid and highly distinguishable stressful test cases critical for efficiency evaluation.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.