Vol. 33 · Evaluation & Improvement

Core Metrics for LLM Pipelines

One volume about the most useful metrics for LLM systems: from average, variance and standard deviation to accuracy, precision, recall, F1, MRR, MAP, nDCG@k, calibration, pass@k, latency and cost per success. Each card answers four questions: what it measures, how to calculate it, how to read, and where to apply it in the pipeline.

Retrieval answer

One volume about the most useful metrics for LLM systems: from average, variance and standard deviation to accuracy, precision, recall, F1, MRR, MAP, nDCG@k, calibration, pass@k, latency and cost per success. Each card answers four questions: what it measures, how to calculate it, how to read, and where to apply it in the pipeline.

01

Basic statistics

5 cards
01BaseMean and weighted average1 visual2 source notes

The average answers the question “how much on average.” This is the most common aggregating metric for judge score, latency, cost, reward and batch quality. A weighted average is needed when observations are unequal: for example, requests differ in the number of tokens or importance.

Source-complete notesformula · Where it helps
formulatex
mean = Σx_i / n
weighted mean = Σ(w_i * x_i) / Σw_i

If all observations are equally important -> the usual average.
If the weight is different, use weights.

Where it helps

  • average judge score
  • cost / request
  • middle-tail
  • Don't just look at the mean latency.
02BaseMedian and percentiles: p50, p95, p991 visual2 source notes

The median shows a "typical" value that doesn't break down from rare emissions. Percentile p95 means 95% of observations are as good as this. For latency and token count, they are usually more important than average.

Visual model · Formula mapConnect the quantities and operations that determine Median and percentiles: p50, p95, p99.
Source-complete notesformula · Where it helps
formulatex
p50 = median
p95 = value below which lies 95% of observations
p99 = value below which lies 99% of observations

Question to the metric:
"how bad is the system's tail?"

Where it helps

  • p95 latency
  • tail token count
  • median does not show worst-case
  • p99 for SLO
03BaseDispersion and standard deviation1 visual2 source notes

The variance and standard deviation show a spread around the mean. They are needed when it is important not only what the average score is, but also how stable it is from example, for example, from launch to launch and from annotator to annotator.

Visual model · Formula mapConnect the quantities and operations that determine Dispersion and standard deviation.
Source-complete notesformula · Where it helps
formulatex
variance = Σ(x_i - mean)^2 / n
std = sqrt(variance)

The more std, the less predictable the outcome.
The std is measured in the same units as the reference metric.

Where it helps

  • run-to-run variance
  • judge consistency
  • std without a mean of little information
  • compare
04BaseShare, success rate, error rate1 visual2 source notes

A lot of product and eval metrics are actually just fractions: how many queries worked, how many JSONs were valid, how many answers were grounded, how many times the system failed. This is the most universal type of metric.

Visual model · Formula mapConnect the quantities and operations that determine Share, success rate, error rate.
Source-complete notesformula · Where it helps
formulatex
rate = successes / total
error rate = errors / total = 1 - success rate

The main rule:
Always indicate the denominator.
"87 errors" without "how many" is almost useless.

Where it helps

  • task success rate
  • schema-valid rate
  • hallucination rate
  • You need a size sample.
05BaseConfidence interval, delta and lift1 visual2 source notes

One number without uncertainty often overestimates confidence. The confidence interval shows the range of plausible values. Delta shows an absolute difference, lift shows relative growth relative to baseline.

Visual model · Formula mapConnect the quantities and operations that determine Confidence interval, delta and lift.
Source-complete notesformula · Where it helps
formulatex
For fraction p:
95% CI ~= p +/- 1.96 * sqrt(p(1-p)/n)

delta = metric_B - metric_A
lift  = (metric_B - metric_A) / metric_A

Where it helps

  • A/B comparison
  • report uncertainty
  • delta in pp!= lift in %
  • Do not publish a point estimate
02

Classification and filters

6 cards
06ClassificationConfusion Matrix: TP, FP, TN, FN2 visuals2 source notes

Almost all binary metrics are derived from four numbers. If you do not fix what is a positive class, then it is easy to confuse the meaning of precision, recall and false positive rate. For safety and routing, this is the basic table from which everything starts.

