Part 07›
✎

03. Goals and Requirements#

Level: Practitioner · Reading time: 25 min · Exercise: 60 min Prerequisites: From Models to Systems and Products, for the difference between a system goal and model accuracy.

In one sentence: After this chapter you can turn a vague request for an ML feature into layered goals, one precise measure per goal, and a short list of requirements that separates the world from the software.

Why this matters#

The triage model got better. Accuracy on the test set went from 88 to 94 percent. Three months later nothing else had moved. Customers waited as long as ever, and support leads still re-routed one ticket in five.

The data scientist was doing her job. Nobody had written down what the feature was for. Each person held a different goal in their head:

This chapter fixes that. You write the goals down in layers, find where they pull apart, give each one a measure, and turn them into requirements.

The core idea#

Goals come in layers#

Kästner separates four layers (chapter 5). Here they are for the triage feature:

Layer Whose goal For the triage feature A measure
Organizational The company Lower cost per resolved ticket. Keep customers. Cost per resolved ticket. Churn: the share of customers who leave
Product The feature A ticket reaches the team that can solve it, the first time First-time-right rate
User Each kind of user Customer: a fast, correct answer. Agent: every ticket in my queue is mine to solve Time to first correct answer. Re-route rate
Model The ML component Predict the right category Accuracy on an evaluation set

For a company, the organizational goal is almost always money, now or later. That goal is far away and hard to observe today. So teams watch leading indicators: easier-to-observe measures that they expect to move with future success. Kästner's example is the number of attorneys licensing the company's chatbot, and the ratio of new to canceled licenses. A proxy is any measure that stands in for something you cannot observe directly.

The layers are like an org chart: each exists to serve the level above. Unlike an org chart, they have no one with authority over every level, so the model layer can improve while the top layer gets worse.

The layers pull apart#

Kästner's clearest example is a self-help legal chatbot from a real project (chapter 5). A company licenses it to attorneys as a marketing tool. The product goal is to look modern and to generate leads, not to give complete legal advice.

Now give the chatbot a better model. It answers more questions without an attorney. Clients are happier. Attorneys get fewer contracts, so the customer is less happy. A gain at the model layer is a loss at the user and product layers.

His conclusion for that product: it is fine, even intended, for the chatbot to fail on hard questions and hand the client to an attorney. A good-enough model is good enough.

Chapter 01 made the same point with Booking.com, where more accurate models did not raise sales. You find such conflicts only if you write every layer down and ask how each one relates to the others.

Goals become requirements#

Goals are high-level requirements. Kästner suggests a chain for finding where ML helps: a goal needs decisions, decisions need answers to questions, and some answers can come from predictions. He uses two user-story forms, which you can fill in for the triage feature:

If no prediction would change a decision, the model has no job.

Requirements live in two places: the world and the machine#

Kästner borrows a distinction called "the World and the Machine" (chapter 6). A goal is a statement about the real world: a state you want out there. The software, the machine, only touches that world through its inputs and outputs. So he splits statements three ways:

Kind About Example for triage
REQ, a requirement The world: the state you want A customer with a billing problem gets an answer from the billing team within one business day
ASM, an assumption The link between them: how inputs and outputs correspond to things in the world The ticket text reflects the customer's real problem. The category the model returns is a team that exists and takes the ticket
SPEC, a specification The software: what it must do Given ticket text, return one category from the current list and a confidence, in under 200 ms

Kästner writes the link as a formula, ASM ∧ SPEC ⊨ REQ: together they must entail the requirement. The software can satisfy the requirement only while the assumptions hold. If the world breaks an assumption, no change to the code fixes the failure.

He adds a fourth part, the implementation (IMPL): the code that is meant to match the specification. Things then go wrong in five places. The requirement itself is wrong. An assumption is incorrect, changing or missing. The specification is wrong. The parts contradict each other. The implementation differs from the specification. Engineers concentrate on the last one, he observes, because testing tools make it easy to find. In questions of safety, security, fairness and feedback loops, he finds faulty assumptions the more pressing problem.

Kästner's example is Lufthansa Flight 2904, which overran the runway at Warsaw in 1993. The requirement was never to engage the thrust reversers while the plane is in the air. The software cannot see whether a plane is in the air, so it relied on an assumption: the plane is on the ground if each landing gear carries at least 6.3 tons, or if the wheels turn faster than 72 knots. In rain and strong wind, water on the runway kept the wheels slow and the wind unloaded one gear, so neither condition held for several seconds after touchdown. The code did exactly what it was specified to do and blocked the reversers.

