Abstract
While Large Language Models (LLMs) have achieved high functional correctness in code generation, their ability to produce computationally efficient code remains under-explored. We introduce EffiBench-X, a multi-language benchmark designed to evaluate the runtime and memory efficiency of LLM-generated solutions against human-expert baselines. Our findings reveal a significant "efficiency gap," where even state-of-the-art models like Qwen3-32B and DeepSeek-R1 achieve only approximately 62% of human-level execution efficiency.
Introduction
Modern coding benchmarks such as HumanEval and MBPP primarily focus on "functional correctness"—whether the code works. However, in production environments, efficiency is paramount. Existing efficiency benchmarks are often limited to Python, prone to data contamination, or lack algorithmic complexity. EffiBench-X addresses these gaps by sourcing post-October 2023 competitive programming tasks across six languages (Python, C++, Java, JavaScript, Ruby, and Go), providing a rigorous testbed for code optimization.
Methodology
The construction of EffiBench-X involves a multi-stage pipeline to ensure data quality and measurement precision.
- Contamination-Free Sourcing: Tasks are collected from platforms like Codeforces and AtCoder, specifically filtering for problems released after October 2023 to avoid overlap with LLM training data.
- Canonical Solutions: Expert human solutions serve as the 100% efficiency baseline.
- Automated Test Suites: LLMs generate robust test cases, which are then validated against human solutions to ensure correctness and coverage.
- High-Resolution Profiling: Code is executed in a sandboxed Docker environment with CPU pinning. A custom profiler samples resource usage at 10 kHz.
- Metrics: Performance is measured via Execution Time (ET), Memory Peak (MP), and Memory Integral (MI) relative to the human baseline.
Experimental Results
We evaluated 26 state-of-the-art LLMs, including both open-source and proprietary models. The results highlight a persistent gap between functional correctness and computational efficiency.
Key findings include:
- The Efficiency Ceiling: The top-performing model, Qwen3-32B, reached an ET score of 62.21%. This indicates that the most optimized LLM code is still nearly twice as slow as expert human code.
- Model Leaders: DeepSeek-R1 led the open-source category with a 61.33% ET score. Gemini-2.5-Pro demonstrated the highest functional correctness (79.43% Pass@1) and peak memory efficiency (75.60%), though it lagged in execution speed (47.82% ET).
- Language Discrepancies: Models generally perform better on dynamically-typed scripting languages (Python, JS) than on statically-typed compiled languages (C++, Java). For instance, DeepSeek-R1's efficiency dropped from 67.30% in Python to 52.23% in Java, despite maintaining high functional correctness.
Discussion and Insights
The results highlight several critical bottlenecks. Models often default to brute-force approaches rather than optimal algorithmic structures. Furthermore, a significant performance drop is observed in "Standard I/O" tasks compared to "Functional" tasks, suggesting LLMs struggle with low-level buffer management. Interestingly, increased reasoning capabilities do not always translate to better efficiency; some models over-explain or produce verbose code that degrades performance.
Limitations
EffiBench-X primarily focuses on algorithmic efficiency within competitive programming. Future work should expand to systems programming and hardware-specific optimizations. Additionally, while the benchmark quantifies the efficiency gap, automated root-cause analysis of suboptimal patterns remains an open challenge.
Summary updated