Prompt Adherence in LLMs: Evaluating Complex Geometry Web Tasks
This article explains why prompt adherence should be assessed separately when evaluating large language models for complex development tasks. Using an interactive geometry webpage task that requires a straightedge-and-compass construction of a regular heptagon, step-by-step animation, and GIF export, it examines hidden constraints around coordinate systems, formalized ruler rules, state management, mathematical validation, and export functionality. It also proposes a four-part code review and a layered evaluation process to help developers distinguish visually plausible output from implementations that correctly understand and execute user intent.
When evaluating a newly released large language model, many people first look at parameter scale, response speed, context length, or code generation quality. For real development work, however, another often underrated metric is whether the model can accurately understand complex requirements and reliably turn them into runnable, verifiable results.
This is especially important in web page generation, interactive visualization, mathematical demonstrations, and engineering prototype development. Users often provide not a strict formal specification but a description that combines natural language, technical terminology, implicit conditions, and operational steps. The model must not only “generate code.” It must first parse the requirements, reason about constraints, model objects, design the workflow, and finally implement all of this as an interactive program. Therefore, checking whether the code runs is not enough. We also need to examine whether the model truly understood the task.
Why Prompt Adherence Deserves Its Own Evaluation
Prompt adherence is not the same as copying every sentence of the user’s request. High-quality adherence should include several layers:
- Identify the task goal: Understand the final result the user wants, rather than only executing a local action.
- Restore the operation order: Complex tasks often have strict sequential dependencies. An incorrect step order can invalidate the entire result.
- Handle object relationships: Distinguish among points, lines, circles, auxiliary lines, and traces, and correctly establish references between them.
- Fill in implicit constraints: When the user does not explicitly provide units, coordinate ranges, scales, or default rules, the model needs to make reasonable judgments based on context.
- Preserve interaction intent: If the user asks for animation, dragging, export, or dynamic demonstration, the model cannot generate only a static image.
- Take responsibility for the result: After generating the result, the model should have some self-checking awareness and proactively correct problems in geometric relationships, calculations, or interactive functionality.
From this perspective, prompt adherence is essentially a reflection of a model’s comprehensive capability. It involves language understanding, spatial reasoning, program design, mathematical modeling, and result validation at the same time, rather than being a simple text-matching problem.
A Geometry Web Task Suitable for Testing Model Capability
Consider the following test task: ask the model to generate an HTML interactive page that uses straightedge-and-compass construction ideas to construct a regular heptagon, with step-by-step animation and animated image export.
The example requirements can be abstracted as follows:
- First construct a unit square.
- Draw the perpendicular bisector of the bottom edge.
- Using a specified vertex as the center and the square’s diagonal as the radius, draw an auxiliary circle.
- Use a ruler with two equidistant marks to complete a specific positioning step.
- Based on the positioning result, complete the subsequent perpendicular bisectors, center, and circle operations.
- Determine the vertices of the regular heptagon on the circumference.
- Dynamically display the construction process.
- Retain auxiliary traces only at necessary stages.
- Finally, support exporting the animation as a GIF file.
The difficulty of this task is not drawing a polygon. Drawing a polygon on a canvas is easy. The real difficulty is converting a natural-language description of a geometric process into an internally consistent computational model.
Key Constraints Hidden in the Task
1. Unit Scale Is Not Irrelevant
If the requirements do not explicitly state the side length of the square, the model needs to decide whether it should be treated as a unit square. This decision cannot be separated from the final goal.
The vertices of a regular heptagon usually lie on the same circumcircle. If the length ratios in the preceding construction are inconsistent, the resulting circle radius, positioning points, and vertex spacing may lose their geometric meaning. Therefore, the coordinate system, unit length, and canvas scaling ratio must be explicitly established at the beginning of the program.
A more robust approach is to model with mathematical coordinates and then map mathematical coordinates to screen coordinates:
function toScreen(point, scale, offsetX, offsetY) {return {x: offsetX + point.x * scale,y: offsetY - point.y * scale};}
This separates geometric calculation from screen drawing and avoids affecting mathematical logic because of issues such as the canvas y-axis pointing downward or changes in scaling.
2. The “Two-Mark Ruler” Needs a Formal Definition
A “two-mark ruler” in natural language is not an ordinary ruler. To make it executable by a program, at least the following information must be clarified:
- The distance between the two marks;
- Whether the ruler may translate;
- Whether the ruler may rotate;
- Which endpoint or mark must touch a specified point;
- Whether “passing through a line” is judged by intersection, projection, or infinite extension;
- Whether the ruler’s movement must record a trace.
If these rules are not formalized, the model may generate a visually similar animation whose computation process does not match the task. A high-quality implementation should abstract it as a geometric constraint problem. For example:
Let the ruler direction unit vector be (u), and let the two marks be separated by a fixed distance (d), with the first mark passing through point D. If the second mark needs to pass through a target line, the ruler direction can be solved using the positional relationships of the points and the line equation, rather than relying on frame-by-frame trial and error.
This representation is more suitable for program implementation and easier to verify afterward.
3. “Necessary Traces” Require State Management
The requirement that the compass leave traces only at necessary stages means the program cannot simply overlay all drawing content permanently on the canvas. A more reasonable approach is to split content into multiple layers:
- Static base graphics;
- Auxiliary lines for the current step;
- Temporary moving objects;
- Arcs or traces that need to be retained;
- Text descriptions and step numbers.
Redrawing these layers on every frame allows precise control over which elements are shown, hidden, or retained. For example:
const state = {step: 0,rulerAngle: 0,showSquare: true,showConstructionLines: false,retainedArcs: [],temporaryObjects: []};
When the animation moves to the next step, only the state is modified, not the pixels directly. This makes it easier to control traces and also supports pause, replay, jumping, and export.
Four Aspects for Evaluating Model Code Generation
1. Is the Geometric Model Correct?
First, check whether the model has established explicit point, line, circle, and polygon objects, rather than hardcoding all elements as a series of drawing commands.
Recommended data structures include:
const point = { x: 0, y: 0 };const line = { p1: point, p2: point };const circle = { center: point, radius: 1 };
For each construction step, the model should also record input objects, output objects, and dependencies. This helps determine whether the model truly understands relationships such as “with a certain point as the center,” “based on a certain line,” and “make a certain mark pass through a certain auxiliary line.”
2. Does the Animation Reflect the Real Process?
Many automatically generated web pages directly show the final figure and then create an animation effect through simple opacity changes. This does not prove that the model understands the construction workflow.
A more reliable implementation uses a step state machine:
const steps = [{ name: "Draw square", duration: 1000 },{ name: "Draw perpendicular bisector", duration: 1000 },{ name: "Draw auxiliary circle", duration: 1200 },{ name: "Move two-mark ruler", duration: 1800 },{ name: "Determine circle center", duration: 1000 },{ name: "Generate regular heptagon", duration: 1200 }];
Each step should have a clear start state, end state, and explainable transition. This helps users understand the process and helps locate implementation errors in the model.
3. Is the Result Mathematically Verified?
A figure that “looks like a regular heptagon” is not necessarily a regular heptagon. The program should numerically verify the vertices, for example by checking:
- Whether all vertices are approximately equidistant from the circle center;
- Whether the chord lengths between adjacent vertices are approximately equal;
- Whether the central angle between adjacent radii is close to (2\pi/7);
- Whether the polygon is closed;
- Whether the drawing order is consistent along the circumference.
An error tolerance can be used for judgment:
function nearlyEqual(a, b, tolerance = 1e-6) {return Math.abs(a - b) <= tolerance;}
In engineering practice, validation logic does not necessarily need to be shown to end users, but it should exist during development and testing. It effectively distinguishes “an implementation that follows geometric rules” from “an implementation based only on visual approximation.”
4. Is the Export Function Actually Usable?
GIF export is not as simple as adding a button to the page. It also involves:
- Capturing canvas content frame by frame;
- Controlling frame rate and delay;
- Handling the total animation duration;
- Choosing an appropriate color quantization method;
- Avoiding page jank during export;
- Generating and downloading the file under browser limitations.
If the model only implements a button with no actual logic, or if the exported content is not synchronized with the page animation, the feature cannot be considered complete. During evaluation, you should actually click, play, pause, and inspect the generated file, rather than only checking whether the word “export” appears in the code.
Designing a More Scientific Model Evaluation Process
To avoid the randomness of a single test, a layered evaluation can be used.
Layer 1: Instruction Parsing
Check whether the model can restate the task goal, list key objects, identify implicit conditions, and point out ambiguities in the description.
Layer 2: Solution Design
Ask the model to first provide the data structures, coordinate system, geometric algorithms, and animation state machine before generating code. This shows whether the model can model the problem before coding.
Layer 3: Minimal Runnable Implementation
First implement the drawing of the square, auxiliary lines, and circles, then gradually add ruler movement, trace retention, and polygon generation. Staged validation makes it easier to find problems than generating the complete project in one pass.
Layer 4: Boundary Testing
Change the canvas size, scaling ratio, window size, and playback speed to check whether the figure still maintains correct proportions. Also test scenarios such as pausing and resuming playback, repeated playback, and quickly switching steps.
Layer 5: Human Review
For tasks involving geometric construction, a person with relevant knowledge must check whether the process matches the task. Automated tests can verify numerical correctness, but they cannot fully replace human judgment of construction logic and presentation.
An Objective Assessment of Practical LLM Capability
If a model can accurately construct object relationships, fill in reasonable constraints, generate a runnable interactive page, and verify mathematical results under an incomplete, colloquial prompt that contains professional concepts, then its prompt adherence has indeed reached a high level.
At the same time, we should avoid equating one successful web page generation with complete engineering capability. Such tasks mainly reflect the model’s performance in “rapid prototyping” and “natural-language-based generation of interactive interfaces.” They may not cover requirement changes, module collaboration, exception handling, performance optimization, security review, and long-term maintenance in large projects.
It is also necessary to distinguish between two capabilities:
- Vibe coding capability: The model can quickly generate interfaces and code that look reasonable based on a description.
- Intent-based coding capability: The model can understand the problem the user truly wants to solve, proactively fill in constraints, verify implementation results, and ask key questions when requirements are unclear.
The former can significantly improve prototyping efficiency. The latter is closer to what production-grade software development requires.
Recommendations for Developers Using These Models
First, do not ask the model to complete all functionality in one pass at the beginning. Instead, ask it to explain the requirements, then provide the mathematical model and program structure, and finally implement the solution step by step.
Second, for geometry, physics, and engineering tasks, provide verifiable constraints whenever possible. For example, specify units, coordinate systems, allowed motion types, error ranges, and output formats.
Third, ask the model to generate testing methods as well as business code. Being able to explain “how to prove the result is correct” is often more valuable than simply generating more code.
Fourth, separate static graphics, dynamic processes, interaction control, and file export into independent modules. The clearer the module boundaries, the easier it is to locate errors and replace implementation approaches later.
Fifth, do not rely only on visual judgment. For mathematical and engineering tasks, combine numerical validation, state checks, and boundary testing to avoid being misled by results that “look correct.”
Overall, complex geometry web page generation is a good case for testing an LLM’s comprehensive capabilities. It examines natural language understanding, spatial reasoning, algorithm modeling, frontend implementation, and result validation at the same time. What truly matters is not whether the model can quickly generate a piece of code, but whether it can transform ambiguous human intent into a rigorous, executable, checkable, and maintainable technical solution.
