Skip to content
AI Product Engineer Wiki

    ↑ ↓ to move between results, Enter to open, Esc to close

    Menu

    Defining success metrics before you build

    Choose success metrics for an AI feature before you build it, from task success and adoption to guardrails and cost per success, with code to compute them.

    Level: Beginner 9 min read Updated
    On this page

    Why this matters

    If you define success after launch, you’ll define it as whatever happened. Usage went up? Success. Usage went down but power users love it? Also success. Without a metric chosen in advance, every outcome can be told as a win, which means you learn nothing.

    AI features make this trickier, because “the feature was used” and “the feature helped” can diverge sharply. People click an AI button out of curiosity, get a poor result, and quietly go back to doing it by hand. This article shows how to pick metrics that catch the difference, and how to compute them from the events your feature emits.

    Four layers of metrics

    Metrics for an AI feature sit in four layers. Each answers a different question, and you need at least one from each.

    Four layers of metrics for an AI feature. Quality enables behavior, behavior drives outcomes, and cost decides whether it's worth it.
    Show text descriptionHide text description

    A stack of 4 layers, listed from top to bottom (from What the business sees to What the model produces).

    1. Business outcome : Retention, conversion, revenue, support cost. Slow to move, decisive.
    2. Cost : Cost per successful task, compared with what a success is worth.
    3. User behavior : Acceptance, edits, retries, task completion, repeat use.
    4. Output quality : Eval pass rate on real tasks. Measured offline, before and after launch.
    • Output quality is measured with evals before launch and on samples after. It tells you whether the AI is producing good output.
    • User behavior tells you whether people find the output useful: do they accept it, edit it, retry, or give up?
    • Business outcome tells you whether the feature matters to the business. It moves slowly and is affected by many things, so you rarely use it alone to judge a feature.
    • Cost turns everything else into a decision: a feature that helps but costs more than it’s worth isn’t finished.

    The layers are linked. Better quality should improve behavior, and better behavior should move outcomes. Checking that those links actually hold is the subject of linking eval scores to business KPIs.

    A north star and guardrails

    From those layers, pick:

    • One primary metric (sometimes called a north star for the feature): the number you’re trying to move. It should be a behavior metric close to the job, such as “share of status updates sent using the draft.”
    • Two or three guardrails: numbers that must not get worse. Typical guardrails for AI features are quality complaints, the time the overall task takes, and cost per success.

    Why one primary metric? Because when you have five, you’ll always find one that went up. A single primary metric, chosen before launch, makes the result unambiguous.

    Why guardrails? Because primary metrics can be gamed by accident. A feature that inserts drafts automatically will raise “drafts used” while annoying everyone. A guardrail on edit rate or complaints catches that.

    Metrics specific to AI features

    Standard product metrics (adoption, retention, task completion) still apply. AI features add a few that are especially informative:

    Metric Definition What it tells you
    Acceptance rate Outputs accepted (used, sent, inserted) ÷ outputs shown Whether output is useful as-is or close to it
    Edit rate Accepted outputs the user changed ÷ accepted outputs How far output is from what users want
    Retry rate Requests the user regenerated ÷ requests Dissatisfaction with the first answer
    Abandonment Outputs shown and then ignored ÷ outputs shown Output not worth the effort to use
    Cost per success Total model cost ÷ successful tasks Whether the feature can pay for itself

    Cost per success deserves special attention. Cost per request hides the true cost, because failed and retried requests cost money too. If a request costs two cents but only half of them lead to an accepted output, each success costs four cents. That’s the number to compare against the value of a success.

    Exact formulas and the events each metric needs are in the metric definitions reference page.

    Computing metrics from events

    Metrics are only as good as the events behind them. If your feature records a few well-chosen events, every metric above is a simple calculation. Here’s a minimal event type and the code that turns a list of events into the metric set.

    lib/ai-metrics.ts
    /** One event per thing that happens to an AI output. Recorded by the feature, stored by your analytics tool. */
    export type AiEvent =
      | { type: 'shown'; outputId: string; costUsd: number }
      | { type: 'accepted'; outputId: string; edited: boolean }
      | { type: 'retried'; outputId: string }
      | { type: 'dismissed'; outputId: string };
    
    export interface AiMetrics {
      outputsShown: number;
      acceptanceRate: number;
      editRate: number;
      retryRate: number;
      abandonmentRate: number;
      costPerSuccessUsd: number | null;
    }
    
    /** Rate helper that returns 0 instead of NaN when there's nothing to divide by. */
    const rate = (part: number, whole: number) => (whole === 0 ? 0 : part / whole);
    
    export function computeMetrics(events: AiEvent[]): AiMetrics {
      const shown = new Map<string, number>();
      const accepted = new Map<string, boolean>();
      const retried = new Set<string>();
      const dismissed = new Set<string>();
    
      for (const e of events) {
        switch (e.type) {
          case 'shown':
            shown.set(e.outputId, e.costUsd);
            break;
          case 'accepted':
            accepted.set(e.outputId, e.edited);
            break;
          case 'retried':
            retried.add(e.outputId);
            break;
          case 'dismissed':
            dismissed.add(e.outputId);
            break;
        }
      }
    
      // Every output costs money, including the ones nobody used: that's what makes this cost per *success*.
      const totalCost = [...shown.values()].reduce((sum, cost) => sum + cost, 0);
      const edited = [...accepted.values()].filter(Boolean).length;
      // Abandoned: shown, then neither accepted nor retried (dismissed explicitly or simply ignored).
      const abandoned = [...shown.keys()].filter((id) => !accepted.has(id) && !retried.has(id)).length;
    
      return {
        outputsShown: shown.size,
        acceptanceRate: rate(accepted.size, shown.size),
        editRate: rate(edited, accepted.size),
        retryRate: rate(retried.size, shown.size),
        abandonmentRate: rate(abandoned, shown.size),
        costPerSuccessUsd: accepted.size === 0 ? null : totalCost / accepted.size,
      };
    }
    
    // Example: three outputs shown, one accepted unchanged, one accepted after edits, one retried.
    const example = computeMetrics([
      { type: 'shown', outputId: 'a', costUsd: 0.02 },
      { type: 'shown', outputId: 'b', costUsd: 0.02 },
      { type: 'shown', outputId: 'c', costUsd: 0.02 },
      { type: 'accepted', outputId: 'a', edited: false },
      { type: 'accepted', outputId: 'b', edited: true },
      { type: 'retried', outputId: 'c' },
    ]);
    console.log(example);
    // acceptanceRate ≈ 0.67, editRate 0.5, retryRate ≈ 0.33, abandonmentRate 0, costPerSuccessUsd 0.03

    Two details make this robust:

    • Cost is attached to shown, not accepted. That’s what makes failures count towards cost per success.
    • Rates never divide by zero. On launch day, with few events, NaN on a dashboard causes more confusion than a zero.

    In production you’ll compute these in your analytics tool or a SQL query rather than in application code, but the definitions are the same. Write them down once, in code or in the metric definitions, so everyone computes them the same way. Product analytics events for AI features covers the full event schema, including model and prompt version.

    Common mistakes

    • Measuring usage instead of success. Clicks on an AI button measure curiosity. Acceptance and task completion measure value.
    • Choosing metrics after launch. With enough metrics to choose from, one always looks good. Pick the primary metric and guardrails in the spec.
    • Ignoring cost per success. Cost per request hides the cost of failures and retries. Divide total cost by successful tasks.
    • No guardrails. A primary metric can improve while the experience gets worse. Pair it with quality, time and cost guardrails.
    • Inconsistent definitions. If two dashboards compute acceptance differently, every discussion becomes an argument about numbers. Define each metric once.

    Try it

    Exercise

    About 30 min

    Define a metric set for your one-page spec

    1. Open the spec you wrote in the previous article.
    2. Choose one primary metric and two or three guardrails, covering at least three of the four layers.
    3. List the events you’d need to compute each one.
    4. Write keep, change and remove thresholds for the primary metric.
    Show a hint

    For the primary metric, ask: if the feature works perfectly, what does the user do differently? That behavior, counted, is usually the right metric.

    Show a worked solution

    Example for AI-drafted support replies:

    • Primary: share of how-to tickets answered using a draft (accepted ÷ drafts shown).
    • Guardrails: customer satisfaction on how-to tickets; reopen rate; cost per accepted draft.
    • Events: shown with cost, accepted with an edited flag, retried, dismissed; ticket satisfaction and reopen events from the helpdesk.
    • Thresholds after four weeks: keep and expand above 40% acceptance with no guardrail regressions; change the prompt or retrieval between 15% and 40%; remove below 15%.

    Check your understanding

    Question 1 of 4: Why is "number of clicks on the AI button" a weak primary metric?

    Show answer

    B. It measures curiosity, not whether the output helped

    People click new features out of curiosity. Acceptance, completion or repeat use show whether the output was actually useful.

    Question 2 of 4: Each request costs $0.02 and 50% of outputs are accepted. What is the cost per success?

    Show answer

    C. $0.04

    Two requests are needed per success on average, so each success costs $0.02 × 2 = $0.04.

    Question 3 of 4: What is the job of a guardrail metric?

    Show answer

    B. To catch improvements in the primary metric that come at an unacceptable cost

    Guardrails are numbers that must not get worse, so a primary metric cannot "win" by harming quality, time or cost.

    Question 4 of 4: In the code example, why is cost recorded on the shown event rather than accepted?

    Show answer

    B. So that outputs nobody used still count towards cost per success

    Every output costs money. Counting only accepted outputs would understate the real cost of each success.

    Key takeaways

    • Choose metrics before you build, or every outcome becomes a story about success.
    • Cover four layers: output quality, user behavior, business outcome and cost.
    • Pick one primary metric and a few guardrails, with keep, change and remove thresholds.
    • AI features add acceptance, edit, retry and abandonment rates and cost per success; compute them from a small set of events.

    Progress is saved in this browser and lights up the roadmap.