LLM Eval Metrics Calculator
Turn prediction/truth pairs into a confusion matrix, precision, recall, F1, accuracy and Cohen's kappa.
Eval data
10 lines · 179 charsRows of the matrix are actual labels; columns are predictions. Micro-F1 equals accuracy for single-label classification.
Metrics
10 pair(s) · 2 class(es)Class “positive” has only 3 example(s); metrics are unstable.
| Actual \\ Predicted | negative | positive |
|---|---|---|
| negative | 6 | 1 |
| positive | 1 | 2 |
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| negative | 0.8571 | 0.8571 | 0.8571 | 7 |
| positive | 0.6667 | 0.6667 | 0.6667 | 3 |
Positive class: negative · TP 6 · FP 1 · FN 1 · TN 2 · specificity 0.6667
Examples
Binary confusion
2× correct positive, 1 false negative, 1 correct negativeTP 2 · FP 0 · FN 1 · TN 1 · accuracy 0.75 · kappa 0.5The positive class defaults to the alphabetically first label and can be overridden.
Unbalanced multi-class
Three classes with 2, 3 and 1 examplesMacro, micro and weighted F1 differ because supports differRead weighted F1 alongside macro F1 when class counts are uneven.
LLM judge labels
[{"predicted":"Pass","actual":"pass"}]Normalized to one class; accuracy 1, kappa undefinedSingle-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
Paste or upload pairs
Use predicted,truth per line, tab/TSV columns, a CSV with headers, or a JSON array of objects.
Set label options
Toggle trim/casefold normalization and, for binary data, choose which label counts as positive.
Read the report
Check the confusion matrix orientation, summary metrics and per-class support before drawing conclusions.
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
| Metric | Definition |
|---|---|
| Matrix | Rows are actual labels, columns are predicted labels. |
| Precision | True positives for a class / all predictions of that class. |
| Recall | True positives / all actual examples of that class (support). |
| F1 | Harmonic mean of precision and recall; null when undefined. |
| Macro F1 | Unweighted mean of per-class F1 values. |
| Micro F1 | Global correct predictions / total; equals accuracy for single-label data. |
| Weighted F1 | Per-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
Related tools
Agent Tool Flowchart Builder
Design agentic tool-call DAGs with decision branches and bounded loops. Validates reachability, cycle handling, and emits clean Mermaid flowcharts — fully in your browser.
AI Agent Memory & Buffer Simulator
Compare sliding window, summary buffer, and vector memory strategies
AI API Client SDK Generator
Generate typed API client SDK files from OpenAPI specifications or cURL requests
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Code Security Auditor
Scan source code for high-confidence OWASP Top 10 vulnerabilities
AI Code Translator
Translate code into idiomatic implementations in another language