Skip to main content

Scoring contract

madbench separates the verdict from the measurement details:

  • pass is the Check's Expectation verdict.
  • score is the normalized utility score used for aggregation and comparison.
  • reason is the human-readable explanation.
  • evidence holds structured details, including raw metric-native values.

The unified score​

score is always a number from 0 to 1, and higher is always better.

This is deliberate. Composite Checks such as select-best, max-score, and compare add, average, and maximize child Check scores. They must be able to treat every child score the same way, regardless of whether the underlying measurement is answer quality, latency, cost, toxicity risk, or hallucination risk.

Examples:

  • contains returns 1 when the text is present and 0 when it is absent.
  • latency passes when actual latency is under the Expectation, but its score is normalized as quality: faster runs score higher.
  • cost passes when actual cost is under the Expectation, but its score is also normalized as quality: cheaper runs score higher.
  • Safety Checks should return a high-is-good safety score, while preserving raw risk values such as raw_toxicity, raw_bias, or raw_hallucination in evidence.

Details metrics​

Keep raw measurements in evidence when they are useful for debugging but should not participate directly in score aggregation. Use explicit named metrics only when the raw value is intentionally part of a user's report or of a metrics: expression.

Good evidence fields:

{
"raw_toxicity": 0.82,
"unsafe_categories": ["personal_attack"],
"judge_model": "claude-sonnet-5"
}

Good named scores:

scenarios:
- name: answers
checks:
- type: llm-rubric
metric: answer_quality
value: "answers the question accurately"
- type: latency
metric: latency_quality
threshold: 90000
metrics:
- metrics.answerQuality = mean(answer_quality)
- metrics.overall = (mean(answer_quality) + mean(latency_quality)) / 2

metric: names the score on the scores line, and the report block reads it under that name as the array of the score across the run's Scenarios. No entry copies it. A Check's metric: and an entry that writes the same name (metrics.answer_quality = score) refuse the bench at load: a name is a Check's score or a written value, never both. See A Check's metric: is a sample.

Check author rules​

When adding a Check:

  1. Return Result.Score as normalized utility, where 1 is best and 0 is worst.
  2. Set Result.Pass from the Check's Expectation semantics.
  3. Put raw lower-is-better values in Result.Evidence.
  4. Document any evidence keys that users might depend on.
  5. Never return a lower-is-better value as Result.Score; it will invert composites and row-level averages.

This means madbench can preserve metric-native detail without making users remember which Check types need to be minimized.