Metrics Reference & Limitations¶
This page covers the three core deterministic, reference-based metrics, which date from v0.1.0. The others are in Advanced metrics, and openbench metrics list prints every registered metric. Every metric inherits from openbench.metrics.base.BaseMetric and returns structured MetricResult and AggregateMetricResult objects.
Text Normalization (NormalizationConfig)¶
Before comparing model outputs against reference answers, text is normalized using NormalizationConfig:
strip_whitespace(Trueby default): Removes leading and trailing whitespace.case_sensitive(Falseby default): Converts text to lowercase unless set toTrue.collapse_whitespace(Trueby default): Replaces consecutive spaces, tabs, and newlines with a single space.strip_punctuation(Falseby default): Punctuation is preserved by default so significant symbols in code ([1, 9],__repr__), fractions (1/2), or JSON are never silently stripped.unicode_normalization(Noneby default): Optional Unicode normalization form ("NFC"or"NFKC") applied before other normalization steps.strip_unicode_punctuation(Falseby default): WhenTruealongsidestrip_punctuation=True, also strips Unicode punctuation characters (categoryP*).
1. Exact Match (exact_match)¶
Definition¶
Returns 1.0 (passed=True) if and only if:
normalize_text(model_response) == normalize_text(expected_answer)
Otherwise returns 0.0 (passed=False).
When to Use¶
- Short factual outputs, strict formatting tasks (
instruction_following), or single-token answers where extra conversational text is undesirable.
Limitations¶
- Any conversational wrapper (e.g.,
"The answer is 180."whenexpected_answeris"180") scores0.0.
2. Accuracy (accuracy)¶
Definition¶
Calculates the proportion of evaluation items answered correctly according to a configurable deterministic rule (rule parameter):
"exact_or_substring"(default):- Marks an item correct (
1.0) ifnormalize_text(response) == normalize_text(expected_answer), OR - If
record.metadata.get("disallow_substring")is notTrue, checks whether the normalized expected answer appears inside the normalized response respecting word boundaries (\b) on alphanumeric edges. - Word boundaries prevent false positive substring matches (for example, expected answer
"18"will match"The answer is 18."but will not match"The answer is 180."). "exact_only":- Identical to
exact_match. "word_boundary":- Checks word-bounded containment directly.
Limitations¶
- Does not parse semantic negation (e.g.,
"The answer is definitely not 180"still contains the bounded token"180").
3. Keyword Coverage (keyword_coverage)¶
Definition¶
Evaluates the fraction of expected keywords present in the normalized model response:
- Expected keywords are read from
record.metadata["keywords"]if provided, or fall back to[record.expected_answer]. - For each keyword \(k_i\), checks whether
normalize_text(k_i)is a substring ofnormalize_text(response). - Item score: $\(\text{score} = \frac{|\text{matched\_keywords}|}{|\text{expected\_keywords}|}\)$
- Returns
matched_keywords,missing_keywords,total_keywords, andcoverage_percentage(0.0to100.0).
Explicit Methodological Warning¶
Keyword coverage is NOT equivalent to semantic correctness. A model response can include 100% of the target keywords while stating the exact opposite of the intended meaning or using the terms in an unsafe context. Always inspect
exact_match,accuracy, and individual item outputs alongsidekeyword_coverage.