Testing LLM Prompt Compliance: A Case Study of Heptagon Construction
Evaluating Large Language Models (LLMs) goes beyond parameter size and benchmark scores; it requires testing prompt compliance—the ability to strictly understand and execute complex, natural language instructions. This article explores a reproducible testing framework using a specific geometric construction case: drawing a regular heptagon with a two-marked ruler on an HTML canvas. We break down the testing methodology, common difficulties such as semantic inference of rare terms and multi-object referencing, a quantifiable scoring rubric, and engineering best practices for deploying LLMs in real-world scenarios.
1. Why Prompt Compliance Needs Separate Testing
When the community evaluates large models, parameter size and benchmark scores are commonly used. While these two metrics indicate a model’s overall level, they struggle to answer a specific question: Can the model strictly understand and execute complex tasks described by users in natural language?
A high benchmark score does not equal high compliance. Benchmarks cover general topics, whereas business tasks often have their own constraints, terminology, and acceptance criteria. A model that scores highly on general topics might still miss a specific requirement explicitly stated by the business side.
Prompt compliance can be broken down into three layers:
- Semantic Layer: Understanding the true intent behind colloquial or imprecise expressions.
- Constraint Layer: Identifying implicit physical constraints, spatial relationships, and logical prerequisites within the task.
- Execution Layer: Completely and flawlessly restoring these constraints in the generated results.
Long Chain-of-Thought (CoT) models particularly require these three capabilities. The longer the reasoning chain, the more opportunities there are for intermediate steps to deviate from user intent. Only highly compliant models can maintain goal consistency during long reasoning processes and output results that match requirements.
2. A Reproducible Test Case
The task in this case is: Use a single HTML page to demonstrate the geometric construction process of drawing a regular heptagon with a two-marked ruler, and provide a GIF export function. To make the test reproducible, initial conditions must be fixed: the coordinate system, square side length, allowed tools, and runtime environment.
Here is the complete prompt used for testing:
Please use a single-file HTML page to demonstrate the geometric construction process of drawing a regular heptagon using a two-marked ruler.
Initial conditions:
- Take a square in the Cartesian coordinate system with vertices at (0,0), (1,0), (1,1), and (0,1), and a side length of 1.
- The distance between the two marks on the two-marked ruler is 1.
- Allowed technologies: Vanilla JavaScript and Canvas. No third-party geometry libraries.
Construction requirements:
- Construct the perpendicular bisector of the bottom edge of the square.
- Draw a circle centered at the bottom-right vertex with a radius equal to the length of the square’s diagonal.
- Keep one end of the two-marked ruler fixed at the bottom-left vertex, move the first mark along the circle until the second mark passes through the perpendicular bisector, and mark this position.
- Complete all omitted standard perpendicular bisector construction steps.
- Only keep necessary parts of the compass traces.
- The page provides an “Export GIF” button. In the exported GIF, each construction step corresponds to at least one frame, and the frame order matches the step order.
Output: An index.html file that can be opened directly in the latest version of Chrome or Edge without server-side dependencies.
The runtime environment is a modern browser’s Canvas. For testing, evaluators need to prepare two things:
- Standard Step Checklist: Pre-written by the evaluator, listing every required step, such as perpendicular bisector construction, circle drawing, ruler mark movement and positioning, and trace retention rules.
- Reference Image: Manually drawn using the same parameters and saved as a screenshot, used for comparison with the model-generated graphic.
Acceptance criteria are detailed in the scoring rubric in Section 6.
3. Three Categories of Test Difficulties
This case simultaneously tests several model capabilities.
3.1 Semantic Inference of Rare Terminology
A two-marked ruler is a straightedge with two marks at a fixed distance; it is not a common concept. Many models do not recognize it or treat it as an ordinary straightedge. This type of question tests whether the model can infer the definition and usage from context when faced with unfamiliar terms, rather than fabricating a plausible-sounding explanation. If the model treats it as an ordinary ruler, the construction process becomes invalid, and points should be deducted during scoring.
3.2 Multi-Object Referencing
Almost every step in the process involves at least three geometric objects: vertices, circles, lines, and ruler marks. The model needs to track the relative positions of these objects throughout the generation process. If an object is misidentified in any step, the final construction will be incorrect. This requirement poses a strong test for long-range consistency.
3.3 Implicit Prerequisite Completion
The prompt uses colloquial descriptions with a few imprecise areas:
- Square side length not given: In the test, we explicitly set it to 1. If not stated in the prompt, the model must make an assumption and state it in the output.
- Mark spacing not defined: Similarly set to 1. Note that setting both the side length and mark spacing to 1 is an evaluation convention, not a geometric necessity. If both are multiplied by the same positive number s, the construction remains similar. Therefore, the focus here is the proportional relationship, not specific values.
- “Necessary traces” is semantically ambiguous: Which traces to keep and which to erase depends on the model’s understanding of the construction logic. This is best judged via manual spot-checking.
3.4 Engineering Add-on Requirements
Exporting a GIF is a pure engineering requirement. It requires the model to implement frame-by-frame rendering, Canvas frame capturing, and file export in addition to completing geometric logic. This simulates the mixed scenario of “business logic plus engineering details” common in real-world development.
When discussing test results, two related concepts often emerge. Vibe coding refers to describing requirements in natural language and letting the model directly generate usable results; this case primarily tests this capability. Wish coding refers to merely describing desired outcomes, letting the model explore implementation paths autonomously and even discover better solutions the describer hadn’t considered. This article’s test does not directly cover the latter.
4. Interpreting Test Results
The author observed during actual testing that newer model versions show significant improvements in compliance compared to earlier versions. Prompts that were previously misunderstood or only partially executed can now mostly be fully understood and well-executed.
Such observations need to be verified using a fixed scoring rubric before being used as conclusions. Single-run results are affected by sampling fluctuations and should not be used to judge a model’s capability ceiling.
5. Reusable Evaluation Methodology
Based on the above case, a general compliance evaluation framework can be distilled:
- Construct rare concepts: Use terms the model is unfamiliar with but can be defined by context to test semantic inference rather than memory retrieval.
- Stack multi-object constraints: Make each operation involve multiple entities and their relationships to test long-range consistency.
- Embed implicit prerequisites: Intentionally omit some parameters to see if the model can deduce necessary assumptions from the goal and explicitly state them.
- Mix in colloquial expressions: Avoid overly polished prompts to simulate real user input habits.
- Add engineering requirements: Include non-core features like export or interaction to simulate complete development scenarios.
Each test case should clearly state initial conditions, standard step checklists, and reference images; otherwise, results cannot be reproduced.
6. Quantifiable Scoring Rubric
Manual judgments of “whether it looks right” are subjective and hard to compare across teams. It is recommended to use the table below for quantitative scoring. The passing lines are suggested values; teams can adjust them based on their own business risks.
| Dimension | Calculation Method | Suggested Passing Line |
|---|---|---|
| Constraint Coverage Rate | Number of constraints satisfied / Total constraints in the prompt | No less than 90% |
| Geometric Error | Average deviation of generated vertices from ideal heptagon vertices / Side length | No more than 1% |
| Omitted Steps | Number of steps from the standard checklist not present in the output | No more than 1 step |
| Hallucination Count | Number of times the output contradicts the prompt or fabricates rules, buttons, or data | 0 times |
| GIF Integrity | Exported frames are no fewer than standard steps, and frame order matches step order | Must be met |
Geometric error can be calculated by reading vertex coordinates from the page Canvas via a script, requiring no manual measurement.
7. Common Error Checklist
The following errors frequently occur in this case and should be checked step-by-step during scoring:
- Omitted intermediate steps: Directly presenting the result of a perpendicular bisector without showing the construction process.
- Excessive compass traces: Retaining all auxiliary arcs, obscuring key line segments.
- Incorrect two-marked ruler usage: Treating the two-marked ruler as an ordinary straightedge, causing subsequent construction to fail.
- Inconsistent proportions: The mark spacing set initially differs from the value actually used later.
- GIF export anomalies: Export failures, frame counts not matching step counts, or frame order disruptions.
8. Engineering Practice Suggestions
For teams looking to implement large models in their business, in addition to evaluation during model selection, a few points need attention:
- Incorporate continuous regression testing: Model version updates may cause behavior drift. Establish a fixed evaluation set, record the model version number used for each test, and re-run when versions change.
- Use structured prompts to reduce ambiguity: Explicitly state key constraints line by line, such as “the square side length is 1,” to reduce reliance on the model’s inference capabilities.
- Automate verification with local tools: Use Playwright or Puppeteer to open the generated page in a headless browser, take screenshots for comparison with the reference image, check the console for errors, and count the frames of the exported GIF. This transforms “looks right” into “runs right.”
- Fix sampling conditions: If the API supports it, fix the random seed and record sampling parameters. The same case should be run multiple times to capture the result distribution, rather than drawing conclusions from a single output.
- Retain manual spot-checks: For ambiguous semantics like “necessary traces,” it is currently still difficult to judge completely automatically and requires manual review.
9. Conclusion
Benchmark scores tell you a model’s overall level; compliance tests tell you whether the model can complete specific tasks according to your requirements. The former aids in selection; the latter determines whether the model can enter business processes. By turning compliance into recordable, comparable, and reproducible numbers, teams can determine whether a model is reliable for their specific tasks.