Figure 1. How the four kinds of statement fit together.

flowchart LR
    A["ASM: assumptions about the world"] -->|"with the spec, must entail"| R["REQ: the state we want in the world"]
    S["SPEC: what the software must do"] -->|"with the assumptions, must entail"| R
    I["IMPL: the code"] -->|"must match"| S

The requirement, the specification and the implementation were all fine. Only the assumption about weight and wheel speed was false.

For a feature with a model, he names four more kinds of assumption to question. People give unreliable feedback: an embarrassed wearer denies a fall, so a true alarm is recorded as a false one and turns into wrong training data. Training data drifts: falls recorded in senior homes differ from falls on a plush carpet at home. Feedback loops: after false alarms, wearers leave the watch off, so data is missing for exactly those situations. Attacks: someone shakes the watch on a nightstand to trigger a call.

Behavioral and quality requirements#

Requirements also split by kind:

Kästner lists common qualities: safety, security, reliability and fairness; latency, throughput and cost; usability and convenience; development cost, development time, maintainability and extensibility. Every quality requirement needs a measure and the conditions under which you take it. "Fast" is a wish. "Under 200 ms for 95 of 100 requests at 50 requests per second" is a requirement. Chapter 06 goes deeper on these.

How it works, step by step#

Run this on one feature. It produces a one-page note.

  1. List the goal layers. One line each for organization, product, every kind of user and the model.
  2. Find the conflicts. For each pair of layers, ask whether improving one can hurt the other.
  3. Write one measure per goal. Use the three ingredients below.
  4. Check each measure with the tests in Is the measure any good?
  5. Separate the world from the machine. Write REQ, ASM and SPEC statements.
  6. Add quality requirements with numbers.
  7. Review the note like code. Show it to the stakeholders named in it and ask what is missing.

Three ingredients of a measure#

Kästner's test for a precise measure: imagine arguing in front of a judge that you met the goal, while an independent party recomputes the measure. To pass, each measure needs three ingredients.

Ingredient Question it answers Kästner's latency example
Measure What quantity, under what conditions? 90 percent of chatbot requests get a response within X ms under normal load
Data collection Which data, gathered how? Log the time of every request and every response on the server
Operationalization How do you compute the number from the data? Keep the quickest 90 percent of requests from the previous 24 hours and report the largest latency among them

Operationalization is the rule that turns raw observations into a number.

Is the measure any good?#

Noise or bias? For measurements, Kästner separates two properties that share names with classifier metrics but mean something else. The accuracy of a measure is how close its values lie, on average, to the true value. Its precision is how reliably it gives the same value when you repeat it.

Does it measure what you meant? Kästner's minimum: plot the distribution of the values and inspect a sample by hand. For important measures he names three questions:

Validity Question
Construct Does the measure capture the concept you intended?
Predictive Does it tell you something about the outcome you care about?
External Does it still hold outside the data it was designed on?

Two traps#

Bringing the stakeholders in#

Kästner defines a stakeholder as anyone with an interest in the system or affected by it, including people who never use it: regulators, responders, competitors. His advice for gathering requirements (chapter 6):

Worked example#

This is step 3 for one measure: first-time-right rate. The code needs Python 3.10 or newer and nothing else.

# measure.py — operationalizing "first-time-right rate" for ticket routing
from datetime import datetime, timedelta

# Routing events in time order, as the system logs them.
ROUTING_LOG = [
    {"ticket": "t-101", "auto": True,  "at": "2026-11-02T09:14:00"},
    {"ticket": "t-101", "auto": False, "at": "2026-11-02T11:02:00"},  # a human re-routes
    {"ticket": "t-102", "auto": True,  "at": "2026-11-02T09:20:00"},
    {"ticket": "t-103", "auto": True,  "at": "2026-11-03T10:00:00"},
    {"ticket": "t-103", "auto": False, "at": "2026-11-12T10:00:00"},  # nine days later
]

def first_time_right_rate(log, window=timedelta(days=7)):
    """Share of automatically routed tickets that no human re-routes
    within `window` of the automatic routing."""
    first_auto, re_routed = {}, set()
    for event in log:
        when = datetime.fromisoformat(event["at"])
        if event["auto"]:
            first_auto.setdefault(event["ticket"], when)
        else:
            first = first_auto.get(event["ticket"])
            if first is not None and when - first <= window:
                re_routed.add(event["ticket"])
    assert first_auto, "no automatically routed tickets in the log"
    return 1 - len(re_routed) / len(first_auto)

