Evaluating LLM Instruction Following with Geometric Construction Tasks

    Geometric construction tasks can reveal whether a large language model follows a prescribed process rather than merely producing a correct-looking result. This article outlines an evaluation framework covering geometric correctness, procedural consistency, delivery completeness, and response experience, with Python checks, common failure modes, and practical guidance for repeatable testing.

    1. Why Evaluate Models with Generative Tasks?

    Code generation and frontend generation are becoming part of everyday development workflows. Teams therefore need evaluations that reflect whether models can deliver usable results. Multiple-choice tests and knowledge-based question answering primarily assess recall and reasoning; they do not establish whether a model can follow a complex workflow and produce a working artifact.

    Generative tasks, such as building a runnable web animation, can assess four capabilities at once: understanding requirements, planning steps, writing code, and managing implementation details. Instruction following is particularly easy to overlook. A model may produce something that looks correct while using an implementation that differs substantially from the requested method.

    2. Designing a Geometric Construction Test

    Geometric construction is well suited to this type of evaluation. A prompt can specify an explicit sequence of operations, each with a defined geometric meaning, while the final result can be checked numerically or visually.

    Consider a task that asks a model to construct a regular heptagon using a ruler with two marked points. Such a prompt typically requires three things:

    • Follow every construction step in the specified order, without adding or skipping steps.
    • Retain construction marks only where required and hide other intermediate traces.
    • Export the construction process as an animation, such as a GIF file.

    The main challenge is compliance with the prescribed process. There are multiple ways to produce a regular heptagon, but the task specifies one particular path. If the model introduces extra auxiliary lines or substitutes a different construction method, the result fails to meet the requirements even if the final shape is correct.

    That deviation also matters in teaching demonstrations and other settings where users need to reproduce the construction process.

    3. Separate the Evaluation into Four Dimensions

    Judging only the final screenshot can lead to misleading conclusions. Score the following four dimensions separately.

    3.1. Result Correctness

    Check whether the final figure satisfies the required geometric conditions. For a regular polygon, verify that all side lengths are equal and all interior angles are equal.

    Because floating-point errors can occur during construction, these comparisons need a tolerance rather than strict equality.

    3.2. Procedural Consistency

    Compare the model’s construction steps against the prompt, step by step. This dimension should carry the greatest weight.

    A correct result produced through a noncompliant process should fail the evaluation. The user requested a specific method. If the model silently replaces it, the output cannot reliably support teaching, verification, or reproduction.

    3.3. Delivery Completeness

    Check whether every requested feature is present. For example:

    • Does the animation play?
    • Does GIF export work?
    • Do construction traces follow the specified visibility rules?

    Missing functionality can usually be confirmed by inspecting the code structure and running the result.

    3.4. Response Experience

    Record time to first token, total completion time, and how smoothly the response is delivered.

    Track cases where the model performs reasoning but produces no final answer as a separate failure category. From a user’s perspective, waiting tens of minutes without receiving a usable output is no different from a direct failure.

    4. Common Failure Modes

    Several problems recur in practical testing.

    1. Correct result, incorrect process. The final figure is correct, but the construction uses auxiliary elements that the prompt did not permit. Detecting this usually requires manual review or rule-based checks against step logs.

    2. Reasoning without a deliverable. The model performs reasoning but provides no usable code or page. Evaluators should distinguish any separately available reasoning segment from the final output. Only the final output should undergo functional checks.

    3. Missing functionality. The page displays the figure, but the animation does not play or the export feature is absent. The code often provides clear evidence of the omission.

    4. Accumulated errors prevent closure. Small errors can compound across construction steps. The resulting vertices may fail to close the polygon, or side-length differences may exceed the tolerance. Check whether the implementation uses appropriate numerical precision and tolerances.

    5. Basic Automated Checks

    Relying entirely on manual review is expensive. The following example illustrates two basic checks: whether the model produced a plausible output and whether polygon vertices have consistent side lengths.

    Keyword detection is only an initial screening method. It cannot replace browser rendering tests or geometric validation.

    1. import math
    2. from dataclasses import dataclass, field
    3. @dataclass
    4. class EvalResult:
    5. has_output: bool = False
    6. has_html: bool = False
    7. has_animation: bool = False
    8. has_gif_export: bool = False
    9. first_token_latency: float = 0.0
    10. total_latency: float = 0.0
    11. issues: list = field(default_factory=list)
    12. def check_html_output(text: str, first_token_latency: float,
    13. total_latency: float) -> EvalResult:
    14. """Perform basic structural and feature checks on model output."""
    15. result = EvalResult(first_token_latency=first_token_latency,
    16. total_latency=total_latency)
    17. if not text.strip():
    18. result.issues.append(
    19. "Empty output; reasoning may have occurred without a final answer"
    20. )
    21. return result
    22. result.has_output = True
    23. lowered = text.lower()
    24. result.has_html = "<!doctype html" in lowered or "<html" in lowered
    25. result.has_animation = ("requestanimationframe" in lowered
    26. or "<canvas" in lowered
    27. or "setinterval" in lowered)
    28. result.has_gif_export = "gif" in lowered
    29. if not result.has_html:
    30. result.issues.append("No complete HTML structure detected")
    31. if not result.has_animation:
    32. result.issues.append("No animation-related implementation detected")
    33. if not result.has_gif_export:
    34. result.issues.append("No GIF export-related code detected")
    35. return result
    36. def check_regular_polygon(points, n: int, tol: float = 1e-2) -> bool:
    37. """Check whether n vertices have side-length deviations below tolerance."""
    38. if len(points) != n:
    39. return False
    40. sides = [math.dist(points[i], points[(i + 1) % n]) for i in range(n)]
    41. mean_side = sum(sides) / n
    42. return all(abs(s - mean_side) / mean_side < tol for s in sides)

    Despite its name, check_regular_polygon checks only side-length consistency. Full validation also requires checks of interior angles and distances from the center.

    The keyword checks in check_html_output are similarly limited. Comments or unrelated text can trigger them, and the presence of a <canvas> element does not establish that an animation works. Use these checks alongside browser rendering tests.

    6. Practical Recommendations

    • Run multiple samples. Repeat the same task and measure the success rate rather than relying on one result. Generative tasks have enough variability that a single run can be misleading.

    • Keep process logs. Save the model’s step descriptions or intermediate outputs so reviewers can later verify compliance with the prompt.

    • Separate latency measurements. Record time to first token and total completion time independently to help distinguish delays before output begins from delays during generation.

    • Define explicit failure rules. Empty outputs, procedural deviations, and missing required functionality should count as failures, not receive credit for being “almost correct.”

    • Be clear about the test’s scope. Geometric construction tasks work well as a baseline gate for instruction following and code implementation. They do not represent the full range of real-world engineering performance and should be combined with other tasks.

    7. Conclusion

    Generative tasks expose problems that multiple-choice evaluations can miss, especially deviations from a required process. A useful evaluation should score result correctness, procedural consistency, delivery completeness, and response experience separately.

    Empty outputs and unauthorized changes to the construction method need clear failure criteria. This approach provides a more meaningful assessment of whether a model can reliably follow instructions and deliver usable results in development workflows.