Evaluating Code Generation Models with Animation and Rendering Tasks

    This article explains how to evaluate code generation models using animation and rendering tasks. It covers why a successful run is not enough for visual output, how to split animated vector graphics into dimensions that can be checked, how to judge lighting in procedural rendering, and how to build a reproducible evaluation process with scoring, baselines, and regression checks.

    Why Use Animation and Rendering Tasks to Measure Code Generation

    A common way to judge generated code is to check whether the program runs. For visual tasks, a successful run is only the starting point. A program can execute without errors and still produce a static image, a malformed graphic, or a scene with clearly wrong lighting. Evaluation therefore needs to cover three areas: functional correctness, visual quality, and engineering maintainability.

    These tasks have two useful properties. First, the output is executable program text, so structural defects appear directly in the result and are hard to hide behind a surface-level appearance. Second, the tasks combine geometry, time, interaction, and lighting, which covers far more ground than a single function-level problem. They therefore reflect a model’s understanding of a complete system more accurately.

    1. Animated Vector Graphics: Breaking Evaluation into Checkable Dimensions

    Using “vector illustrations with animation” as an example, the evaluation can be split into four dimensions.

    1. Structural completeness: Are the main objects (for example, people, vehicles, and backgrounds) all present, and is their layering reasonable?
    2. Animation semantics: Does the motion follow common sense? For example, the direction a wheel turns should match the direction of travel, and body parts should not pass through each other during movement.
    3. Interaction completeness: Are all the features the prompt requires, such as pause, speed control, and theme switching, implemented, rather than only some of them?
    4. Standalone operation: Does the exported file depend on external network resources, and can it open and run normally in an offline environment?

    The following illustrative animation snippet shows these checkpoints. The root element and its namespace declaration are omitted.

    1. <circle cx="60" cy="90" r="20" fill="none" stroke="#333" stroke-width="3">
    2. <animateTransform attributeName="transform" type="rotate"
    3. from="0 60 90" to="360 60 90" dur="1s" repeatCount="indefinite"/>
    4. </circle>

    When reviewing this code, confirm that the rotation center is correct (here, 60, 90), that the animation duration is reasonable, and that the file does not reference external resources. If the overall playback speed needs to be adjusted, the timing parameters should be managed in one place rather than hard-coded on each element.

    2. Procedural Rendering: From “Looks Right” to “Lighting Is Plausible”

    The difficulty in lighting tasks lies in the judging criteria. An attractive picture and a picture with physically plausible lighting are two different qualities. When evaluating, judgment can be split into four levels.

    • Geometry: Does the shape of light patches cast through a window match the window frame? Are occlusion relationships between objects correct?
    • Lighting: Is the transition between direct and scattered light natural? Are shadow edges softened to an appropriate degree?
    • Materials: Do the floor, walls, and fabrics show different reflectivity and roughness, rather than one uniform color?
    • Rendering method: Real-time rasterization and offline path tracing differ greatly in accuracy and cost, so their results should not be compared directly. Each should be given its own time budget.

    The simplest lighting model used for illustration is the Lambertian diffuse model:

    1. L = Kd * max(0, N · Lm) * Ll

    Here, N is the surface normal, Lm is the unit vector pointing toward the light source, Kd is the diffuse coefficient, and Ll is the light source intensity. This formula describes only direct illumination from a single point light. It does not include indirect light. If the corner of a wall lacks a soft transition, the cause may be that indirect lighting was not computed, not a failure in the renderer itself. Evaluators need to identify which layer causes the problem before deciding how to score it.

    3. Building a Reproducible Evaluation Process

    Judging from a single output can easily be skewed by chance. The following steps are recommended.

    1. Fix inputs and versions: Record the full prompt, model version, generation date, and run parameters.
    2. Sample multiple times: Generate several outputs from the same prompt and check whether the results are stable, rather than picking only the best one.
    3. Score by dimension: Give each dimension a score from 0 to 2 and state the reason for each deduction.
    4. Run in a clean environment: Execute the code without cache or extra dependencies, and record error messages, run time, and resource usage.
    5. Set a comparison baseline: Include a manually written reference implementation or a known stable version, so quality is not judged in isolation.

    The following example scoring table shows how each dimension can be graded.

    Dimension 0 points 1 point 2 points
    Runnability Errors with no output Some features work All features work correctly
    Structural completeness Main objects missing Objects present but proportions off Structure matches semantics
    Visual transitions Obvious breaks Local stiffness Natural transitions
    Maintainability One long monolithic function Coarse module division Clear responsibilities, centralized parameters

    Aesthetic preferences should be recorded separately and not counted toward functional scores. For example, “the color palette leans cool” is a style issue, while “the shadow direction contradicts the light source” is a correctness issue. Their fix priorities differ completely.

    4. Common Pitfalls

    • Treating “it runs” as “it is implemented correctly.” After a successful run, a reviewer still needs to check scene semantics, such as whether the light source position matches the shadow direction.
    • Drawing conclusions from a single screenshot. Screenshots cannot show animation timing, interaction logic, or frame-to-frame stability. These require actual interaction or a recorded video.
    • Ignoring rendering cost. Path tracing usually takes far longer than real-time rendering. When comparing image quality directly, state the time cost of each.
    • Using pixel-level comparison to judge consistency. Anti-aliasing and floating-point error cause small differences that often produce false alarms. Use structural similarity metrics instead, combined with manual spot checks.

    5. Engineering Recommendations

    Including this evaluation method in daily development helps track quality changes over time. Specifically:

    • Write prompts and expected behavior as test cases, and run them automatically after every change.
    • Save animation frames or rendering results as baseline snapshots. After a model or dependency upgrade, compare against the baseline and record the cause of any differences.
    • For visual output, combine automated metrics with manual spot checks. Automated metrics flag obvious regressions, and a human reviewer decides whether to accept the change.
    • Archive evaluation results by dimension to build quality data that can be compared across models and tracked over time.

    With these foundations in place, a team can judge the real limits of code generation ability without relying on subjective impressions. Limited human review can then focus on the points that require judgment.