How Engineering Teams Can Measure Prompt Following When Evaluating Large Language Models
A practical framework for evaluating whether large language models follow explicit instructions, implicit constraints, implementation requirements, and output formats. It includes a high-constraint geometry task, a reproducible test procedure, and a scoring rubric that separates result accuracy from process compliance.
Large language models are increasingly used for engineering work. Whether a model can complete a task step by step and comply with required constraints and output formats depends heavily on its prompt-following ability, also known as instruction following.
In this article, prompt following means the extent to which a model’s output satisfies both the explicit and implicit requirements in a prompt. General benchmark scores rarely capture this ability accurately, so engineering teams should design their own evaluations.
1. Decomposing Prompt Following
Prompt following can be divided into three levels.
Level 1: Instruction Identification
The model must identify every explicit instruction in the prompt without omitting or misinterpreting any of them.
Level 2: Semantic Understanding
The model must understand technical terms and ambiguous descriptions, then convert them into precise internal representations. For example, “a square with side length 1” should be interpreted as four well-defined vertex coordinates.
Level 3: Execution Fidelity
The final output must fully reflect the intended requirements, including conditions that are not stated explicitly but necessarily follow from the logic. For example, a drawn line segment must actually pass through the specified intersection point rather than merely look approximately correct.
The third level is the most difficult. During generation, the model must check constraints incrementally. When the prompt is ambiguous, it should make choices based on explicit reasoning rather than filling in details arbitrarily or ignoring the ambiguity.
2. Why Ordinary Tasks Fail to Reveal Model Differences
Tasks such as “write a sorting algorithm” or “summarize this article” usually measure only a model’s baseline capability. There are three main reasons:
- Few constraints: Omitting one requirement often has little effect on the perceived quality of the answer.
- Common knowledge can compensate: The model can rely on familiar patterns from its training data to produce a plausible response.
- Evaluation is subjective: Without objective criteria, it is difficult to explain precisely why one answer is better than another.
A useful test case should therefore satisfy three conditions:
- It has a high density of constraints.
- It depends on domain knowledge.
- Its result and process can be checked for internal consistency.
There are also three common evaluation mistakes:
- Treating a playable animation as a passing result. Smooth playback does not prove that the geometric relationships are correct. The coordinates must be checked.
- Treating a correct result as sufficient. A model might use trigonometric functions to calculate the vertex coordinates directly. The result could be correct while still violating the construction constraints.
- Estimating frame count from duration. Timing should be measured with
performance.now(). The number of animation frames does not represent elapsed time reliably.
3. Designing a High-Constraint Test Task
The following task asks a model to create a single-file HTML page that simulates a compass-and-straightedge construction in code and presents it as an animation. The source material was truncated at the first construction step, so the five-step construction below has been defined here to make the evaluation reproducible.
The three task types can be compared as follows:
| Task type | Number of constraints | Dependence on domain knowledge | Evaluation method |
|---|---|---|---|
| Ordinary tasks, such as sorting or summarization | Low | Low | Subjective review |
| Medium-constraint tasks, such as a report with a specified format | Medium | Medium | Partially verifiable |
| This task: high-constraint geometric construction | High | High | Coordinates and process are both verifiable |
The complete prompt is provided below. It can be copied directly into the model being evaluated.
Create a single-file HTML page that uses JavaScript to simulate the following compass-and-straightedge construction and display it step by step as an animation.
The target environment is a modern desktop browser: the latest versions of Chrome, Edge, and Firefox. The page must not depend on any network resources. All scripts and styles must be inline. Do not import third-party libraries or polygon libraries.
The total animation duration must be at least 10 seconds, measured by the elapsed time between the first and final frames using
performance.now()within the page.Initial conditions: square ABCD with A(0,0), B(1,0), C(1,1), and D(0,1), where side AB = 1. Use a marked straightedge with a distance of d = 1 between its marks.
Construction tools are limited to drawing straight lines, drawing circles, and finding intersections between line-line, line-circle, and circle-circle pairs. Do not use trigonometric functions such as
sin,cos,tan, oratanto calculate vertex coordinates directly.Construction steps:
- Connect AC and BD. Denote their intersection as O.
- Draw circles centered at A and B, each with radius d. Take the intersection above AB as E, then connect AE and BE.
- Extend AE until it intersects line CD. Denote the intersection as F.
- Through E, draw a line parallel to AB. Let its intersections with AD and BC be G and H, respectively.
- Extend DE until it intersects line BC. Denote the intersection as K.
After completing each step, highlight the newly added line segments or points and list the coordinates generated in that step in a sidebar. Preserve four decimal places.
At the end of the page, display the coordinates of O, E, F, G, H, and K.
Reference coordinates:
- O(0.5000, 0.5000)
- E(0.5000, 0.8660)
- F(0.5774, 1.0000)
- G(0.0000, 0.8660)
- H(1.0000, 0.8660)
- K(1.0000, 0.7321)
4. Result Evaluation, Process Evaluation, and Scoring
Result evaluation checks the coordinates of the six points. The allowed absolute error is no more than 0.001.
Process evaluation checks the implementation method and animation requirements. The two categories are scored separately and do not offset each other.
| Category | Check | Points | Evaluation method |
|---|---|---|---|
| Result | Correct coordinates for O | 10 | Compare with the reference value; error ≤ 0.001 |
| Result | Correct coordinates for E | 10 | Same as above |
| Result | Correct coordinates for F | 12 | Same as above |
| Result | Correct coordinates for G | 8 | Same as above |
| Result | Correct coordinates for H | 8 | Same as above |
| Result | Correct coordinates for K | 12 | Same as above |
| Process | All five steps are complete and correctly ordered | 10 | Check the page highlights and sidebar output step by step |
| Process | Constraint compliance | 10 | Inspect the source code for direct trigonometric coordinate calculations and third-party libraries |
| Process | Animation duration and timing | 10 | Confirm use of performance.now() and a first-to-final-frame difference of at least 10,000 ms |
| Process | Runtime and compliance | 10 | Confirm that the page is self-contained, makes no network requests, and produces no console errors |
The result category is worth 60 points, and the process category is worth 40 points.
A passing result requires:
- At least 50 points in the result category.
- At least 32 points in the process category.
- No hard violations.
Directly calculating vertices with trigonometric functions or importing a third-party library results in failure regardless of the other scores.
5. Reproduction Procedure
- Keep the original prompt unchanged.
- Run the same model three times, using a new session for each run.
- Save each response as an
.htmlfile and open it in Chrome, Edge, and Firefox. - Score every item against the rubric. Record the three total scores and use the median as the model’s final result.
- If the result score is high but the process score is low, record the reasons for the deductions. This often indicates that the model can produce correct outputs while failing to follow implementation constraints.
6. Risks and Limitations
Animation performance depends on the device. Lower-end hardware may produce a lower frame rate, but elapsed time should still be measured with performance.now(). The animation timeline should be driven by time rather than by accumulating frame counts.
Some browsers may reduce the precision of performance.now() because of privacy settings. Record the actual timing precision during evaluation. If the measurement error is too large, set the target duration to 12 seconds to provide additional margin.
Browser differences may affect rendering details. Evaluation should focus on coordinates and construction steps rather than pixel-level visual appearance.
This test measures performance on one type of geometry-constrained task. It does not represent a model’s overall prompt-following ability across all domains. Model selection should combine results from multiple task categories.
Conclusion
General benchmark scores are not sufficient for selecting a model for engineering workflows. Teams need task-specific evaluations that test whether a model can identify instructions, understand their meaning, and execute them while preserving all relevant constraints.
The three-level framework, high-constraint construction task, evaluation criteria, and scoring rubric presented here can be reused directly or adapted to tasks from a team’s own domain.
