Evaluating LLM Prompt Adherence: A Geometric Construction Case Study

    This article explores how to evaluate whether large language models truly follow prompt constraints rather than merely producing fluent output. Using the task of constructing a regular heptagon with a two-mark ruler as an example, it breaks prompt adherence into testable dimensions such as terminology parsing, implicit constraint satisfaction, multi-object reference, state consistency, and fuzzy semantics handling. It also covers common failure patterns, root-cause attribution, and engineering practices for regression gating.

    1. Background: Why “Being Able to Generate” Is Not “Being Able to Follow”

    In intelligent coding and automated content generation, teams often focus on surface-level metrics such as generation speed and whether the code runs. A more fundamental capability is frequently overlooked: whether the model actually understands the constraints described in the prompt and faithfully reproduces the user’s intent in its output. Many failures are not because the model “cannot write,” but because it drifts when handling references to multiple objects, implicit constraints, or ambiguous wording, ultimately producing a result that “looks reasonable but does not match the description.”

    The focus of evaluation should therefore shift from “whether the generation is fluent” to “whether the constraints are fully satisfied.” This capability can be collectively referred to as prompt adherence, which measures a model’s combined ability to parse spatial operations, physical constraints, technical terminology, and vague expressions.

    2. Task Design: Using an Obscure yet Self-Consistent Process to Increase Discrimination

    A high-discrimination evaluation task usually has three characteristics: an obscure process, internally consistent logic, and strong coupling among multiple objects at every step. Take “draw a webpage that demonstrates constructing a regular heptagon with a two-mark ruler” as an example. A sample prompt can be constructed as follows:

    1. Draw a webpage that demonstrates constructing a regular heptagon with a two-mark ruler:
    2. 1. Take a square and construct the perpendicular bisector of its base;
    3. 2. Use the bottom-right vertex as the center and the diagonal as the radius to draw a circle;
    4. 3. Keep the two-mark ruler tight against the bottom-left vertex, and move the first mark along the circle
    5. until the second mark passes through the perpendicular bisector of the base;
    6. 4. Complete the remaining compass-and-straightedge steps, determine the center, and finish the regular heptagon;
    7. 5. Keep only the necessary compass traces, and finally support exporting a dynamic demonstration.

    The difficulty of this task is concentrated in four places. First, the two-mark ruler is an obscure tool; if the model does not truly understand its “two marks defining a fixed distance” semantics, it easily degrades into an ordinary ruler. Second, a single step involves multiple objects at once, such as vertices, a circle, a perpendicular bisector, and mark lines, resulting in extremely high reference density. Third, the prompt is deliberately left incomplete—for example, no side length is given, so the model must infer a unit length; otherwise it cannot close the construction into a regular heptagon. Fourth, “necessary traces” is fuzzy wording that the model must define on its own and keep consistent.

    3. Evaluation Dimensions: Breaking “Understanding” into Decidable Items

    To make the evaluation reproducible, it is recommended to break adherence into the following dimensions and score each one:

    • Terminology parsing: whether obscure tools and technical terms are handled correctly rather than ignored or replaced.
    • Constraint satisfaction: whether implicit conditions (unit length, mark spacing) are correctly filled in.
    • Multi-object reference: whether the referenced object in each step is unique and unambiguous.
    • State consistency: whether object relationships remain self-consistent throughout the construction, with no contradictions.
    • Fuzzy semantics handling: whether a reasonable and stable interpretation is given for undefined expressions.
    • Result verifiability: whether the final figure meets the goal (a regular heptagon) and can be replayed dynamically.

    A “hard constraints first” principle can be used for judgment: an incorrect target shape is an immediate failure; the remaining dimensions are deducted based on the degree of omission. Sample judgment logic is as follows:

    1. def evaluate(result):
    2. if not result.is_regular_heptagon():
    3. return {"pass": False, "reason": "target_shape_wrong"}
    4. score = 0
    5. score += 20 * result.term_parsing_ok
    6. score += 20 * result.implicit_constraint_ok
    7. score += 20 * result.reference_unambiguous
    8. score += 20 * result.state_consistent
    9. score += 20 * result.fuzzy_semantics_stable
    10. return {"pass": score >= 80, "score": score}

    4. Common Failure Modes and Root-Cause Attribution

    In practice, model drift concentrates in three categories. The first is terminology degradation, treating the two-mark ruler as an ordinary ruler, which makes the fixed-distance logic disappear. The second is reference drift, locking onto the wrong target when multiple objects appear together. The third is constraint omission, ignoring the unit length or mark spacing so that the construction cannot close. In attribution, it is important to distinguish “understanding errors” from “expression errors”: the former requires switching tasks or adding context, while the latter can be significantly improved by structuring the prompt (bullet points, explicit variables, boundary conditions).

    5. Engineering Implementation Recommendations

    In real business scenarios, the evaluation can be moved forward as a regression gate: maintain a set of high-discrimination tasks for each core capability and incorporate them into continuous integration; introduce executable checks for generated results (geometric constraints, unit consistency, state machine checks) to reduce manual visual inspection; and record failure samples to form a searchable issue library. For large-scale task scheduling, the evaluation pipeline can be hosted on general cloud capabilities such as container platforms, message queues, object storage, and logging services, with monitoring and alerting used to track fluctuations in pass rates.

    6. Conclusion

    Prompt adherence is the key dividing line that takes a model from “being able to write” to “being controllable.” Through obscure yet self-consistent task design, decidable multi-dimensional metrics, and an engineering regression mechanism, developers can more realistically assess a model’s ability to reproduce complex constraints, thereby establishing a reliable quality baseline for intelligent coding and automated generation.