Dynamic Code Capability Benchmark: Design and Practice for LLM Evaluation

    This article explains why static code benchmarks risk data contamination and how a dynamic benchmark addresses the problem by continuously collecting recent public programming problems, normalizing them, and validating them in an automated execution environment. It describes the benchmark’s components, including up-to-date problem sources, unified problem representation, and sandboxed compilation and testing. It then covers task dimensions beyond code generation—self-repair, code execution reasoning, and test-output prediction—along with contamination controls, evaluation metrics, result interpretation, and practical recommendations for enterprise and R&D teams. Readers gain a framework for building and using dynamic code benchmarks to compare LLMs more credibly and to distinguish memorization from genuine problem-solving ability.

    1. Why Dynamic Code Capability Evaluation Is Needed

    As large language models gain capabilities in code generation, program interpretation, error repair, and test analysis, accurately measuring their programming level has become an important issue in model R&D and engineering applications. Traditional code evaluation usually relies on a fixed problem set: problems are organized and used for a long time, and model developers can train, tune, or even build dedicated prompt templates around public samples. This approach makes experiments easy to reproduce, but it also creates a clear risk of data contamination.

    When test problems appear in model training corpora, public code repositories, or online discussions, a model may complete a task not by understanding the problem, designing an algorithm, and writing a program, but by relying on parameter memory or transfer from similar samples. In this case, the evaluation score may look high, yet it cannot show whether the model truly has the ability to handle unknown problems.

    Dynamic code capability benchmarks are proposed against this background. Their core idea is not to maintain a static set of problems for a long time, but to continuously collect recently published new programming problems and, after filtering, normalization, and automated validation, build an evaluation set that can be updated continuously. Compared with a fixed problem set, this mechanism is closer to a real software development environment: developers face requirements they have not seen before, need to understand constraints, design solutions, implement code, and revise results through testing.

    2. Basic Components of the Benchmark

    This type of benchmark usually includes the following key parts.

    2.1 Continuously Updated Problem Sources

    Problems mainly come from multiple public programming contests and algorithm practice channels. To reduce the probability that a model has seen a problem in advance, the evaluation system prioritizes problems with recent publication times and records the publication time, difficulty, input/output format, and reference validation information.

    Taking the sixth version as an example, the data covers roughly May 2023 through April 2025 and contains 1,055 programming problems. This time range is not merely a data description; it is an important basis for controlling contamination risk. In actual evaluation, the publication time of the problems should be considered together with the training data cutoff time of the model under test, and problems published later than that cutoff should be selected so that the problems are as unknown to the model as possible.

    2.2 Unified Problem Normalization Process

    Problems from different sources may differ in description style, input format, sample organization, and testing rules. Therefore, the benchmark needs a unified data representation that includes at least:

    • Problem description and constraints;
    • Input format and output format;
    • Example inputs, example outputs, and explanations;
    • Allowed programming languages;
    • Compilation, execution, and resource limits;
    • Standard test data and judging rules;
    • Problem publication time and difficulty label.

    The purpose of normalization is not to change the meaning of the problem, but to eliminate differences in problem-statement format and make comparisons between models fairer. At the same time, the problem description, examples, and test data should be consistent with one another to avoid distorted evaluation results caused by documentation errors.

    2.3 Automated Execution Environment

    Code evaluation cannot simply check whether model output contains certain keywords, nor can it rely only on a small number of manual examples. A more reliable approach is to place the program generated by the model into an isolated environment for compilation and execution, and to judge whether the program is correct based on the full test set.

    A typical flow is as follows:

    1. Read the problem
    2. ↓
    3. Generate code or a program patch
    4. ↓
    5. Static checks and format validation
    6. ↓
    7. Compile or interpret and execute
    8. ↓
    9. Run public examples
    10. ↓
    11. Run hidden tests
    12. ↓
    13. Aggregate pass rate, error types, and resource consumption

    The execution environment should fix compiler versions, runtime configuration, time limits, and memory limits as much as possible. For untrusted code, measures such as container isolation, permission restrictions, network disabling, and process resource control are also needed to prevent programs from accessing host files, making external requests, or consuming excessive system resources.

    3. Evaluation Capabilities Should Not Be Limited to Code Generation

    Many early benchmarks focused only on “given a problem, generate a program that passes the tests.” However, real software development often involves more stages. Dynamic code capability evaluation therefore extends tasks across multiple dimensions.

    3.1 Code Generation

    Code generation tasks require a model to start from a natural-language problem and complete algorithm analysis, data structure selection, and program implementation. This task can further reveal whether the model can:

    • Correctly understand input-output relationships;
    • Handle boundary conditions;
    • Choose complexity that matches the data scale;
    • Follow the syntax and runtime rules of the target language;
    • Generate a complete and executable program.

    Outputting correct results only on simple examples does not mean the algorithm is generally applicable. Hidden tests should cover empty inputs, extreme values, duplicate data, special orderings, and large-scale data to test program robustness.

    3.2 Self-Repair

    Self-repair tasks provide the model with a defective program and its failure information, requiring the model to locate the problem and submit modified code. This capability is closer to debugging work in actual development.

    Evaluation should not only check whether the repaired program passes the tests; it can also record whether the model can identify the error type, for example:

    • Syntax errors;
    • Type conversion errors;
    • Array out-of-bounds;
    • Missing null handling;
    • Missing boundary conditions;
    • Excessively high algorithm complexity;
    • Incorrect state updates or loop termination conditions.

    If a model simply keeps modifying code until it accidentally passes a small number of tests, its debugging capability is still limited. Therefore, self-repair tasks need to be combined with sufficient hidden tests and error classification analysis.

    3.3 Code Execution and Result Reasoning

    Some tasks do not require the model to write a complete program, but ask it to predict the output of given code under a specific input or explain the program execution process. Such tasks can examine the model’s understanding of control flow, variable states, recursive calls, exception paths, and data structure changes.

    Code execution tasks are especially likely to expose “surface understanding” problems. A model may be familiar with a syntax but unable to accurately track state changes across multiple rounds. To improve discrimination, test samples can appropriately include nested loops, conditional branches, mutable objects, and boundary inputs, while still ensuring that the problem statement is clear and the answer is unique.

    3.4 Test Output Prediction

    Test output prediction requires the model to determine the runtime result based on a program and input, or to identify whether a certain test will fail. This capability is closely related to code review, automated testing, and fault localization.

    In an engineering environment, if a model can determine failing cases in advance, it can help developers narrow the troubleshooting scope and reduce ineffective runs. Evaluation should avoid using only very obvious examples; it should include inputs that can trigger hidden defects, thereby testing the model’s in-depth analysis of program behavior.

    4. Data Contamination Control and Trustworthy Evaluation

    Dynamic problems do not automatically eliminate contamination; a complete governance process is still needed.

    First, the publication time and collection time of problems should be stored, and the relationship between the model training data cutoff time and the evaluation problem time should be established. For problems whose publication time cannot be confirmed, that have already spread widely, or that have many public solutions, their evaluation weight should be reduced, and they should be excluded when necessary.

    Second, evaluation should distinguish between “problem contamination” and “search contamination.” If the model is allowed to access the network, it may obtain ready-made answers by searching the problem statement. Even if the model parameters do not memorize the problem, this will cause evaluation bias. Therefore, rigorous offline evaluation should disable external network access. If the research goal is to evaluate intelligent coding systems with search capabilities, the search permissions, access process, and retrieval results need to be recorded separately and must not be confused with pure model capability.

    Third, problems should undergo similarity detection. Even if a problem is newly published, it may be highly similar to historical problems in algorithm structure or problem-statement expression. Text similarity, code structure features, and algorithm labels can be used for auxiliary screening, but these methods can only reduce risk and cannot fully prove that the model has not seen related knowledge.

    5. Metric Design and Result Interpretation

    The most intuitive metric is the pass rate, that is, the proportion of problems for which the program generated by the model passes the full test set. In addition, the following metrics should be considered:

    • First-submission pass rate: measures the model’s ability to complete a task in one attempt;
    • Post-repair pass rate: measures the model’s ability to improve code based on feedback;
    • Compilation success rate: reflects basic code generation quality;
    • Difference between example pass rate and hidden-test pass rate: identifies overfitting to examples;
    • Average runtime and memory consumption: evaluates efficiency and resource awareness;
    • Pass rate across difficulty ranges: observes capability distribution;
    • Performance across problem types and algorithm categories: locates model strengths and weaknesses;
    • Proportion of error types: supports subsequent training and prompting strategy optimization.

    Results should not be interpreted by comparing only a single total score. Two models may have the same overall pass rate, but one may be stable on easy problems and fail on complex ones, while the other may be more balanced; their value in real development is not the same. Therefore, reports should present stratified results, confidence intervals, and failure cases together.

    In addition, evaluation should avoid mistaking differences in execution environments for differences in model capability. Compiler versions, timeout policies, floating-point precision, and test data quality can all affect final results. Horizontal comparisons are meaningful only when the environment, rules, and test sets are consistent.

    6. Practical Recommendations for Enterprises and R&D Teams

    For teams that need to evaluate code LLMs, dynamic benchmarks can be incorporated into the model R&D loop:

    1. Use new problems whose solutions have not been recently published for periodic acceptance testing, rather than testing only on training sets or historical problem banks;
    2. Evaluate code generation, self-repair, and test analysis separately to clarify improvement goals for different capabilities;
    3. Save the prompts, model versions, generated results, and execution logs of each evaluation to ensure traceability;
    4. Perform manual attribution on failure samples to distinguish knowledge gaps, reasoning errors, implementation errors, and environment issues;
    5. Update problems regularly to prevent internal tuning from creating new overfitting;
    6. Use isolated environments for high-risk code execution and restrict file, network, and system resource access;
    7. When publishing conclusions about model capabilities, clearly state the problem time range, whether tool invocation is allowed, and the testing rules.

    It should be noted that programming problem evaluation mainly reflects algorithm understanding, program implementation, and test-passing ability; it cannot fully represent real software engineering capability. Actual development also involves requirement clarification, architecture design, code maintainability, security, collaboration processes, and long-term evolution. Therefore, dynamic code benchmarks should be used together with code review, real project tasks, defect repair, and security testing.

    7. Conclusion

    The core value of dynamic code capability evaluation is to distinguish as much as possible between “whether the model has memorized problems” and “whether the model can solve unknown problems.” By continuously introducing new problems, controlling data contamination, unifying the execution environment, and covering tasks such as code generation, self-repair, execution reasoning, and test output prediction, it is possible to observe the programming capabilities of large language models more comprehensively.

    Taking the 1,055 new problems covered by the sixth version and spanning about two years as an example, this type of dataset provides a good foundation for horizontal model comparison and continuous iteration. However, evaluation results still depend on problem quality, isolation mechanisms, test strength, and metric design. Only by combining dynamic data, automated execution, stratified statistics, and error analysis can a more objective, stable, and realistic code model evaluation system be formed.