Dynamic Benchmarking of Reasoning Capabilities in Code Large Language Models Under Data Contamination

Simin Chen, Pranav Pusarla, Baishakhi RayarXiv 2025 · DOI

Abstract

Static benchmarks for code generation, such as HumanEval and MBPP, are increasingly compromised by data contamination, where models memorize solutions rather than reason through problems. We present DyCodeEval, a dynamic benchmarking framework that utilizes a multi-agent system to transform static programming problems into semantically equivalent but contextually diverse variants. By decoupling algorithmic logic from contextual description, DyCodeEval provides a more accurate assessment of a model's true reasoning capabilities. Our evaluation of 18 Code LLMs demonstrates that DyCodeEval effectively unmasks performance inflation caused by memorization and offers a robust tool for detecting data contamination.

1. Introduction

The rapid advancement of Large Language Models (LLMs) for code generation has relied heavily on public benchmarks like HumanEval and MBPP. However, these static datasets are often included in training corpora, leading to "stochastic parrot" behavior where models recall solutions instead of reasoning. Existing solutions either require manual effort or alter problem complexity, hindering fair comparison. DyCodeEval addresses this by automatically generating complexity-controlled variations of existing problems to test if a model understands the underlying logic.

Example of a static programming problem used as a seed for dynamic variant generation.

2. Methodology: The DyCodeEval Framework

DyCodeEval employs metamorphic testing principles to create problem variants that preserve original logic while changing the narrative context. The framework consists of a pipeline of four specialized agents:

  • Scenario Proposer: Suggests a real-world domain (e.g., banking, healthcare, or social media) to serve as the new "skin" for the problem.
  • Context Generator: Performs type inference on the original code and assigns meaningful roles to variables within the chosen scenario (e.g., changing a generic list of floats into "daily recorded temperatures").
  • Prompt Rewriter: Reformulates the entire problem description to fit the new scenario while strictly preserving original logic and constraints.
  • Validator: Acts as a quality gate, using an LLM-as-a-judge to ensure the new prompt is still solvable by the original code and hasn't lost its core intent.
The DyCodeEval multi-agent pipeline for dynamic benchmark generation.

To quantify performance, we introduce DyPass@K, a rigorous metric requiring the model to solve $n$ different semantic variants of the same problem, making it significantly harder to succeed through memorization alone.

3. Experimental Evaluation

We applied DyCodeEval to HumanEval and MBPP-Sanitized, evaluating 18 models ranging from small open-source models like Llama-3.2-1B to state-of-the-art systems like Claude 3.5 Sonnet. The framework produced significantly more diverse prompts both syntactically (measured by BLEU-4) and semantically (measured by cosine similarity) compared to simple rule-based mutations like variable renaming.

Results show a significant performance gap between static and dynamic benchmarks for models suspected of contamination. In controlled experiments where data was intentionally "leaked," static scores skyrocketed (e.g., from 0.22 to 0.82). However, when tested with DyCodeEval, those same models saw their scores plummet back to baseline (~0.13), proving the framework effectively bypasses memorization. DyCodeEval also acts as a "lie detector" for existing models; for instance, Qwen2.5-Coder-7B consistently fell outside the expected performance range, suggesting potential exposure to seed datasets during training. Furthermore, the benchmarking results remained consistent across multiple runs despite the inherent randomness of agent-based generation.

4. Discussion and Conclusion

DyCodeEval demonstrates that context-shifting is a powerful tool for isolating algorithmic reasoning. The study found that models fine-tuned on leaked data show a massive performance gap, acting as a "lie detector" for contamination. While agent-based generation introduces computational overhead and potential information overload in prompts, it provides a significantly more honest measure of model capability than static benchmarks. Future work will focus on optimizing generation efficiency and refining context density to further enhance benchmark reliability.

Summary updated

BibTeX
@misc{chen2025dynamic,
  author = {Simin Chen and Pranav Pusarla and Baishakhi Ray},
  title = {{Dynamic Benchmarking of Reasoning Capabilities in Code Large Language Models Under Data Contamination}},
  year = {2025},
  eprint = {2503.04149},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.04149},
}
Figure