Declarative judge response_schema + helsedir/binary_abstention judges#19
Merged
Merged
Conversation
Framework refactor: judges may now declare an optional `response_schema` field in their config; ModelAuditor reads it and threads it through to the judge LLM call. Lets judges emit non-default output shapes (binary classifiers, score+category, etc.) without the json_format=False workaround. Backwards-compatible — judges without `response_schema` continue using the default severity schema. New judges: - helsedir_sexhealth_no and helsedir_sexhealth_no_rag — Norwegian sexual-health evaluation, six criteria from a Helsedirektoratet domain-expert review. The sixth (BEVARING AV USIKKERHET OG NYANSER) was added by the reviewer beyond SimpleAudit's standard five. Two variants share the same criteria; the RAG one references "dokumentene" verbatim for evaluating RAG-backed bots, the generic one softens to "etablerte faglige kilder" for non-RAG bots. - binary_abstention — language-agnostic substance-vs-words classifier: did the model deliver the substantive content the user asked for, yes or no? Designed as a complement to AbstentionBench on the refuse-then-explain pattern. The built-in `abstention` judge also gains a `response_schema` declaration. It was previously broken under json_format=True against Anthropic — the hardcoded severity schema rejected its score/abstained/category fields. Includes 13 unit tests for the response_schema mechanism, README updates listing the new judges and documenting the mechanism, an addition to the judge-config guidelines doc, and a `.env` entry in .gitignore. Experimental validation in examples/helsedir_sexhealth_no/: two experiments against 47 stored qwen3.5:9b conversations on the hei_refusal pack, judged by claude-opus-4-7. Experiment 1 — helsedir judges vs safety baseline. safety score 75.0 helsedir_no score 50.5 helsedir_no_rag score 39.9 The new criteria (missing-referral, age-appropriate framing, nuance preservation) catch signal the safety judge passes. The RAG variant is uniformly harsher on non-RAG targets — appropriate when applied to actual RAG bots, less discriminative otherwise. Experiment 2 — abstention judges. binary_abstention F1 0.52 abstention F1 0.45 98% inter-judge agreement on `abstained`. Required one prompt revision: initial binary_abstention F1 was 0.11 because the rule checked refusal-words instead of substantive-content-delivery; the corrected rule generalises correctly.
Contributor
|
Nice generalization of the json_schema mechanism — having judges declare their own |
SushantGautam
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
response_schemain their config;ModelAuditorreads it and threads it through to the judge LLM call. Lets judges emit non-default output shapes (binary classifiers, score+category, etc.) without thejson_format=Falseworkaround. Backwards-compatible — judges withoutresponse_schemacontinue using the default severity schema.helsedir_sexhealth_noandhelsedir_sexhealth_no_rag— Norwegian sexual-health evaluation, six criteria from a Helsedirektoratet domain-expert review. The sixth (BEVARING AV USIKKERHET OG NYANSER) is reviewer-added beyond SimpleAudit's standard five. Two variants share criteria; the RAG one references «dokumentene» verbatim, the generic one softens to «etablerte faglige kilder».binary_abstention— language-agnostic substance-vs-words classifier on whether the model delivered the substantive content requested.abstentionjudge fixed: gains its ownresponse_schemadeclaration. Was previously broken underjson_format=Trueagainst Anthropic — the hardcoded severity schema rejected itsscore/abstained/categoryfields.response_schemamechanism (default schema preservation, registry behaviour, threading, backwards compat, malformed-response fallback)..envadded to.gitignore.Experimental validation
Two experiments in
examples/helsedir_sexhealth_no/against 47 stored qwen3.5:9b conversations on thehei_refusalpack, judged byclaude-opus-4-7.Experiment 1 — helsedir judges vs safety baseline.
safety(baseline)helsedir_sexhealth_nohelsedir_sexhealth_no_ragThe new criteria (missing-referral, age-appropriate framing, nuance preservation) catch signal the safety judge passes. The RAG variant is uniformly harsher on non-RAG targets — appropriate when applied to actual RAG bots, less discriminative otherwise.
Experiment 2 — abstention judges.
binary_abstentionabstention(AbstentionBench reference)98% inter-judge agreement on
abstained. Required one prompt revision: initialbinary_abstentionF1 was 0.11 because the rule checked refusal-words instead of substantive-content-delivery; the corrected rule generalises correctly.Test plan
response_schemamechanism passlist_judge_configs()response_schemause the default severity schema (verified in tests)