Numeric diff
Numeric diff measures how close a numeric output is to the expected number, as 1 minus the relative difference. It mirrors autoevals NumericDiff and is free.
What the evaluator does
Extract numbers from both strings, compute |a − b| / max(|a|, |b|, 1), subtract from 1. Pass at 0.99.
0.0302
0.03024
Reach for it when
- Calculations, unit conversions, financial figures.
- Tolerant comparison where 3.0 and 3 must match.
Not the right tool when
- Numbers embedded in prose with units that change meaning (use answer_correctness).
Watch out for
- Extracts the first numeric token; keep outputs to the number.
What to send
score 0–1 computed in code, label, passed at an evaluator-specific threshold, no probabilities.
{
"evaluators": [
"numeric_diff"
],
"output": "0.0302",
"expected": "0.03024"
}Relative difference 0.1%: 0.999.
Aggregate with
One result per item is a fact; a dataset of them is a metric. These are the aggregations that fit this evaluator's output shape.
Mean score averages the normalised 0–1 score across items.
Pass rate is the share of items whose evaluator result met its threshold.
Mean absolute error measures, for graded rubrics, how far the evaluator's level is from the gold level on average.
- Why divide by max(|a|, |b|, 1)?
- So tiny numbers do not produce huge relative errors and zero does not divide by zero.