print(f"{first_time_right_rate(ROUTING_LOG):.0%}")   # 2 of 3 tickets: 67%

Run python measure.py. It prints 67%: three tickets were routed automatically and one of them was re-routed within a week.

What to observe:

What changes for LLM and agent systems#

The layers stay the same. What changes is the bottom layer and the nature of the measures.

The model goal is no longer plain accuracy. It is a score on an evaluation set that you wrote: labeled examples with expected outputs. Helpfulness ratings from users are proxies with known bias, since happy users rate less often than angry ones. Treat evaluation as the product's test suite: Evaluation Is the Product.

The same input can produce different outputs on two runs, so a measure from one run is noisy. Run each evaluation several times and report a range, not a number.

Two quality requirements move to the front. Cost per request, in tokens, is now a first-class number in the spec. So is resistance to hostile input: "a ticket containing instructions does not change the system's behavior" is a quality requirement you can test, as in Threat Modeling LLM Applications and Agents.

For an agent, write one goal layer per step and one for the whole task. The measure that matters is end-to-end task success. A high score on each step can still add up to a failed task. The ASM row grows too: an agent assumes that its tools work, that the pages it reads are honest and that its credentials are scoped. Part 02 covers the structure: The Anatomy of an Agent.

What the practitioners say#

Pitfalls#

  1. Writing the model goal as the project goal. Fix: four layers, always, with the model last.
  2. Measuring what is in the logs. Fix: start from the goal with Goal-Question-Metric, then work out how to collect the data.
  3. A precise, wrong measure. A number that never fluctulates can still be biased. Fix: inspect a sample by hand and compare with an independent source.
  4. Paying people on a proxy. Fix: measures inform, incentives stay separate.
  5. Mixing world and machine. "The classifier shall reach 90 percent" is a specification, not a requirement. Fix: one REQ, ASM and SPEC table per feature.
  6. Quality requirements without numbers. Fix: a value, the load and the window, for each one.
  7. Asking users what they want. Fix: ask what problem they have and what happens when it goes wrong.

Try it#

Write the one-page goals-and-requirements note for one feature that contains a model.

Include:

  1. The four goal layers, with every kind of user.
  2. One conflict between layers, or a sentence saying you looked and found none.
  3. One measure per goal, each with measure, data collection and operationalization.
  4. One REQ, ASM and SPEC table.
  5. Three quality requirements with numbers.

You are done when a colleague can recompute one of your measures from the note alone and get your number, and can point to the assumption most likely to break in production.

Stretch goal: find one place where your measure and the goal it stands for would disagree, and add a second measure that catches the gap.

Key takeaways#

Self-check#

  1. Name the four goal layers, from the top.
  2. Model accuracy rises and the first-time-right rate stays flat. What is the first thing to check? - A. Whether the test set is large enough to detect the improvement. - B. Whether every team logs its re-routes in the same way. - C. Whether better predictions change what the system does with them. - D. Whether the accuracy figure was computed for the latest model.
  3. A measure gives the same value every time you compute it, and the value is wrong. Is that inaccuracy or imprecision, and why is it the harder problem?
  4. Write one REQ, one ASM and one SPEC for "keep junk out of my inbox".
  5. Which is the streetlight effect? - A. Agents stop re-routing tickets because their team is scored on first-time-right rate. - B. The team counts messages per chat because the logs contain them. - C. The satisfaction survey reaches only five percent of attorneys in any given month. - D. Latency is reported from the slowest of the fastest ninety percent of requests.
  6. What separates a quality requirement from a behavioral one, and what must every quality requirement contain?
Show answers 1. Organizational, product, user and model. 2. C. The model layer improved. The question is whether the routing logic, the review queue or the interface turns that into a different outcome. 3. Inaccuracy. Repeatability shows high precision. The error is systematic, so averaging and other statistics never expose it. You find it by inspecting samples or comparing with the true value. 4. Example. REQ: a user loses no important message to the spam folder. ASM: senders of important mail do not write like spammers, and users report misfiles. SPEC: if the spam score is above 0.9, move the message to the spam folder. 5. B. The count is convenient and says nothing about whether clients were helped. A is Goodhart's law. C and D are ordinary limits of a measure. 6. A behavioral requirement says what the software does. A quality requirement says how well. Each quality requirement contains a value, and the conditions under which it is measured.

Sources#

Next#

→ Planning for Mistakes, because the requirements tell you what must not go wrong, and that chapter shows how to keep a wrong prediction from breaking them.