Threshold labMove the threshold. Change which error you buy.

Adjust the decision threshold and watch the four cells and derived metrics recompute.

Truth +Truth −Predict +
TP0
FP0
Predict −
FN0
TN0
Precision
Recall
F1

The same scored cases can produce very different false-positive and false-negative profiles. A threshold is an operating decision, not a cosmetic setting.
Visual model · MatrixRead Confusion Matrix: TP, FP, TN, FN across the dimensions encoded by rows and columns.
Source-complete notesread · Where it helps
readtext
TP: Model says 'positive' and it's true
FP: Model says 'positive' but it's false alarm
TN: Model says "negative" and it's true
FN: Model said "negative" but missed positive

Accuracy/precision/remember/F1
It's just a different relationship between these four numbers.

Where it helps

  • toxicity filter
  • intent classifier
  • spam / abuse detector
  • You have to ask positive class.
07ClassificationAccuracy and error rate1 visual2 source notes

Accuracy shows a proportion of correct predictions. It is convenient when the classes are more or less balanced. With a strong imbalance, accuracy often looks more beautiful than the model is actually useful.

Visual model · Formula mapConnect the quantities and operations that determine Accuracy and error rate.
Source-complete notesformula · when to use
formulatex
accuracy = (TP + TN) / (TP + FP + TN + FN)
error rate = 1 - accuracy

when to use

  • balanced-class
  • class imbalance makes sense
  • Do not use it alone for safety
08ClassificationPrecision and Recall1 visual2 source notes

Precision answers the question, “If a model flagged something, how often is she right?” Recall answers the question, “What proportion of really important cases did the model find?” This is almost always the main pair of metrics for filters, detectors, and routers.

Visual model · Formula mapConnect the quantities and operations that determine Precision and Recall.
Source-complete notesformula · choose
formulatex
precision = TP / (TP + FP)
recall    = TP / (TP + FN)

Precision -> Price of false alarm
recall -> skip price

choose

  • High recall for safety
  • High precision for routing
  • You can't improve one for free.
  • threshold
09ClassificationSpecificity, FPR and FNR1 visual2 source notes

These metrics are useful when it is separately important to control false locks and dangerous omissions. For safety-review, it is often more convenient to talk about the false negative rate, and for antifraud and moderation, false positive rate is sometimes more important.

Visual model · Formula mapConnect the quantities and operations that determine Specificity, FPR and FNR.
Source-complete notesformula · Where it helps
formulatex
specificity = TN / (TN + FP)
FPR = FP / (FP + TN) = 1 - specificity
FNR = FN / (FN + TP) = 1 - recall

Where it helps

  • guardrails
  • moderation
  • abuse detection
  • It is important to fix the threshold
10ClassificationF1 and F-beta1 visual2 source notes

F1 is needed when both precision and recall are important at the same time, and you want one final digit. This is a harmonic average: a metric will not allow one side to mask the failure of the other. F-beta allows you to appreciate recall or precision.

Visual model · Formula mapConnect the quantities and operations that determine F1 and F-beta.
Source-complete notesformula · when to use
formulatex
F1 = 2PR / (P + R)
F_beta = (1 + beta^2)PR / (beta^2 P + R)

Beta > 1 - More weight recall
Beta < 1 - More precision weight

when to use

  • single headline metric
  • model selection
  • F1 hides which compromise is chosen
  • F2 for safety/triage
11ClassificationMacro, Micro, Weighted, Balanced Accuracy and MCC1 visual2 source notes

Once there are more than two classes or the data is unbalanced, the method of averaging is important. Macro gives all classes the same voice. Weighted gives more weight to frequent classes. Micro counts errors globally. Balanced accuracy and MCC are useful when looking more honestly at imbalanced data.

Visual model · Formula mapConnect the quantities and operations that determine Macro, Micro, Weighted, Balanced Accuracy and MCC.
Source-complete notesformula · selection rule
formulatex
macro = mean(metric c by class)
weighted = Σ(support_c * metric_c) / Σsupport_c
micro = count TP/FP/FN globally, then metric

