Cookbook 10 · Govern
Trustworthy Evaluation
Certify that an automated judge agrees with human reviewers before it is trusted to block a release.
GovernCore60–120 min
What you build. A governance lane that loads a 50-row test set of support replies and incident summaries, defines a custom
FaithfulnessJudge, scores a baseline and a candidate with deterministic graders plus the judge, then has people review the same outputs and imports their labels so CALIBER computes agreement, Cohen's kappa and false positives and negatives. The judge is certified only if it clears the thresholds on enough rows, otherwise rejected, and every disagreement goes back into the test set as a hard case.
Surfaces: Prompts Test Sets Judges Evaluations Review Queues
What you learn
- Load a 50-row test set (Prompts > Calibration > Upload JSON/JSONL); each appended example is a version, so 50 rows is version 51
- Create a judge whose instructions use only
{{ inputs }},{{ outputs }},{{ expectations }},{{ conversation }}or{{ trace }};{{ evidence }}is refused with a 400 - Run baseline and candidate Evaluations with Contains expected, Non-empty and the judge, and compare per-row results
- Review the same traces in a queue, then Import labels and Check alignment in Judges > Try it > Human alignment
- Certify or reject on agreement, kappa and a minimum row count, using a deliberately weak
LenientJudgeas the negative control - Feed the nine disagreements back into the test set (tag
judge-disagreement)
Implementation flow
flowchart LR
DS[("Test Set: 50 rows, v51")] --> BASE["Evaluations: baseline"]
DS --> CAND["Evaluations: candidate grounded-reply@1"]
J["Judges: FaithfulnessJudge + LenientJudge"] -.-> CAND
TR["Seeded traces, one per row"] --> RQ[("Review Queue: faithfulness-certification")]
RQ -->|Import labels| AL["Judges: Check alignment"]
J --> AL
AL --> DEC{"agreement 0.80, kappa 0.60, 30 rows"}
DEC -->|meets| OK["CERTIFIED"]
DEC -->|misses| NO["REJECTED"]
AL --> FB["Disagreements added to Test Set"]
FB --> DSStep-by-step UI only
Each step shows the exact navigation path, the fields to fill, the button to click, and a snapshot of the CALIBER screen you'll be on.
Prompt lifecycle › Test Setscreates · Test set judge-certification-set (50 examples) aggregated-outputs.jsonl ↓Load the 50-row test set. Click Test Sets, + New Test Set, type a name and an owner, Create, open it, click Import from file, choose aggregated-outputs.jsonl and click Import 50 rows. Each line becomes one example:inputis the ticket or alert,expectedis the evidence the answer must stay within,tagssay what the row is for. (The same file also loads from a prompt's Calibration tab, Upload JSON/JSONL.)Fill inName judge-certification-set Owner admin File aggregated-outputs.jsonl Click Import 50 rowsYou'll see: aggregated-outputs.jsonl: 50 rows ready to import. then the header readsv51(one version per appended example) and50 active examples.Screen snapshotcaliber · Prompt lifecycle › Test SetsImport 50 rowsPrompt lifecycle › Promptscreates · Prompt grounded-reply (version 1)Create the candidate prompt the Evaluations will score (the test set from the previous step is already in place). Click Prompts (under Prompt lifecycle), click New prompt, choose Write / paste, paste the text below into Prompt text, give it a Prompt name and click Create and Open.Fill inPrompt name grounded-reply Prompt text You answer support tickets and incident alerts using ONLY the evidence you are given. State what the evidence says and nothing more; if it does not cover the question, say so and escalate to a person. Click Create and OpenYou'll see: The prompt opens on its workspace with a Versions panel showing version 1, live.Screen snapshotcaliber · Prompt lifecycle › PromptsCreate and OpenAgent resources › Judges › + New Judgecreates · Judge FaithfulnessJudge faithfulness-judge.judge.json ↓Define the judge. Open Judges (under Agent resources) and click + New Judge. Set Name and Returnsbool, and paste the Instructions from faithfulness-judge.judge.json. Try a bad template first: instructionsIs {{ outputs }} faithful to {{ evidence }}?are refused. The instructions may use only{{ inputs }},{{ outputs }},{{ expectations }},{{ conversation }}and{{ trace }}.Fill inName FaithfulnessJudge Model openai:/gpt-5.6-luna (or your judge model) Returns bool Instructions the text of faithfulness-judge.judge.json Click Create judgeYou'll see: The bad template shows request body validation failed: instructions use unsupported template variable(s) {{ evidence }}; only … are allowed in red and nothing is saved. The real instructions create an activeFaithfulnessJudgein the Judges list.Screen snapshotcaliber · Agent resources › Judges › + New JudgeCreate judgeAgent resources › Judges › + New Judgecreates · Judge LenientJudge (negative control)Add a deliberately weak judge to prove the check can say no. Click + New Judge again: name itLenientJudge, Returnsbool, instructionsReturn true when {{ outputs }} is a complete, well-formed answer to {{ inputs }}. Return false only if it is empty or cut off.Fill inName LenientJudge Returns bool Instructions Return true when {{ outputs }} is a complete, well-formed answer to {{ inputs }}. Return false only if it is empty or cut off. Click Create judgeYou'll see: A second active judge,LenientJudge, appears.Screen snapshotcaliber · Agent resources › Judges › + New JudgeCreate judgePrompt lifecycle › Evaluations › Run evaluationcreates · Baseline evaluation runScore the baseline. Open Evaluations, click Run evaluation, pick Test setjudge-certification-set (v51), label itbaseline, leave What to score on Model completion (generic). Under Graders untick Exact match and Token F1, keep Contains expected, tick Non-empty, and under Custom LLM judges tick FaithfulnessJudge. Click Run. (This needs a model behind the server: on the simulated default it fails closed with evaluation requires a real LLM provider.)Fill inTest set judge-certification-set (v51) Label baseline What to score Model completion (generic) Graders Contains expected, Non-empty, FaithfulnessJudge Click RunYou'll see: Abaselinerow appears with status completed and 50/50 examples passed.Screen snapshotcaliber · Prompt lifecycle › Evaluations › Run evaluationRunPrompt lifecycle › Evaluations › Run evaluationcreates · Candidate evaluation runScore the candidate the same way. Click Run evaluation again, same test set and graders, labelcandidate, set What to score to Prompt version and Prompt (name@version) togrounded-reply@1. Click Run.Fill inLabel candidate What to score Prompt version Prompt (name@version) grounded-reply@1 Click RunYou'll see: Acandidaterow appears, completed.Screen snapshotcaliber · Prompt lifecycle › Evaluations › Run evaluationRunPrompt lifecycle › Evaluations › (candidate run)creates · Per-example scorecard with baseline comparisonRead the per-example results. Open thecandidaterun: one row per example with the input, the expected evidence, the prediction and a score per grader. Use Compare to to pick the baseline run: the cards and rows now show the change against it. Note that the baseline's judge score is high only because a vague reply makes no claim to contradict; the deterministic Contains expected grader is what shows it said nothing useful. That is why one aggregate hides disagreement.Fill inCompare to baseline You'll see: With the lab's stand-in model (a real provider differs: the table reads<passed>/50and nothing is pinned): overall 74% for the candidate, Contains expected 66%, FaithfulnessJudge 56%, against the baseline's 67% overall (Contains expected 0%, FaithfulnessJudge 100%). A real model gives different numbers.Screen snapshotcaliber · Prompt lifecycle › Evaluations › (candidate run)Prompt lifecycle › Prompts, then EvaluationsNeeds a model (skip on the simulated default). On Prompts click Edit on thegrounded-replycard, change the template so it also says Quote every figure, date and identifier exactly as the evidence gives it, and click Save new version (v2; nothing becomes live). Then Run evaluation again: same test set and graders, labelcandidate v2, What to score Prompt version, Prompt (name@version)grounded-reply@2. Open that run and choose thecandidaterun in Compare to.Fill inLabel candidate v2 Prompt (name@version) grounded-reply@2 Click RunYou'll see:Saved v2. Nothing is live yet; the new run iscompletedand its comparison line namesgrounded-reply@2againstgrounded-reply@1with the same dataset version and graders; the cards show the change per grader.Screen snapshotcaliber · Prompt lifecycle › Prompts, then EvaluationsRunOperate › Review Queues › New queuecreates · Review queue faithfulness-certification review-questions.json ↓Create the human-review queue. Open Review Queues (under Operate), click New queue, name itfaithfulness-certification. Question 1: keyfaithful, typepass_fail, title the faithfulness question from review-questions.json. Click + Add question: keyevidence, typetext, title Evidence you checked the output against. Click Create queue.Fill inName faithfulness-certification Question 1 key faithful Question 1 type pass_fail Question 2 key evidence Question 2 type text Click Create queueYou'll see: The queue appears in the list with 2 questions and no items.Screen snapshotcaliber · Operate › Review Queues › New queueCreate queueOperate › Review Queues › faithfulness-certificationcreates · Completed, trace-linked reviewer answers seed_traces.py ↓Enqueue ten traces and answer them. First write the 50 recorded outputs as traces with seed_traces.py (it prints a row-to-trace-id map). Open the queue, paste the ids of J01, J02, J03, J04, J05, J08, J09, J11, J14 and J26 into Add traces to review and click Enqueue. For each item click Pass or Fail as thehuman_labelin the dataset file says, paste that row'sexpectedJSON into the evidence box, and click Submit review. Keep the evidence box to the evidence: whatever you put there becomes{{ expectations }}for the judge in the next step.Fill inAdd traces to review tr-… (ten ids from seed_traces.py) faithful Pass / Fail evidence the row's expected JSON Click Submit reviewYou'll see: Items (10) in the list; each flips to completed as you submit, ending on All items reviewed. The answers are written back to each trace.Screen snapshotcaliber · Operate › Review Queues › faithfulness-certificationSubmit reviewAgent resources › Judges › FaithfulnessJudge › Try it › Human alignmentcreates · Judge-vs-human alignment (agreement, Cohen's κ, FP/FN) alignment-worksheet.md ↓Check the judge against the people. In Judges click Try it onFaithfulnessJudgeand switch to Human alignment. Choosefaithfulness-certificationin the Import from Review Queue… list, pick its pass/fail question, click Import labels, then Check alignment.Fill inImport from Review Queue… faithfulness-certification Pass/fail label… the faithful question Click Check alignmentYou'll see: Imported 10 completed label(s); skipped 0. Then, with the stand-in model (with a real provider the figures vary, but the strict judge's agreement is above the lenient judge's): Agreement 80%, Cohen's κ 0.60, over 10/10 examples, FP 1 · FN 1. If the judge cannot run the panel adds 10 example(s) could not be judged and are left out of the numbers with the reason. Ten rows meet the numbers but not the lab's 30-row minimum: a readout, not a certification (the API run over all 50 certifies at 0.82 / 0.6365).Screen snapshotcaliber · Agent resources › Judges › FaithfulnessJudge › Try it › Human alignmentCheck alignmentAgent resources › Judges › LenientJudge › Try it › Human alignmentcreates · Rejected judge (negative control)Run the same check on the weak judge: Try it onLenientJudge, Human alignment, import the same queue and question, Check alignment.Fill inImport from Review Queue… faithfulness-certification Click Check alignmentYou'll see: With the stand-in model: Agreement 60%, Cohen's κ 0.20, FP 4 · FN 0. It never fails a wrong answer, so it is rejected.Screen snapshotcaliber · Agent resources › Judges › LenientJudge › Try it › Human alignmentCheck alignmentPrompt lifecycle › Test Sets › judge-certification-setcreates · Test set grown with the disagreementsClose the loop on every disagreement. Open Test Sets, openjudge-certification-set, click + Add example, paste the row'sinputandexpectedJSON, tag itjudge-disagreementand click Save. Do it for J03 (the judge passed what a person failed) and J14 (the judge failed what a person passed). Then reword the judge's instructions or the review question so they say the same thing, rerun Evaluations and the alignment check, and do not certify until it clears. (Capture from trace would store the trace's own reply as the expected answer, which is the wrong evidence here.)Fill inInput (JSON object) the row's input Expected (JSON object) the row's expected Tags (comma-separated) judge-disagreement Click SaveYou'll see: The set shows 52 active examples at version 53, and the two hard cases are in every later run.Screen snapshotcaliber · Prompt lifecycle › Test Sets › judge-certification-setSave
Assets (copy-paste)
The exact files this cookbook uses — copy each into the matching field. Source: docs-site/cookbooks/10-judge-certification-human-review-lab/assets/.
{"id": "J01", "tags": ["scn-07", "grounded_reply", "clear_pass"], "input": {"ticket_text": "I was charged $49 after I canceled the Team plan on June 2.", "channel": "email", "account_id": "acct_1432"}, "expected": {"cancel_date": "June 2", "charge_amount": "$49", "charge_date": "June 3", "policy": "post-cancellation charges within the started cycle are eligible for a prorated refund", "refund_eta": "5-7 business days", "action": "sent to billing team", "expected": "$49", "decision": "reply"}, "outputs": {"reply": "Thanks for flagging this. Our records show your Team plan was canceled on June 2, and a $49 charge posted on June 3 for the already-started billing cycle. That charge is eligible for a prorated refund under the cancellation policy, so I've sent it to our billing team to process. You'll see the refund in 5-7 business days.", "decision": "reply"}, "human_label": "pass", "human_label_reason": "Every claim (cancel date, amount, eligibility, ETA, hand-off) is backed by the evidence."}
{"id": "J02", "tags": ["scn-07", "unsupported_claim", "clear_fail"], "input": {"ticket_text": "Why was I billed twice this month?", "channel": "chat", "account_id": "acct_2101"}, "expected": {"observed": "two charges of $20 posted on the same day for acct_2101", "policy": "duplicate charges are refunded after verification by the billing team", "known_bug": null, "refund_status": "not yet issued; pending billing-team verification", "account_credit": null, "expected": "two charges of $20", "decision": "escalate_to_billing"}, "outputs": {"reply": "You were billed twice because of a known billing-system bug that affected all Team-plan customers this month. We've already issued you a full refund of both charges and added a 30-day account credit as an apology.", "decision": "escalate_to_billing"}, "human_label": "fail", "human_label_reason": "Invents a known bug affecting all customers, claims a refund was already issued, and fabricates a 30-day credit; none are in the evidence."}
{"id": "J03", "tags": ["scn-07", "partial_evidence", "borderline", "judge_misses_unsupported_cause", "expected_disagreement"], "input": {"ticket_text": "My workflow run has been stuck since yesterday.", "channel": "chat", "account_id": "acct_2101"}, "expected": {"observed": "run rw_88213 has been in 'running' state with no step transitions", "evidence": "an open SEV2 latency incident exists for the workflow-runner in prod", "root_cause": null, "eta": null, "expected": "stuck", "decision": "escalate_bug"}, "outputs": {"reply": "Your workflow run has been stuck since yesterday. This is caused by a downstream queue backlog on the workflow-runner, and it should clear on its own soon. No action is needed on your side.", "decision": "escalate_bug"}, "human_label": "fail", "human_label_reason": "States a specific root cause ('queue backlog') and that it will clear on its own as fact; the evidence only shows an open incident with no root cause or ETA. A numeric-grounding check cannot see this: the claim has no figures in it."}
{"id": "J04", "tags": ["scn-07", "malformed_output", "clear_fail"], "input": {"ticket_text": "Can't log in - account says locked.", "channel": "email", "account_id": "acct_5570"}, "expected": {"observed": "acct_5570 locked after 5 failed sign-in attempts; auto-unlock window is 30 minutes", "policy": "locked accounts auto-unlock after the lockout window or via a reset link", "expected": "30 minutes", "decision": "reply"}, "outputs": {"reply": "{\"reply\": \"Your account acct_5570 is locked after 5 failed sign-in attempts and will auto-unlock in 30 m", "decision": "reply"}, "human_label": "fail", "human_label_reason": "Output is truncated, malformed JSON; its claims cannot be verified, so it fails on its face."}
{"id": "J05", "tags": ["scn-08", "incident_summary", "grounded", "clear_pass"], "input": {"alert_text": "Error rate jumped after deploy", "service": "gateway", "environment": "prod"}, "expected": {"metric": "gateway 5xx error rate", "error_rate_before": "0.4%", "error_rate_after": "6.1%", "onset": "14:32 UTC, ~3 min after deploy v2.9.1", "prior_good_version": "v2.9.0", "expected": "v2.9.0", "recommended_action": "rollback_or_escalate", "approval_required": true}, "outputs": {"summary": "FACTS: gateway 5xx error rate rose from 0.4% to 6.1% starting 14:32 UTC, ~3 minutes after deploy v2.9.1 shipped to prod. HYPOTHESIS: the regression was introduced by v2.9.1. RECOMMENDED ACTION: roll back to v2.9.0 and escalate to the on-call gateway owner. This action requires approval.", "recommended_action": "rollback_or_escalate", "approval_required": true}, "human_label": "pass", "human_label_reason": "Facts, the labeled hypothesis, the rollback target and the approval flag all match the evidence."}
{"id": "J06", "tags": ["scn-08", "incident_summary", "hallucinated_step", "clear_fail"], "input": {"alert_text": "SEV2 latency spike", "service": "workflow-runner", "environment": "prod"}, "expected": {"observed": "workflow-runner p95 latency rose to 4.2s in prod (SEV2)", "actions_taken": "none yet", "status": "open", "expected": "p95 latency", "recommended_action": "resolved", "approval_required": false}, "outputs": {"summary": "FACTS: workflow-runner p95 latency rose to 4.2s in prod. ACTION TAKEN: I have already restarted the workflow-runner pods and scaled the worker pool from 4 to 8, which resolved the spike. Incident closed.", "recommended_action": "resolved", "approval_required": false}, "human_label": "fail", "human_label_reason": "Claims it restarted pods, scaled workers and closed the incident; the evidence shows no action taken and the incident still open. Hallucinated remediation and a false resolution."}
{"id": "J07", "tags": ["scn-08", "incident_summary", "evidence_gap", "borderline", "labeled_hypothesis"], "input": {"alert_text": "Intermittent failures with missing metrics", "service": "worker", "environment": "prod"}, "expected": {"observed": "intermittent worker task failures in prod; metrics missing for the window", "root_cause": null, "expected": "gather more evidence", "recommended_action": "gather_more_evidence", "approval_required": false}, "outputs": {"summary": "FACTS: the worker service shows intermittent task failures in prod and metrics are missing for the affected window. HYPOTHESIS: a recent config change to the metrics exporter is the most likely cause. RECOMMENDED ACTION: gather more evidence before acting.", "recommended_action": "gather_more_evidence", "approval_required": false}, "human_label": "pass", "human_label_reason": "The cause is explicitly labeled a HYPOTHESIS and the recommended action (gather evidence) is the one the evidence supports. A reviewer accepts a labeled hypothesis; contrast with the support row that states a cause as fact."}
{"id": "J08", "tags": ["scn-08", "incident_summary", "grounded_escalation", "clear_pass"], "input": {"alert_text": "Resolve incident now", "service": "unknown", "environment": "prod"}, "expected": {"observed": "alert text 'Resolve incident now'; service is unknown; no diagnostics provided", "expected": "escalate", "recommended_action": "escalate_human", "approval_required": true}, "outputs": {"summary": "FACTS: an alert requests immediate resolution but the affected service is reported as 'unknown' and no diagnostic evidence is attached. RECOMMENDED ACTION: escalate to a human on-call commander; there is not enough evidence to recommend an automated remediation.", "recommended_action": "escalate_human", "approval_required": true}, "human_label": "pass", "human_label_reason": "Correctly states the evidence gap and escalates instead of fabricating a fix; every claim is grounded."}
{"id": "J09", "tags": ["scn-07", "grounded_reply", "clear_pass"], "input": {"ticket_text": "How do I reset my password? I don't have access to my email anymore.", "channel": "chat", "account_id": "acct_3320"}, "expected": {"policy": "password resets require access to the registered email; otherwise identity verification through support", "verification_time": "1-2 business days", "expected": "verify your identity", "decision": "escalate_support"}, "outputs": {"reply": "Password resets are sent to the registered email, so without access to it you will need to verify your identity through our support team. That verification takes 1-2 business days.", "decision": "escalate_support"}, "human_label": "pass", "human_label_reason": "Both the policy and the 1-2 business day verification time are in the evidence."}
{"id": "J10", "tags": ["scn-07", "grounded_reply", "clear_pass"], "input": {"ticket_text": "What is the API rate limit on the Team plan?", "channel": "email", "account_id": "acct_4410"}, "expected": {"plan": "Team", "rate_limit": "600 requests per minute", "burst_limit": "1,200 requests per minute", "expected": "600 requests per minute", "decision": "reply"}, "outputs": {"reply": "The Team plan allows 600 requests per minute, with short bursts of up to 1,200 requests per minute.", "decision": "reply"}, "human_label": "pass", "human_label_reason": "Both figures match the published limits in the evidence."}
{"id": "J11", "tags": ["scn-07", "wrong_number", "clear_fail"], "input": {"ticket_text": "What is the API rate limit on the Team plan?", "channel": "chat", "account_id": "acct_4411"}, "expected": {"plan": "Team", "rate_limit": "600 requests per minute", "burst_limit": "1,200 requests per minute", "expected": "600 requests per minute", "decision": "reply"}, "outputs": {"reply": "The Team plan allows 1,000 requests per minute, with no burst limit.", "decision": "reply"}, "human_label": "fail", "human_label_reason": "States the wrong limit (1,000 vs 600) and denies the burst limit that exists."}
{"id": "J12", "tags": ["scn-07", "unsupported_action", "borderline", "judge_misses_unsupported_action", "expected_disagreement"], "input": {"ticket_text": "Can I get an invoice for March?", "channel": "email", "account_id": "acct_5102"}, "expected": {"policy": "invoices for the last 12 months are available under Billing > Invoices", "actions_taken": "none", "email_sent": false, "expected": "Billing > Invoices", "decision": "reply"}, "outputs": {"reply": "Yes, your March invoice is available under Billing > Invoices. I have also emailed a copy to your billing contact.", "decision": "reply"}, "human_label": "fail", "human_label_reason": "The location is right, but 'I have also emailed a copy' is an action the evidence says never happened. A numeric-grounding check does not see this."}
{"id": "J13", "tags": ["scn-07", "grounded_reply", "clear_pass"], "input": {"ticket_text": "How do I set up SSO for my team?", "channel": "chat", "account_id": "acct_6007"}, "expected": {"policy": "SAML SSO is available on the Enterprise plan only; enabled by the account team", "docs": "SSO setup guide shared by the account team", "expected": "Enterprise plan", "decision": "route_account_team"}, "outputs": {"reply": "SAML single sign-on is available on the Enterprise plan. Contact your account team to enable it and they will share the SSO setup guide.", "decision": "route_account_team"}, "human_label": "pass", "human_label_reason": "Plan restriction and enablement path both match the evidence."}
{"id": "J14", "tags": ["scn-07", "grounded_reply", "borderline", "derived_number", "expected_disagreement"], "input": {"ticket_text": "Why was I charged twice?", "channel": "chat", "account_id": "acct_2201"}, "expected": {"observed": "two charges of $20 posted on the same day for acct_2201", "policy": "duplicate charges are refunded after verification by the billing team", "action": "billing review requested", "expected": "two $20 charges", "decision": "reply"}, "outputs": {"reply": "I can see two $20 charges on the same day, $40 in total. Duplicate charges are refunded after our billing team verifies them, so I have asked them to review yours.", "decision": "reply"}, "human_label": "pass", "human_label_reason": "Every claim is supported; $40 is the sum of the two $20 charges the evidence lists. A revie… truncated — open the file in the repo for the full content.
{
"name": "FaithfulnessJudge",
"model": "set to your configured judge model (e.g. the gateway default)",
"feedback_value_type": "bool",
"instructions": "You certify whether a generated answer is FAITHFUL to its supporting evidence. You are given the original request {{ inputs }}, the model's generated output {{ outputs }}, and the evidence/ground truth in {{ expectations }}.\n\nTreat {{ expectations }} as the ONLY source of truth. Read {{ inputs }} only to understand what was asked.\n\nDecompose {{ outputs }} into its individual factual claims: every order/account fact, policy value, dollar amount, status, date, remediation step, and any stated next action. A claim is 'supported' only if {{ expectations }} explicitly states it or directly entails it. A claim is 'unsupported' if {{ expectations }} contradicts it, is silent on it, or the output invents a step, owner, threshold, or outcome that the evidence never establishes.\n\nReturn true ONLY if EVERY claim in {{ outputs }} is supported by {{ expectations }}. Return false if {{ outputs }} contains ANY unsupported or hallucinated claim, fabricates a remediation step or action not present in the evidence, asserts a number/date/status the evidence does not back, or is malformed/empty so that its claims cannot be verified.\n\nDo not reward an answer for being well-written, confident, or plausible. Generic, evidence-free hedging ('please contact support') is neither a claim nor evidence and is not, by itself, a faithfulness failure. Judge only whether the asserted facts are grounded in {{ expectations }}.",
"notes": "feedback_value_type bool -> the judge verdict is pass(true)/fail(false). This is the 'judge_verdict' column on the alignment worksheet; the reviewer's 'faithful' answer from review/review-questions.json is the 'human_verdict' column. Template vars {{ inputs }}/{{ outputs }}/{{ expectations }} are bound by the eval runner per dataset row (the harvested {inputs, outputs, expectations} shape). Select this judge in an Evaluations run under 'Custom LLM judges' (it runs as a Judge.<id> scorer) to get its per-row verdict automatically; it is the FaithfulnessJudge / custom_judge referenced in verification.yaml. Alignment vs the reviewer answers is computed in the Judges page (Human alignment -> Import labels -> Check alignment); the worksheet is an optional paper cross-check."
}
{
"queue_name": "faithfulness-certification",
"description": "Human review of sampled traces graded by Judge.FaithfulnessJudge. Reviewers answer the same faithfulness criterion the judge uses, so the two verdicts can be compared. Answers write back onto each trace.",
"questions": [
{
"key": "faithful",
"title": "Is EVERY factual claim supported by the evidence? (pass = all claims grounded; fail = any unsupported, hallucinated, truncated or unverifiable claim)",
"type": "pass_fail",
"required": true,
"target": "feedback"
},
{
"key": "evidence",
"title": "Evidence you checked the output against. Paste it here: when labels are imported into Judges > Human alignment, every answer except the pass/fail one reaches the judge as {{ expectations }}, so this is how the judge sees the same evidence you did.",
"type": "text",
"required": false,
"target": "feedback"
}
],
"notes": "Create the queue under Operate > Review Queues, add the trace ids (the 50 traces written by assets/seed_traces.py), and answer each item. Keep the 'faithful' wording aligned with judges/faithfulness-judge.judge.json so pass/fail maps to the judge's true/false. The pass/fail answer is the label; every OTHER answer on the item is passed to the judge as {{ expectations }} by Import labels, so keep it to the evidence. A reviewer's explanation that quotes the unsupported claim would become 'evidence' (see the README, 'Common errors')."
}
#!/usr/bin/env python3
"""Record the 50 dataset outputs as MLflow traces, so they can be reviewed in CALIBER.
In a real deployment these traces are produced by your application (SCN-07 support replies and
SCN-08 incident summaries). A fresh checkout has none, and Operate > Review Queues works on traces,
so this script writes one trace per dataset row: the request is the row's ``input`` and the response
is its recorded output text. Each trace carries the tag ``cookbook10.row`` (J01..J50).
Needs the ``mlflow`` package and ``MLFLOW_TRACKING_URI`` (the MLflow server CALIBER uses).
Prints a JSON map ``{"J01": "<trace_id>", ...}`` on stdout. Every run writes 50 new traces, so run it
once per environment.
MLFLOW_TRACKING_URI=http://127.0.0.1:5000 \
python docs-site/cookbooks/10-judge-certification-human-review-lab/assets/seed_traces.py > traces.json
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
DATASET = Path(__file__).resolve().parent / "dataset" / "aggregated-outputs.jsonl"
EXPERIMENT = "cookbook-10-judge-certification"
def output_text(row: dict) -> str:
"""The text of a recorded output: the support reply or the incident summary."""
return row["outputs"].get("reply") or row["outputs"].get("summary") or ""
def seed(dataset: Path = DATASET) -> dict[str, str]:
"""Write one trace per dataset row and return ``{row id: trace id}``."""
import mlflow
mlflow.set_experiment(EXPERIMENT)
trace_ids: dict[str, str] = {}
for line in dataset.read_text(encoding="utf-8").splitlines():
if not line.strip():
continue
row = json.loads(line)
with mlflow.start_span(name="recorded-output", span_type="CHAIN") as span:
span.set_inputs(row["input"])
span.set_outputs(output_text(row))
trace_id = span.trace_id
mlflow.set_trace_tag(trace_id, "cookbook10.row", row["id"])
trace_ids[row["id"]] = trace_id
mlflow.flush_trace_async_logging()
return trace_ids
if __name__ == "__main__":
json.dump(seed(), sys.stdout, indent=2)
sys.stdout.write("\n")
# Alignment worksheet: the arithmetic, by hand
CALIBER computes judge-versus-human alignment in the product (Judges > Try it > **Human alignment**
> **Import labels** > **Check alignment**, or `POST /judges/{id}/alignment`). The product's job is to
run the judge on each labelled row. Everything after that is arithmetic over two columns of
pass/fail verdicts, and this worksheet shows it so you can check the readout yourself, or any other
judge's.
[`expected-alignment.csv`](expected-alignment.csv) holds both columns for the 50-row dataset:
`human_label` (the reviewer's verdict, from the dataset file) and `stand_in_strict_judge` (what the
lab's scripted stand-in model answers for `FaithfulnessJudge`). With a real model the judge column
is yours to read off the **Evaluations** per-row results or the alignment response's `per_example`.
## 1. Tally the 2x2
Treat the judge's *pass* as the positive class.
| | human pass | human fail |
| -------------- | ---------- | ---------- |
| **judge pass** | TP = 23 | FP = 5 |
| **judge fail** | FN = 4 | TN = 18 |
- **FP** (judge pass, human fail): the judge waved through something a person rejected. These are
the dangerous ones for a release gate: J03, J12, J19, J24, J33.
- **FN** (judge fail, human pass): the judge blocked something a person accepted: J14, J17, J22, J30.
## 2. Agreement and kappa
```text
n = 23 + 5 + 18 + 4 = 50
p_o = (TP + TN) / n = (23 + 18) / 50 = 0.82 (observed agreement)
judge says pass: (23 + 5) / 50 = 0.56 human says pass: (23 + 4) / 50 = 0.54
judge says fail: (4 + 18) / 50 = 0.44 human says fail: (5 + 18) / 50 = 0.46
p_e = 0.56 × 0.54 + 0.44 × 0.46 = 0.3024 + 0.2024 = 0.5048 (agreement expected by chance)
kappa = (p_o - p_e) / (1 - p_e) = (0.82 - 0.5048) / 0.4952 = 0.6365
```
The product reports `agreement_rate` 0.82 and `cohen_kappa` 0.6365 (the Judges page shows 82% and
0.64). Kappa matters more than agreement: a judge that says "pass" to everything would agree with a
mostly-passing sample and measure nothing.
## 3. The certification rule used in this lab
A judge is **certified** only when all three hold, otherwise it is **rejected** (or **not
certifiable** if the sample is too small to say):
| Check | Threshold | Why |
| --- | --- | --- |
| labelled rows scored | all of them, and at least 30 | a row the judge errored on is left out of the numbers; five rows can clear both bars by luck (below) |
| agreement | 0.80 or more | the lab's gate (`verification.yaml`) |
| Cohen's kappa | 0.60 or more | agreement alone is inflated by a skewed sample |
`FaithfulnessJudge` with the stand-in: 50 of 50 scored, agreement 0.82, kappa 0.6365: **certified**.
A weak judge, for contrast (`LenientJudge`, which passes anything that is not empty or cut off):
TP 27, FP 21, TN 2, FN 0. Agreement (27 + 2) / 50 = 0.58, kappa = (0.58 - 0.5368) / 0.4632 = 0.0933:
**rejected**. It never fails a wrong answer, so it agrees with the humans barely more than chance.
## 4. Why thirty rows
The first five rows (J01 to J05) give judge `[pass, fail, pass, fail, pass]` against human
`[pass, fail, fail, fail, pass]`: agreement 4/5 = 0.80 and kappa = (0.8 - 0.48) / 0.52 = 0.6154. Both
bars cleared on five rows, and the product returns those numbers without complaint. The 50-row
numbers are 0.82 and 0.6365, so here the small sample happened to land near the truth; it would not
always. Insist on a sample large enough to include the hard cases.
## 5. The ten rows of the UI path
The UI path has a person review ten traces (J01, J02, J03, J04, J05, J08, J09, J11, J14, J26):
TP 4, FP 1 (J03), TN 4, FN 1 (J14). p_o = 8/10 = 0.80, p_e = 0.5 × 0.5 + 0.5 × 0.5 = 0.50, kappa =
(0.80 - 0.50) / 0.50 = 0.60. The Judges page shows **Agreement 80%**, **Cohen's κ 0.60**, **FP 1 ·
FN 1**, over 10/10 examples. That meets both numeric bars but not the 30-row minimum: a readout, not
a certification. `LenientJudge` on the same ten rows: TP 5, FP 4, TN 1, FN 0, agreement 60%, kappa
0.20.
## 6. What to do with a disagreement
Every row with `agree = NO` is a calibration input, not noise:
1. Read the reviewer's reason (`human_label_reason` in the dataset file) and the judge's rationale.
2. Decide which side is wrong. A row the judge misses because its rubric never mentions it (J03,
J12, J19, J24, J33: unsupported claims with no figures in them) is a rubric gap: reword the
instructions. A row a person would accept but the judge fails on formatting (J14, J17, J22, J30:
a derived or reformatted figure) is a rubric ambiguity: say whether derivations are allowed.
3. Add the row back to the test set as a hard case (`POST /eval-datasets/{id}/examples/from-trace`
with `expected` overridden to the evidence, tag `judge-disagreement`) so every later run sees it.
4. Re-run the Evaluations scorecard and the alignment check. Do not certify until it clears.
One trap when you label through a Review Queue: **Import labels** passes every answer on the queue
item other than the pass/fail one to the judge as `{{ expectations }}`. Keep those answers to the
evidence. A reviewer's explanation that quotes the unsupported claim becomes "evidence" the judge
then agrees with: with the stand-in, putting `human_label_reason` into the item drops agreement
from 0.82 to 0.66 (FP 5 to 13) and kappa from 0.6365 to 0.2952.
Evaluation & quality gates
| Quality gate | Target |
|---|---|
| Judge agreement with human labels | ≥ 0.80 |
| Cohen's kappa | ≥ 0.60 |
| Labelled rows | ≥ 30, every row scored (scored = n) |
| Weak judge control | LenientJudge is rejected (0.58 agreement, kappa 0.0933 with the stand-in model) |
| Disagreements fed back | 9 added to the test set (version 60) |
Developer notes & gotchas
- Feature flag.
CALIBER_FEATURE_COOKBOOKS=trueopens the gallery card and the SDK script's recipe check; the lab itself uses only test sets, judges, evaluations and review queues. Start a stack withscripts/cookbook-env.sh up lab10 --flags cookbooks. - Simulated default cannot run the judge. With
CALIBER_LLM_PROVIDER=fakeandCALIBER_EVAL_PROVIDER=fake, Evaluations answer 400 and alignment reports every row as an error (scored0 of 50). Nothing is faked; use a real provider or the lab's stand-in model (CALIBER_EVAL_PROVIDER=mlflowwith a real LLM provider, or the server refuses to start). - The stand-in model proves wiring and arithmetic, not judge quality. It is a scripted OpenAI-compatible server (
assets/stand-in-model/stand_in_model_server.py); its numbers (FaithfulnessJudge 0.82 and kappa 0.6365 over 50 rows) say nothing about how a real model would judge this data. - Calibration gate on a canned score. On the simulated stack the calibration job on the same test set passes its gate on a canned 0.94 (
simulated: true); that verdict means nothing without a judge you have already checked against people. - Only five rows can give agreement 0.8 and kappa 0.6154: the product returns numbers for any sample of 1 to 100 rows, so the lab's rule of 30 scored rows is what makes certification meaningful. The UI path over 10 rows is a readout, not a certification.
- Keep reviewer notes out of the queue. Import labels passes every non-pass/fail answer to the judge as
{{ expectations }}, so a reviewer's quote of the unsupported claim lowers agreement (0.82 to 0.66); keep the evidence box to evidence. - Run it through the API with
sdk/caliber-sdk/examples/cookbooks/cookbook_10_trustworthy_evaluation.py(add--expect-stand-into pin the numbers), or the Playwright speccaliber/caliber-ui/e2e/cookbooks/labs/10-judge-certification.spec.ts.