Concepts / Designing Metrics for AI Systems

Designing Metrics for AI Systems

Observability means understanding how a system fails, designing metrics and alerts around those failures, and building the system so failures are detectable and traceable.

  • Programming

The Wrong Answer Nobody Saw

Imagine you have built an application that sends user requests to a foundation model and returns the model's answers. In your tests it works well. Then, a few weeks after launch, users start reporting responses that seem wrong, slow, or unsafe. The natural first instinct is to start fixing the problem. But the more important first question is different: how would you have known about it at all? Could you see that something had gone wrong, find where it went wrong, and tell the difference between a single odd answer and a real pattern?

The idea that answers this question is called observability. It asks you to think about failure before failure happens. The rest of this article works through that question, and it is useful to keep it in mind as you read.

Three Parts of Observability

Definition

Observability means understanding how a system fails, designing metrics and alerts around those failures, and building the system so failures are detectable and traceable.

The definition has three parts, and each depends on the one before it. First, you need to understand the ways the system can fail. Second, you decide what to measure and what should trigger an alert, based on those failures. Third, the system itself has to be built so that the measurements are possible and a failure leaves a trail someone can follow.

Key point

A system with excellent dashboards but no way to connect a bad answer to the request that produced it is only partly observable. Dashboards alone do not give you observability; the link between a failure and the record of the request that caused it does.

This is why observability is best treated as a property you design into the system, not something you bolt on after an incident. A metric is useful only if the system actually produces the information it measures, and an alert is useful only if it is tied to a metric that matters.

How a Failure Travels Through a Request

To see why traceability matters, follow one request through an AI application. Suppose the request passes through a retrieval step that looks up supporting material, then a foundation model call, then a post-processing step before the answer is returned. The diagram below shows that path. When a user reports a bad answer, the question is which stage produced the problem.

User requestentry point of the traceRetrieval stepsupporting material lookedupFoundation model callpossible origin of thefailurePost-processingoutput shaped before returnReturned answerwhat the user seesrequestcontextraw outputfinal answer
When a request passes through retrieval, the foundation model call, and post-processing, the failure can start at one stage and reach the user at the end. Without a record for each stage, all you see is the final answer.

Notice that the failure is only visible at the end of the path. If the system has recorded what each stage received and produced, you can compare the records and see where the answer first went wrong. If it has recorded nothing except the final answer, you know that something is wrong but not where it started. The trail through the stages is what turns a complaint into something you can act on.

Making Failures Detectable and Traceable

The word detectable carries real weight in the definition. A failure that happens silently, with no signal anywhere, cannot be acted on. Designing for observability means making sure that the failures you care about leave a signal that someone or something will notice in time. A wrong answer that looks like any other successful response leaves no signal unless you deliberately created one.

Traceability is the companion idea. A failure should leave a trail that a person can follow from the symptom back to the request that produced it, and through each step the request took. Records made at each stage, tied together by the same request, are what make that possible. Without them, the system may be running correctly from the infrastructure's point of view while users receive answers that are wrong.

Why Added Components Add Failure Modes

Separating an AI application into components keeps it easier to change and maintain. Each component has a clear job, and you can reason about it on its own. However, the boundaries between components are rarely as clean as a diagram suggests. Several components can take on overlapping responsibilities, and the same job can often be placed in more than one spot.

A guardrail shows this clearly. A guardrail is a check that screens what goes into or comes out of a model, for example to block content you do not want the application to produce. The job of the guardrail stays the same wherever it lives. It can be implemented in the inference service that runs the model, in the model gateway that routes requests, or as a standalone component of its own. What changes is where the check lives and which other parts of the system must know about it.

Guardrail checkdecisions visible only inthe service's recordsGuardrail checksits where requests areroutedGuardrail checkreports its ownmeasurements, one morepiece to monitor
The job of the guardrail is identical in each column. What differs is where its decisions are recorded and how many parts of the system you must monitor.

Placement matters for observability. If the check is buried inside the inference service, its decisions may be visible only in that service's records, so someone investigating a problem has to know where to look. If it is a standalone component, it can report its own measurements separately, which is helpful, but you now have one more piece to monitor and one more place where things can go wrong. In every case, the addition makes the system more capable, safer, or faster, and it also makes the system more complex and creates new ways to fail.

Key point

Every added component is a trade. Retrieval, guardrails, and tool calling each improve something, and each introduces a new point where a request can silently go wrong. When you add a component, add the question of how its failures will be detected and traced at the same time.

