Evaluating Lightweight LLMs: Insights from an HTML Geometry Animation Test

    General benchmark scores often fail to reflect real-world business scenarios and may suffer from overfitting. Generating HTML pages with complex geometric animations has emerged as an effective, albeit toy-like, testing method for Large Language Models (LLMs). This article explores a geometric animation test involving the construction of a regular heptagon to evaluate LLMs across instruction adherence, spatial reasoning, and coding capabilities. By analyzing common failure modes and proposing a structured evaluation framework, we provide insights into selecting lightweight models that may rival flagship performance in specific reasoning-intensive tasks.

    1. Why We Need “Tricky” HTML Tests

    During model selection, many teams rely on general benchmark scores. However, these leaderboards often suffer from overfitting and deviate from real-world business scenarios. Recently, a “toy-like but effective” testing approach has gained traction: prompting models to directly generate HTML pages containing geometric constructions, physics animations, and interactive logic. These tests seem simple but simultaneously evaluate multiple dimensions:

    • Instruction Following: The prompt includes multi-step drawing processes with a strict order. The model must implement each step sequentially without skipping or inventing steps.
    • Spatial and Geometric Reasoning: Involves spatial relationships like perpendicular bisectors, circular trajectories, and scale line constraints, testing the model’s implicit mathematical reasoning.
    • Code Engineering: Animation rendering, trajectory drawing, and state management require solid programming skills.
    • Self-Constraint Awareness: Restrictions like “the compass leaves traces only on necessary parts” verify if the model understands the difference between auxiliary lines and result lines.

    An interesting phenomenon is that some larger, flagship models fail at such tasks, while lightweight models can fully implement them. This indicates that parameter scale and task performance do not have a simple linear relationship.

    2. Test Case Design: Constructing a Regular Heptagon with a Marked Ruler

    The core prompt for this test describes a classic geometric construction problem, roughly following these steps:

    1. Take a square and construct the perpendicular bisector of its base edge.
    2. Draw a circle centered at the bottom-right vertex with a radius equal to the length of the diagonal.
    3. Using a “marked ruler” (a ruler with two fixed marks), keep one end sliding against the bottom-left vertex so that the first mark always falls on the circle, until the second mark exactly passes through the perpendicular bisector of the base edge.
    4. Complete the subsequent standard compass-and-straightedge construction steps to determine the center.
    5. Add a feature to export the result as a GIF.

    The “trap” in this problem is that the model cannot simply draw a regular heptagon using mathematical formulas. Instead, it must reproduce the animation of this approximate construction process. In other words, the correctness of the answer relies on the authenticity of the process.

    3. Analysis of Common Failure Modes

    In extensive evaluation practices, models fail this type of task in highly consistent ways, which can be categorized into three types:

    1. Deviating Process, Forcing the Result. The most typical failure: the model eventually draws a regular heptagon that visually “seems to meet the requirements,” but the implementation completely mismatches the steps described in the prompt. It adds auxiliary steps not present in the problem to forcefully achieve the result. This is essentially result-oriented opportunistic behavior, violating the core of process-constrained tasks.

    2. Thinking Without Outputting. Some models fall into a loop of long-chain reasoning, delaying code generation, leading to long unresponsive periods. This is fatal for interactive experience.

    3. Unstable and Stuttering Output. The generation process is intermittent with obvious pauses. Even if the final result is correct, engineering usability is significantly compromised.

    4. Evaluation Framework: Building an Objective Assessment System

    Teams are advised to establish the following structured evaluation process:

    Control Group Design: Select models with different positioning (flagship, lightweight) as control groups. Conduct horizontal comparisons under the same prompt and parameter configuration to avoid biases from “single-point observations.”

    Quantitative Scoring Dimensions:

    1. Scorecard Example (Total 100 points):
    2. - Instruction Following (40 pts): Are steps implemented in order? Are steps self-invented?
    3. - Geometric Correctness (20 pts): Is the final shape a regular heptagon? Are auxiliary lines reasonable?
    4. - Animation Implementation (20 pts): Are trajectory drawing and timing control smooth?
    5. - Additional Features (10 pts): Are extended requirements like GIF export completed?
    6. - Generation Quality (10 pts): Response speed, presence of "thinking without outputting"

    Key Judgment Principle: A correct result with an incorrect process should be judged as a failure, not a partial success. This is the core of process-constrained evaluations.

    5. Positioning and Selection of Lightweight Models

    A noteworthy conclusion from the evaluation is that lightweight models can approach flagship model performance in complex reasoning tasks, often at the cost of slower generation speed. This offers inspiration for engineering selection:

    • Don’t Judge Solely by Parameter Size: Lightweight models may deliver unexpected performance in specific reasoning-intensive tasks, suitable for cost-sensitive scenarios that still demand decent quality.
    • Balance Speed and Quality: If response latency is a core metric, real throughput must be tested rather than just looking at capabilities.
    • Build Proprietary Test Sets: Accumulate a batch of private prompts that “can distinguish model tiers,” like the HTML geometry problem in this article. These reflect business fit better than public leaderboards.

    6. Conclusion

    The value of HTML animation tests lies not in their “toy-like” nature, but in compressing instruction following, spatial reasoning, and code generation into a single, quickly verifiable task. For developers, rather than chasing leaderboard rankings, it is better to construct a proprietary evaluation system containing process-constrained problems, using real performance to guide technical selection. In the current era of rapid LLM iteration, this pragmatic methodology is particularly important.