Mercury: A Code Efficiency Benchmark for Code Large Language Models

Mingzhe Du, A. Luu, Bin Ji, Qian Liu, See-Kiong Ng
2/3/2026

No official code found. Best implementation: Elfsong/Mercury (87 stars, last commit 2026-03-06).

Abstract

Amidst the recent strides in evaluating Large Language Models for Code (Code LLMs), existing benchmarks have mainly focused on the functional correctness of generated code, neglecting the importance of their computational efficiency. To fill the gap, we present Mercury, the first code efficiency benchmark for Code LLMs. It comprises 1,889 Python tasks, each accompanied by adequate solutions that serve as real-world efficiency baselines, enabling a comprehensive analysis of the runtime distribution. Based on the distribution, we introduce a new metric Beyond, which computes a runtime-percentile-weighted Pass score to reflect functional correctness and code efficiency simultaneously. On Mercury, leading Code LLMs can achieve 65% on Pass, while less than 50% on Beyond. Given that an ideal Beyond score would be aligned with the Pass score, it indicates that while Code LLMs exhibit impressive capabilities in generating functionally correct code, there remains a notable gap in their efficiency. Finally, our empirical experiments reveal that Direct Preference Optimization (DPO) serves as a robust baseline for enhancing code efficiency compared with Supervised Fine Tuning (SFT), which paves a promising avenue for future exploration of efficient code generation. Our code and data are available on GitHub: https://github.com/Elfsong/Mercury.

View on arXivView PDF

Code Implementations(1)

Elfsong/MercuryCommunity100%

Code Efficiency Benchmark

8710Shell, PythonJan 15, 20247 months ago
benchmarkcode-generationllmsoftware-engineering

Similar Papers

Cite this paper

@article{du2026mercury,
  title  = {Mercury: A Code Efficiency Benchmark for Code Large Language Models},
  author = {Mingzhe Du and A. Luu and Bin Ji and Qian Liu and See-Kiong Ng},
  year   = {2026},
  eprint = {2402.07844},
  archivePrefix = {arXiv},
  doi    = {10.52202/079017-0529},
  url    = {https://arxiv.org/abs/2402.07844},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.07844.svg)](https://codeofpaper.com/paper/2402.07844)

Discussion