Skip to content

M14 solution

The expected, fully-commented artifacts for M14's lab. Peek only after you've tried.

File What it is
bias_probe.py A fairness probe: runs the same task while swapping a sensitive attribute (name/gender) and flags measurable differences (suggested salary) for human review.
privacy.py PII redaction (email, phone, SSN-like, card-like), pure Python, no key; clean text before sending it to a model.

Run it

  • Privacy (no key): python privacy.py
  • Fairness probe (needs your M4 .env key): python bias_probe.py

How this was verified

  • privacy.py verified for real (pure Python): a sample with an email, phone, SSN, and card has all four redacted, with correct counts. (It's a first line, names/odd formats can slip through; the file says so.)
  • bias_probe.py verified with a mocked biased model: given a model that suggests a higher salary for one name than another, the probe extracts the numbers and flags the gap ("DIFFERENT by $7,000") across both pairs, confirming the harness surfaces fairness signals for review.

The fairness probe's real findings come from a live model (the learner's key), the tool surfaces pairs to review; a human judges whether a difference reflects bias. This is educational: we probe our own app to improve it. No API key or billed call was used here.