How to Evaluate Prompt Adherence in Large Language Models

    This article explains why generating fluent output does not guarantee that a model follows instructions, and introduces a test design based on a difficult geometric construction task. It covers five scoring dimensions, common failure patterns, and practical engineering recommendations for improving and tracking prompt adherence.

    1. Background: Why “Can Generate” Does Not Mean “Can Follow”

    In intelligent coding and content generation, a common gap appears: a model can produce structurally complete code or a page, yet skip key steps described by the user. As chain-of-thought length grows and parameter counts increase, language fluency generally improves, but the ability to “understand what people actually mean” does not improve at the same pace.

    Prompt adherence refers to a model’s ability to understand implicit spatial operations, physical constraints, technical terminology, and vague semantics in natural language, and then reflect the user’s true intent in the final output. It is stricter than “format compliance” and closer to business value than “the code runs.”

    2. Test Design: Building a High-Difficulty Case from a Drawing Task

    A high-discrimination case can be expressed as a task like “construct a regular heptagon using only two types of drawing tools”: start with a square and draw the perpendicular bisector of its base; then use a bottom corner as the center and the diagonal as the radius to draw a circle; next, place a ruler with two scales tightly against the other bottom corner, sliding the first scale mark along the circle until the second scale mark passes through the perpendicular bisector of the base; finally, complete the standard steps for the perpendicular bisector and center, output the target figure, and provide the ability to generate an animated GIF.

    The difficulty is layered:

    • Uncommon terminology: a two-scale ruler is not a standard drawing tool, and most models lack a stable way to handle it;
    • Multiple referents: each step involves corners, circles, perpendicular bisectors, and scale marks at the same time;
    • Colloquial omission: no side length is given, so the model must infer a unit length and work backward from the final goal;
    • Default conventions: the distance between the two scales defaults to one unit, and “necessary marks” is undefined;
    • Output constraints: the drawing trajectory must be preserved, marks should appear only at key points, and animated GIF export must be supported.

    3. Scoring Dimensions: Turning Subjective Impressions into Verifiable Metrics

    The evaluation can be split into five weighted layers:

    1. Terminology and constraint parsing: whether tool semantics and unit conventions are correctly identified;
    2. Step completeness: whether all omitted construction steps are filled in;
    3. Spatial consistency: whether geometric relationships between objects are self-consistent, with no dangling references;
    4. Visual and interaction constraints: whether trajectory marks are restrained and the animation feature works;
    5. Intent fidelity: whether the final output achieves the implicit goal of a “regular heptagon.”

    A sample scoring skeleton (logic illustration only):

    1. def evaluate(case, output):
    2. scores = {
    3. "term_parsing": check_terms(case, output), # terminology and unit conventions
    4. "step_coverage": check_steps(case, output), # step coverage
    5. "spatial_consistency": check_geometry(output), # geometric consistency
    6. "visual_constraint": check_trace(output), # marks and animation
    7. "intent_fidelity": check_goal(output), # goal achievement
    8. }
    9. weights = {"term_parsing":0.2,"step_coverage":0.25,
    10. "spatial_consistency":0.25,"visual_constraint":0.15,
    11. "intent_fidelity":0.15}
    12. return sum(scores[k]*weights[k] for k in weights)

    4. Common Failure Modes and Root Causes

    Failures usually fall into four categories: misreading terminology, such as treating a two-scale ruler as an ordinary ruler; reference drift, where references shift in multi-object scenarios; lost constraints, such as ignoring default conditions like “unit length” and “necessary marks”; and goal drift, where the figure looks complete but is not a regular heptagon. Root-cause analysis should separate “understanding errors” from “execution errors”: the former needs stronger semantic parsing, while the latter needs better planning and self-checking.

    5. Engineering Recommendations

    In real applications, three approaches can improve adherence: layer the prompt by explicitly separating the goal, constraints, and output format to reduce implicit conventions; add a self-check step so the model restates constraints before generating; and build a regression test set that turns uncommon terminology and multi-object scenarios into fixed evaluation items. When relying on general cloud capabilities, you can use object storage to keep cases and outputs, a message queue to schedule batch evaluations, a container platform to host sandbox execution, and logging plus monitoring with alerts to track pass-rate changes, forming a closed loop.

    6. Conclusion

    The essence of prompt adherence is whether a model can turn colloquial, elliptical, and implicit human expression into executable intent. Evaluation should not stop at “does it run” but ask “does it do what I said.” Including uncommon terminology, multi-object references, and vague constraints in test cases is what makes evaluation truly reflect everyday work scenarios and reveals the upper limit of model capability.