auditing-subgroup-fairness
하는 일
이 스킬은 임상 언어 모델이 일부 인구통계 집단에서 다른 집단보다 성능이 떨어지는지 확인합니다. 예를 들어 개인 정보를 찾는 능력에서 그렇습니다. 실제 환자에게 쓰기 전에 모델의 공정성을 검토하는 팀을 위한 스킬입니다.
사용하는 경우
- ✓비식별화 또는 NER 모델의 집단별 재현율과 누출 수치가 필요할 때.
- ✓한 환자 집단에서 다른 집단보다 개인 정보가 더 많이 노출된다고 의심될 때.
- ✓임상 AI 거버넌스 검토에 문서화된 격차 수치가 필요할 때.
스킬 링크
https://github.com/maziyarpanahi/openmed/blob/master/skills/auditing-subgroup-fairness/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 비식별화 모델이 일부 연령대에서 개인 정보를 더 많이 놓치는지 확인하고, 그 차이를 보여 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 골드 표준 테스트 구간을 인구통계 태그로 묶고, 집단별 재현율과 누출을 측정한 뒤, 가장 큰 격차와 성능이 가장 나쁜 집단을 보고합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Auditing Subgroup Fairness
An aggregate pass can hide a group the model fails. For de-identification that
failure has a name: under-protection — PHI that leaks more often for one
demographic group than another. openmed.eval.fairness_report slices leakage and
recall by gold-span group so disparities surface before deployment, not after a
breach.
When to use this skill
- You want per-subgroup recall and leakage for a de-id or NER model.
- You suspect (or must rule out) that one group is under-protected.
- You need disparity numbers for a clinical AI governance review.
- You need to document which subgroups you couldn't evaluate (the data gap).
What it measures
For each surrogate group fairness_report returns:
- leakage_rate — fraction of that group's gold PHI characters left exposed (the de-id harm metric).
- recall — fraction of that group's gold spans detected.
- leakage_disparity —
max - minleakage across groups (the gap to close). - worst_group / worst_group_leakage — the most-failed group.
Group membership comes from a group tag in each gold span's metadata (keys
group, demographic_group, or surrogate_group); ungrouped spans fall into
unspecified.
Quick start
from openmed.eval import fairness_report
# Gold fixtures must tag spans with a surrogate group, e.g.
# {"start": 4, "end": 12, "label": "PERSON", "metadata": {"group": "female"}}
fair = fairness_report(
"OpenMed/Privacy-PII-Detection",
"golden", # named suite, or pass a list of fixtures
device="cpu",
)
print("leakage disparity:", fair.leakage_disparity)
print("worst group :", fair.worst_group, fair.worst_group_leakage)
for group, m in sorted(fair.per_group.items()):
print(f" {group:14s} recall={m.recall:.3f} leakage={m.leakage_rate:.4f}")
# Under-protection alarm: any group leaking more than the rest.
LEAKAGE_GAP_LIMIT = 0.0 # leakage-first: ideally zero leakage everywhere
assert fair.leakage_disparity <= LEAKAGE_GAP_LIMIT or fair.worst_group_leakage == 0
FairnessReport.to_dict() is JSON-ready and PHI-free — drop it straight into a
model card.
Workflow
- Tag the gold corpus by group. Add a synthetic
groupto each PHI span'smetadata(sex, age band, race/ethnicity surrogate). Use synthetic surrogates, not real protected attributes (seebuilding-gold-corpus). - Run
fairness_reporton the model + suite. - Read leakage first, recall second. For de-id, a group with higher leakage is under-protected — that is the headline finding.
- Compute the disparity (
leakage_disparity) and locateworst_group. Equalized-odds framing: equal true-positive (recall) and equal leakage across groups. - Document the gap. If race/ethnicity surrogates are absent, report that the audit could not cover them — most clinical NLP studies omit race entirely, so silence is the default failure mode, not equity.
- Feed it forward. Put per-group numbers and the gap into the model card and the governance review.
Hand-off to / from OpenMed
- From
building-gold-corpus: supplies group-tagged synthetic fixtures. - From
evaluating-with-leakage-gates: an aggregateRELEASABLEdecision should be paired with this audit — overall pass, subgroup fail is exactly the trap this catches. - To
authoring-model-cards:FairnessReport.to_dict()fills the quantitative-analysis / subgroup section. - Pairs with
benchmarking-clinical-ner: same run, different slice (label vs group).
Edge cases & gotchas
- Under-protection is the de-id harm; lead with leakage. A group with equal recall but higher leakage is still failed.
- The race documentation gap is the norm. Most clinical NLP corpora don't record race/ethnicity, so most fairness audits silently can't measure it. Report the absence explicitly — don't let missing data read as parity.
unspecifiedis not a real group. A pile of spans inunspecifiedmeans your gold isn't tagged; fix the corpus before trusting the disparity.- Small groups give noisy rates. Report span counts (
span_count,total_chars) alongside rates; a 1-of-2 leak isn't a 50% population rate. - Synthetic surrogates only. Never store real protected attributes in eval fixtures; use fabricated group labels for slicing.
- Disparity ≈ 0 with high leakage everywhere is not "fair". Equal failure is still failure — chec
자주 묻는 질문
데이터에 집단 라벨이 없으면요?
라벨이 없는 구간은 지정되지 않은 집단으로 분류되며, 보고서는 그 데이터 공백을 보여 줍니다.
여기서 누출은 무엇을 뜻하나요?
비식별화 후에도 그 집단의 개인 정보 중 노출된 채 남은 비율입니다.
모델을 고쳐 주나요?
아니요. 배포 전에 다룰 수 있도록 격차를 측정합니다.
상세 정보
작성자의 원본 설명
Audit an OpenMed NER or de-identification model for performance disparities across demographic subgroups (sex, age band, race/ethnicity when available) using openmed.eval.fairness_report. Use when the user wants per-subgroup recall and leakage, wants to check whether de-identification under-protects a group, wants to surface a documentation gap where subgroup data is missing, or needs equalized-odds-style disparity numbers for a clinical model. Trigger on \"fairness\", \"subgroup\", \"bias audit\", \"disparity\", \"equalized odds\", \"under-protected group\", \"per-group recall\", or \"STANDIN
repo: maziyarpanahi/openmed
인기도
- GitHub 스타
- 5.8k
- 순위
- #14672
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
annotating-variants
5.8k에이전트가 유전 변이의 효과를 예측하고, HGVS 이름을 게놈 위치로 바꾸고, 무료 공개 주석 도구를 사용해 인구 빈도를 붙이도록 돕습니다.
ask-openmed
5.8k에이전트가 임상 텍스트 요청에 맞는 OpenMed 워크플로를 고르도록 돕되, 환자 데이터가 있을 수 있으면 먼저 개인 정보 확인을 거치게 합니다.
assembling-fhir-bundles
5.8k여러 FHIR 건강 기록을 EHR로 보낼 수 있도록 하나의 트랜잭션 Bundle로 묶고, 내부 참조를 올바르게 연결하도록 에이전트를 돕습니다.
auditing-deid-leakage
5.8k비식별화된 임상 텍스트에 남은 SSN, 카드 번호, 이메일, 날짜 같은 식별자를 검사하고, 남은 것이 있으면 공개를 막도록 돕습니다.