balanced accuracy = (recall + specificity) / 2
MCC = (TP*TN - FP*FN) / sqrt((TP+FP)(TP+FN)(TN+FP)(TN+FN))

selection rule

  • macro for fairness by class
  • micro
  • MCC for imbalance
  • Weighted hides minority fail
03

Retrieval and Ranking

5 cards
12RankingHit@k / Success@k1 visual2 source notes

Hit@k answers a simple question: is there at least one useful document in the top-k? For the first retrieval stage, this metric is especially convenient when the generator needs one good support, rather than a complete set of all relevant documents.

Visual model · Annotated exampleInspect the concrete example behind Hit@k / Success@k, one layer at a time.
Complete view · 3 layers
Source-complete notesformula · when to use
formulatex
Hit@k for one request:
1 if there is at least one relevant item in the top-k
0 if not

Hit@k = Average of Requests

when to use

  • first-stage retrieval
  • RAG candidate search
  • Do not see the quality of order inside the top k
  • handy as a ceiling for a generator
13RankingPrecision@k and Recall@k1 visual2 source notes

Precision@k shows how clean top-k is. Recall@k shows how much of all relevant documents retriever managed to bring. This is a basic pair of metrics for search and candidate generation.

Visual model · Formula mapConnect the quantities and operations that determine Precision@k and Recall@k.
Source-complete notesformula · Where it helps
formulatex
P@k = relevant_in_top_k / k
R@k = relevant_in_top_k / total_relevant

P@k -> issue noise
R@k -> Relevance coverage

Where it helps

  • search quality
  • RAG chunk retrieval
  • We need relevance markups.
  • look up
14RankingMRR: Mean Reciprocal Rank1 visual2 source notes

The MRR measures how early the first benefit appears. If a user or generator needs one good document, MRR is usually more informative than recalling all relevant items.

Visual model · Formula mapConnect the quantities and operations that determine MRR: Mean Reciprocal Rank.
Source-complete notesformula · when to use
formulatex
RR = 1 / rank_first_relevant
if the relevant item is not found -> RR = 0

MRR = mean(RR for all requests)

when to use

  • FAQ search
  • single-best-doc retrieval
  • Ignore second and third useful documents
  • Good for QA and support search
15RankingAP and MAP1 visual2 source notes

Average Precision evaluates the entire ranking at once: the metric increases when relevant documents are higher and appear earlier. MAP averages AP for all queries. This is a convenient metric when not one document is important, but the whole set of relevant elements.

Visual model · Formula mapConnect the quantities and operations that determine AP and MAP.
Source-complete notesformula · Where it helps
formulasql
AP = average Precision@r
at all levels of r, where the relevant document

MAP = mean(AP on request)

Where it helps

  • document retrieval
  • reranker evaluation
  • More difficult to explain to a business than Hit@k
  • MRR is better when all relevant docs are important
16RankingDCG and nDCG@k: when relevance is graded1 visual2 source notes

nDCG@k is needed when documents are not just relevant / not relevant, but have levels of utility: for example, 3 = perfect proof, 2 = useful, 1 = partially. The metric rewards important documents at the top and normalizes the result of a relatively perfect sort.

Visual model · Formula mapConnect the quantities and operations that determine DCG and nDCG@k: when relevance is graded.
Source-complete notesformula · Where it helps
formulatex
DCG@k = Σ(rel_i / log2(i + 1))
nDCG@k = DCG@k / IDCG@k

IDCG = best possible DCG for this query
nDCG is always in the range [0, 1]

Where it helps

  • reranking
  • graded search relevance
  • human-labeled passage quality
  • It is not binary but graded markup.
04

Generation, Judge and Reliability

6 cards
17GenerationExact Match and schema accuracy1 visual2 source notes

If the problem has an exact correct answer or a strict format, the exact metrics work best. For extraction, tool calling, JSON output and structured QA exact match is often more useful than any soft judge score.

Visual model · Formula mapConnect the quantities and operations that determine Exact Match and schema accuracy.
Source-complete notesformula · Where it helps
formulatex
Exact Match = exact_matches / total
Schema Accuracy = valid_schema_outputs / total

Either it matched or it didn't.

