arrow
Return

Complexity-Constraint Code Evaluation: A Benchmark for Time Complexity Compliance in LLM-Generated Code

delete2026-05-01
delete1
PRE
AI
C
Chen, Li-Guo
W
Wang, Xin
C
Chen, Jue-Yu
L
Liang, Ren-Zhao
Z
Zeng, Zheng-Ran
L
Li, Yang-Ning
L
Li, Ying-Hui
W
Wang, Yi-Dong
X
Xu, Yi-Jiang
G
Gao, Qing
Z
Zhang, Shi-Kun *
DOI:10.1007/s11390-025-5518-5delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
While large language models for code (Code LLMs) excel at generating functionally correct code, existing benchmarks neglect a crucial aspect: adherence to explicit time complexity constraints. We introduce the Complexity-Constraint Code Evaluation (C3E), a novel benchmark evaluating both functional correctness and complexity compliance across feasible and infeasible scenarios. C3E enables precise differentiation between asymptotic complexity classes and tests model robustness against theoretically impossible constraints. Our proposed Complexity Alignment Score (CAS) integrates correctness and complexity adherence into a unified metric, assessed through theoretical analysis rather than costly executions. Experiments reveal a striking gap in state-of-the-art models: GPT-4o achieves 81% correctness but only 31% CAS, demonstrating poor complexity compliance. Notably, most models fail to recognize infeasible constraints except advanced ones such as GPT-4o. These findings underscore the necessity for complexity-aware evaluation, positioning C3E as an essential tool for advancing real-world coding reliability in Code LLMs. The C3E benchmark is available at .
Keywords:
large language model for code (Code LLM)
code evaluation
benchmark dataset
time complexity constraint

Journal

J
Journal of Computer Science and Technology
IF:
1.3
Papers:
76
Citations:
1.5K

Organization

B
beihang university
Scholars:
2.5K
Papers: 785
Citations: 0
P
Peking University
Scholars:
3.2K
Papers: 991
Citations: 0
T
Tsinghua University
Scholars:
4.4K
Papers: 1.6K
Citations: 0
researcher View more organizations
Cited Papers

Cited Papers

No cited papers available