Designing Evaluations for Natural Language Instruction Following in Code Generation: A Regular Heptagon Case Study with a Two-Mark Ruler
This article explains how to design evaluations that test whether large language models can follow natural language instructions in technical tasks. It uses constructing a regular heptagon with a two-mark ruler as a case study. The article covers the specialized tool knowledge and multi-object references the task requires, the premises users leave unstated, a five-dimension scoring framework, a Python script that checks the geometry numerically, common failure modes, and practical recommendations for acceptance testing.
1. Why Measure Instruction Following in Natural Language
Large models are increasingly used in daily work in ways that resemble spoken communication between people. Users rarely write step-by-step, executable specifications. Instead, they describe what they need in natural language that includes omissions, default assumptions, and technical terms. Whether a model can recover the real intent from such descriptions determines whether it can take over part of the repetitive design and coding work.
For this reason, checking whether a model can complete standardized boilerplate tasks is not enough. A more useful test gives a conversational description with a clear goal, then observes whether the model understands the technical concepts, fills in conditions the description leaves out, and produces output that meets the constraints.
This kind of test centers on three questions:
- Does the model correctly identify the technical terms and objects in the task?
- Can the model fill in premises that the description omits, and state consistent assumptions?
- Does the final output satisfy all constraints, rather than only looking complete on the surface?
2. Task Structure: Multi-Object Reference and Implicit Conditions
Using “constructing a regular heptagon with a two-mark ruler” as the example, the task presents two kinds of difficulty.
2.1 Understanding a Specialized Tool
A two-mark ruler is a straightedge with two marks on it. In a construction, one mark slides along a given curve, such as a circle, while the other mark passes through a specified point. This produces a new point that satisfies a distance condition. In classical geometry, this operation is called a “neusis” construction.
Ordinary ruler-and-compass construction allows only an unmarked straightedge and a compass. According to Gauss and others, a regular heptagon cannot be constructed with ruler and compass alone, but it can be constructed with a two-mark ruler. The task therefore requires the model to go beyond standard ruler-and-compass knowledge and understand the operating rules of a non-standard tool.
2.2 Tracking Multiple Objects Across Steps
Nearly every step involves at least three objects at once: the vertices of the square, the perpendicular bisector of the base, a circle centered on one vertex, the two marks on the ruler, and the intersection points among them. The model must keep track of these references accurately. For example, it must know which vertex is “the lower-right vertex” or that the ruler stays “pressed against the lower-left vertex.” A single misreference invalidates every step that follows.
2.3 Unstated Premises
The description leaves several conditions unstated:
- The side length of the square is not given. The final goal is a regular heptagon, and the proportions in later steps must hold. The square can therefore only have unit side length. The model needs to infer this premise from the goal.
- The distance between the two marks on the ruler is not given. It is usually assumed to be unit length, which matches the unit square.
- The meaning of “necessary traces” is ambiguous. The model must decide, based on the logic of the construction, whether to keep every arc the compass draws or only the arcs that determine intersection points.
These omissions are not defects. They are normal in real work. The value of the test lies in observing how the model handles them.
3. Evaluation Dimensions
Instruction following should be split into five dimensions, each scored separately. A single total score would hide specific problems.
| Dimension | What It Checks | Assessment Method |
|---|---|---|
| Terminology understanding | Whether the model uses concepts such as the two-mark ruler, perpendicular bisector, and neusis correctly | Manual review of how accurately the concepts are used |
| Assumption completion | Whether the model states and consistently applies assumptions such as unit length | Check that assumptions are declared and used consistently |
| Step completeness | Whether the output covers all construction steps the task requires | Item-by-item comparison against a step checklist |
| Constraint satisfaction | Whether the final figure meets the geometric conditions of a regular heptagon | Numerical verification (see Section 4) |
| Output compliance | Whether the output meets additional requirements, such as an exportable animation file | Check file format, frame count, and playability |
Of these, constraint satisfaction is the most reliable dimension. A program can judge it automatically, without relying on subjective assessment.
4. Numerical Verification Method
A regular heptagon satisfies three conditions: all seven sides have equal length, all vertices are equidistant from the center, and the central angle between adjacent vertices is 2π/7. The following code depends only on the standard math library and is provided for reference:
import mathdef dist(p, q):return math.hypot(p[0] - q[0], p[1] - q[1])def is_regular_heptagon(pts, tol=1e-3):"""pts: seven vertex coordinates (x, y) given in order."""n = len(pts)if n != 7:return False# 1. All seven sides have equal lengthsides = [dist(pts[i], pts[(i + 1) % n]) for i in range(n)]if max(sides) - min(sides) > tol:return False# 2. All vertices are equidistant from the centercx = sum(p[0] for p in pts) / ncy = sum(p[1] for p in pts) / nradii = [dist(p, (cx, cy)) for p in pts]if max(radii) - min(radii) > tol:return False# 3. The central angle between adjacent vertices is 2π/7angles = [math.atan2(p[1] - cy, p[0] - cx) for p in pts]for i in range(n):d = (angles[(i + 1) % n] - angles[i]) % (2 * math.pi)if abs(d - 2 * math.pi / n) > tol:return Falsereturn True
Keep two points in mind when using this code:
- Sort the vertices by central angle first. Otherwise, the third check may report false failures.
- The scale may vary. If the square the model outputs does not have unit side length, check the ratio of circumradius to side length instead. For a regular heptagon, this ratio is 1 / (2 sin(π/7)) ≈ 1.1524, regardless of absolute scale.
5. Common Failure Modes
Models typically show the following problems in this kind of test. Record each one separately during evaluation to identify where improvement is needed.
- Tool misunderstanding. The model uses the two-mark ruler as an ordinary straightedge and ignores the requirement that both marks constrain the ruler at the same time. The resulting figure looks plausible, but the numerical check fails.
- Reference drift. In a multi-step operation, a vertex identified earlier as “the lower-right vertex” is later mistaken for a different vertex. This error is most common when many objects are involved.
- Inconsistent assumptions. The model sets unit side length early on but later uses other values in its calculations, which throws off the proportions.
- Excessive or insufficient output. Keeping every compass arc makes the figure hard to read. Keeping only the final result omits the process the task requires.
- Surface completeness. The code runs and the figure looks like a regular heptagon, but the numerical check reveals deviations in side lengths or angles. Only a program can catch this kind of problem.
6. Engineering Recommendations
When applying this approach to acceptance testing of real LLM applications, consider the following practices.
- Build a test set with reference answers. Attach a programmatically verifiable pass condition to each task so that evaluation does not rely only on visual inspection.
- Require the model to state its assumptions. Add an instruction to the prompt, such as “List all assumptions you adopt before starting the steps.” This makes it possible to check whether the model completes premises correctly.
- Check intermediate results step by step. For multi-step tasks, require the model to output intermediate coordinates or states after each step. This helps locate the step where an error first appears.
- Record and classify failed samples. Tally failures by the five failure modes above. This guides prompt and system design improvements better than the pass rate alone.
- Separate capability from presentation. If the model’s mathematical reasoning is correct but its output format does not meet the requirements, record the two problems separately. Otherwise, a formatting error may be mistaken for a lack of understanding.
7. Final Notes on Use
Natural language instruction-following tests aim to check whether a model can recover the user’s real intent from conversational descriptions that contain omissions. In professional settings, this ability reflects practical value better than performance on standard examples. Test design should keep the ambiguity of real descriptions where possible, while using programmatically verifiable constraints as the basis for judgment. This way, the conclusions reflect actual work and rest on evidence that others can check.
