How to Evaluate Instruction Following in Large Language Models
This article explains how to evaluate instruction following in large language models. It defines instruction following and breaks it into four dimensions: multi-object reference, implicit constraints, domain terminology, and vague semantics. It then shows how to design test cases with geometric construction tasks, outlines a repeatable evaluation workflow with scoring and result interpretation, and lists common pitfalls.
Why Instruction Following Needs Separate Evaluation
General capability metrics, such as knowledge question-answering accuracy or code pass rates, cannot fully capture how a model performs in real work. In practice, users often describe tasks in casual, vague language and leave constraints implied. Whether a model can understand these descriptions and produce results that match what the user actually wants determines whether it can be used in production workflows. This ability is called instruction following. It measures how well a model understands intent and carries it out faithfully, not just whether it produces fluent-looking output.
Four Dimensions of Instruction Following
1. Multi-Object Reference
A task description often contains several objects at once, such as points, line segments, variables, or files. These objects refer to one another through pronouns like “it,” “its,” and “the.” In long instructions, the model must keep track of each object’s identity and state. To test this, count how often the model mismatches objects in long instructions, and check whether the errors increase as the instructions get longer.
2. Implicit Constraints
Many instructions leave out some premises. For example, a task may ask for a fixed shape without giving its dimensions, while the target shape itself forces the dimensions to take a specific value. A qualified model should infer these premises from the goal and state its assumptions in the output. Test designers must derive these implicit premises in advance. Otherwise, they cannot tell whether the model truly understood the task.
3. Domain Terminology
The same word can mean different things in different fields. The model needs to recognize a term and apply its standard definition in that field. If a term is obscure, the model may treat it as an ordinary word, and the whole process can drift from what was expected. Tests should cover both common and rare terms in the domain and observe the model’s performance on each.
4. Vague Semantics
Expressions such as “appropriate,” “necessary traces,” and “routine operations” have no precise boundaries. A good output should adopt the industry’s standard interpretation. When the meaning is uncertain, it should explicitly list the possible options instead of arbitrarily picking one interpretation and producing a result.
Designing Test Cases with Geometric Construction Tasks
Geometric construction tasks work well as test samples. The correctness of each step can be judged, and the task requires the model to apply all four dimensions above. The following example shows how to design one.
The sample task is as follows:
- Take a square and construct the perpendicular bisector of its bottom edge.
- Using the bottom-right vertex as the center, draw a circle with the diagonal as the radius.
- Using a straightedge with two marks (the “two-notch ruler” in classical geometry), move one mark point along the circle until the other mark point passes through the perpendicular bisector.
- Fill in all omitted compass-and-straightedge steps, and output a process animation.
The test designer must first derive a reference answer, then write checks based on it. This example has two key implicit premises. First, the task does not give the side length of the square, but the later steps depend on the spacing of the marks. The square’s side length and the mark spacing must use the same unit, or the proportional relationship does not hold. Second, the task does not specify which traces count as “necessary traces.” The designer must set the criteria in advance, for example keeping only the arcs and lines that determine the intersection points.
During testing, do not only check whether the final figure appears. Also check whether the model identified the premises above, stated its assumptions in the output, and ordered the steps reasonably.
A Repeatable Evaluation Workflow
A reproducible evaluation process usually includes four steps:
- Build a test set with at least several cases per dimension, and label each case with its difficulty.
- Fix the inputs and inference parameters, and run each case multiple times to reduce the effect of chance.
- Design checks for each case. Separate rule-based checks that can be judged automatically from semantic checks that need human review.
- Aggregate scores by dimension and difficulty, and record typical failure examples.
The following is a skeleton of an evaluation framework. The check functions must be filled in for the specific task:
from dataclasses import dataclassfrom typing import Callable@dataclassclass Case:case_id: strprompt: strdimension: str # multi-object reference / implicit constraints / domain terminology / vague semanticschecks: list[Callable[[str], bool]] # each check function receives the model output and returns whether it passesdef evaluate(model_fn: Callable[[str], str], cases: list[Case], runs: int = 3) -> dict:"""Run each case repeatedly and return the pass rate for each case."""results = {}for case in cases:passed = 0for _ in range(runs):output = model_fn(case.prompt)if all(check(output) for check in case.checks):passed += 1results[case.case_id] = passed / runsreturn results
The model_fn is a unified wrapper around the model under test. It should ensure that different models receive input in the same format and that their outputs are parsed in the same way.
Scoring Criteria and Result Interpretation
| Dimension | Key check points | Judgment method |
|---|---|---|
| Multi-object reference | Object numbering and states remain consistent | Mainly rule-based checks |
| Implicit constraints | Premises are identified and assumptions are stated | Human review |
| Domain terminology | Terms follow the domain’s definitions | Human review |
| Vague semantics | A reasonable interpretation is given or options are listed | Human review plus sample re-checking |
When interpreting results, look at each dimension separately rather than only the total score. Two models with similar total scores may each be strong or weak in different dimensions. For failed cases, distinguish two causes. A comprehension error means the model did not recognize what the instruction meant. An execution error means the model understood the instruction but made a mistake in the output. The two causes call for different fixes. Comprehension errors usually need clearer prompts or more context, while execution errors may need adjustments to the output format or an added validation step.
Common Pitfalls
- Drawing conclusions from single-run results and ignoring random variation in outputs.
- Using test questions that heavily overlap with public material, which inflates scores and does not reflect real capability.
- Treating how attractive the output looks as a measure of instruction following.
- Not stating implicit premises in advance, so different reviewers apply different standards.
Summary
Breaking instruction following into observable dimensions, using tasks with definite answers as samples, and combining a fixed workflow with per-dimension statistics can produce reproducible evaluation conclusions. These conclusions can guide model selection and help refine how prompts and task descriptions are written.
