How to Measure Prompt Compliance: A Neusis Regular Heptagon Case Study
This article explains how to measure prompt compliance, meaning whether a model's output meets the conditions a user states and the reasonable implicit conditions. It covers splitting a prompt into checkable statements, using a neusis-based regular heptagon construction as a test case, setting numerical acceptance criteria, and common errors when building the construction as an interactive web page. It also describes how to run repeated tests and diagnose failures.
Prompt compliance refers to whether a model’s output meets the conditions the user states, along with the reasonable implicit conditions the user did not state. The key to judging it is whether the same acceptance criteria can be applied repeatedly to check the output, rather than whether the answer reads smoothly.
1. Break the Prompt into Checkable Items
A complex prompt usually mixes three types of content: objects (points, circles, lines, a straightedge), actions (moving, passing through a point, drawing a circle), and constraints (mark spacing, intersection positions, termination conditions). Before testing, rewrite each sentence as a statement that can be judged true or false. For example, “the second mark line passes through the perpendicular bisector of the base” can be split into two parts: the endpoint of the mark line lies on a certain line, and that line perpendicularly bisects the base. Once each statement is separated, coordinate calculations can verify it.
2. Case Study: Constructing a Regular Heptagon with a Neusis
A neusis ruler is a straightedge with two marked points separated by a fixed distance. To use it, you move the ruler so that one marked point lies on one curve, the other marked point lies on another curve or line, and the edge of the ruler passes through a specified point. In English, this construction method is called neusis. A regular heptagon cannot be constructed exactly with only a compass and an unmarked straightedge, so this task is often used to test how a model handles obscure terminology and multi-step constraints.
The initial conditions of the test must be stated explicitly. The original test prompt did not give the side length of the initial square, so the model may assume a unit square on its own. This assumption is reasonable, but the output should state it clearly and keep it as a constant in the code. If the model neither makes an assumption nor asks the user for confirmation, the response should be judged as having insufficient compliance.
Acceptance cannot rely only on the visual result. Check at least three items:
- Whether the distances from the seven vertices to the center are equal.
- Whether the central angle between adjacent vertices is approximately 360°/7, or about 51.43°.
- Whether the distance between the two marked points on the neusis ruler matches the declared unit length.
If any item deviates beyond a preset tolerance, record the test as a failure.
This article does not reproduce the complete construction steps of the original test. To evaluate the actual output of a model, first have a person provide a feasible set of construction steps, then compare the model’s output against them step by step.
3. Common Errors When Building a Web Page
When turning the construction into an interactive web page, the common problems fall into four areas.
- Coordinate system confusion: The y-axis of a Canvas points down, while the y-axis of a mathematical coordinate system points up. Without a conversion, circles and lines will appear upside down.
- Dynamic positioning: The ruler’s position requires solving equations, usually with numerical methods such as bisection or Newton’s iteration, to find the parameters at which a marked point lies on a curve. Set a maximum iteration count and a convergence threshold to keep the page from freezing.
- Trace control: If traces must appear only where necessary, separate the canvas layer that keeps traces from the dynamic layer that is redrawn every frame. Otherwise, erasing and redrawing will interfere with each other.
- GIF export: Exporting requires reading the Canvas frame by frame and encoding each frame. More frames use more memory, so limit the number of frames and the resolution, and show export progress in the interface.
4. Practical Testing Methods
First, run the same prompt several times and record whether each result passes. A single pass does not show that the model is stable.
Second, record the model version, parameters such as temperature, and the complete prompt so the test can be reproduced later.
Third, when a test fails, first determine which category the problem belongs to: the model omitted a condition, the model misapplied a condition, or the code contains an error. Each category requires a different fix, and handling them together makes the problem harder to resolve.
For developers familiar with geometry, an informal, descriptive prompt can reduce the time spent writing structured input. However, complex constraints still need structured verification, and informal descriptions cannot replace acceptance criteria.
5. Conclusion
Prompt compliance can be measured. Break the prompt into items, state the initial assumptions, and accept results using numerical metrics. Only when all three are in place do test results become a useful reference. The construction steps in this case study have not been reproduced, so readers who want to use it for evaluation should first verify the reference answer themselves.
