Evaluating Lightweight LLMs with an HTML Geometry Animation Task

    An HTML animation of a regular heptagon construction provides a practical test of instruction following, geometric reasoning, and long-form code generation. This article examines a comparison between a lightweight reasoning model and a flagship model, explains why a visually correct result can conceal an incorrect implementation, and outlines evaluation and deployment practices for engineering teams.

    1. Rethinking the Capabilities of Lightweight Models

    Model selection has long been shaped by a familiar assumption: lightweight large language models, typically characterized by smaller parameter counts and lower inference costs, are suitable only for simple tasks. Complex reasoning and demanding code generation should be left to flagship models.

    Improvements in model architectures, training data quality, and post-training alignment are challenging that assumption. On some tasks, newer lightweight models can approach the performance of much larger models.

    For developers and technical decision-makers, this calls for a different approach to evaluation. Parameter counts and published benchmark scores are not enough. Teams also need practical tests that reveal where a model succeeds, where it fails, and whether it follows the required implementation process.

    This article explores one such test: generating a complex HTML geometry animation to assess instruction following, spatial reasoning, and the ability to produce a complete, multi-stage application.

    2. Designing a Task That Exposes Meaningful Differences

    2.1 The Task

    The model was asked to generate an HTML page that animates the construction of a regular heptagon using a two-mark ruler. The required construction sequence and implementation constraints were:

    • Draw a square, then construct the perpendicular bisector of its bottom side.
    • Draw a circle centered at the square’s bottom-right vertex, with a radius equal to the square’s diagonal.
    • Use a ruler with two marks at a fixed distance apart. Keep its edge passing through the square’s bottom-left vertex while moving the first mark along the circle, until the second mark lies on the perpendicular bisector of the bottom side.
    • Complete the remaining standard straightedge-and-compass steps, including locating the center, drawing the circumcircle, and dividing the circumference into equal parts.
    • Retain only the necessary compass traces, reflecting the behavior of a construction in which marks are left only where needed.
    • Provide a feature for exporting the animation as a GIF.

    2.2 Why This Task Is Discriminating

    Although it looks like a front-end animation request, the task combines several distinct challenges.

    Mathematical understanding. A two-mark ruler enables a neusis construction, a classical geometric method that goes beyond unmarked straightedge-and-compass construction. A regular heptagon cannot be constructed exactly using a conventional straightedge and compass alone. The model must understand the marked-ruler method well enough to translate the description into coordinate calculations and animation logic.

    Instruction following. The prompt specifies the construction order, how the tools must be used, and which traces should remain visible. A model can take a shortcut by calculating the heptagon’s vertices directly with trigonometric functions. That may produce the right shape, but it does not demonstrate the requested construction. A correct-looking result reached through the wrong process is a failure under these constraints.

    Long-form code generation and state management. A complete implementation requires coordinated construction stages, Canvas or SVG rendering, animation timing, and GIF encoding. The resulting application can run to several hundred lines of code, making planning and implementation completeness important parts of the test.

    3. Observed Results: Lightweight Versus Flagship

    3.1 Comparison Setup

    The comparison used the same prompt for a lightweight reasoning model and a flagship model, with reasoning mode enabled for both.

    The evaluation recorded three aspects of each run:

    • Observable characteristics of the reasoning output
    • Total completion time
    • Geometric correctness and compliance with the requested construction process

    3.2 The Lightweight Model

    The lightweight model’s visible reasoning output progressed in bursts rather than at a steady pace. There were also long intervals with no new output. Total completion time was slightly over 30 minutes, which was a substantial delay.

    The final HTML page, however, followed the requested construction sequence closely. It included the square, perpendicular bisector, auxiliary circle, sliding two-mark ruler, and subsequent straightedge-and-compass steps. Its handling of compass traces also matched the requirement to retain marks only where necessary.

    In this test, the lightweight model demonstrated strong adherence to the instructions and an ability to handle complex geometric reasoning. Its main weakness was efficiency: a wait of more than half an hour is a significant drawback for interactive coding.

    Task decomposition and asynchronous generation can help accommodate such delays in practical workflows, but the latency remains an important selection criterion.

    3.3 The Flagship Model’s Failure to Follow the Process

    The flagship model completed its output in approximately 20 minutes. Its page appeared convincing: it displayed a regular heptagon, and the animation was reasonably smooth.

    Code inspection revealed a different picture. The implementation did not follow the prescribed construction. It introduced steps that were not in the prompt and reached the final shape through a different process.

    This illustrates a common evaluation trap: a visually correct result can conceal a noncompliant implementation. Reviewing only the rendered animation could lead an evaluator to credit the model with capabilities that the code did not demonstrate.

    In engineering work, process requirements can be essential. An implementation may need to follow a specified algorithm or comply with an established workflow. Under those conditions, reaching an approximately correct result is not enough.

    This single failure does not establish that the flagship model is generally less capable. It does show why model size should not be treated as a reliable proxy for adherence to complex instructions.

    4. Lessons for Model Evaluation

    The comparison suggests several reusable evaluation principles.

    1. Test the Process as Well as the Result

    A useful evaluation task should have a verifiable outcome and explicit constraints on how that outcome is produced. This helps distinguish faithful implementation from shortcuts that merely reproduce the expected appearance.

    2. Assess Observable Execution Behavior

    The timing and continuity of visible reasoning output, long pauses, and inconsistencies between a stated approach and the delivered implementation can all affect engineering usability. These observations should complement, rather than replace, inspection of the final artifact.

    3. Inspect Outputs That Look Correct

    Review the implementation, not just the rendered page. Check whether the model bypassed required steps or introduced operations outside the requested construction.

    For this task, the final polygon alone was insufficient evidence of success. The construction sequence was part of the deliverable.

    4. Validate Across Multiple Tasks

    A single task is vulnerable to task-specific strengths, weaknesses, and variation between runs. A broader evaluation set should include mathematical reasoning, code generation, and long-document comprehension to build a more stable picture of model capabilities.

    5. Consider Cost Alongside Quality and Latency

    If a lightweight model meets the quality requirements of a core workload, lower inference costs and deployment flexibility may make it the better practical choice.

    This can be especially relevant to high-volume batch processing, where response time is less critical. For interactive applications, the same model’s long completion time may outweigh those advantages.

    5. Recommendations for Production Use

    Teams adopting models for complex generation tasks should consider asynchronous pipelines. Task queues and progress callbacks can prevent long-running requests from blocking the user workflow.

    Generated outputs should also pass automated structural checks. For example, validation can check whether the generated code invokes the required construction stages. Such checks help identify deviations that a visual review might miss.

    Evaluation suites should be included in continuous integration workflows. When a model version changes, automated regression tests can help detect losses in instruction following or implementation quality.

    Cloud-hosted inference services, together with monitoring and alerting capabilities, can support these evaluation and deployment workflows without requiring teams to build every component themselves.

    Conclusion

    A carefully designed HTML geometry task can reveal differences that broad labels such as “lightweight” and “flagship” miss.

    In this comparison, the lightweight model took longer but followed the required construction, while the flagship model produced a convincing animation through a noncompliant process. The lesson is not that one model category is universally better. It is that model evaluation must examine how an answer was implemented, not just how the result looks.

    For technical selection, instruction adherence and process correctness belong alongside output quality, latency, and cost.