Measures an LLM judge (Nous.Eval.Scorers.Judge) against human labels.
{:ok, cases} = Nous.Eval.JudgeCalibration.load("priv/eval/judge_cases.jsonl")
{:ok, result} =
Nous.Eval.JudgeCalibration.calibrate(
[judge: "openai:gpt-4o-2024-08-06", rubric: "...", scale: :binary],
cases
)
result.kappa #=> 0.71
result.false_pass #=> %{estimate: 0.06, ci: {0.02, 0.17}, count: 3, n: 50}calibrate/3 replays stored agent outputs through the judge (no agent
runs) and compares its verdicts with the human labels on the holdout
split only; tune the rubric on the tune split and never look at holdout
results while doing so. mix nous.eval.judge.calibrate runs it from the
command line and stores the result in an eval store
(Nous.Eval.Store.put_calibration/3), keyed by the judge's
Nous.Eval.Scorers.Judge.fingerprint_id/1. A judge configured with
require_calibration: refuses to grade unless the stored result matches
its configuration and passes check/3.
Cases (schema nous.judge_case/1)
A JSONL file, one case per line:
{"id": "refund-17", "input": "Refund order 42", "output": "Refunded $20 for order 42.",
"reference": "Refund of $20 issued for order 42.", "human_label": "pass",
"annotator": "ana", "split": "holdout", "group": "refund-17",
"provenance": "run 2026-10-30-main, sample 0"}id- non-empty string, uniqueinput- the request: a string or a list of{role, content}messages (system,user,assistant)output- the agent's answer: a string, or a JSON object for structured outputreference- optional reference answer (seen by a judge withinclude: [:reference])human_label- the human's verdict, a label of the judge's scale ("pass","4", ...; an integer is read as its string). Human labels only: never a judge's own verdictannotator- who labelled itsplit-"tune"or"holdout"; all cases of agroupmust share itgroup- cases that must stay in one split (paraphrases, outputs of the same request)provenance- where the output came from (string or object)
Loading is strict like Nous.Eval.Dataset: an unknown key, a missing or
mistyped field, a duplicate id or a group spanning both splits is an
error, and nothing in the file becomes an atom. A line may carry
"schema": "nous.judge_case/1".
Metrics (holdout only)
agreement- share of cases where judge and human gave the same label, with a Wilson intervalkappa- Cohen's κ (Nous.Eval.Stats.cohen_kappa/2) for binary, ternary and choice scales; quadratic-weighted κ (Nous.Eval.Stats.weighted_kappa/3) for Likert scales.nilwhen undefinedconfusion- counts by human label (rows) and judge label (columns), in the scale's label orderfalse_pass- among cases the human failed (label value below the judge's threshold), the share the judge passed, with a Wilson interval;nilwithout such caseserror_rate- share of cases where the judge returned aNous.Eval.ScorerError; those cases are left out of the other metrics and listed inerrors
Summary
Functions
Replays the holdout cases through the judge and measures it against the human labels.
Checks a stored calibration against a judge configuration and the
require_calibration thresholds.
A plain-text report of result, as mix nous.eval.judge.calibrate prints it.
Loads a nous.judge_case/1 JSONL file. Blank lines are skipped; errors
name the file and line.
Builds cases from string-keyed maps with the fields of the JSONL format,
validated the same way as load/1.
The schema id of the case format ("nous.judge_case/1").
Functions
@spec calibrate( keyword() | {module(), keyword()} | Nous.Eval.Scorer.Spec.t(), [Nous.Eval.JudgeCalibration.Case.t()], keyword() ) :: {:ok, Nous.Eval.JudgeCalibration.Result.t()} | {:error, term()}
Replays the holdout cases through the judge and measures it against the human labels.
judge is the judge's options ([judge: "openai:...", scale: ...]),
{Nous.Eval.Scorers.Judge, opts} or a Nous.Eval.Scorer.Spec for it.
:require_calibration, :calibration and :gate are ignored: they
decide whether a judge may grade, not what it answers.
Options
:concurrency- judge calls in flight (default4):timeout- per case, in ms (default120_000); a case that runs over counts as a judge error
Returns {:error, reason} before any judge call when the judge options
are invalid, a human label is not a label of the judge's scale, the
judge includes evidence a case cannot provide (:tool_calls,
:transcript: judge cases carry no trace), or there are no holdout cases.
@spec check( Nous.Eval.JudgeCalibration.Result.t() | nil, String.t(), map() | keyword() ) :: :ok | {:error, :missing | :stale | {:below_threshold, String.t()}}
Checks a stored calibration against a judge configuration and the
require_calibration thresholds.
requirements holds :min_kappa (κ at least this) and
:max_false_pass (false-pass point estimate at most this); absent keys
are not checked. Fails closed: nil result → {:error, :missing}, a
result for another fingerprint_id → {:error, :stale}, an undefined κ
or no human-failed holdout cases while a threshold needs them →
{:error, {:below_threshold, reason}}.
@spec format(Nous.Eval.JudgeCalibration.Result.t()) :: String.t()
A plain-text report of result, as mix nous.eval.judge.calibrate prints it.
@spec load(Path.t()) :: {:ok, [Nous.Eval.JudgeCalibration.Case.t()]} | {:error, String.t()}
Loads a nous.judge_case/1 JSONL file. Blank lines are skipped; errors
name the file and line.
@spec new([map()]) :: {:ok, [Nous.Eval.JudgeCalibration.Case.t()]} | {:error, String.t()}
Builds cases from string-keyed maps with the fields of the JSONL format,
validated the same way as load/1.
@spec schema() :: String.t()
The schema id of the case format ("nous.judge_case/1").