Building a Realistic Code LLM Evaluation Benchmark Based on Real Development Workflows

    This article is for engineering teams that need to select a code LLM or AI coding tool, or want to build their own internal evaluation benchmark. If you only care about function-level scores reported in papers, the approach described here will not apply. It explains why function-level tests fall short, how to set up a realistic local development environment, how to design reasoning effort tiers, how to run end-to-end tasks, and which metrics to report.

    Why Function-Level Tests Fail to Reflect Real Development

    Function-level tests typically provide a function signature and description, then check whether the generated function passes unit tests. Their advantages are high automation and reproducible results. But the drawbacks are clear—mainly three ways they diverge from real development:

    1. The model cannot see the project structure, dependency versions, or existing code style.
    2. Real programming involves iterative operations such as reading error messages, fixing logic, and modifying code across files. A single generation cannot cover these steps.
    3. Code that runs is not the same as code that meets business requirements. Acceptance requires multi-step verification.

    The alternative is experiential evaluation: place the model inside a complete local project, have it complete a task from requirements to acceptance, and record the entire process.

    How to Set Up a Complex Local Development Environment

    An evaluation environment should include three types of elements.

    First, a multi-level file tree. The repository should contain at least frontend, backend, and database script directories, requiring the model to locate relevant files on its own.

    Second, dependencies and build chain. Lock package manager and dependency versions to ensure consistent builds. Generated code must pass compilation, static checks, and test commands.

    Third, version control state. Every task should start from the same commit or snapshot, and the environment should be restored to its initial state after each task so that one task does not affect the next.

    The evaluation environment must also meet the following security requirements:

    • Least privilege: the evaluation process runs as a regular user, with no production directories mounted and no production credentials injected.
    • Network isolation: only internal package mirrors and addresses required for evaluation are allowed; all other external access is denied by default.
    • Sensitive data masking: repositories use synthetic or already-anonymized data, never real user records.
    • No keys on disk: API keys for model calls are injected via environment variables and never written to workspace files or logs.
    • Snapshot rollback: containers are destroyed or snapshots restored after every run to guarantee reproducibility.

    How to Design Reasoning Effort Tiers

    Reasoning effort tiers define the maximum reasoning depth available to the model in a single task. They directly affect accuracy and token consumption, so they must be expressed as configurable parameters rather than vague descriptions.

    The table below shows an example configuration. Exact values should be calibrated against the model’s limits and task scale:

    Tier Reasoning Token Cap (example) Per-Task Timeout (example) Max Revision Rounds Suitable Tasks
    Low 2,000 60 seconds 1 Small single-file changes with no dependency changes
    Medium 8,000 300 seconds 2 2–3 files, requires reading existing interfaces
    High 32,000 900 seconds 3 3+ modules, involving data migration or concurrency

    Task grading is labeled by evaluators according to the rules above and written into task metadata—not decided by the model itself. Tasks that time out or exhaust their reasoning token budget are marked as failed, with the failure reason saved (e.g., timeout, budget exhausted, or tests not passing).

    How to Run End-to-End Tasks

    The execution flow of a task is: receive requirements, modify code, run build and tests, read errors, modify again, and repeat until acceptance is passed or the revision round limit is reached. The inputs, outputs, and command return values of every step should be recorded to support post-hoc failure analysis.

    Acceptance criteria must be frozen before the task begins and written by evaluators. The model must not read or modify test files. If the model alters tests to make them pass, the result is invalid.

    How to Compute Evaluation Metrics

    At minimum, report the following four metrics:

    1. Task pass rate = number of tasks passing acceptance / total tasks.
    2. First-pass rate = number of tasks passing without any revision / total tasks. This reflects the quality of single-shot delivery.
    3. Average output tokens = total output tokens across all tasks / total tasks. Chain-of-thought tokens should be counted separately, not mixed with code output.
    4. Cost per success = total spend / number of passing tasks. Spending on failed tasks is included in the cost of successful ones, making this closer to real-world usage cost.

    Pass rates should be reported with confidence intervals. Run each task 3 times and report the median and variance. With small sample sizes, a difference of a few percentage points between two models may simply be random noise.

    How to Design Complex Cross-File Tasks

    Below is an example task for testing cross-layer collaboration capability.

    Requirement: when refunding an order, the user must select a refund reason, and the reason must be saved to the database.

    Changes involved:

    • Frontend: add a reason dropdown to the refund form and pass the new parameter when calling the API, e.g., modifying frontend/src/api/order.ts.
    • Backend: the refund endpoint accepts and validates the refund_reason field, and the service layer writes it to the order record, e.g., modifying backend/src/order/.
    • Database: add a migration script that appends a refund_reason column to the orders table, e.g., placed under db/migrations/.

    Acceptance checklist:

    • All frontend and backend build commands succeed, with no new static check errors.
    • All frontend component tests and backend API tests pass.
    • The migration script runs forward on both an empty database and a database with historical data, and can be rolled back.