Skip to content

feat(examples): worked examples for DIF catching a biased judge panel#15

Closed
brittanyreese wants to merge 3 commits into
mainfrom
feat/bias-conditioner-examples
Closed

feat(examples): worked examples for DIF catching a biased judge panel#15
brittanyreese wants to merge 3 commits into
mainfrom
feat/bias-conditioner-examples

Conversation

@brittanyreese

Copy link
Copy Markdown
Owner

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_weak flags the corrupted run automatically.
  • scripts/prep_demo.py: add --field so non-coherence SummEval dimensions (consistency/fluency/relevance) can be regenerated, defaulting non-coherence output to scratch/ since only coherence ships in the wheel.
  • Tests pin both examples' teaching claims so a refactor can't quietly turn either demonstration boring or wrong.
  • README: link both examples from the existing examples section.

Test plan

  • uv run pytest -q full suite green, coverage gate met
  • uv run ruff check . / uv run ruff format --check . clean
  • uv run pyright clean on changed files
  • Both examples run standalone with no key/network: uv run python -m examples.audit_catches_bias, uv run python -m examples.audit_conditioner_choice

…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.
Copilot AI review requested due to automatic review settings July 4, 2026 03:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py with --field to regenerate non-coherence SummEval dimensions, defaulting non-coherence output to scratch/, 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants