Evaluating LLM Instruction Following in Complex Geometric Construction Tasks

    This article examines instruction following in large language models when tasks are specification-heavy rather than simple question answering. Using a single-page HTML task that demonstrates a regular heptagon construction with a two-mark ruler and GIF export, it breaks down the requirements, proposes a hard-gate plus weighted-scoring plus human-intent evaluation framework, and describes automated and manual checks for geometry invariants, process state, trace control, and export reliability. It also catalogs common failure modes and shows how to incorporate such high-difficulty samples into engineering regression loops.

    Evaluating LLM Instruction Following in Complex Geometric Construction Tasks

    1. Why Instruction Following in Complex Tasks Is More Than Format Alignment

    In simple question-answering scenarios, instruction following is often understood as “whether the output matches the requested format.” In complex tasks such as code generation, graphics generation, workflow orchestration, and engineering documentation, however, the user prompt is often no longer a single request. It is a specification that includes objects, relationships, constraints, order, deliverables, and acceptance criteria. In this setting, whether a model follows instructions cannot be judged only by whether its answer “looks right.” The model must understand the spatial relationships, physical limits, technical terminology, staged states, and implicit dependencies behind the prompt, and it must restore the user’s true intent in the final artifact.

    The importance of this capability lies in the cumulative nature of errors in complex tasks. A misidentified term can push an entire technical route in the wrong direction. An ignored intermediate constraint can make the final result look reasonable while being practically unusable. An animation or export requirement that is not implemented can prevent a demonstrable prototype from being delivered. For scenarios that require review, reproduction, and secondary development, users need not only a “correct answer” but also a traceable construction process, explicit assumptions, and verifiable deliverables.

    The web-generation task of “constructing a regular heptagon with a two-mark ruler” is exactly such a high-density test sample. It combines an obscure geometric tool, continuous constraint solving, multi-object dependencies, completion of construction steps, control of construction traces, and GIF export. It appears to be a graphic demonstration problem, but in practice it covers the full chain from semantic parsing to engineering implementation.

    2. Breaking Down the Test Sample: How Many Layers of Requirements Fit in One Prompt

    The goal of the task can be summarized as follows: generate a single-page HTML page that uses animation and construction traces to demonstrate “constructing a regular heptagon with the help of a two-mark ruler,” and support GIF export. Its core requirements include at least the following categories.

    2.1 Domain Concept Understanding

    A “two-mark ruler” is not an ordinary straightedge, nor is it a compass. It usually refers to a straightedge with two fixed marks or markings, used in geometric construction to achieve “sliding positioning” with continuous constraints: the ruler must remain in contact with a fixed point, one mark must lie on a given circle, and the other mark, or the line determined by the mark, must pass through a specified line. If the model misreads the “two-mark ruler” as an ordinary straightedge, every subsequent step will deviate.

    2.2 Geometric Objects and Dependencies

    The task includes a square, the perpendicular bisector of the bottom edge, a circle centered on the lower-right vertex with the diagonal as radius, the lower-left vertex, the two mark constraints of the two-mark ruler, and later use of a perpendicular bisector to locate the circle center. Each step is not an isolated drawing; it depends on points, lines, circles, and intersections produced by the previous step. The model needs to maintain the dependencies among these objects and avoid drawing only a static image that “looks like” the result.

    2.3 Continuous Constraints and the Solving Process

    The key step with the two-mark ruler is not simply drawing a line. It must satisfy a set of simultaneous constraints: the ruler touches a specified vertex, the first mark moves along a specified circle until the line determined by the second mark passes through the perpendicular bisector of the bottom edge. This involves continuous movement and a critical position. In implementation, numerical methods can be used to find a pose that satisfies the constraints, or the animation can approach the position step by step. Evaluation should not only check whether the final heptagon is correct; it should also check whether keyframes truly reflect these constraints and whether the page clearly explains “why it stops at this position.”

    2.4 Step Completion and Readability

    The original description omits some routine straightedge-and-compass construction steps and requires the model to complete them. Completion does not mean adding decorative lines at will. The entire construction chain must be self-consistent: which points are intersections, which lines are auxiliary lines, which circles retain only necessary arc segments, and which objects need labels. Missing intermediate steps prevent users from checking the work; adding irrelevant steps introduces noise.

    2.5 Control of Construction Traces

    The prompt explicitly requires that “using a compass will produce a trajectory of moving points, but traces should appear only in necessary parts.” This means the page cannot simply keep overlaying full circles during animation, nor can it retain all movement trajectories. In implementation, arc start and end angles need to be calculated from intersections so that only necessary arc segments are drawn; alternatively, the animation layer and the static construction layer can be separated, and temporary traces can be cleaned up after the animation ends.

    2.6 Animation and GIF Export

    The page needs a replayable process animation and must be able to export a GIF. Evaluation should check whether the export button actually works, whether the GIF contains the complete construction process, whether it has a stable final frame, whether its size and duration are reasonable, whether it is obscured by page controls, and whether multiple exports produce deterministic results.

    2.7 Implicit Engineering Quality Requirements

    Although the prompt does not list them one by one, a qualified deliverable should also meet the following expectations: the page can be opened and run directly, there are no console exceptions, the layout does not overflow, key objects have labels, the animation can be paused or replayed, the export process provides feedback, and assumptions are stated for ambiguous points. These requirements should be treated as soft scoring items rather than ignored entirely.

    3. Evaluation Framework: From “Looking at Results” to “Looking at Process”

    For complex tasks, an evaluation structure of “hard gates + weighted scoring + human intent judgment” is recommended. Below is a reusable scoring rubric example.

    1. {
    2. "task": "marked_ruler_regular_heptagon_demo",
    3. "hard_gates": [
    4. "The page loads independently without fatal errors",
    5. "The final figure is a regular heptagon within tolerance",
    6. "Keyframes satisfy the two-mark ruler constraints",
    7. "A GIF containing the complete process can be exported"
    8. ],
    9. "requirements": [
    10. {"id": "R1", "desc": "Single-page HTML with controlled or explicitly declared external dependencies", "weight": 0.08, "check": "Loading and network audit"},
    11. {"id": "R2", "desc": "Show the square, perpendicular bisector, circle, two-mark ruler positioning, and subsequent straightedge-and-compass steps in order", "weight": 0.20, "check": "State log and keyframes"},
    12. {"id": "R3", "desc": "The two-mark ruler touches the specified vertex, the first mark lies on the circle, and the second-mark line passes through the perpendicular bisector", "weight": 0.20, "check": "Coordinate assertions"},
    13. {"id": "R4", "desc": "Complete omitted steps, label clearly, and preserve correct dependencies", "weight": 0.12, "check": "Manual and structural checks"},
    14. {"id": "R5", "desc": "Compass traces appear only on necessary arc segments, with no full-circle accumulation or continuous ghosting", "weight": 0.12, "check": "Arc ranges and draw events"},
    15. {"id": "R6", "desc": "Final heptagon vertices are concyclic, and side lengths and central angles are within tolerance", "weight": 0.15, "check": "Geometric invariants"},
    16. {"id": "R7", "desc": "Animation is replayable; the GIF contains the complete process, has a stable final frame, and is repeatable", "weight": 0.08, "check": "GIF parsing and frame extraction"},
    17. {"id": "R8", "desc": "Key assumptions, controls, and explanations are clear", "weight": 0.05, "check": "Manual review"}
    18. ]
    19. }

    Hard gates are used to quickly exclude “unusable” results, such as a page that does not open, a final figure that is obviously not a regular heptagon, key constraints that are completely absent, or an export function that is an empty implementation. Weighted scoring distinguishes results that “run but are rough” from results with a rigorous, reviewable process. Human intent judgment focuses on the delivery form the user actually wants: a teachable demonstration, an engineering-integration-ready page, or merely a static illustrative diagram. Under different intents, scoring weights can be adjusted, but key constraints must not disappear.

    4. How Automated and Manual Checks Work Together

    4.1 Functional and Runtime Checks

    First, load the page in an isolated environment and record script exceptions, resource loading failures, and timeouts. Check whether operations such as starting, pausing, replaying, and exporting the animation work. If the prompt requires offline availability, verify that the page still runs with the network disconnected. If external dependencies are allowed, their versions and sources should also be explicitly stated. Run the page multiple times and observe whether results are stable.

    4.2 Geometric Invariant Checks

    For the final heptagon, check whether all vertices are approximately on the same circumcircle, whether adjacent side lengths are approximately equal, and whether central angles are close to 360/7 degrees. For intermediate steps, check the side-length relationships of the square, the direction of the perpendicular bisector, and the positions and radii of circle centers. For the keyframe of the two-mark ruler, record the distance from the ruler edge to the specified vertex, the distances from the two mark points to the circle and the perpendicular bisector, and set reasonable tolerances.

    4.3 Process State Checks

    Require the page to record step states internally, such as the object ID, creation time, dependent objects, and drawing type for each step. The evaluation program can read the state trajectory to confirm step order and dependencies; manual reviewers can spot-check keyframe screenshots to confirm whether the animation really shows “moving the ruler until the condition is satisfied” rather than jumping directly to the result.

    4.4 Trace Range Checks

    For SVG or Canvas drawing, parse arc start and end angles or record drawing events. If the page draws full circles during animation or retains movement trajectories in the final frame, trace control should be judged as failing. A reasonable implementation is that the temporary animation layer may briefly show the movement process, while the static construction layer retains only necessary arc segments.

    4.5 GIF Export Checks

    Parse the frame count, dimensions, duration, and loop information of the exported file, and extract the first frame, intermediate frames, and final frame for verification. Focus on whether the final frame is stable, whether the construction area is complete, whether controls obscure the content, and whether there are obvious dropped frames. When the same task is exported multiple times, the frame sequence should be basically consistent; unless the animation includes random effects, results should not be non-reproducible.

    4.6 Human Intent Judgment

    Manual review should answer three questions. First, did the model understand the “two-mark ruler” rather than replacing it with an ordinary drawing method? Second, do the completed steps serve the construction logic rather than decoration? Third, does the page explain the key stopping position in a way users can understand? For numerical solving implementations, check whether the constraints are visualized and whether assumptions such as “this is numerical positioning rather than a pure straightedge-and-compass step” are declared, so that apparently precise coordinates do not hide missing process.

    5. Common Failure Modes and How to Identify Them

    1. Terminology misreading: treating the two-mark ruler as an ordinary straightedge or compass, causing constraints to disappear. The identification method is to check whether keyframes contain the two mark constraints.
    2. Result cheating: hardcoding the vertices of a regular heptagon and then adding irrelevant animation. The identification method is to inspect the state trajectory for the key positioning process and dependencies.
    3. Constraint loss: the ruler does not touch the specified vertex, a mark does not lie on the circle, or the line does not pass through the perpendicular bisector. The identification method is coordinate assertions.
    4. Process skipping: drawing only the final figure without step-by-step construction. The identification method is the keyframe sequence and state log.
    5. Trace pollution: leaving many full circles or motion trails after the animation ends. The identification method is checking the number and angle ranges of arcs in the static layer.
    6. Fake export implementation: clicking the button produces no file, downloads an empty file, or exports only a static screenshot. The identification method is parsing the exported file and extracting frames.
    7. Non-reproducibility: using random numbers or depending on canvas size, causing result drift. The identification method is comparing multiple runs.
    8. Undeclared ambiguity: interpreting terms such as “until,” “touching,” and “necessary traces” without explanation. The identification method is checking page notes and comments.
    9. Overpackaging: a complex interface but incorrect geometry. The identification method is to prioritize hard gates and not let visual scores mask core failures.

    6. Engineering Implementation: Bringing Complex Prompt Evaluation into the Iteration Loop

    6.1 Build a Layered Test Set

    Maintain tasks by capability layer. The basic layer checks format and runtime; the middle layer checks multi-step dependencies and graphic correctness; the high-difficulty layer checks obscure concepts, continuous constraints, process auditability, and export stability. Constructing a regular heptagon with a two-mark ruler belongs to the high-difficulty layer and can be used for regression testing, but it should not be the only metric. Variants should also be designed, such as changing whether to retain complete auxiliary circles, whether to require step-by-step explanations, and whether to require both static-frame and animated-format exports, to observe the model’s ability to follow condition changes.

    6.2 Constrain Prompts with Structured Contracts

    For such tasks, a structured contract can be added to the prompt: goal, coordinate conventions, object list, invariants that must be satisfied, animation timing, deliverables, acceptance criteria, and ambiguity-handling strategy. Requiring the model to output an execution plan and assumptions before generating code can significantly reduce the probability of “writing the page directly but missing key constraints.” An example template is as follows:

    1. Goal: Generate a single-page HTML demonstration of the specified geometric construction, with animation and GIF export support.
    2. Objects: List all points, lines, circles, and their names.
    3. Constraints: List, in order, the relationships and tolerances that each step must satisfy.
    4. Traces: Explain which arcs should be retained and which may exist only as temporary animation.
    5. Delivery: Prefer a single file; if external dependencies are used, they must be declared.
    6. Acceptance: Provide automatically checkable geometric invariants and functional checkpoints.
    7. Ambiguity handling: List assumptions when ambiguity arises; do not silently skip it.

    6.3 Add Verifiable Hooks

    Require generated results to expose a read-only state trajectory for automated checking, such as recording step IDs, object dependencies, and keyframe coordinates. Limit this to debug or acceptance mode so that normal use is not affected. For export functionality, provide clear start, progress, and completion feedback, and provide readable error messages on failure.

    6.4 Isolated Execution and Security Review

    Complex generated artifacts may contain scripts, external resources, and download behavior. They should be run in an isolated environment with restricted network access and file system permissions, and checks should be performed for unnecessary remote loading. For page generation intended for production environments, content security policies, dependency sources, file size, and runtime should also be reviewed to avoid bringing convenience practices from the evaluation environment directly into production.

    6.5 Establish Regression Baselines and Release Gates

    After each model or prompting-strategy adjustment, run regression on the same batch of tasks and compare atomic requirement satisfaction rate, hard-gate pass rate, intent-restoration score, first-run success rate, and average repair rounds. For high-difficulty tasks, a release gate can require “key constraints must pass”; for exploratory tasks, human review can be allowed as a fallback. Over time, the test set should continuously incorporate complex constraints from real business scenarios rather than remaining limited to a single geometry problem.

    7. Conclusion: Treat “Prompt Following” as a Verifiable Delivery Capability

    The value of a task such as “constructing a regular heptagon with a two-mark ruler” does not lie in how obscure it is. Its value lies in breaking complex instruction following into multiple observable, verifiable, and reproducible layers: whether the model understands technical terminology, maintains multi-object dependencies, satisfies continuous constraints, controls construction traces, completes animation and export, and explains key assumptions. For developers and enterprise users, what matters is not whether the model “seems able to do it” in a single demonstration, but whether it can deliver stably under explicit acceptance criteria and make the result reviewable, maintainable, and regression-testable.

    Therefore, complex prompt evaluation should move from “does the result look right?” to “is the process correct, are the constraints satisfied, and is the deliverable usable?” Use atomic requirement tables to break down prompts, hard gates to protect key correctness, geometric invariants and state trajectories to improve automation, and human review to judge true intent restoration. Then high-difficulty samples should be added to continuous regression. In this way, “instruction following” becomes more than the appearance of a single question-and-answer exchange; it becomes a measurable engineering capability.