Where it helps

  • tool calling
  • information extraction
  • structured QA
  • A very strict metric for open-ended chat
18GenerationROUGE, BLEU and overlap metrics1 visual2 source notes

Overlap metrics compare model output to reference text for shared tokens, n-grams, or longest common subsequence. They are useful when there are not too many acceptable formulations, but often miss real utility and actual correctness.

Visual model · Formula mapConnect the quantities and operations that determine ROUGE, BLEU and overlap metrics.
Source-complete notesformula · when to use
formulatex
ROUGE-1 recall = overlap_unigrams / reference_unigrams
BLEU ~= precision in n-grams *brevity penalty

Rouge is more likely to watch "what's covered,"
BLEU is more likely to look at “how similar the text is to the reference.”

when to use

  • summarization baseline
  • translation baseline
  • Does not measure factuality directly
  • bad for creative chat
19GenerationPass@k1 visual2 source notes

Pass@k answers the question: if we allow models to make multiple attempts, what is the probability that at least one of them will be correct. This is the main metric for code generation, unit-test solving and multi-sample decoding.

Visual model · Formula mapConnect the quantities and operations that determine Pass@k.
Source-complete notesformula · Where it helps
formulatex
If n candidates are sampled,
And among them are the correct ones:

pass@k = 1 - C(n-c, k) / C(n, k)

Intuitive:
the probability that among k attempts
It'll be at least one good one.

Where it helps

  • code generation
  • self-consistency decoding
  • Increased cost and latency
  • It is important to record the sampling policy
20GenerationPairwise win rate1 visual2 source notes

When it is difficult to make an absolute estimate, it is easier to ask which of the two answers is better. Pairwise win rate is convenient for comparison of models, prompts and postprocessors. It can be considered human-raters or LLM-as-judge.

Visual model · ComparisonContrast the alternatives in Pairwise win rate under the same frame.
Complete view · 3 layers
Source-complete notesformula · when to use
formulatex
win rate = (wins + 0.5 * ties) / total_comparisons

If the tie is excluded:
win rate = wins / (wins + losses)

when to use

  • chat quality comparison
  • prompt bake-off
  • Position bias control
  • stronger for ranking than for calibration
21CalibrationCalibration: Brier Score and ECE1 visual2 source notes

Calibration checks whether the stated confidence of the model matches the actual success rate. This is critical for auto-approve, human handoff, self-check and policy-threshold solutions. The model may be accurate but poorly calibrated.

Visual model · Formula mapConnect the quantities and operations that determine Calibration: Brier Score and ECE.
Source-complete notesformula · Where it helps
formulasql
Brier = mean((p_i - y_i)^2)
where y i = 1 for success and 0 for error

ECE = Average gap between confidence and accuracy
confidence-baskets

Where it helps

  • auto-approve thresholds
  • confidence-based routing
  • ECE Depends on Bucketization
  • Do not confuse high confidence with good calibration.
22CalibrationCoverage, abstain rate and faithfulness1 visual2 source notes

In many LLM systems, the model does not always have to respond. It can refuse, request a person or respond only with high confidence. In this case, accuracy is not enough: you need to watch coverage separately. For RAG, faithfulness almost always lives next to this, that is, the fraction of statements that are actually supported by the context.

Visual model · Formula mapConnect the quantities and operations that determine Coverage, abstain rate and faithfulness.
Source-complete notesformula · Where it helps
formulatex
coverage = answered / total
abstain rate = abstained / total = 1 - coverage
selective risk = wrong_answered / answered

faithfulness = supported_claims / total_claims

Where it helps

  • abstention policies
  • human handoff
  • RAG grounding
  • You cannot compare accuracy without coverage.
05

Ops, Product and Pipeline Card

4 cards
23OpsLatency, TTFT, p95 and tokens/sec1 visual2 source notes

For an LLM product, it is important to distinguish between “when the user saw the first token” and “when the answer ended.” That’s why we usually watch TTFT, end-to-end latency and generation rate. SLOs almost always need p95 or p99, not just the average.

