Evaluating LLM Prompt Compliance Through Complex Geometric Construction
This article examines how complex geometric construction can serve as a low-cost, high-information stress test for LLM prompt compliance. Using a regular-heptagon construction with a two-tick ruler, it outlines evaluation criteria, implementation patterns, common failure modes, and engineering takeaways for turning ambiguous natural-language prompts into verifiable execution plans.
In real R&D settings, developers rarely give large language models tasks written in strict programming language. More often, the task is expressed in natural language with omissions, defaults, and colloquial phrasing. To evaluate a high-parameter model with long chain-of-thought reasoning, public benchmark scores are not enough. The model must also be judged by whether it can turn vague expressions into executable, verifiable intent. Complex geometric construction offers a useful test bed for this: the rules are uncommon, the objects are dense, the constraints are implicit, and the result is checkable. This article uses a prompt stress test based on “constructing a regular heptagon with a two-tick ruler” to discuss evaluation methods for prompt compliance and their engineering implications.
Why Complex Geometric Construction Works as a Stress Test
Complex geometric construction is not a simple “write a webpage” task. It requires the model to perform semantic parsing, spatial reasoning, constraint completion, step planning, and code generation at the same time. Consider a regular heptagon. A regular heptagon cannot be constructed exactly with a traditional straightedge and compass alone; it requires extended tools such as a two-tick ruler with a fixed tick spacing. A two-tick ruler is not an ordinary straightedge. It depends on the distance between two fixed tick marks and determines positions through physical constraints such as “the edge passes through a certain point,” “the first tick slides along a circle,” and “the second tick passes through the perpendicular bisector.” If a model knows only straightedge-and-compass construction, it may mistake the two-tick ruler for an ordinary straightedge, causing the entire construction to fail.
The task has two further advantages. First, the result is verifiable: whether the final figure is a regular heptagon, whether the vertex angle is close to (2\pi/7), and whether the side lengths are consistent can all be checked with program assertions. Second, the process is observable: the objects, constraints, auxiliary lines, and animation frames at each step can be recorded, making it possible to analyze whether the model actually understood the prompt or merely imitated its surface format.
Four Core Difficulties in the Task
First, uncommon terminology must be understood. Expressions such as “two-tick ruler,” “the first tick mark,” “the second tick mark,” and “flush against the lower-left vertex” require the model to build a physical model of the tool. If the model cannot understand fixed tick spacing, the straightedge edge passing through a point, and the stopping condition for sliding, it cannot generate a correct construction.
Second, there are many object references. The square, bottom edge, perpendicular bisector, lower-right vertex, diagonal, circle, lower-left vertex, tick marks, and circle center are referenced repeatedly across steps. Almost every step involves at least three objects at the same time. The model must maintain a stable object graph and avoid reference drift.
Third, implicit parameters must be completed. The prompt does not explicitly give the side length of the square, nor does it state the distance between the two tick marks. Given the goal of constructing a regular heptagon, the square should use unit side length, and the tick spacing should also match the unit length; otherwise, later constraints cannot close. The phrase “necessary traces” is likewise not precisely defined. The model needs to distinguish construction auxiliary lines, necessary compass traces, and final result lines.
Fourth, vague semantics and output constraints must be handled. Natural-language phrases such as “move until,” “flush against,” and “complete the usual steps” contain omissions. The model must fill in reasonable assumptions without adding incorrect steps on its own, and it must output a runnable page, animation, and GIF export function.
Evaluation Design: From Prompt to Verifiable Results
For evaluation, the task can be split into explicit constraints, implicit constraints, and output constraints. Explicit constraints are the steps written by the user. Implicit constraints are default conditions such as the unit square, tick spacing, and necessary traces. Output constraints cover the HTML page, step-by-step animation, GIF export, and code runnability. A rewritten task description might read:
Generate a runnable HTML page that uses Canvas to demonstrate step by step: start from a unit square and construct the perpendicular bisector of the bottom edge; draw a circle centered at the lower-right vertex with the diagonal as radius; use a straightedge with two fixed tick marks separated by a distance of 1, keep its edge passing through the lower-left vertex, slide the first tick along the circle until the second tick lies on the perpendicular bisector of the bottom edge; then complete the necessary compass-and-straightedge steps to find the center and construct the regular heptagon; keep only necessary compass traces; provide a button to export a GIF.
The corresponding structured specification can be represented as:
const spec = {canvas: { width: 960, height: 720 },geometry: { squareSide: 1, rulerTickGap: 1 },steps: ["square", "midline", "circle", "markedRulerSlide", "center", "heptagon"],asserts: ["tick1.distanceTo(circleCenter) ≈ circleRadius","tick2.on(midline)","final.vertices.length === 7","final.angleStep ≈ 2 * Math.PI / 7"],outputs: ["html", "animation", "gif"]};
Evaluation dimensions should include at least the following: semantic parsing accuracy, meaning whether the model identifies the two-tick ruler and all objects; reasonableness of implicit constraint completion, meaning whether it uses a consistent unit length; spatial reasoning consistency, meaning whether the construction sequence is geometrically correct; output executability, meaning whether the page runs, the animation is coherent, and the GIF can be exported; trace minimization, meaning whether only necessary traces are retained; robustness, meaning whether the model can still reliably recover the intent when the prompt is rephrased colloquially; and explainability, meaning whether the step descriptions are consistent with the code and the figure.
Implementation Path and Key Engineering Points
For implementation, a structure based on “state machine + object graph + constraint solving + verification assertions” is recommended. The page layer uses HTML and Canvas to draw points, lines, circles, and traces. The state machine advances the animation step by step. The object graph maintains references among points, lines, and circles. The constraint-solving layer converts “the first tick is on the circle, the second tick is on the perpendicular bisector, and the straightedge passes through a fixed point” into residual functions, then determines the straightedge direction through one-dimensional search or joint solving. Trace management needs to tag each graphical element to distinguish auxiliary lines, necessary compass traces, and final result lines. For GIF export, frame-by-frame rendering results can be sent to a general GIF encoding pipeline, with control over frame rate, size, and color palette.
The key difficulty is not the amount of code but consistency between steps and intent. For example, the stopping condition for sliding the two-tick ruler must be driven by geometric constraints, not by hard-coding an angle. Verification of the regular heptagon cannot rely on appearance alone; it should use assertions on vertex count and angle. Animation frames should not merely display the final figure; they should show how constraints are satisfied step by step.
Observations and Engineering Takeaways
When a model can reliably complete this kind of task, it shows that the model is not merely following an output format. It is mapping spatial operations, physical constraints, specialized terminology, and vague semantics from natural language into an executable plan. Common failure modes include treating the two-tick ruler as an ordinary straightedge, ignoring the sliding stopping condition, omitting the perpendicular bisector, changing the unit length without justification, producing too many traces, missing GIF export, and explanatory text that is inconsistent with the code.
For engineering practice, a hybrid input of “natural language + structured constraints” is recommended, with key geometric conditions converted into assertions. Use a staged workflow of “plan first, generate second, self-check third.” For ambiguous points, require the model to state its assumptions explicitly. Build a small evaluation set that includes uncommon terminology, multi-object references, implicit constraints, and verifiable results, and run multiple sampling runs and statistics. A single case cannot represent overall capability, but complex geometric construction can expose real weaknesses in intent recovery at low cost, making it a worthwhile task type for prompt-compliance evaluation.
