feat(examples): worked examples for DIF catching a biased judge panel#15
Closed
brittanyreese wants to merge 3 commits into
Closed
feat(examples): worked examples for DIF catching a biased judge panel#15brittanyreese wants to merge 3 commits into
brittanyreese wants to merge 3 commits into
Conversation
…mensions Lets prep_demo.py extract consistency/fluency/relevance annotations in addition to the shipped coherence dimension. Non-coherence output defaults to scratch/ since only the coherence demo.csv ships in the wheel.
…anel Two simulated panels with near-identical reliability numbers, one carrying a planted bias against the focal output family. The DIF pillar fires class C on the biased panel and class A on the clean one, showing that high agreement is not fairness. A second example on the same panels shows the conditioner argument to audit() is not cosmetic: the default rest-score conditioner is corrupted by the panel-shared bias and misses the effect (class A) where an external quality conditioner correctly lands class C. The conditioner_overlap_weak diagnostic flags the corrupted run automatically. Tests pin both outcomes so a refactor can't quietly turn either demonstration boring or wrong.
Closes the loop the original plan deferred: with two simulated examples now telling one story (catches bias, then explains why the conditioner choice matters), the README's example section should point at them.
There was a problem hiding this comment.
Pull request overview
This PR adds deterministic, worked example modules that demonstrate why DIF (and conditioner choice) is necessary to catch panel-shared bias even when reliability looks strong, plus supporting tests, docs, and a small demo-prep script enhancement.
Changes:
- Add two new
examples/simulations: one where DIF catches a planted bias (class C vs A), and another showing rest-score vs external conditioner can flip the DIF verdict. - Add tests that pin the examples’ “teaching claims” (DIF class outcomes, conditioner source, and overlap diagnostic behavior).
- Extend
scripts/prep_demo.pywith--fieldto regenerate non-coherence SummEval dimensions, defaulting non-coherence output toscratch/, and link the new examples from the README.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_conditioner_choice.py | New tests pin the conditioner-choice example outcomes (external vs rest-score). |
| tests/test_catches_bias.py | New tests pin the biased-vs-clean example outcomes (DIF separates while reliability doesn’t). |
| scripts/prep_demo.py | Add --field selection and default output routing for non-coherence fields. |
| README.md | Link to the new example modules in the existing examples section. |
| examples/audit_conditioner_choice.py | New example demonstrating how conditioner choice can erase/catch a true DIF effect. |
| examples/audit_catches_bias.py | New example demonstrating DIF catching planted bias despite similar reliability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+11
to
+15
| import pytest | ||
| from examples.audit_catches_bias import build_cards | ||
|
|
||
| from metajudge import ReportCard | ||
|
|
Comment on lines
+13
to
+17
| import pytest | ||
| from examples.audit_conditioner_choice import build_cards | ||
|
|
||
| from metajudge import ReportCard | ||
|
|
This was referenced Jul 4, 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
examples/audit_catches_bias.py: two simulated judge panels with near-identical reliability numbers, one carrying a planted bias against one output family. Only the DIF pillar catches it, firing Jodoin-Gierl class C on the biased panel against class A on the clean one.examples/audit_conditioner_choice.py: runs the same biased panel through both conditioners. The default rest-score conditioner is corrupted by the panel's own shared bias and misses the effect (class A); an external quality conditioner correctly lands class C.conditioner_overlap_weakflags the corrupted run automatically.scripts/prep_demo.py: add--fieldso non-coherence SummEval dimensions (consistency/fluency/relevance) can be regenerated, defaulting non-coherence output toscratch/since only coherence ships in the wheel.Test plan
uv run pytest -qfull suite green, coverage gate metuv run ruff check ./uv run ruff format --check .cleanuv run pyrightclean on changed filesuv run python -m examples.audit_catches_bias,uv run python -m examples.audit_conditioner_choice