How to Evaluate Lightweight Language Models: From Geometric Animation to Engineering Delivery

    Lightweight language models should be evaluated by more than generation speed or visual polish. This article presents a rigorous framework for testing them on highly constrained programming tasks, using geometric construction animation as an example. It covers requirement analysis, mathematical modeling, solver design, animation state management, rendering, GIF export, numerical validation, reproducible benchmarking, and total delivery cost.

    1. Define “Capability” Before Evaluating a Lightweight Model

    In AI-assisted programming, “lightweight” usually refers to a model optimized for reasoning resources, response speed, or deployment cost. It does not represent a standardized capability level. A model’s name alone cannot tell you its parameter count, inference cost, generation speed, or ability to complete complex tasks. Nor does it prove that the model must be weaker than a larger one.

    What developers actually need to know is whether a model can handle a requirement with multiple constraints: understand the problem, design a valid solution, generate runnable code, and complete verification and repair.

    That is different from asking whether the model can quickly generate an attractive webpage. A page may include smooth animations, complete buttons, and polished colors while using an invalid core algorithm—or even replacing the requested solving process with a predefined result.

    A meaningful evaluation of complex programming ability should cover at least four dimensions:

    1. Requirement understanding: Does the model identify explicit requirements, implicit conditions, and ambiguities?
    2. Technical correctness: Are the algorithms and mathematical relationships valid, rather than merely visually plausible?
    3. Engineering completeness: Does the program run, and do its interactions, error handling, and export features actually work?
    4. Delivery efficiency: Are the total time, number of human interventions, and resource costs acceptable?

    Geometric construction animation can test all four dimensions at once, provided that the test itself is designed rigorously.

    2. Why Geometric Animation Is More Discriminating Than Ordinary Page Generation

    Consider the following requirement: build a webpage that demonstrates how to construct a regular heptagon using a straightedge with two fixed marks. Start with a square and an auxiliary circle, complete the necessary construction steps, limit the visibility of auxiliary traces, and provide animated export.

    On the surface, this looks like a frontend animation task. In practice, it combines mathematical modeling, numerical solving, state management, graphics rendering, and file encoding.

    Ordinary webpage generation mainly tests layout, styling, and interaction design. This task is more objectively verifiable. For example:

    • Are all seven sides equal?
    • Are the seven vertices on the same circle?
    • Does the straightedge always satisfy the required contact conditions while moving?
    • Does the distance between its two marks remain constant?
    • Does the animated construction actually produce the final result?
    • Does the exported file contain a complete, playable animation?

    These conditions make it possible to distinguish between something that merely looks correct and something that is technically correct.

    However, a single geometry task cannot represent every aspect of a model’s capability. It is better treated as one high-constraint programming benchmark, not as the sole basis for ranking models.

    3. Audit the Problem First: Mathematical Constraints Cannot Be Guessed

    3.1 Distinguish Classical Construction from Marked-Straightedge Construction

    A regular heptagon cannot be constructed exactly with the classical unmarked straightedge and compass. This is an important premise for evaluating the task.

    A straightedge with two fixed marks introduces an additional operation. By moving the straightedge, the two marks can be made to satisfy specific geometric positions simultaneously. This tool therefore cannot be treated as equivalent to an ordinary straightedge and compass.

    However, allowing a marked straightedge does not mean that every movement rule will produce a regular heptagon. The construction still needs to be fully defined and mathematically verified.

    3.2 Convert Natural Language into Executable Constraints

    Let the side length of the initial square be (a), with the lower-left corner (D=(0,0)) and the lower-right corner (E=(a,0)). The perpendicular bisector of the bottom edge is:

    [
    x=\frac{a}{2}
    ]

    A circle centered at (E), with the square’s diagonal as its radius, satisfies:

    [
    (x-a)^2+y^2=2a^2
    ]

    The rules for using the straightedge must then be defined precisely. If “passing through the lower-left corner” means that the line containing the straightedge passes through (D), its direction vector can be written as:

    [
    u=(\cos\theta,\sin\theta)
    ]

    Assume that the two marks have a fixed directed separation (s). Their positions can be expressed as:

    [
    P=t u,\qquad Q=(t+s)u
    ]

    If the first mark lies on the auxiliary circle and the second lies on the perpendicular bisector of the bottom edge, we obtain:

    [
    (t\cos\theta-a)^2+(t\sin\theta)^2=2a^2
    ]

    [
    (t+s)\cos\theta=\frac{a}{2}
    ]

    These equations convert the straightedge movement into a numerical solving problem. They are not, however, a complete proof of a regular-heptagon construction.

    The specification must still define:

    • the relationship between the mark spacing (s) and the square’s side length;
    • the orientation of the two marks;
    • the permitted angular range of the straightedge;
    • which solution to select when there are multiple intersections or roots;
    • how the final contact position determines the heptagon’s side length or another key quantity;
    • the subsequent steps for locating the center, cutting the chord, and closing the construction.

    If these conditions are missing, the model should identify the incomplete information or clearly label any assumptions it introduces. It should not claim to have completed a rigorous construction without qualification.

    Clarifying an underspecified requirement is itself part of complex programming ability.

    4. Separate Solving, Animation, and Presentation

    4.1 Geometry-Solving Layer

    The geometry layer should calculate results without directly manipulating the page. It should receive inputs such as the initial dimensions, mark spacing, construction branch, and tolerance, then return key points, auxiliary lines, auxiliary circles, intersections, and verification results.

    When the constraint equations have multiple solutions, the valid solution should be selected according to the domain, orientation, and construction semantics. A solution should not be accepted merely because it produces a shape that looks plausible.

    Numerical methods also need explicit stopping conditions. If solving fails, the system should return diagnostic information rather than iterate indefinitely or output invalid coordinates.

    4.2 Animation-State Layer

    Animation should not be assembled from a large number of chained delay callbacks. A more reliable approach is to define explicit stages:

    • display the initial square;
    • construct the perpendicular bisector of the bottom edge;
    • draw the auxiliary circle;
    • show the constrained movement of the marked straightedge;
    • mark the position that satisfies the conditions;
    • complete the remaining auxiliary construction;
    • reveal the final polygon edge by edge;
    • display the error metrics and verification result.

    Each stage should define its inputs, outputs, and time range. This makes pause, replay, seeking, and deterministic frame generation possible.

    4.3 Rendering Layer

    The rendering layer should read geometry data and animation progress, rather than deciding geometric conclusions. It can separately manage:

    • the tool currently in motion;
    • completed auxiliary traces that should remain visible;
    • the final shape;
    • explanatory text and status indicators.

    This separation prevents a common failure mode: modifying key coordinates to make the animation smoother, causing the displayed result to violate the original constraints.

    5. How to Implement “Only the Necessary Traces”

    A compass demonstration is not simply a matter of drawing a circle. An instructional animation may need to show the compass opening, needle position, and pencil trajectory without preserving the entire circle.

    The correct approach is to define a valid trace interval for each construction operation—for example, a start angle, an end angle, and a retention rule. The compass pencil can move along the full path, while the persistent drawing layer records only the arc that should remain visible.

    It is especially important to distinguish between two kinds of objects:

    • Transient objects: the straightedge’s current position, the compass posture, and moving marked points;
    • Persistent objects: completed auxiliary arcs, intersection markers, and final edges.

    If every object from every frame is permanently accumulated, the page will contain large amounts of meaningless motion trails. If everything is cleared on every frame, necessary construction history will disappear.

    Therefore, “necessary traces” are not a color or styling issue. They are a drawing-lifecycle problem that must be modeled explicitly.

    6. Animated Export Requires More Than a Button

    Animated export is an effective test of engineering completeness. A visible button and a success message do not prove that the feature works.

    A complete workflow generally includes:

    1. Fix the export dimensions and background.
    2. Define the frame sampling times.
    3. Reconstruct the corresponding animation state for each time point.
    4. Capture the pixels for each frame.
    5. Perform color processing and encoding.
    6. Generate a downloadable file.
    7. Reopen the file and verify its contents.

    Directly recording real-time playback is vulnerable to device load, page changes, and scheduling jitter. A more reliable approach is to generate frames offline from a timeline:

    [
    t_i=i\Delta t
    ]

    where (\Delta t) is the interval between adjacent sampled frames. Each frame should be rendered from a deterministic time state instead of relying on the current playback position.

    Memory use must also be controlled. Uncompressed pixel data grows approximately linearly with width, height, and frame count. Long animations or high-resolution exports should be processed in batches and should provide progress reporting, cancellation, and failure-recovery feedback.

    At minimum, acceptance testing should verify whether the file opens, contains multiple frames, plays in the correct order, includes a complete final frame, and preserves transparency and text correctly.

    7. Replace “It Looks Round and Even” with Numerical Verification

    The correctness of the final shape should be verified independently of the animation.

    Let the seven vertices of the polygon be (V_0,\ldots,V_6). The edge lengths are:

    [
    li=|V{(i+1)\bmod 7}-V_i|
    ]

    Using the average edge length (\bar l), define the relative edge-length error as:

    [
    \varepsilon_l=\frac{\max_i|l_i-\bar l|}{\bar l}
    ]

    If the construction provides a center (O), also calculate the distances from each vertex to the center and check the circumcircle error. After ordering the vertices around the center, the adjacent central angles can be checked against:

    [
    \frac{2\pi}{7}
    ]

    These metrics can show that the final figure is close to a regular heptagon. They cannot prove that the construction process was correct. A program could generate mathematically correct vertices by evenly dividing a circle, then play an unrelated straightedge animation.

    Verification must therefore cover both:

    • Result correctness: edge lengths, radii, angles, and closure satisfy the requirements;
    • Process correctness: key points are actually produced by the specified construction, and the movement constraints remain valid throughout.

    For tasks centered on a process, the second category cannot be replaced by the first.

    8. How to Test Models Fairly and Reproducibly

    Experiences such as “the model took a long time but produced a strong result” or “the page looked complete but was incorrect” can be useful observations. They cannot, by themselves, establish a model ranking.

    Different runtime environments, generation budgets, external dependencies, network conditions, and levels of human intervention can significantly affect the outcome. A fair test should standardize:

    • the same complete task description;
    • the same restrictions on dependency use;
    • the same time and interaction-round budgets;
    • the same runtime environment and acceptance scripts;
    • the same error feedback and repair opportunities.

    The test should also record four separate time measurements:

    • time to the first useful output;
    • time to the first runnable version;
    • time to the first version that passes acceptance tests;
    • time to final repair completion.

    These represent interaction experience, initial usability, correct delivery efficiency, and maintenance cost. They should not be treated as interchangeable.

    A weighted or multidimensional evaluation is more informative than a single visual score:

    Evaluation Dimension Key Checks
    Requirement completeness Does the implementation cover construction, trace control, interaction, and export?
    Mathematical correctness Are the constraints, solution branches, and error metrics reasonable?
    Process consistency Does the animation genuinely correspond to the final result?
    Engineering reliability Are there failures, nonfunctional buttons, or hidden dependencies?
    Maintainability Are the module boundaries and data structures clear?
    Delivery efficiency Are the time, repair rounds, and human interventions acceptable?

    Core mathematical errors and missing critical functions should be treated as severe defects. They should not be offset by a more polished interface.

    9. The Advantages of Lightweight Models That Actually Matter

    Without tying the discussion to a specific product, the potential value of lightweight models lies mainly in resource efficiency, task throughput, and deployment flexibility. These advantages must be validated in the target environment rather than inferred from the label “lightweight.”

    For complex programming tasks, more meaningful advantages include the ability to:

    • turn lengthy requirements into a clear constraint list;
    • identify incomplete or contradictory conditions;
    • separate mathematical logic from presentation;
    • generate implementations that can be tested and repaired;
    • meet acceptance criteria consistently within a limited budget.

    A solution that generates quickly but requires extensive manual rework may not be more economical. A solution that takes slightly longer initially but reduces later repairs may have a lower total delivery cost.

    Model selection should therefore compare the total cost of reaching an accepted result, rather than comparing output speed or visual completeness alone.

    10. Conclusion: The Value of Complex-Constraint Tasks Lies in Traceable Verification

    Geometric animation is not automatically a reliable model benchmark. It becomes discriminating only when the task conditions are sufficient, the construction rules are explicit, the process is inspectable, and the results can be calculated independently.

    For developers, the key question is not whether a demonstration looks impressive. It is whether a complete evidence chain exists:

    • how requirements become constraints;
    • how those constraints are solved;
    • how the solution drives the animation;
    • how the final result is independently verified.

    Whether a lightweight model is suitable for complex programming should ultimately be determined by this evidence chain and by the actual cost of delivery. Producing a correct-looking figure is only the starting point. Explaining where it came from, preserving consistency throughout the process, handling failure cases, and delivering reliable functionality are the more valuable forms of engineering capability.