Evaluating Lightweight LLMs with a Geometry Drawing Task: A Reproducible Method with Acceptance Checks
A rigorous evaluation of lightweight language models needs more than a final screenshot. This article shows how to turn a complex front-end geometry task—constructing a regular heptagon with a two-marked ruler and exporting a GIF—into machine-checkable constraints, complete with an acceptance table, statistical methodology, and runnable Node.js validation code.
Introduction: Define Acceptance Criteria First, Then Look at Model Performance
When evaluating lightweight models, many teams rely on a single final screenshot. A good-looking screenshot does not mean the constraints were actually satisfied. A page might display a square and a circle, but the two-marked ruler may not be pinned to the specified vertex, and the compass trace may cover the entire canvas. This article uses a complex front-end geometry task to demonstrate how to rewrite “does it look right” into verifiable conditions, and provides acceptance code you can run directly.
The key takeaway up front: the core of evaluation is expressing the task as coordinates and thresholds, letting a program—not the human eye—judge the result. Only then can the data be compared across models and across time.
1. Why Use Complex Geometry Drawing for Evaluation
Lightweight models are typically designed for low inference cost, high throughput, or easy deployment. Evaluating them only with short code completion, simple Q&A, or single static pages easily leads to a “good enough” conclusion, while revealing nothing about how the model handles multi-constraint, multi-stage tasks.
Complex front-end geometry drawing is a good stress test. It simultaneously requires mathematical construction, spatial reasoning, front-end rendering, animation timeline design, and file export. A failure in any of these stages will surface in the final artifact.
The task in this article is not tied to any specific product. It can be abstracted into one sentence: can a lightweight model, under a limited prompt, complete a multi-stage front-end geometry generation task? A typical use case: construct a regular heptagon with a two-marked ruler on a web page, and export it as a GIF.
1.1 Coordinate Definitions
To avoid divergent interpretations of the figure, this article fixes the coordinates first. The four vertices of square DEFG are:
- D(0, 0), bottom-left
- E(2, 0), bottom-right
- F(2, 2), top-right
- G(0, 2), top-left
The side length is a = 2. The perpendicular bisector of the bottom edge DE is the line x = 1. Circle E is centered at E with the diagonal EG as its radius, i.e., r = 2√2 ≈ 2.828.
1.2 Constraints of the Two-Marked Ruler
A two-marked ruler carries two marks; the distance between them is denoted d. This article sets d = a = 2 as a parameter chosen for easy verification. The constraints are:
- One end of the ruler always stays pinned at D.
- The first mark P moves along circle E.
- The second mark Q lands on the perpendicular bisector x = 1.
- Points P, Q, and D are collinear, and |PQ| = 2.
Let θ be the angle between the ruler and the bottom edge DE, and let c = cos θ. Since Q has x-coordinate 1, the length DQ equals 1/c. P lies on the ray DQ at distance 2 beyond Q, so the distance from P to D is s = 1/c + 2. Because P lies on circle E, it satisfies:
s² − 4sc − 4 = 0
Substituting s = 1/c + 2 and simplifying yields:
8c³ + 4c² − 4c − 1 = 0
This cubic has three roots, corresponding to cos(2π/7), cos(4π/7), and cos(6π/7). Acceptance should only accept the solution with c > 0, i.e., c = cos(2π/7) ≈ 0.6235, θ ≈ 51.43°. This angle is exactly the central angle of a regular heptagon, 2π/7, and serves as a cross-check for the later construction.
Numerical verification: P ≈ (2.247, 2.817), |PE| ≈ 2.828, matching the radius of circle E.
1.3 Compass Trace
The original task requires the compass to leave a trace only where necessary. Whether the trace is “only where necessary” must be described in terms of the angular intervals of arc segments. The acceptance rule in this article is: the number of visible compass arcs is 1, and the arc span is greater than 0 degrees and no more than 180 degrees. Any trace outside this range counts as abuse.
2. Acceptance Table
The table below converts five categories of acceptance items into executable checks. Each row specifies inputs, method, threshold, and a failure example.
| Acceptance Item | Input Data | Check Method | Threshold | Failure Example | ||
|---|---|---|---|---|---|---|
| Square vertices | Coordinates of D, E, F, G | Point-by-point comparison with theoretical coordinates | Error ≤ 1e-3 | Square with side length 1.5 | ||
| Perpendicular bisector | Two endpoints of the line | Check the x-values of both endpoints | Both equal 1 ± 1e-3 | Bisector is tilted | ||
| Circle E radius | Radius r | Compare with 2√2 | Error ≤ 1e-3 | Radius mistakenly set to side length 2 | ||
| Circle center | Center coordinates | Compare with E | Error ≤ 1e-3 | Center placed at D | ||
| Ruler pivot | Ruler endpoint | Compare with D | Error ≤ 1e-3 | Pivot offset from D by 0.05 | ||
| Mark spacing | Coordinates of P, Q | Compute \ | PQ\ | Difference from 2 ≤ 1e-3 | Spacing of 2.5 | |
| Mark P on circle | P coordinates | Compute difference between \ | PE\ | and r | ≤ 1e-3 | P outside the circle by 0.1 |
| Mark Q on bisector | Q coordinates | Check the x-value | Difference from 1 ≤ 1e-3 | Q at x = 1.2 | ||
| Ruler angle | Direction angle of Q relative to D | Compare with 2π/7 | Error ≤ 0.05° | Angle of 45° | ||
| Compass trace | List of visible arcs | Count arcs and compute span | 1 arc, span 0–180 degrees | Full circle visible | ||
| Stage order | List of completed stages | Compare with standard order | Five stages completed in order | Skipping animate | ||
| GIF frame count | Number of frames | Compare with lower bound | At least 60 frames | Only the last frame exported | ||
| GIF size | Width | Compare with lower bound | At least 480 px | Width of 200 px | ||
| GIF frame rate | Frame rate | Range check | 10 to 25 fps | Frame rate of 1 fps |
The thresholds in the table are starting values chosen for this article. The original task does not specify exact numbers; teams should adjust them according to target devices and business requirements, and state the values used in their reports.
3. Evaluation Dimensions and Statistical Methods
The acceptance table answers “is this single output acceptable?” To judge a model’s overall capability, you also need multiple runs and multiple test cases.
3.1 Four Dimensions
- Correctness and constraint compliance: judged by the acceptance table in Section 2; the result is pass or fail.
- Process explainability: stage status must be generated by code, not declared by the model itself. The model may output a structure like the one below, but
constraintsSatisfiedshould be written by the acceptance function:
{"stage": "construct","completedStages": ["plan", "construct"],"constraintsSatisfied": false,"warnings": ["ruler-pivot-offset"]}
- Stability: record whether each run got stuck, timed out, or needed retries.
- Cost and latency: record per-stage duration, retry counts, and peak memory.
3.2 Statistical Method
A single run cannot represent a model’s capability. We recommend the following approach:
- Run each model on each test case at least 5 times. If you want to report P95 latency, you need at least 20 runs per group; otherwise P95 fluctuates heavily. With small samples, report only the median and maximum.
- For each group, compute the mean and sample standard deviation to observe latency stability.
- Failure rate = failures / runs. With small samples, the confidence interval of the failure rate is wide. For example, 0 failures in 5 runs does not prove the failure rate is 0. We recommend reporting a Wilson confidence interval, or simply increasing the number of runs.
- Use at least 3 test cases of similar difficulty. Passing one case does not imply that other cases will also pass.
Single-case comparisons are easily misleading. A model approaching a high-spec model on one task does not mean it does so across all tasks—and vice versa.
4. Runnable Acceptance Functions
The following code runs on Node.js 18 and above with no external dependencies. art is the artifact object for each stage, containing vertices, lines, the circle, the ruler, compass arcs, GIF metadata, and the list of completed stages.
const EPS = 1e-3;const ANGLE_TOL = (0.05 * Math.PI) / 180;const HEPTAGON_ANGLE = (2 * Math.PI) / 7;const STAGES = ["plan", "construct", "animate", "encode", "validate"];const MIN_FRAMES = 60;const MIN_WIDTH = 480;const dist = (p, q) => Math.hypot(p.x - q.x, p.y - q.y);const near = (a, b, tol = EPS) => Math.abs(a - b) <= tol;function rulerAngleOk(ruler) {if (!ruler) return false;const { pivot, markQ } = ruler;const theta = Math.atan2(markQ.y - pivot.y, markQ.x - pivot.x);return Math.abs(theta - HEPTAGON_ANGLE) <= ANGLE_TOL;}function checkConstraints(art) {const D = { x: 0, y: 0 };const E = { x: 2, y: 0 };const F = { x: 2, y: 2 };const G = { x: 0, y: 2 };const v = art.vertices ?? {};const { midline, circleE, ruler, arcs } = art;return {squareVertices:Boolean(v.D && v.E && v.F && v.G) &&dist(v.D, D) <= EPS && dist(v.E, E) <= EPS &&dist(v.F, F) <= EPS && dist(v.G, G) <= EPS,midlineAtX1:Boolean(midline) && near(midline.p1.x, 1) && near(midline.p2.x, 1),circleRadius:Boolean(circleE) && near(circleE.r, 2 * Math.SQRT2),circleCenterAtE:Boolean(circleE) && dist(circleE.center, E) <= EPS,pivotAtD:Boolean(ruler) && dist(ruler.pivot, D) <= EPS,markSpacing:Boolean(ruler) && near(dist(ruler.markP, ruler.markQ), 2),markPOnCircle:Boolean(ruler && circleE) &&near(dist(ruler.markP, circleE.center), circleE.r),markQOnMidline:Boolean(ruler) && near(ruler.markQ.x, 1),rulerAngle:rulerAngleOk(ruler),compassTrace:Boolean(arcs) &&arcs.visible.length === 1 &&arcs.visible[0].spanDeg > 0 &&arcs.visible[0].spanDeg <= 180,};}function validateStage(stage, art = {}) {const failures = [];const warnings = art.warnings ?? [];if (!art.svg) failures.push("missing-svg");const checks = checkConstraints(art);if (!checks.squareVertices) failures.push("square-vertices");if (!checks.midlineAtX1) failures.push("midline-not-at-x1");if (!checks.circleRadius) failures.push("circle-radius");if (!checks.circleCenterAtE) failures.push("circle-center");if (!checks.pivotAtD) failures.push("ruler-pivot");if (!checks.markSpacing) failures.push("mark-spacing");if (!checks.markPOnCircle) failures.push("mark-p-on-circle");if (!checks.markQOnMidline) failures.push("mark-q-on-midline");if (!checks.rulerAngle) failures.push("ruler-angle");if (!checks.compassTrace) failures.push("compass-trace");// Stage order: completed stages must follow the canonical orderconst completed = art.completedStages ?? [];const lastIndex = completed.reduce((acc, s) => Math.max(acc, STAGES.indexOf(s)), -1);const ordered = completed.every((s, i) => STAGES.indexOf(s) >= 0 &&(i === 0 || STAGES.indexOf(s) > STAGES.indexOf(completed[i - 1])));if (!ordered || lastIndex < STAGES.indexOf(stage)) failures.push("stage-order");// GIF checks (only relevant once encoding is done)if (stage === "validate" && art.gif) {if ((art.gif.frames ?? 0) < MIN_FRAMES) failures.push("gif-frames");if ((art.gif.width ?? 0) < MIN_WIDTH) failures.push("gif-width");const fps = art.gif.fps ?? 0;if (fps < 10 || fps > 25) failures.push("gif-fps");}return { stage, passed: failures.length === 0, failures, warnings };}
The validateStage function returns a structured result with the stage name, pass/fail status, failure codes, and warnings, so it can be logged and aggregated directly into your evaluation pipeline.
5. Conclusion
Evaluating lightweight models on complex tasks requires turning subjective impressions into coordinates, thresholds, and programmatic checks. By fixing the geometry, defining per-item acceptance criteria with concrete tolerances, running enough repetitions with sound statistics, and validating outputs with runnable code, teams can produce evaluation data that is reproducible and comparable across models and over time. The method shown here—acceptance table plus statistical discipline plus executable validators—generalizes to other multi-stage front-end generation tasks beyond geometry drawing.
