Evaluating LLM Prompt Compliance Through a Geometric Construction Task
A two-marked-ruler construction of a regular heptagon is a surprisingly demanding test for large language models. This article breaks down what real prompt compliance means—from surface feature delivery to semantic and mathematical correctness—and offers a practical framework for requirements checklists, formalized constraints, layered engineering design, and rigorous validation when evaluating AI-generated code.
From “Generated Output” to “Constraints Honored”: Rethinking Model Evaluation
When large language models are used for coding assistance, the most visible changes are usually code generation speed, page completeness, and interactive effects. But for tasks with professional constraints, these metrics alone cannot show whether the model truly understood the requirements.
A page can run correctly while depicting wrong geometric relationships; an animation can be smooth while substituting visual approximation for the specified construction process; an export button can appear in the UI while producing no valid animation file. All of these are cases of “superficially complete, substantively incomplete.”
Evaluating prompt compliance therefore requires distinguishing three levels:
The first level is textual coverage: did the model implement the features the user listed, such as drawing, step-by-step demonstration, and export?
The second level is semantic implementation: did the model understand descriptions like “passing tightly through a given vertex,” “the mark landing on the circle,” or “keep only necessary traces,” and translate them into explicit computational and interaction constraints?
The third level is professional correctness: do the generated geometric objects satisfy the mathematical relationships, are the numerical methods reliable, and does the presented process match the specified construction?
Genuine capability improvement should show up in the latter two levels—not merely in longer code or more elaborate interfaces. Without unified test conditions, complete execution logs, and independent verification, it is unwise to judge a model’s overall capability from a single demo case.
Why a Two-Marked-Ruler Construction Is a Good Test of Complex Requirement Understanding
Consider this task: build an interactive web page that demonstrates constructing a regular heptagon using a two-marked ruler (a neusis construction). First draw a square and the perpendicular bisector of its base; then draw a circle centered at the bottom-right vertex with radius equal to the square’s diagonal; next, move the marked ruler so it passes through the bottom-left vertex while its two marks land on the circle and the bisector respectively; complete the remaining auxiliary constructions, control trajectory display, and finally support animation export.
The requirement is short, but it packs together problems of several different natures.
1. A Professional Concept Is Not an Ordinary UI Element
A two-marked ruler is a straightedge with two fixed marks that permits neusis constructions. Using it means satisfying several geometric position conditions simultaneously during motion.
This differs from an ordinary ruler connecting two known points. The model cannot simply draw a line with tick marks and claim to have performed a marked-ruler construction. It must specify the distance between the two marks, the fixed point the ruler passes through, which objects the marks must lie on, and which of the valid positions is finally chosen.
A regular heptagon cannot be constructed exactly with a finite sequence of unmarked straightedge-and-compass steps. Introducing a marked ruler changes the allowed set of operations. Evaluation must therefore check whether the model obeys the specified construction rules, rather than bypassing the construction and directly computing seven equally spaced points.
2. Relationships Among Multiple Objects Are Harder Than a Single Figure
The task involves at least a square, its vertices, a circle, a line, marked points, and motion trajectories.
The difficulty lies not in drawing each object, but in maintaining the relationships among them. For example:
- The circle’s center must be the specified vertex;
- The radius must come from the square’s diagonal;
- The ruler must continuously pass through the fixed vertex while moving;
- The distance between the two marks must remain constant;
- Each mark must lie on its designated geometric object.
If any one relationship is misunderstood, subsequent steps may be built on a faulty foundation. Compliance with complex prompts is, at its core, the ability to maintain a network of constraints.
3. Ellipses in Natural Language Cannot Be Filled in Arbitrarily
The original description gives neither the square’s side length nor the distance between the two marks. It is important to distinguish “unit choice” from “geometric condition.”
Setting the square’s side length to 1 simplifies coordinates and computation, but this does not mean the heptagon construction requires a square of side length 1. For constructions that preserve proportions, uniform scaling generally does not change the nature of the result.
What actually needs confirming is the ratio between the mark spacing and the square’s side length. If a construction depends on a specific ratio, the model should state it explicitly; if the task does not provide enough information, the model should ask a clarifying question or declare its assumptions—not disguise assumptions as known facts.
Build a Requirements Checklist Before Generating Code
To avoid “everything looks done, but key conditions are missing,” convert the prompt into an acceptance-ready requirements checklist first.
Geometric Requirements
Specify the square’s vertex naming, side length, coordinate orientation, the base’s perpendicular bisector, and the definition of the specified circle. For the marked ruler, add the mark spacing, the ordering of the two marks, and the allowed range of motion.
Process Requirements
Clarify each step’s input objects, generated objects, and completion conditions. For example, when moving the marked ruler, should the search process be demonstrated, or only an animation from an initial position to the correct one? Are multiple candidate solutions allowed to be shown? What is the selection criterion?
These questions directly affect the computational approach and what the user sees.
Display Requirements
Distinguish auxiliary lines, search trajectories, and the final figure. “Necessary traces” can be interpreted as: show only the segments, arcs, or intersection points that aid understanding at the designated steps—rather than letting every moving object permanently leave a trail.
This interpretation should be a visible design rule, not something hidden in the code.
Export Requirements
Animation export is not a button but a complete data-processing pipeline, including at least frame generation, image encoding, file packaging, and download.
The export scope also needs clarification: the current step, the full construction process, or the state after user interaction? If unspecified, a default can be offered—but the user should be told.
Turn Colloquial Descriptions into Verifiable Mathematical Models
Let the square’s side length be (a>0), with the bottom-left vertex at:
[
D=(0,0)
]
and the bottom-right vertex at:
[
E=(a,0)
]
Under this coordinate convention, the base’s perpendicular bisector is:
[
x=\frac{a}{2}
]
The circle centered at (E) with radius equal to the diagonal satisfies:
[
(x-a)^2+y^2=2a^2
]
Now let the two marked points on the ruler be (P) and (Q), with mark spacing (s>0). One formal interpretation—pending confirmation—is:
[
D,P,Q \text{ are collinear}
]
[
|P-Q|=s
]
[
(P_x-a)^2+P_y^2=2a^2
]
[
Q_x=\frac{a}{2}
]
This set of relations converts the key natural-language requirements into computable conditions, but it does not automatically determine every construction detail the user wants.
For instance, collinearity does not fix the ordering of the three points; the equations may also have multiple solutions. Conventions are still needed for the ruler’s direction, the ordering of the marks, the valid quadrant, and the rule for choosing among candidate solutions. The first solution returned by a solver cannot simply be treated as the correct answer.
A convenient parameterization is:
[
P=t(\cos\theta,\sin\theta)
]
[
Q=(t+s)(\cos\theta,\sin\theta)
]
This expression assumes the two marks are arranged along the chosen direction. Substituting into the constraints yields equations in (t) and (\theta). If the actual construction uses the opposite ordering, the parameterization must be adjusted accordingly—not by casually swapping labels at the rendering stage.
This process reveals whether the model truly understands the task: it should state its interpretation and assumptions first, then present a solution and display plan.
Complete the Construction Steps: A Target Figure Is Not a Proof
Phrases like “complete the rest with the standard steps” are often the riskiest part of a task.
For geometric constructions, completing the steps means more than adding a few lines. It means explaining why the points, segments, or angles obtained in one step can be used in the next, and why the final result is a regular heptagon.
If key construction relationships are missing, the model should clearly state that the full procedure cannot yet be uniquely reconstructed, and request supplementary sources, diagrams, or definitions of intermediate objects. It may implement the confirmed portion first—but it must not invent the latter half and paper over the logical gap with “standard construction.”
One shortcut deserves special caution: computing the seven vertices directly via the central angle (2\pi/7), then playing decorative auxiliary-line animations unrelated to the result. This draws a regular heptagon but does not perform the specified construction.
Directly computed vertices can serve as an independent verification reference, but they must not masquerade as the outcome of the marked-ruler construction.
Engineering Design: Separate Computation, State, and Rendering
To keep generated code maintainable and testable, use a layered structure.
1. Geometry Computation Layer
Handles points, lines, circles, intersections, distances, and constraint solving, without touching the UI. Each function should return structured results: success status, candidate solutions, and necessary error information.
For degenerate cases—nearly parallel lines, nonexistent intersections, or non-convergent solvers—return an explicit status rather than silently falling back to default coordinates.
2. Construction State Layer
Break the full process into finite steps, each recording currently visible objects, active objects, explanatory text, and completion conditions.
This supports step-by-step playback as well as undo, reset, and repeated demonstration. Compared with mixing all logic in a single draw function, state-based design makes it much easier to detect omissions and step-ordering errors.
3. Rendering Layer
Converts world coordinates to screen coordinates and draws objects by category. Resizing the window should not alter the geometric data.
Auxiliary lines, candidate solutions, the final polygon, and moving objects should use different line styles or opacities, so readers can distinguish “objects used to find the answer” from “the construction result that is kept.”
4. Animation and Export Layer
Animation state should be computed from a unified timeline, not from actual screen refresh counts.
Having live preview and offline export share the same state-computation entry point reduces inconsistency between the two outputs. During export, sample frames at fixed time intervals, encode the frame sequence into a GIF file, and handle progress feedback, cancellation, and failure notifications.
For longer animations, cap resolution, frame count, or memory usage to avoid keeping all uncompressed frames resident in memory.
Correctness Validation Must Cover Both Process and Result
A reliable implementation requires at least two kinds of validation.
Process Validation
Check that the specified constraints hold at all times: is the mark spacing constant, does the ruler pass through the designated vertex, and do the final mark positions satisfy the circle and bisector conditions?
In numerical computation, define residuals:
[
r_1=\left||P-Q|-s\right|
]
[
r_2=\left|(P_x-a)^2+P_y^2-2a^2\right|
]
[
r_3=\left|Q_x-\frac{a}{2}\right|
]
Because these residuals have different dimensions, they should not share a single raw threshold. Normalize each by the appropriate length or area scale before judging whether the errors are acceptable.
Result Validation
For the final seven vertices, check that they lie on a common circle, adjacent side lengths are equal, the central angles in circular order are close to (2\pi/7), and the polygon is not self-intersecting.
Passing result validation does not substitute for passing process validation. Conversely, satisfying a few intermediate constraints does not prove the final figure is correct.
Moreover, sufficiently small numerical error only means the implementation reached some approximation accuracy—it is not a mathematical proof of exact construction. Technical write-ups and UI explanations should clearly distinguish these two kinds of conclusions.
Using This Task to Build More Reliable Model Evaluation
Developers and enterprise teams can evaluate generated results along these dimensions:
- Requirement coverage: Are all features implemented, and are unfinished parts explicitly explained?
- Ambiguity handling: Does the model identify missing conditions, disclose assumptions, and ask necessary clarifying questions?
- Mathematical correctness: Do the geometric definitions, solving relations, and construction rationale hold?
- Engineering reliability: Are state transitions, window resizing, repeated playback, and export stable?
- Verifiability of results: Does the model provide independent checks, rather than only a visual demo?
- Consistency under modification: After changing the side length, mark parameters, or display requirements, are the core constraints still maintained?
When evaluating, fix the task text, execution environment, allowed number of interactions, and acceptance criteria, and run multiple trials. A single success may be influenced by prompt phrasing or lucky generation, and does not directly represent stable capability.
For ambiguous tasks, proactively asking about key conditions is often the correct behavior—“not immediately outputting a complete page” should not simply be counted as incompetence. On the contrary, fabricating conditions without disclosure poses the greater engineering risk.
From Rapid Prototyping to Trustworthy Delivery
Natural-language-driven development dramatically lowers the barrier to prototyping, but there remains a gap between “generated a page that runs” and “delivered a system that meets professional requirements.”
The marked-ruler construction case highlights the core question: can the model convert colloquial intent into explicit constraints, and maintain those constraints throughout solving, animation, interaction, and export?
The same approach applies to data processing, report generation, workflow automation, and similar tasks: clarify the business semantics first, establish executable rules second, and validate results against independent standards last.
So when evaluating a large language model’s prompt compliance, what matters most is not how confident it appears, or how much code it produces in one shot, but whether it accurately distinguishes known from unknown conditions, avoids fabricating reasoning chains, and delivers implementations that are checkable, reproducible, and maintainable. That is the capability with real value for everyday development and enterprise applications.