Visual model · Formula mapConnect the quantities and operations that determine Latency, TTFT, p95 and tokens/sec.
Source-complete notesformula · Where it helps
formulatex
TTFT = time_to_first_token
E2E latency = time_to_last_token
tokens/sec = generated_tokens / decode_time

For operational control:
mean + p95 + p99 + tok/s

Where it helps

  • serving SLO
  • model / infra comparison
  • Mean latency is not enough
  • Separate prompt and decode time
24OpsCost per request and cost per success1 visual2 source notes

A good system should not only be qualitative, but also economically sustainable. The average cost per request is useful for budget planning, and the cost of a successful outcome often better reflects the actual effectiveness of the solution.

Visual model · Formula mapConnect the quantities and operations that determine Cost per request and cost per success.
Source-complete notesformula · Where it helps
formulatex
cost/request = total_cost / requests
cost/success = total_cost / successful_requests

If the success rate falls,
Cost per success increases even at the same API price.

Where it helps

  • model selection
  • multi-step pipeline economics
  • watch with quality
  • Cheaper is not always better than end-to-end.
25OpsOnline funnel: success, fallback, escalation, lift1 visual2 source notes

After offline eval, it is important to see how the system lives in production. Usually, you need a simple funnel: how many tasks are solved automatically, how many went into a fallback or to a person, how many ended in failure. For A/B comparison, delta and lift are added to this.

Visual model · Formula mapConnect the quantities and operations that determine Online funnel: success, fallback, escalation, lift.
Source-complete notesformula · Where it helps
formulatex
success rate    = solved / total
fallback rate   = fallback / total
escalation rate = escalated / total

delta = metric_B - metric_A
lift  = (metric_B - metric_A) / metric_A

Where it helps

  • assistant funnel
  • agent handoff monitoring
  • online A/B
  • You need guardrails near success
26Map.Map of metrics by steps of LLM-pipeline3 source notes

The main rule of thumb is that each pipeline step should have its own local metric, and the entire system should have a separate end-to-end success. Don’t expect a single “magical” number to replace the entire diagnosis. A good eval stack is always multi-layered.

Source-complete notesMinimal logic · table · finalist
Minimal logicsql
step metric -> tells you exactly where the pipeline breaks
end-to-end metric -> says whether the system solves the user's problem
Guardrail metric -> says if you paid for the improvement with hidden risk

Practice:
1. keep local metrics in step
2. keep the overall task success metric
3. keep latency/cost/safety guardrails
Step.Main metricWhat to keep close toWhat it does failure mean?
Classifier / RouterRecall, Precision, F1macro F1, confusion matrixThe system is going the wrong workflow
Safety / GuardrailRecall, FNRFPR, escalation rateDangerous cases pass or everything is blocked
RetrieverHit@k, Recall@kP@k, coveragegenerator has nothing to rely on
RerankerMRR, MAP, nDCG@klatency, candidate recalluseful documents, but are too low
Extractor / Tool CallExact Match, schema accuracyfield-level recall, valid JSON ratePipeline breaks down on structural step
Generatortask success, win rate, pass@kfaithfulness, judge scoreThe answer is formally beautiful but useless.
Confidence / AbstainBrier, ECE, coverageselective riskThe model is overconfident or too silent
Serving / Productp95 latency, cost/successTTFT, funnel success, liftQuality does not scale in the product

finalist

  • Local metrics for each step
  • One common task success metric
  • mandatory guardrails
  • Don't argue about the quality of one number

No dead end

Keep moving through the map.

Continue in sequence, switch to a related guide, or return to the seven-track learning map.

Discovery graph / next reads

Continue through New Runtime

Open the graph
  1. 01learning trackEvaluation And ImprovementOpen the complete learning track.
  2. 02related materialLLM Observability & EvaluationsContinue with another guide in this learning track.
  3. 03related materialEvaluation Process & LLM-as-JudgeContinue with another guide in this learning track.
  4. 04related materialThe Production Observability & Evaluation LoopContinue with another guide in this learning track.
  5. 05related materialThe Data Flywheel: From Production Cases to Release GatesContinue with another guide in this learning track.

These links are also published in this page’s JSON twin and as typed edges in DiscoveryGraph v1.

Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate…

Open the JSON contract