DevTools Logo

LLM Eval Metrics Calculator

LLM Eval Metrics Calculator

Turn prediction/truth pairs into a confusion matrix, precision, recall, F1, accuracy and Cohen's kappa.

Runs in your browser
Try an example

Eval data

10 lines · 179 chars

Rows of the matrix are actual labels; columns are predictions. Micro-F1 equals accuracy for single-label classification.

Metrics

10 pair(s) · 2 class(es)
Accuracy0.8000
Macro F10.7619
Cohen's kappa0.5238
Confusion matrix: rows are actual, columns are predicted
Actual \\ Predictednegativepositive
negative61
positive12
Precision, recall and F1 by class
ClassPrecisionRecallF1Support
negative0.85710.85710.85717
positive0.66670.66670.66673

Positive class: negative · TP 6 · FP 1 · FN 1 · TN 2 · specificity 0.6667

Examples

Binary confusion

Input
2× correct positive, 1 false negative, 1 correct negative
Output
TP 2 · FP 0 · FN 1 · TN 1 · accuracy 0.75 · kappa 0.5

The positive class defaults to the alphabetically first label and can be overridden.

Unbalanced multi-class

Input
Three classes with 2, 3 and 1 examples
Output
Macro, micro and weighted F1 differ because supports differ

Read weighted F1 alongside macro F1 when class counts are uneven.

LLM judge labels

Input
[{"predicted":"Pass","actual":"pass"}]
Output
Normalized to one class; accuracy 1, kappa undefined

Single-class data cannot measure agreement beyond chance, so kappa is shown as —.

About this tool

LLM Eval Metrics Calculator turns prediction/truth pairs into a full classification report: confusion matrix, per-class precision, recall, F1 and support, plus macro, micro and weighted F1 and overall accuracy.

For binary evaluations it also reports TP/FP/FN/TN, specificity, error rate and prevalence, with a selectable positive class. Cohen's kappa compares observed agreement with the agreement expected by chance and is shown as undefined when the data has only one class.

Input is deliberately ergonomic for LLM work: comma, tab or semicolon separated lines, a CSV header, or a JSON array of {predicted, actual} objects. Label normalization trims whitespace and case-folds strings; every calculation runs locally.

What this tool does not do

  • Single-label predictions only; multi-label examples are not modeled.
  • Ordered or regression scores are treated as categorical labels.
  • Probabilistic thresholds are not optimized by the tool.
  • Very large pastes are limited by browser memory.
  • No comparison of two eval sets is performed in this implementation.

How to use this tool

  1. Paste or upload pairs

    Use predicted,truth per line, tab/TSV columns, a CSV with headers, or a JSON array of objects.

  2. Set label options

    Toggle trim/casefold normalization and, for binary data, choose which label counts as positive.

  3. Read the report

    Check the confusion matrix orientation, summary metrics and per-class support before drawing conclusions.

  4. Export the report

    Copy or download the markdown table for an eval write-up or issue.

Use cases

Eval reports

Produce a reproducible classification table for a model-card or benchmark write-up.

Prompt A/B comparisons

Compare precision/recall trade-offs between two prompt versions.

Judge audits

Check whether an LLM judge's labels agree with human ground truth beyond chance.

Metric conventions

MetricDefinition
MatrixRows are actual labels, columns are predicted labels.
PrecisionTrue positives for a class / all predictions of that class.
RecallTrue positives / all actual examples of that class (support).
F1Harmonic mean of precision and recall; null when undefined.
Macro F1Unweighted mean of per-class F1 values.
Micro F1Global correct predictions / total; equals accuracy for single-label data.
Weighted F1Per-class F1 averaged by support.
Kappa(observed − expected) / (1 − expected) agreement.

Zero-denominator metrics display as — rather than 0 so missing predictions are visible.

Common mistakes

Mistake:Swapping predicted and truth columns.

Fix:The first field is predicted; the matrix states that rows are actual and columns predicted.

Mistake:Reading accuracy as sufficient on unbalanced data.

Fix:Compare macro F1 and per-class support before concluding a model is good.

Mistake:Expecting kappa on single-class data.

Fix:Expected agreement is 1 in that case, so kappa is undefined; add examples of both classes.

Mistake:Treating — as zero.

Fix:A dash means the denominator was empty, not that the model scored zero.

Mistake:Forgetting label normalization.

Fix:Keep trim/casefold on unless 'Pass' and 'pass' must be distinct classes.

Frequently asked questions

How is F1 computed from a confusion matrix?

For each class, precision is diagonal count divided by that predicted column's total; recall is the diagonal divided by the actual row's support. F1 is 2·precision·recall/(precision+recall). Macro F1 averages those per-class values, micro F1 uses global counts, and weighted F1 averages by support. A dash means the denominator was zero, not that the score was zero.

What's the difference between macro and micro F1?

Macro F1 weights every class equally, which exposes poor performance on rare classes. Micro F1 aggregates all true positives, false positives and false negatives, so common classes dominate; with one label per example it equals accuracy. Report both when class sizes are uneven.

What does Cohen's kappa add over accuracy?

Accuracy can look high when one class dominates. Kappa subtracts the agreement expected by chance from observed agreement and divides by the room above chance: (po − pe)/(1 − pe). Values near zero mean the classifier agrees no better than random guessing given the class distribution. With a single class, pe is 1 and kappa is undefined.

How do I handle multi-class matrices?

Just paste more than two labels. The label set is the union of observed predicted and actual strings; the matrix uses actual labels as rows and predicted labels as columns. Per-class precision, recall, F1 and support appear below the matrix, and the report is copyable as markdown.

Can I paste a CSV with headers?

Yes. A first row naming predicted and actual columns (or common aliases like guess/truth) is detected and skipped. Comma, tab and semicolon separators all work, quoted values are trimmed, and a JSON array of {predicted, actual} objects is accepted as an alternative.

Does my evaluation data leave the browser?

No. Parsing, label normalization, matrix construction and every metric are computed locally in your browser tab. Nothing is transmitted or stored after you leave the page.

References & standards