Where Familiar Monitoring Still Helps

Much of what you already know about monitoring software applies here too. Software engineering has long offered practices for logging, tracing requests, watching resource use, and paging someone when a service degrades. Traditional machine learning has its own practices for tracking model behavior over time. Many of the tools built for these fields carry over to AI engineering, and you should use them rather than reinvent them.

The difficulty is that foundation models introduce failure modes that those existing practices were not built to catch. A failure mode is a particular way a system can go wrong. Because the model's behavior is produced by the model rather than written line by line by your team, the ways it can misbehave do not always match the failures your existing dashboards were designed to show.

The practical result is that the metrics you already collect may be necessary but not sufficient. A service can have healthy resource use and fast responses while still returning answers that are wrong, unhelpful, or unsafe. You need additional metrics and additional design decisions aimed at the failures a foundation model can cause.

Mistakes in Observability Design

  • Common mistake

    Assuming existing dashboards will reveal wrong answers

    What it looks like

    Latency and error-rate charts look healthy, but users keep reporting incorrect responses.

    Why it fails

    Those dashboards were designed for failures that software practices already anticipate. A foundation model can misbehave in ways they do not measure.

    Do this instead

    Add measurements aimed at the failure modes the model can actually produce, alongside the familiar ones.

  • Common mistake

    Choosing metrics before knowing the failures

    What it looks like

    A team adds a set of charts because they are easy to collect, then later cannot explain what any of them would detect.

    Why it fails

    A metric is useful only when it tracks a failure that matters for your application.

    Do this instead

    Identify the failure modes first, then design the records, metrics, and alerts that follow from them.

  • Common mistake

    Recording only the final answer

    What it looks like

    Each request is logged with its output, but nothing records what the retrieval or post-processing stages did.

    Why it fails

    When something goes wrong, you can see the bad result but not the step that produced it.

    Do this instead

    Record what each stage received and produced, and tie those records to the same request.

  • Common mistake

    Treating an added component as free

    What it looks like

    A guardrail is added to improve safety, with no plan for where its decisions will be visible.

    Why it fails

    Each addition makes the system more capable but also more complex, and creates new ways to fail.

    Do this instead

    When adding a component, decide how its failures will be detected and traced before it goes live.

Planning Metrics from Failure Modes

Once you have a list of the failures your application can produce, each one suggests what to measure and what should trigger an alert. The map below is an illustrative example of that planning step. The failures listed are plausible ones for an AI application, and each is paired with a signal that could reveal it. The right alert threshold for each depends on your application and is a decision your team makes, so none is shown here.

Hallucinationoutput quality score forfactual groundingLatency spikeresponse time per stageRefusal rateshare of requests answeredwith a refusalMalformed outputshare of responses failinga format checkCost overrunusage cost per request overtime
Each likely failure is a key, and the metric listed beside it is the signal that could reveal it. The alert that fires on that metric is set after you know the failure matters for your application.

What do you think happens?

When you are planning observability for a new AI feature, which should you settle first: the metrics and alerts, or the failure modes they are meant to catch?

  • The metrics and alerts first, then the failure modes

  • The failure modes first, then the metrics and alerts that follow from them

Reveal answer
Answer:

The failure modes come first. The metrics and alerts follow from them.

You cannot design useful metrics and alerts until you know which failures matter for your application. Identifying those failure modes comes first, and the metrics follow from them.

Tracing a Silent Failure

MEDIUM

A support assistant sends each user question through a retrieval step, a foundation model call, and a post-processing step. A user reports that an answer gave the wrong return policy. Using only what this article describes, list the records you would need to find the stage where the wrong information first appeared, and state which of the three parts of observability each record supports.

Hints
  • Think about what each stage received and what it produced, and whether those records are tied to the same request.
  • Ask whether the failure could be found without a record from each stage, and whether an alert could have fired before the user complained.

Key Takeaways

  • Observability means understanding how a system fails, designing metrics and alerts around those failures, and building the system so failures are detectable and traceable.
  • A failure is only actionable if it leaves a signal someone notices in time, and only traceable if records tie that signal back to the request and stage that caused it.
  • Adding components such as guardrails, retrieval, or tool calling makes an AI system more capable, safer, or faster, but each addition also adds complexity and new failure modes.
  • Familiar monitoring practices still apply, but foundation models introduce failure modes that call for additional metrics and design decisions.
  • Identify the failure modes first, then design the records, metrics, and alerts that follow from them.

Related concepts

More concepts starting with D