NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

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

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

Introduction

The rapid advancement of Large Language Models (LLMs) in code generation has necessitated robust evaluation frameworks. However, current gold standards like HumanEval and MBPP are increasingly criticized for being "static." These benchmarks consist of fixed problem sets that have been publicly available for years, leading to two critical vulnerabilities: data contamination and a lack of structural complexity. DynaCode addresses these issues by introducing a dynamic, complexity-aware framework that evaluates LLMs on multi-step, interdependent programming tasks.

The Limitations of Static Benchmarking

Static benchmarks often fail to distinguish between a model's ability to reason through logic and its ability to recall patterns from its training data. Because these benchmarks are part of the public web, they are likely included in the pre-training corpora of modern LLMs. Furthermore, real-world software development involves complex webs of interdependent function calls, whereas static benchmarks typically focus on isolated, single-function tasks. This "complexity gap" means that high performance on traditional benchmarks may not translate to proficiency in real-world software engineering.

The DynaCode Framework

DynaCode transforms static code problems into a massive, dynamic evaluation suite through a three-stage process.

The DynaCode pipeline: from code complexity classification to dynamic benchmark generation.
  1. Complexity Classification: Base functions are categorized into four "Units" of increasing difficulty based on cyclomatic complexity—a metric that measures the number of independent paths through a program's logic.
  2. Call Graph Construction: The framework defines 16 distinct Directed Acyclic Graph (DAG) structures, ranging from simple linear chains to complex branching trees. These structures dictate how multiple sub-functions are coordinated by a "main" function.
  3. Dynamic Generation: By matching functions based on input/output types and nesting them according to the defined call graphs, DynaCode can generate up to 189 million unique coding problems. This scale ensures that models cannot rely on memorization.

Experimental Results and the "Memorization Mirage"

The researchers evaluated 12 leading LLMs, including GPT-4o and DeepSeek-V3. The results provided a sobering reality check: average performance dropped by 16.8% to 45.7% when moving from static benchmarks to DynaCode. Even top-tier models like GPT-4o saw a significant decline, with Pass@1 scores falling from 87.6% on MBPP to 55.4% on DynaCode.

A key insight from the study is the "Memorization Mirage." To test this, the authors fine-tuned models on MBPP+. While the fine-tuned models achieved nearly 100% on the static benchmark, their performance on DynaCode remained stagnant.

Finetuning results on MBPP+ vs DynaCode, highlighting the gap between memorization and logical reasoning.

This discrepancy confirms that models are often recalling specific patterns rather than mastering the underlying logic required for complex, nested tasks.

Analysis of Failure Modes

DynaCode reveals that LLMs struggle significantly with structural complexity. While models perform relatively well on sequential logic (linear chains), their performance craters when faced with multi-branch dependencies where results from multiple functions must be combined. As complexity increases, the primary failure mode shifts from simple syntax errors to a fundamental breakdown in "Problem Understanding." Models simply lose track of requirements across deep nesting levels.

Conclusion and Future Work

DynaCode represents a significant shift toward more realistic and contamination-resistant evaluation of AI coders. By stressing models with interdependent systems rather than isolated snippets, it exposes the gap between pattern recognition and true logical reasoning. While the current framework is limited to Python and call graphs of up to five nodes, future work will aim to expand these structures and support multiple programming languages to better simulate large-scale software engineering environments.

Summary updated

BibTeX
@inproceedings{hu2025dynacode,
  author = {Wenhao Hu and Jinhao Duan and Chunchen Wei and Li Zhang and Yue Zhang and Kaidi Xu},
  title = {{DynaCode: A Dynamic Complexity-Aware Code Benchmark for Evaluating Large Language Models in Code Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure