arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.10452cs.CLcs.AI
收藏

DynaCode:用于评估大型语言模型代码生成的动态复杂度感知代码基准

DynaCode: A Dynamic Complexity-Aware Code Benchmark for Evaluating Large Language Models in Code Generation

University of Electronic Science and Technology of China(电子科学与技术大学);Drexel University(德雷塞尔大学)

Wenhao Hu, Jinhao Duan, Chunchen Wei, Li Zhang, Yue Zhang, Kaidi Xu

AI总结:

为解决静态代码基准易导致数据污染的问题,本文提出动态复杂度感知基准DynaCode,结合代码复杂度与调用图结构生成上亿嵌套代码问题,有效区分了12个最新LLM的性能并揭示了其行为偏好。

摘要:

大型语言模型(LLMs)的快速发展显著提升了其在代码生成任务中的性能。然而,现有的代码基准保持静态,由包含预定义问题的固定数据集组成。这使得它们在训练期间容易受到记忆的影响,即LLMs会回忆特定的测试用例而不是泛化到新问题上,从而导致数据污染和不可靠的评估结果。为了解决这些问题,我们引入了DynaCode,这是一个动态的、复杂度感知的基准,克服了静态数据集的局限性。DynaCode使用复杂度感知指标系统性地评估LLMs,结合了代码复杂度和调用图结构。DynaCode实现了大规模的多样性,在四种不同的代码复杂度级别(称为单元)和16种类型的调用图中,生成多达1.89亿个独特的嵌套代码问题。在12个最新LLMs上的结果显示,与静态代码生成基准MBPP+相比,平均性能下降了16.8%至45.7%,且性能随着复杂度的增加而逐渐降低。这证明了DynaCode有效区分LLMs的能力。此外,通过利用调用图,我们深入了解了LLM的行为,特别是它们在处理嵌套代码中子函数交互时的偏好。我们的基准和评估代码可在https://github.com/HWH-2000/DynaCode获取。

英文摘要:

The rapid advancement of large language models (LLMs) has significantly improved their performance in code generation tasks. However, existing code benchmarks remain static, consisting of fixed datasets with predefined problems. This makes them vulnerable to memorization during training, where LLMs recall specific test cases instead of generalizing to new problems, leading to data contamination and unreliable evaluation results. To address these issues, we introduce DynaCode, a dynamic, complexity-aware benchmark that overcomes the limitations of static datasets. DynaCode evaluates LLMs systematically using a complexity-aware metric, incorporating both code complexity and call-graph structures. DynaCode achieves large-scale diversity, generating up to 189 million unique nested code problems across four distinct levels of code complexity, referred to as units, and 16 types of call graphs. Results on 12 latest LLMs show an average performance drop of 16.8% to 45.7% compared to MBPP+, a static code generation benchmark, with performance progressively decreasing as complexity increases. This demonstrates DynaCode's ability to effectively differentiate LLMs. Additionally, by leveraging call graphs, we gain insights into LLM behavior, particularly their preference for handling subfunction interactions within nested code. Our benchmark and evaluation code are available at https://github.com/HWH-2000/DynaCode.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