Evaluating Complex Instruction Following in Large Models: A Practical Engineering Approach

    This article discusses how to evaluate and implement complex instruction-following capabilities in large language models, using a challenging geometric construction task—constructing a regular heptagon with a marked ruler—as a test case. It outlines the core dimensions of instruction adherence, proposes a concrete test design, defines evaluation metrics and common failure modes, and describes engineering practices such as structured prompts and validator-based iterative refinement for reliable complex task delivery.

    Beyond Simple Format Compliance

    Instruction following is often mistaken for whether a model outputs in the requested format. However, for high-parameter models with long reasoning chains, meaningful compliance involves at least four layers:

    1. Semantic fidelity: The output does not substitute the goal, such as downgrading a “marked ruler” construction to a regular straightedge construction.
    2. Constraint satisfaction: Both explicit and implicit constraints hold, e.g., unit square, tick spacing, and compass/ruler trace rules.
    3. Process correctness: Every step in a long workflow is explainable and reproducible, not just the final result.
    4. Reasonable ambiguity resolution: When instructions contain vague phrasing like “necessary traces” or “standard operations,” the model fills in gaps using domain knowledge.

    This capability is difficult because long reasoning chains amplify local deviations. If the model misidentifies an object in early steps, later reasoning may remain internally consistent but the final outcome will stray from user intent. Complex instruction following is not a single point capability—it integrates term comprehension, spatial reasoning, constraint solving, code generation, and process verification.

    Test Case Design: Constructing a Regular Heptagon with a Marked Ruler

    The goal is to generate a single-page HTML page that uses a canvas or vector graphics to draw the process of constructing a regular heptagon with a marked ruler, and supports exporting animation frames to GIF. The core steps can be abstracted as:

    • Take a square and draw the perpendicular bisector of its base.
    • With the lower right vertex E as center, draw a circle E with radius equal to the diagonal.
    • Using a marked ruler, keep the ruler tight against the lower left vertex D, moving the first tick mark along circle E until the second tick mark passes through the perpendicular bisector.
    • Add standard perpendicular bisector and center-finding steps.
    • Leave compass traces only where necessary.
    • Finally, add GIF export functionality.

    This test case is dense with evaluation points. First, the terminology is niche. A marked ruler has two fixed tick marks, unlike a normal straightedge. If the model does not understand its physical constraint, it may substitute ordinary straightedge-and-compass steps. Second, multi-object reference is intensive. Almost every step involves the square, the base’s perpendicular bisector, vertex D, vertex E, circle E, the two tick marks of the ruler, and the movement condition—anaphora resolution errors cascade. Third, implicit parameters abound. The prompt does not specify the square’s side length, but given the goal of a regular heptagon, the square should be unit-side; the tick spacing of the marked ruler is also assumed to be one unit. Fourth, vague semantics need completion. “Necessary traces” requires the model to judge which auxiliary lines are needed based on construction logic. Fifth, the output is multimodal: geometrically correct, executable code, playable animation, and exportable frame sequence.

    Therefore, this test is not simply “write a webpage”—it is a comprehensive test of the model’s ability to understand complex spatial operations, physical constraints, and fuzzy semantics.

    Evaluation Metrics and Common Failure Modes

    A scoring rubric should include:

    • Instruction coverage: Are all explicit steps implemented?
    • Constraint satisfaction: Are constraints like unit square, tick spacing, ruler tightness, and compass trace limits respected?
    • Semantic fidelity: Is a marked ruler actually used, rather than a regular ruler substitute?
    • Geometric correctness: Are points on circles, lines through target points, and tick spacing equal to unit length?
    • Process reproducibility: Do animation frames match the construction step order?
    • Code runnability: Does the HTML load independently without external dependencies?
    • Reasonable ambiguity resolution: Does the completion of “necessary traces” align with domain conventions?

    Common failure modes include: treating the marked ruler as a plain ruler; arbitrarily assigning square side length; setting tick spacing to arbitrary values; misresolving multi-object references; skipping the combined constraint that the first tick rests on circle E and the second tick passes through the perpendicular bisector; drawing too many or too few compass traces; outputting only a static image with no animation; and leaving GIF export as a stub without frame sequence.

    Evaluation should record failed assertions rather than subjective impressions.

    Engineering Practices: Structured Prompts and Validators

    To improve stability in complex task delivery, the prompt should be structured. A template of “Goal–Input–Constraints–Steps–Verification–Output” works well: the goal specifies the final artifact; input states available units; constraints list implicit parameters and tolerances; steps break the task into phases; verification provides checkable assertions; output defines file format and frame sequence structure.

    Generation should be phased: first establish the geometric model, then implement rendering, then generate animation, then export frame sequences. Each phase includes self-check points to avoid error accumulation. For example, the geometry phase checks that points lie on circles, lines pass through target points, and tick spacing equals unit length; the rendering phase checks canvas dimensions and coordinate transforms; the animation phase verifies frame-count correspondence with steps; the export phase checks frame sequence completeness and encoding API calls.

    An illustrative code skeleton is:

    1. <!doctype html>
    2. <html>
    3. <body>
    4. <canvas id="stage" width="800" height="800"></canvas>
    5. <script>
    6. const unit = 1;
    7. const points = { D: [0, 0], E: [1, 0] };
    8. function drawLine(ctx, a, b) { /* draw line segment */ }
    9. function drawCircle(ctx, center, radius) { /* draw circle */ }
    10. function drawMarkedRuler(ctx, angle, spacing) { /* draw marked ruler with two ticks */ }
    11. function solveRulerConstraint(D, circleE, midline, spacing) {
    12. // Search for an angle satisfying the joint constraint:
    13. // 1. The ruler edge stays tight against D.
    14. // 2. The first tick point lies on circle E.
    15. // 3. The second tick point lies on the midline.
    16. // 4. The distance between the two tick points equals spacing.
    17. // Numerical solving depends on the actual geometric relation.
    18. }
    19. function renderFrame(t) {
    20. // Draw the current construction step according to progress t
    21. }
    22. const frames = [];
    23. for (let i = 0; i < 120; i++) {
    24. frames.push(renderFrame(i / 120));
    25. }
    26. // encodeFrames(frames) handles GIF output via a generic frame-sequence encoder
    27. </script>
    28. </body>
    29. </html>

    Validators are equally important. Key constraints can be written as assertions:

    1. assert(onCircle(P, E, radiusE));
    2. assert(onLine(Q, midline));
    3. assert(Math.abs(distance(P, Q) - unit) < 1e-6);
    4. assert(frames.length > 0 && frames.every(Boolean));

    When an assertion fails, do not ask the model to rewrite the whole output. Instead, feed back the failed assertion, the current code, and the expected constraints, and require only the faulty part to be fixed. This reduces iteration cost and preserves observable logs for regression testing.

    Conclusion

    Complex instruction-following capability is a core metric for the engineering usability of complex tasks. A niche geometric construction test is valuable because it simultaneously exposes issues in terminology comprehension, implicit constraints, multi-object reference, spatial reasoning, and process verification. Teams should reduce subjective judgments like “does the answer look right” and increase reliance on executable validators, failed assertions, and regression samples. Only by closing the loop of prompt, constraints, verification, and iterative repair can complex task delivery become stable and reproducible.