How to Test Complex Instruction Following in LLMs: A Reproducible Evaluation Method

    This article defines explicit and implicit instruction constraints, proposes four numerically checkable evaluation dimensions, explains how to design a three-tier test set, provides five prompt-and-acceptance examples, and includes a Python standard-library check script for reproducible evaluation.

    1. Define the Conceptual Boundaries

    Instruction following refers to how well a model’s output satisfies user requirements. These requirements fall into two categories. The first is explicit requirements: points, lines, dimensions, and steps written directly in the prompt. The second is implicit constraints: conditions the task must satisfy even though the user did not write them, such as absolute dimensions or unit length.

    “Vibe Coding” and “Wish Coding” are terms proposed in the original article, not industry-standard terminology. This article uses them only for the scenario of turning colloquial requirements into code.

    Implicit constraints cannot be treated uniformly. If a user says “draw a square,” and the task only involves proportional relationships, the side length can take any value, and the model does not need to infer a unit length. Only when the acceptance requirement fixes pixel coordinates or requires a unique numeric result must the model choose a unit itself. The criterion is simple: check whether the acceptance standard requires absolute dimensions.

    This article divides evaluation into four dimensions, each of which can be checked numerically:

    Dimension What It Examines Pass Example Fail Example
    Implicit constraint inference Select and consistently use a unit length Model states “1 unit = 200 pixels,” and all subsequent lengths are converted accordingly Unit is undefined, or two conversions are inconsistent
    Multi-object reference Correctly distinguish points, lines, and circles, and preserve their relationships Circle O is centered at B with radius √2, and intersection point P lies on the circle P is not on the circle, or the center is written as another point
    Term mapping Convert technical terms into concrete geometric operations “Perpendicular bisector” is output as a line through the midpoint and perpendicular to the segment The line passes through an endpoint, or is not perpendicular to the segment
    Operation and physical constraints Keep only the traces required by the task Only points, segments, and arcs of the final figure remain Intermediate auxiliary lines remain, or a full circle is drawn

    Expressions such as “necessary traces” need to be rewritten as explicit rules. The rule in this article is: keep only the points, segments, and arcs used in the final construction, and delete all other auxiliary lines. Without a rule, it is impossible to judge whether the model is right or wrong.

    2. How to Design the Test Set

    The test set is divided into three difficulty levels, and every level must cover every dimension:

    1. Single-step tasks: one object and one operation, such as finding a midpoint or a perpendicular line. These confirm basic capability.
    2. Multi-object tasks: two or three objects constrain one another, such as the intersection of a circle and a line.
    3. Long-chain tasks: three to six steps, including implicit constraints and trace rules, such as a two-mark ruler construction.

    Prepare at least five tasks for each dimension. Store reference answers for the tasks, and compute those answers numerically rather than relying only on human judgment.

    The test environment is standardized as follows:

    • Python 3.11, using only the standard library and no additional dependencies.
    • Web-based tasks are opened and checked in Chrome 120 or above.
    • The model parameter temperature is set to 0.
    • Record the model name, version number, and call date, because models are updated and old results need timestamps.

    Use three numbers as evaluation metrics:

    • Strict pass rate = number of tasks that pass all checks ÷ total number of tasks
    • Weighted score = average of per-task scores, with a full score of 100
    • Stability = number of tasks that are run 3 times with completely identical results ÷ total number of tasks

    The weights are a suggested starting point in this article, not an experimental conclusion. Teams should adjust the weights based on the most common failure types in their business.

    3. Complete Prompts and Acceptance Criteria

    Case 1: Constructing a Regular Heptagon with a Two-Mark Ruler (Long-Chain Task)

    The complete prompt is as follows:

    Please output a single-file HTML that uses Canvas 2D to draw the following construction process and lists the coordinates of each step at the bottom of the page.
    Setup: square ABCD, A(0,0), B(1,0), C(1,1), D(0,1); 1 unit length corresponds to 200 pixels on the canvas.
    Steps:

    1. Construct the perpendicular bisector l of segment AB.
    2. Draw circle O centered at B with radius equal to segment AC.
    3. Fix one end of a two-mark ruler at A. The distance between the two marks on the ruler is 1 unit. Move the ruler so that the first mark P lies on circle O, the second mark Q lies on line l, and A, P, and Q are collinear.
    4. Starting from P and Q, draw the seven vertices of a regular heptagon.
    5. Keep only the points, segments, and arcs needed by the final figure, and delete intermediate auxiliary lines.
      Output: runnable HTML code and a coordinate list for P, Q, and the seven vertices.

    Acceptance conditions are as follows:

    • The file opens in Chrome 120 without errors.
    • |BP| = √2, with an error no greater than 1e-3.
    • The x-coordinate of Q is 0.5, with an error no greater than 1e-3.
    • |PQ| = 1, with an error no greater than 1e-3.
    • A, P, and Q are collinear.
    • The seven vertices pass check_regular_polygon.
    • Auxiliary lines have been deleted, checked manually.

    The original article does not prove the regular heptagon construction. Before launch, evaluators should first obtain a reference solution numerically. If the reference solution does not exist, or the resulting figure is not a regular heptagon, the task should be removed from the test set rather than marking the model as failed.

    Case 2: Draw a Line Through a Point and Find the Intersection (Multi-Object Task)

    Prompt: Draw circle O centered at A(0,0) with radius equal to segment AC, where C is (3,4). Draw a line through B(6,0) and C. This line intersects circle O at another point D besides C. Output the coordinates of D and provide the verification process.

    Standard answer: D = (4.68, 1.76). Verification method: |AD| = 5, and D lies on line BC.

    Failure example: The model returns C itself, or the radius is written as another value.

    Case 3: Find the Perpendicular Bisector (Term Mapping Task)

    Prompt: Find the equation of the perpendicular bisector of segment AB, where A(0,0) and B(4,2).

    Standard answer: 2x + y − 5 = 0. Verification method: the midpoint (2, 1) lies on the line, and the direction of the line is perpendicular to AB.

    Failure example: The line passes through point A, or the slope is wrong.

    Case 4: Choose a Unit Length (Implicit Constraint Task)

    Prompt: Draw a square as a measurement baseline. After that, use its side length as the unit for all lengths. Draw a horizontal segment 3 units long and a vertical segment 0.5 units long. Output the pixel length of each segment and state the unit used.

    Acceptance method: The model must choose the pixel value of the side length itself and state it. The pixel-length ratios for the horizontal and vertical segments should be 6:1 and 1:1, respectively.

    Failure example: The unit is not stated, or the unit is changed midway.

    Case 5: Trace Rule (Physical Constraint Task)

    Prompt: One end of a marked ruler is fixed at point A and rotates around A, drawing the arc traced by the first mark. Keep only the arc needed by the final result, and delete all intermediate auxiliary lines.

    Acceptance method: The image can contain only one arc and point A; a full circle or other auxiliary lines must not appear. Check manually.

    4. Runnable Check Script

    The following code uses only the Python standard library. Save it as check_instruction.py and run it directly to see the example results.

    1. import math
    2. TOL = 1e-3
    3. WEIGHTS = {"implicit": 30, "multi_object": 40, "physical": 30}
    4. def dist(p, q):
    5. return math.hypot(p[0] - q[0], p[1] - q[1])
    6. def cross(o, a, b):
    7. return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0])
    8. def on_circle(p, center, radius, tol=TOL):
    9. return abs(dist(p, center) - radius) <= tol
    10. def on_line(p, a, b, tol=TOL):
    11. return abs(cross(a, b, p)) / dist(a, b) <= tol
    12. def check_case_bc(d, a, c, b):
    13. """Case 2: D lies on circle (center A, radius |AC