Evaluating LLMs: Instruction Following and Complex Coding Ability
How well does a large language model truly follow complex instructions? This article uses a geometric construction task — building a regular heptagon with a marked ruler — as a test case to explore how to evaluate instruction following beyond surface-level code generation. It covers the four levels of instruction compliance, converting natural language into verifiable mathematical constraints, layering web implementation architecture, and building credible evaluation criteria including requirement coverage, geometric correctness, method fidelity, and engineering stability. Developers will learn practical ways to assess whether an LLM can carry real development tasks, not just produce polished-looking output.
1. From “Generation Quality” to “Constraint Fulfillment”
When evaluating an LLM’s coding ability, the easiest things to observe are whether the code is complete, the page looks good, and the interactions feel smooth. But these surface qualities don’t prove the model actually understood the user’s requirements.
A more revealing question is: when a task combines domain terminology, multi-object relationships, sequential operations, and ambiguous phrasing, can the model translate natural language into consistent, executable, and verifiable constraints — and preserve those constraints in the final implementation?
For example, suppose a user asks for a web page demonstrating the construction of a regular heptagon using a two-marked ruler, while also completing omitted construction steps, limiting auxiliary marks, and supporting animation export. Even if the model produces a polished page, it might simply divide a circle into seven equal vertices and add a plausible-looking ruler-and-compass animation. The result shows the target figure but never implements the specified process.
Therefore, instruction following should not be judged merely by “did it respond to the request.” It should be broken down into four levels:
- Requirement identification: Did the model find all explicit requirements and their dependencies?
- Semantic interpretation: Did it correctly understand domain terms and spatial operations?
- Constraint execution: Does the generated program continuously satisfy the mathematical and interaction conditions?
- Result verification: Can it prove the output meets the goal, rather than relying on visual inspection alone?
These four levels together determine whether a model can handle real development tasks. Code generation is only one part of the picture.
2. Why Geometric Construction Is a Good Test for Complex Instructions
Geometric construction tasks have a special advantage: visual appearance and mathematical correctness can be checked independently.
An approximate heptagon may be nearly indistinguishable on screen from a rigorous construction. A ruler in an animation may appear to touch a vertex while actually failing the collinearity constraint. Such tasks expose models that are “fluent in expression but missing in reasoning.”
1. Multiple Objects Must Stay Correlated
Start with a square, with D as the lower-left corner and E as the lower-right corner. Construct the perpendicular bisector of the bottom edge, then draw a circle centered at E with a radius equal to the square’s diagonal. Next, using a ruler with two fixed marks, position it so the ruler’s edge passes through D, and the two marks satisfy the respective constraints on the circle and the perpendicular bisector.
This is not a set of independent drawing commands but a group of coupled constraints:
- The ruler’s edge passes through a specified vertex;
- The distance between the two marks is fixed;
- One mark lies on a specified circle;
- The other mark lies on a specified line;
- The ordering of the marks and the chosen intersection points may affect subsequent steps.
A model that merely memorizes keywords like “draw circle,” “draw ruler,” or “draw heptagon” cannot perform the actual operation.
2. Process Correctness Cannot Be Replaced by the End Result
Directly computing the heptagon’s vertex coordinates is a valid way to generate the figure, but it does not automatically implement the specified two-marked-ruler construction process.
An evaluation must distinguish:
- Whether the target figure was obtained;
- Whether the specified construction method was used;
- Whether the key steps of that method were demonstrated;
- Whether the model explained why those steps lead to the target figure.
If the task explicitly restricts the method, then bypassing the construction and directly outputting the answer still counts as an instruction-following failure.
3. Ambiguous Requirements Directly Affect Implementation
Phrases like “complete the standard construction,” “keep only the necessary marks,” and “the ruler should hug the vertex” carry significant interpretive room.
A reliable model should not package its own guesses as explicit user requirements. Instead, it should state its default interpretation and identify which assumptions affect the mathematical conclusion, interaction behavior, or acceptance criteria.
3. Two Easily Overlooked Mathematical Points
1. The Square Doesn’t Need a Unique Absolute Side Length
For computational convenience, the square’s side length can be normalized to 1, but that is merely a coordinate choice, not the only scale under which the construction holds.
Let the square’s side length be s and the distance between the two marks on the ruler be m. What the construction actually cares about is the dimensionless ratio:
ρ = m / s
If a construction step requires the mark spacing to equal the square’s side length, the constraint should be written as m = s. Scaling all lengths proportionally changes neither the angular relationships nor the similarity of the figure.
So when a prompt doesn’t specify a side length, the reasonable response is to state:
“For computational convenience, we use a unit square; we also assume the ruler’s mark spacing equals the square’s side length.”
This involves two distinct actions: the former is normalization; the latter is a construction assumption that needs confirmation. Conflating the two leads to the erroneous conclusion that the construction only works with unit side length.
2. A Two-Marked Ruler Is Not an Ordinary Unmarked Straightedge
The two-marked ruler here should clearly mean a straightedge carrying two fixed marks. Positioning such a ruler by simultaneously satisfying multiple constraints falls under the operations of neusis-style construction, which differs from the classical system allowing only an unmarked straightedge and compass.
A regular heptagon cannot be constructed exactly under classical straightedge-and-compass rules. Introducing a marked ruler changes the allowed operations — but that doesn’t mean any arbitrary “move the ruler around” procedure will yield a heptagon.
To prove a specific scheme works, you still need to:
- Fully state all initial conditions;
- Determine the mark spacing and its relationship to the square;
- Specify which solution branch satisfies the constraints;
- Provide the subsequent construction steps;
- Verify the final angular or side-length relationships.
If the original description omits key steps, the model should honestly point out the gaps rather than fabricate a seemingly complete proof.
4. Converting Natural Language into a Checkable Mathematical Model
A robust implementation should first establish the geometric model, then write the page animation.
Set up coordinates:
- D = (0, 0);
- E = (s, 0);
- The square’s two upper vertices at (0, s) and (s, s);
- The perpendicular bisector of the bottom edge: x = s/2;
- Circle E with radius √2s.
Let the two marks on the ruler be P and Q, spaced m apart. Under one clear semantic interpretation: the ruler’s edge passes through D, P lies on circle E, and Q lies on the perpendicular bisector. The core conditions are:
- D, P, Q are collinear;
- |P − Q| = m;
- |P − E|² = 2s²;
- Q’s x-coordinate equals s/2.
But these equations alone are not enough. You also need to specify whether P and Q lie on the same ray from D, which mark is closer to D, and whether only solutions within a certain region are considered.
Using a unit direction vector u for the ruler’s orientation:
P = a·u, Q = b·u, with |u| = 1.
The fixed mark spacing then becomes |a − b| = m. With this parameterization, the program maintains collinearity by construction rather than through per-frame visual adjustment.
Numerical Solving Is Not a Construction Proof
Web pages typically rely on floating-point computation, so numerical methods can find a ruler position satisfying the constraints. But numerical solving and mathematical proof must be kept distinct.
A solver answers: “Under the specified tolerance, were coordinates found that satisfy these equations?”
A construction proof answers: “Why do these conditions necessarily produce the required heptagon relationships?”
Both are indispensable. Without proof, a program may reliably converge on the wrong target; without numerical verification, correct derivations can be broken by coordinate transformations or implementation bugs.
5. How to Fill in Missing Steps
When a user says “then do the perpendicular bisector to find the circumcenter, and other standard operations,” it must not be interpreted as permission for the model to stitch together arbitrary steps.
First, clarify what the inputs to the subsequent operations are. For example, if three non-collinear vertices have been obtained and proven to lie on the target circumcircle, then you can:
- Connect two pairs of vertices to form two chords;
- Construct the perpendicular bisector of each chord;
- Take the intersection of the bisectors as the center;
- Draw the circumcircle using the distance from the center to any known vertex;
- Determine the remaining vertices using the proven side-length or central-angle relationships.
The key phrase is “proven to lie on the target circumcircle.” You cannot pick three arbitrary points and then treat their circumcircle as the target circle.
Likewise, stepping off a fixed length around the circle seven times cannot be accepted as the heptagon’s side length just because the result appears to nearly close. You must further verify the chord length, vertex ordering, closure, and angle relationships.
When the inputs are insufficient to determine a complete construction, an acceptable output is “a runnable constraint demonstration plus flagged unresolved steps” — not a fake “rigorous, complete heptagon construction.”
6. Web Implementation Should Separate Geometry, Process, and Rendering
Putting all the logic into a single drawing function often means modifying the animation breaks the geometric conditions. A more reliable structure is layered.
1. Geometry Layer
Stores points, lines, circles, intersections, and constraint relationships, and is responsible for verifying distances, perpendicularity, collinearity, and solver results.
The geometry layer should use its own world coordinates and never depend directly on screen pixels. Otherwise, window resizing could alter length relationships that should remain invariant.
2. Process Layer
Uses a state machine to describe the construction sequence, for example:
“Build the square → construct the perpendicular bisector → draw the auxiliary circle → position the two-marked ruler → execute subsequent construction → verify the result.”
Each state should record its preconditions, current objects, completion conditions, and failure reasons. This enables pause, rollback, replay, and pinpointing exactly which step failed.
3. Rendering Layer
Maps geometric objects to the screen and displays lines, labels, tool poses, and auxiliary explanations.
The rendering layer may use interpolation for smooth animation, but key nodes must come from the geometry layer’s computations. Points under constraints must never be dragged to arbitrary positions for the sake of visual continuity.
4. Export Layer
The export logic should read from the same process state, rather than recording a separate demo that may drift out of sync with the page. This reduces the risk of “correct on the page, wrong in the export.”
7. “Necessary Marks” Requires an Executable Definition
A compass motion doesn’t mean the full circle must be displayed. Many straightedge-and-compass constructions only need the local arcs used to determine intersections.
On-screen objects can be divided into four categories:
- Base objects: initial conditions such as the square and reference lines;
- Tool objects: the ruler, compass, and their current positions;
- Auxiliary marks: arcs, extension lines, and temporary markers needed for intersections;
- Result objects: final vertices, edges, and the target circle.
For each step, specifying which objects are added, which are temporarily hidden, and which are retained as final evidence turns “show only necessary marks” into a verifiable requirement.
A reasonable default: draw only the local arcs that explain the origin of each intersection; tool movements leave no infinitely accumulating trails; the final frame retains the target figure and the essential construction evidence. If the educational purpose requires full traces, provide that as a separate toggle.
8. Animation Export Is Part of the Complete Engineering Task
Supporting GIF export is not just adding a button. The program must genuinely generate a downloadable, playable animation file.
Common issues to consider include:
- Whether exported frames cover the complete construction process;
- Whether per-frame durations match the demo pacing;
- Whether static explanation stages hold long enough;
- Whether coordinate labels remain readable after scaling down;
- Whether color quantization damages thin lines and intersection points;
- Whether frame buffering causes excessive memory usage;
- Whether export failures produce clear feedback.
The web demo and the file export should ideally share a deterministic timeline: given the same timestamp, they should produce the same geometric states and rendered content. This makes reproduction, testing, and troubleshooting much easier.
9. Building Credible Evaluation and Acceptance Criteria
Comparing two generations from a single prompt is not sufficient to conclude that “the model’s overall capability has significantly improved.” More credible evaluation requires fixed prompts, fixed running conditions, fixed scoring rules, and multiple test runs.
1. Requirement Coverage
Check item by item whether the specified construction process, necessary auxiliary steps, interactive controls, and real export functionality are all present. Claiming “supported” is no substitute for actual acceptance testing.
2. Geometric Correctness
For the two-marked-ruler positioning, check collinearity error, mark-spacing error, point-to-circle residuals, and point-to-bisector distance.
For the final heptagon, check:
- Whether all seven vertices lie on the same circle;
- Whether adjacent side lengths are equal;
- Whether vertices are ordered around the circumference;
- Whether adjacent central angles are close to 2π/7;
- Whether the figure closes correctly without self-intersection.
Errors should be normalized by a reference length rather than compared against fixed pixel thresholds, avoiding unfair judgments across different zoom levels.
3. Method Fidelity
Determine whether the model actually performed the required ruler positioning, or computed vertices directly and added decorative animation afterward. This criterion must be scored separately from final-figure correctness.
4. Handling of Uncertainty
Observe whether the model proactively states assumptions, identifies multiple solutions, flags missing conditions, and distinguishes exact construction from numerical approximation. Reasonable clarification should earn positive marks — a model shouldn’t be judged incompetent simply because it didn’t immediately output complete code.
5. Engineering Stability
Test repeated playback, consecutive exports, window resizing, and pause/resume, confirming the page shows no state leakage, label misalignment, or unbounded resource growth.
10. Practical Takeaways for Developers
In natural-language-to-code generation, the real difficulty is not writing more statements, but keeping requirements, model, and implementation consistent.
Developers can ask a model to produce four kinds of artifacts in sequence:
- Requirements and assumptions list: distinguishing explicit requirements, reasonable defaults, and unconfirmed conditions.
- Constraint model: object relationships, equations, allowed operations, and solution branches.
- Implementation plan: data structures, state transitions, rendering approach, and export flow.
- Verification evidence: residual checks, functional acceptance, and failure-case documentation.
This working style makes problems much easier to localize than “generate the complete page in one shot,” and it transfers well to report generation, business process orchestration, data transformation, and engineering computation.
Ultimately, evaluating an LLM’s instruction-following ability comes down to whether it can turn vague intent into explicit assumptions, professional requirements into executable constraints, and execution results into verifiable evidence. A polished interface and runnable code deserve credit — but only correct methods, satisfied constraints, and clear boundaries prove that a complex task was truly completed.
