Evaluating Open-Source LLMs: Methods for Code Generation and Math Reasoning

    This article breaks down a practical evaluation methodology for open-source large language models on code generation and mathematical reasoning tasks. It explains why a runnable output does not equal a correct one, how to replace subjective impressions with observable metrics, and how to use repeated sampling and failure classification to produce reproducible results. Readers will find task card design, layered observation tables, sampling strategies, common misjudgments to avoid, and a deployable evaluation workflow.

    1. Background: Why “It Runs” Does Not Mean “It’s Correct”

    In practical model evaluation, one of the most commonly misjudged conclusions is this: a model generates code, the code runs without errors, and something renders on screen, so the task is marked complete. Real experience is often the opposite. The program may start, but camera control behaves abnormally, the coordinate system is inconsistent, and world generation logic is misaligned. Alternatively, the main entity behaves correctly while secondary effects (such as projectiles or hit-range detection) are never drawn properly. This kind of “partially correct” output is a typical failure mode of generative models on structured tasks, and it is exactly what evaluation design must address first.

    The evaluation goal should therefore go beyond “did it produce something” and be split into three layers. The first is runnability: can the artifact be loaded and enter the main loop? The second is functional completeness: are the key sub-features listed in the requirements implemented one by one? The third is semantic consistency: are spatial relationships, physics rules, and numeric boundaries self-consistent? Scoring each layer independently is what turns “looks good” into comparable, reproducible conclusions.

    2. Code Generation Tasks: Replacing Subjective Impressions with Observable Metrics

    2.1 Task Design Must Be Verifiable

    A high-quality evaluation prompt should have three characteristics at once: explicit constraints (single file, specified rendering approach, pixel-art style), enumerable sub-items (terrain generation, vegetation generation, creature entities, several additional mechanics), and interactive results (can move, can switch camera view, can trigger behaviors). The more explicit the constraints, the harder it is for a model to pass verification with a vague implementation.

    A sample acceptance checklist can be written as a structured configuration, which keeps results consistent across repeated tests:

    1. task: single_file_3d_voxel_scene
    2. constraints:
    3. files: 1
    4. rendering: webgl_scene_graph
    5. style: pixel_art
    6. checklist:
    7. - load_and_render
    8. - camera_control
    9. - movement_and_jump
    10. - terrain_generation
    11. - vegetation_generation
    12. - mob_behavior
    13. - attack_logic
    14. - projectile_render
    15. - hit_range_correctness
    16. scoring:
    17. runnable: 0.2
    18. checklist_pass_ratio: 0.5
    19. semantic_consistency: 0.3

    2.2 Layered Observation: Locating Failures in Specific Subsystems

    Evaluation should record results per subsystem rather than assigning a single overall score. A common distribution in practice is that main-body movement (walking, jumping) and basic behavior logic are the easiest to get right; attack logic is usually generated correctly as well. The real high-frequency failure areas are “rendering secondary objects” and “numeric ranges” — for example, projectiles that are never drawn, or a basic attack range that does not match the visual representation. Another frequent cluster of issues involves coordinates and camera view: offsets in world-generation coordinates, or incorrect relative transforms between camera and character, can collapse overall playability even when a single frame looks complete.

    A suggested observation table structure is as follows:

    Subsystem Observation Point Judgment Method
    Rendering pipeline Whether the scene produces output Whether a valid frame exists after loading
    Camera View rotation and follow Whether the view changes as expected after interaction
    Movement Walking, jumping Whether displacement and leaving the ground hold after key presses
    World generation Chunk coordinate consistency Whether terrain is continuous and unaligned after moving
    Entity behavior Whether it stays idle for a long time Whether state changes within the observation window
    Combat Attack logic, projectiles, range Whether it is visible after triggering and whether detection matches

    2.3 Repeated Sampling and Failure-Mode Statistics

    A single generation is not enough to demonstrate capability, because structured long-form generation is clearly stochastic. A more rigorous approach is to repeat the same prompt multiple times and record the “runnability rate,” the “mean checklist pass ratio,” and the “frequency of fixed failure points.” When a model repeatedly fails to reach a playable state, record the failure stage (load failure, main-loop exception, initialization error) instead of vaguely writing “unusable.”

    3. Math Reasoning Tasks: Unique Answer + Repeated Sampling + Process Trace

    3.1 Problem Selection Principles

    Reasoning problems used for evaluation should meet three conditions: the answer is unique and can be matched exactly, the solution requires multi-step logic rather than memorization, and it is sensitive to boundary conditions. Three types of problems cover different capability dimensions. One tests integer-range reasoning about “which integers have squares falling within a given interval,” where the correct answer lies in the negative range and is easy to get wrong by ignoring negative roots. One tests permutation counting with repeated elements and a non-zero leading-digit constraint, where the answer is a definite integer. One tests conversion between geometric volume and displaced water volume, requiring correct units and water-level rise calculation.

    3.2 Sampling Count Is More Informative Than a Single Result

    Running multiple independent samples on the same problem and recording the number of correct answers is more discriminative than “got it right once.” Results can be summarized in a table like this:

    Problem Type Sample Count Recorded Content
    Interval integer reasoning 1 Correct or not, whether negative roots are addressed
    Constrained permutation counting 5 Correct count, average time
    Volume and water level 5 Correct count, whether units are consistent

    3.3 Process Trace and Latency Are First-Class Metrics

    Strong reasoning modes usually require long derivation steps and can still be wrong. If a model reliably hits hard combinatorial counting problems without explicit chain-of-thought enabled, this phenomenon deserves separate annotation and repeated verification, because it may indicate an internal computation path different from the common “long-chain enumeration.” Evaluation records should include whether explicit reasoning is enabled, average response time, and whether verifiable intermediate steps are provided. Abnormal latency (for example, slow enough to affect usability) is itself an engineering metric worth recording.

    4. Common Misjudgments and How to Avoid Them

    First, treating “polished visuals” as high capability. Rendering quality and logical correctness belong to different dimensions and should be scored separately. Second, drawing conclusions from a single success. Structured generation fluctuates heavily, so repeated sampling is mandatory. Third, ignoring environment differences. The same artifact may behave differently across runtime environments, so evaluation should fix versions and configurations. Fourth, matching answers too loosely. Math problems require exact matching, and it is worth additionally recording cases where “the answer is right but the process is wrong.” Fifth, lacking failure classification. Only by breaking failures down into load failure, runtime exception, missing functionality, and semantic misalignment can you guide subsequent optimization.

    5. A Deployable Evaluation Workflow

    1. Define the task card: state constraints, the sub-feature checklist, and scoring weights clearly.
    2. Fix the environment: unify the runtime environment, rendering approach version, and input prompts.
    3. Execute in layers: verify runnability first, then go through the checklist item by item, and finally check semantic consistency.
    4. Sample repeatedly: regenerate code-generation tasks multiple times and compute pass rates; sample reasoning problems a fixed number of times and record latency.
    5. Archive in a structured way: use a unified table to store observation results per subsystem and the failure stage.
    6. Review and attribute: map failure points to specific subsystems to form comparable cross-model conclusions.

    When engineering support is needed, task cards and observation results can be managed in general cloud capabilities — for example, using object storage to keep artifacts and logs, a message queue to decouple evaluation task scheduling, a container platform to unify runtime environments, and log services with monitoring and alerting to track failure rates and latency fluctuations. This turns evaluation from a one-off manual operation into a continuously running pipeline.

    6. Conclusion

    Evaluating an open-source model on code and math tasks is not about producing a vague single score. The core is a methodology built on “verifiable task cards + layered observation + repeated sampling + failure classification.” When runnability, functional completeness, and semantic consistency are quantified separately, and when reasoning problems are measured for stability through unique answers and multiple rounds of sampling, evaluation conclusions become reproducible and actionable — and can genuinely support technology selection and follow-up optimization decisions.