How to Evaluate LLM Instruction Following: A Constraint-Heavy Benchmark Design
This article explains how to evaluate the instruction-following capability of large language models (LLMs) with a constraint-heavy task instead of relying on general leaderboard scores. It breaks instruction following into four layers (terminology, constraints, reference consistency, and intent completion), walks through a sample prompt that asks a model to build an interactive web page performing a neusis construction of a regular heptagon, and presents a five-dimension, 10-point scoring rubric with a JSON record example. It also covers result interpretation, how to plug the evaluation into a development pipeline, and common pitfalls to avoid.
1. Why Instruction Following Matters More Than Leaderboard Scores
A recurring pattern in LLM evaluation is that a model scores well on general benchmarks yet still falls short when dropped into a real business workflow. The gap is usually not missing knowledge. More often, the model fails to truly understand a user’s colloquial, abbreviated prompt with implicit constraints, and drifts away from the real intent during generation.
We call this capability instruction following. It covers at least four layers:
- Terminology: recognizing and correctly using niche domain concepts.
- Constraints: translating a text description into hard geometric, physical, or business constraints.
- Reference: keeping references consistent across multiple objects and steps, without mixing one thing up for another.
- Intent: making reasonable completions of unstated defaults and omitted steps that match what the user meant.
In real development work, requirement documents are exactly this kind of “imprecise natural language”: no boundary values, no default configurations, no exception branches. Whoever can fill in these blanks and stay consistent is the one who delivers practical value.
2. Benchmark Design: A Niche Drawing Task as a Stress Test
To force out all four layers at once, you can design a task like this: ask the model to generate an interactive web page that performs a straightedge-and-compass construction of a regular heptagon using a neusis (a drawing tool with two marks at a fixed distance), and export the result as an animation.
The prompt is deliberately colloquial and abbreviated:
- Start with a square and construct the perpendicular bisector of the base edge.
- Using the bottom-right vertex as the center and the diagonal length as the radius, draw a circle.
- Keep the neusis flush against the bottom-left vertex, and slide the first mark along the circle until the second mark passes through the perpendicular bisector of the base.
- Then locate the center in the usual way and fill in all the omitted construction steps.
- Keep only the necessary compass traces, and finally provide the ability to export an animation.
The design intent is clear:
- Niche terminology: most models lack a stable representation of a “neusis” and tend to degrade it into an ordinary ruler.
- High-density references: each step involves multiple objects at once, such as vertices, circles, the perpendicular bisector, and the marks.
- Implicit defaults: the side length of the square is not given, but given the goal of constructing a regular heptagon, it can only be a unit length; the distance between the two marks defaults to one unit.
- Vague phrasing: “necessary traces” is undefined, so the model must decide which auxiliary lines to keep and which to erase.
The value of this kind of task is that there is no single answer template to memorize. The model must genuinely map language to geometric constraints to keep the generated interactive page logically consistent.
3. Scoring Dimensions: Turning “It Feels Better” Into a Quantifiable Table
Score each of five dimensions from 0 to 2, for a total of 10 points:
| Dimension | What to Observe | 0 Points | 2 Points |
|---|---|---|---|
| Terminology correctness | Whether the neusis is treated as a two-mark tool | Degrades into a ruler | Two-mark constraint held throughout |
| Constraint satisfaction | Unit square, unit spacing, tangent/through-point relations | Multiple conflicts | All hold |
| Reference consistency | Whether references to vertices, circles, and lines drift | Switches objects midway | Consistent throughout |
| Intent completion | Whether omitted steps and defaults are reasonable | Missing or fabricated | Reasonable and explainable |
| Engineering usability | Interaction, trace control, animation export | Does not run | Runs directly |
A sample evaluation record can be written as:
{"task_id": "neusis-heptagon-001","scores": {"term": 2, "constraint": 2, "reference": 1, "intent": 2, "engineering": 2},"total": 9,"notes": "Default mark spacing handled correctly; perpendicular bisector trace cleanup slightly excessive"}
The key point is that scores must be tied to observable evidence (which step, which object, which constraint). Otherwise the evaluation degrades into subjective impression.
4. Interpreting Results: Gains Usually Come From “Understanding,” Not “Obedience”
When a model improves on this kind of task, the most notable change is often not that it becomes “more compliant” but that it “understands more.” Specifically:
- It recognizes niche terminology and proactively completes its defining constraints.
- It maintains references across multiple objects without drift in a long chain of thought.
- It infers unstated defaults in a way consistent with the goal.
- It reconstructs the user’s real intent in the final output instead of restating the prompt literally.
Note that this kind of test leans toward constraint-intensive generation and is not equivalent to open-ended creative generation. It checks controllability and self-consistency, not the full extent of a model’s capability.
5. Engineering Practice: Plugging the Evaluation Into the Development Workflow
In intelligent coding and automated office scenarios, instruction following can be turned directly into engineering metrics:
- Build an evaluation set: extract samples with “niche terminology + multiple objects + omissions” from real requirements, with no fewer than a few dozen per category.
- Automated validation: run static checks and smoke tests on executable outputs (web pages, scripts, configurations).
- Constraint assertions: write hard constraints as assertions, such as unit length, object reference counts, and the number of trace layers.
- Regression dashboard: feed dimension scores into monitoring, alerting, and logging services, and compare automatically across versions.
- Human review: manually spot-check only low-scoring items to reduce review cost.
With general capabilities such as the container platform, logging service, and monitoring and alerting offered by Baidu AI Cloud, evaluation tasks can be scheduled as containers, with results stored centrally and visualized, forming a sustainable regression evaluation pipeline.
6. Common Pitfalls and Suggestions
- Pitfall 1: harder is better. Tasks that are too hard make everyone score low and lose discriminative power; keep a difficulty gradient.
- Pitfall 2: looking only at the final output. You must record intermediate steps to tell whether the issue is reference drift or missing constraints.
- Pitfall 3: longer prompts are better. Redundant descriptions dilute key constraints; structure them in layers: goal, objects, constraints, output format.
- Suggestion: write an “implicit defaults list” for each task and check it item by item during evaluation, which significantly improves consistency and reproducibility.
7. Conclusion
Instruction following is not a matter of guesswork. It is an engineering capability that can be characterized together by task design, a scoring rubric, and an automated pipeline. Use niche terminology to test understanding, multiple objects to test reference consistency, and omissions and defaults to test intent reconstruction, then combine them with automated validation of executable outputs. This turns “does the model really understand me” into a trackable regression report.
