Evaluating Lightweight Models for Coding: A Geometric Animation Case Study

    This article uses a geometric construction animation as a case study to explain how to evaluate lightweight models for coding tasks beyond visual output. It covers mathematical clarification, constraint modeling, animation-to-computation consistency, export and interaction verification, and a test framework that balances correctness, reliability, latency, and cost. Readers get a practical checklist for judging whether generated code is verifiable, reproducible, and maintainable.

    1. Why Evaluating Lightweight Models Requires More Than Output Quality

    When lightweight models are used to assist development, they are often expected to meet three goals at once: fast response, controllable cost, and code that can be used directly. These goals are not naturally aligned. Fast generation does not mean reliable handling of complex constraints, and a visually complete page does not mean the code actually implements the algorithm the user requested.

    Geometric construction animation is a typical example. A page can show a regular heptagon, arcs, auxiliary lines, and a play button, looking quite complete, while the internal implementation may simply precompute vertices and display elements in a fixed time sequence. This approach can complete the task of “showing a result,” but it may not complete the task of “deriving and constructing the result according to a specified method.”

    Therefore, the core question when evaluating a lightweight model is not whether it can write a beautiful page, but whether it can:

    • Identify the mathematical premises and information gaps in the task;
    • Translate natural-language constraints into executable program logic;
    • Ensure that the animation process matches the actual computation process;
    • Deliver code that is verifiable, reproducible, and maintainable;
    • After meeting the quality threshold, keep time and resource overhead reasonable.

    These questions are closer to real development scenarios than simply comparing output length, visual presentation, or first-response speed.

    2. Turning a Geometric Animation Task into Acceptable Engineering Requirements

    Consider a task: display on a webpage the process of constructing a regular heptagon using a ruler with two marks, including a square, the perpendicular bisector of the base, a specified circle, ruler sliding, auxiliary construction, trajectory control, and animation export.

    This description involves multiple interrelated but distinct layers.

    2.1 Mathematical Layer: Are the Construction Rules Clear?

    First, it must be clarified that a classical unmarked straightedge and compass cannot exactly construct a regular heptagon. After introducing a marked ruler and specific simultaneous alignment operations, the allowed set of operations changes, and the task can no longer be understood under the restrictions of traditional straightedge-and-compass construction.

    However, “a stronger tool” does not mean the given steps are inherently complete. Before development, it is still necessary to confirm:

    • How the distance between the two marks is defined;
    • Whether the ruler must pass through a fixed point, or only an edge must touch a fixed point;
    • Which mark lies on the circle and which mark lies on the specified line;
    • Which position should be selected when multiple positions satisfy the conditions;
    • How the points obtained after alignment are converted into the side length, vertices, or center of the regular heptagon;
    • Which known points and segments are used in subsequent construction.

    If these points are not determined, the model should ask clarifying questions or explicitly list the assumptions it adopts, rather than inventing unproven steps on its own.

    In particular, a position that satisfies the ruler alignment condition does not automatically prove that the subsequent figure is a regular heptagon. Geometric derivation and numerical verification are both required.

    2.2 Animation Layer: The Display Process Must Correspond to the Computation Process

    Animation cannot simply split the final figure into several segments for playback. Each visible step should map to an actual construction operation, such as creating a midpoint, drawing an auxiliary arc, computing an intersection, selecting a valid intersection, moving the ruler, and determining the target position.

    If the page shows “obtaining an intersection through two arcs” while the code directly reads preset coordinates, then the display process and the computation process are inconsistent.

    2.3 Delivery Layer: Complete Features Are Not Just Buttons

    Play, pause, reset, step execution, speed adjustment, and animated image export should all have verifiable behavior definitions.

    For example, “export animated image” cannot merely show a completion prompt, nor can it download a static screenshot and claim that the feature is implemented. Acceptance should confirm that the file actually contains multiple frames, that the playback order is correct, that the inter-frame delay is effective, and that it is consistent with the key states of the page animation.

    3. Build a Constraint Model Instead of Drawing the Result First and Adding Process Later

    A reliable implementation usually starts with mathematical objects and constraint relationships, not with page layout.

    Let the side length of the square be a, with the lower-left corner at D=(0,0) and the lower-right corner at E=(a,0). If the specified circle is centered at E with the square diagonal as its radius, the equation of the circle is:

    (x-a)²+y²=2a²

    The perpendicular bisector of the base is:

    x=a/2

    Under one explicit convention, the line containing the ruler passes through D, the two mark points are P and Q, and the mark spacing is s. Using the unit direction vector u=(cosθ,sinθ), this can be expressed as:

    P=t·u

    Q=(t+s)·u

    Then add constraints according to the task requirements:

    • P lies on the specified circle;
    • Q lies on the perpendicular bisector of the base;
    • θ and t satisfy the selected direction, interval, and position requirements.

    This only formalizes one interpretation of the task; it does not mean the complete construction has already been proven. If the order of the marks, the contact method, or the allowed positions differ in the actual task, the equations must be adjusted accordingly.

    After formalization, the program can use numerical methods to solve the problem, but it should handle three issues at the same time.

    First, solver failure. Some parameter combinations may have no solution, or the iteration may not converge, and the page should provide a clear status.

    Second, multiple-solution selection. There may be more than one position satisfying the algebraic constraints, and it is necessary to filter based on the figure region, ruler direction, and subsequent construction requirements.

    Third, residual verification. A numerical value returned by the solver does not mean the constraints have been satisfied; each error must be recomputed.

    The following schematic logic can be used:

    1. candidate = solve_constraints(configuration)
    2. if candidate is absent:
    3. report_failure("No position satisfying the constraints was found")
    4. else:
    5. errors = evaluate_constraints(candidate)
    6. if maximum(errors) > tolerance:
    7. report_failure("Constraint error exceeds the allowed range")
    8. else:
    9. accept(candidate)

    The tolerance should match the coordinate scale and numerical precision, and it must not be loosened arbitrarily just to make the result pass.

    4. Identifying Plausible Procedural Shortcuts

    In complex generation tasks, one hidden problem is that the model understands the final image but bypasses the specified method.

    4.1 Directly Generating the Vertices of a Regular Heptagon

    By equally dividing the circle angle, the vertices of a regular heptagon can be computed conveniently:

    θₖ=θ₀+2πk/7

    Connecting the vertices in order then produces a regular figure.

    This formula is suitable for generating a reference answer or validating a result, but if the task explicitly requires showing a specific construction process, it cannot be used as a substitute for the construction path. Otherwise, the page accurately draws the target shape but does not complete the target method.

    The ruler first slides and then suddenly stops at a preset position, which may look natural. But if the stopping position is not obtained through the specified constraints, then “searching for a position that satisfies the conditions” is only a decorative performance.

    It is necessary to check whether the final state of the ruler satisfies the actual constraints and to verify its data dependency with subsequent construction.

    4.3 Adding Unsupported Auxiliary Steps

    When the model cannot derive the next step from the known conditions, it may add new points, lines, or circles so that the figure eventually approaches the target.

    Auxiliary steps are not a problem in themselves. The question is whether they depend only on currently known objects and whether they comply with the allowed operation rules. Points without provenance and unexplained lengths should become key acceptance checks.

    4.4 Treating a Feature Entry Point as Feature Implementation

    The existence of an export button does not mean the export pipeline works. Dependency loading failures, incomplete rendering, inconsistent frame sizes, and background execution throttling can all cause export failures. Evaluation cannot stop at the level of UI screenshots.

    5. Giving Geometric Animation a Verifiable Engineering Structure

    To reduce implementation and acceptance difficulty, the program can be divided into four parts.

    5.1 Geometric Computation Layer

    This layer handles points, lines, circles, intersections, distances, angles, and constraint solving, independent of the page display state.

    This layer should use deterministic input/output design as much as possible so that the same set of parameters produces the same result, facilitating unit testing and fault localization.

    5.2 Construction Step Layer

    Use structured data to record each operation:

    • Which existing objects are depended on;
    • Which new objects are created;
    • Which auxiliary lines need to be displayed;
    • Which trajectories need to be retained;
    • Which mathematical constraint the step corresponds to.

    This supports step-by-step demonstration and prevents the animation script from becoming disconnected from the mathematical computation.

    5.3 Timeline and Rendering Layer

    The frame at any moment should be determined by time and construction data, rather than depending on whether playback has been completed before.

    This design helps implement pause, seek, replay, and offline export, and it can also reduce problems such as a corrupted display after dragging the progress bar to the middle.

    5.4 Export Layer

    Animated image export should reuse the same rendering logic, sample frames at scheduled times, and complete frame encoding and file generation.

    Export cost usually grows with resolution, frame count, and scene complexity. The implementation needs to control peak memory, show progress, and support cancellation. For longer animations, only key construction intervals can be exported to avoid meaningless static frames continuously consuming resources.

    6. Building an Acceptance System Covering Both Mathematics and Engineering

    An effective test suite should include at least the following dimensions.

    Mathematical Correctness

    Verify whether base points lie on the specified objects, whether the ruler mark spacing remains constant, whether the selected intersection satisfies its definition, and whether the final heptagon’s side lengths and central angles are consistent.

    For the final vertices, check the dispersion of adjacent vertex distances and, after determining the center, check whether adjacent central angles are close to 2π/7. However, numerical results only show consistency within the error range; they cannot replace geometric proof.

    Instruction Following

    Confirm whether the implementation uses the specified tools and operations, whether it fills in the necessary steps, whether it explicitly states assumptions, and whether it bypasses the specified path with direct computation.

    Interaction Reliability

    Test rapid repeated clicks, repeated resets, dragging progress during playback, and switching state during export. Many pages work correctly on the default playback path but show state mismatches under combinations of interactions.

    Reproducibility

    Fix the task version, runtime environment, resource limits, and acceptance method, and save raw output, execution logs, and failure cases. One successful run cannot represent stable capability.

    7. How to Fairly Compare the Development Value of Lightweight Models

    A single geometric task can expose problems, but it is not enough to prove that one model is overall better than another. A more reasonable method is to build a task set containing multiple levels of constraint complexity and conduct multiple independent tests.

    Evaluation metrics can be divided into four groups:

    • Quality metrics: mathematical correctness rate, requirement coverage, code runnable rate;
    • Reliability metrics: repeated test pass rate, edge-case pass rate, regression after fixes;
    • Latency metrics: time to first useful feedback, time to first runnable result, time to final acceptance;
    • Cost metrics: call consumption, manual review time, rework count, and runtime resources.

    In particular, distinguish between “generation complete” and “task complete.” A piece of code may be output quickly but require repeated repairs by the developer, and its actual delivery cost may be higher. Conversely, a longer generation process cannot automatically be interpreted as more sufficient reasoning; results still need to be verified.

    In addition, visible thinking summaries or intermediate text in the interface are not suitable as primary evidence for capability judgment. What should really be evaluated is the executable artifact, constraint satisfaction, and repeated experiment performance.

    8. Conclusion: Measure Model Ability by Constraint Satisfaction and Effective Delivery

    The value of complex geometric animation is not that it alone represents all coding ability, but that it simultaneously requires mathematical understanding, condition modeling, process fidelity, state management, and engineering delivery, and can reveal problems that simple page demonstrations easily hide.

    When choosing a lightweight model, establish the correctness threshold first, then compare speed and cost; verify the implementation path first, then evaluate the final image; check repeatable delivery results first, then discuss model capability.

    For developers, the most practical approach is to write requirements as verifiable constraints, express the construction process as traceable data, and build animation and export on the same computation logic. In this way, model-generated code is not merely “looks complete,” but truly has reviewable, reproducible, and maintainable engineering value.