Evaluating With Leakage Gatesのロゴ

Evaluating With Leakage Gates

コミュニティ人気
maziyarpanahi
evaluating-with-leakage-gates

OpenMedの匿名化モデルまたは臨床NERモデルを、F1ではなく残存するPHI漏えいを基準にリリース可否を判定する、漏えい優先のリリースゲートG1a~G8で評価します。合成ゴールデンセットでOpenMed評価ハーネスを実行したい場合、匿名化モデルをRELEASABLEまたはQUARANTINEDと判定したい場合、直接識別子の再現率の下限を適用したい場合、重大な漏えいをゼロにする必要がある場合、しきい値を調整したい場合、または署名付きゲートレポートを作成したい場合に使用します。OpenMedの匿名化に関する文脈で「release gate」「leakage」「is this model safe to ship」「G1a」「G3」「quarantine」「recall floor」「calibration thresholds」といった語句が出た場合に起動します。

概要

公開者maziyarpanahi
リポジトリopenmed
スキル名evaluating-with-leakage-gates
スター
5.3K
フォーク
677
同梱ファイル
指示のみ
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    maziyarpanahiがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Evaluating With Leakage Gates」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/maziyarpanahi/openmed/tree/master/skills/evaluating-with-leakage-gates
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maziyarpanahi/openmed.git /tmp/openmed
mkdir -p .claude/skills
cp -r /tmp/openmed/skills/evaluating-with-leakage-gates .claude/skills/evaluating-with-leakage-gates
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでEvaluating With Leakage Gatesを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にEvaluating With Leakage Gatesを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Evaluating With Leakage Gatesは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Evaluating with Leakage Gates

OpenMed's release gates answer one question: did any PHI leak? A de-id model with a beautiful F1 can still leak a single SSN — and that one leak is a HIPAA breach. So openmed.eval gates on residual leakage and per-label recall floors, not on aggregate F1. The candidate is either RELEASABLE or QUARANTINED; there is no partial credit.

When to use this skill

  • You have a candidate de-id or PII model and need a ship / no-ship decision.
  • You want to run the benchmark harness over a synthetic golden suite.
  • You need to enforce direct-identifier recall floors and critical_leakage == 0.
  • You need calibration thresholds (thresholds.json) before the gate will pass.
  • You want a signed, reproducible gate report for governance.

This is the flagship eval skill. For a pure NER scorecard see benchmarking-clinical-ner; for CI wiring see gating-deid-leakage.

The gates (G1a–G8)

GateChecksFloor / rule
G1aDirect & quasi identifiers (PERSON, EMAIL, PHONE, SSN, ID_NUM, DATE_OF_BIRTH, ...)recall ≥ 0.990 (v1.6) / 0.995 (v2.0); strict-no-leak policies raise the floor
G1bStructured secrets (API_KEY, ACCOUNT_NUMBER, CREDIT_CARD, IBAN)recall ≥ 0.995
G2Free-text names/locations/datesrecall ≥ 0.980 (v1.6) / 0.990 (v2.0)
G3Critical leakage (SSN, CREDIT_CARD, CVV, API_KEY, PIN, IBAN, ...)count must be exactly 0
G4Quantized recall delta vs fp parentwithin INT8 / INT4 limits
G5Latency & RAM vs device tier budgetp50/p95/RAM under tier budget
G6p50/p95 latency documentedmust be present and finite
G7Baseline regressionrecall drop ≤ 0.002/label; leakage ≤ soft ceiling 0.005 and ≤ steward target; no leakage regression vs last-green
G8Span integritypredicted spans validate (no overlaps/out-of-range)

Constants live in openmed.eval.release_gates (G1A_V16_RECALL_FLOOR, G1B_RECALL_FLOOR, G7_RECALL_DROP_LIMIT, RESIDUAL_LEAKAGE_SOFT_CEILING, ...). Confirm them there rather than hardcoding — they move per milestone.

Quick start

Run a candidate benchmark over a synthetic golden suite, then gate it:

python
from openmed.eval import run_suite, ReleaseGate, RELEASABLE

# 1) Produce a candidate BenchmarkReport from a SYNTHETIC fixtures file.
#    Each fixture carries gold PHI spans; no real patient text is committed.
report = run_suite(
    "eval/golden/phi_synthetic.json",     # user-supplied synthetic fixtures
    suite="golden",
    model_name="OpenMed/Privacy-PII-Detection",
    device="cpu",
    metadata={
        "family": "PII",
        "tier": "base",
        "policy": "hipaa_safe_harbor",
        # calibration artifacts are required for mask/replace policies (see below)
        "thresholds_path": "eval/artifacts/thresholds.json",
        "calibration_report_path": "eval/artifacts/calibration_report.json",
    },
)

# 2) Gate it. The gate reads the last-green baseline store read-only and
#    returns a signed GateReport.
gate = ReleaseGate(milestone="v1.6", policy="hipaa_safe_harbor")
decision = gate.evaluate(report)

print(decision.decision)                  # "RELEASABLE" or "QUARANTINED"
for check in decision.gate_results:
    if not check.passed:
        print(check.gate, "->", check.reason, check.details)

assert decision.decision == RELEASABLE, "do not ship a quarantined model"

CLI equivalent (fails closed, exit code 1 on quarantine):

bash
python -m openmed.eval.release_gates \
  --candidate eval/out/candidate_report.json \
  --milestone v1.6 --policy hipaa_safe_harbor \
  --output release-gate-report.json

Workflow

  1. Build a synthetic golden suite. Fixtures are JSON with text and gold_spans (offsets + labels). Use building-gold-corpus to scaffold one. Committed gold must be synthetic; DUA corpora (i2b2/n2c2) are eval-only and never committed.

  2. Fit calibration thresholds for any policy that masks or replaces:

    python
    from openmed.eval import write_calibration_artifacts
    
    paths = write_calibration_artifacts(
        calibration_samples,                 # held-out score/target samples
        artifact_dir="eval/artifacts",
        model_id="OpenMed/Privacy-PII-Detection",
        suite="golden",
        target_leakage=0.0,                   # leakage-first: drive leakage to 0
    )
    # writes thresholds.json + calibration_report.json the gate looks for

    The gate's calibration_present check fails the build if these are missing for a mask/replace policy.

  3. Run the suite (run_suite / run_benchmark) to get a BenchmarkReport.

  4. Evaluate with ReleaseGate(...).evaluate(report).

  5. Read the per-gate results. Each GateCheck carries gate, passed, reason, and details (e.g. which labels fell below the recall floor).

  6. Fail closed. Treat anything other than RELEASABLE as a hard stop.

  7. Audit subgroups with fairness_report (see auditing-subgroup-fairness) so an aggregate pass doesn't hide an under-protected group.

Hand-off to / from OpenMed

  • From building-with-openmed and the de-id pipeline: you evaluate the model produced by openmed.deidentify / openmed.extract_pii.
  • To gating-deid-leakage: wrap ReleaseGate.evaluate(...) in a pytest/CLI gate so CI fails closed on regression.
  • To authoring-model-cards: feed GateReport, fairness_report, and error_report outputs into the model card's metrics and limitations sections.
  • Pairs with auditing-subgroup-fairness (fairness_report) and benchmarking-clinical-ner (error_report).

Edge cases & gotchas

  • F1 is not a gate. A model can have higher F1 and still be quarantined if it leaks one critical identifier (G3) or drops a label below its floor (G1a/G1b).
  • Calibration is mandatory for mask/replace policies. No thresholds.json → calibration_present fails → QUARANTINED.
  • Baselines are read, never written, by the gate. The gate compares against the last-green baseline store without mutating it (G7). Promote baselines in a separate, deliberate step.
  • Strict-no-leak policies raise the G1a floor and force the leakage target to 0. Don't assume the default floor.
  • Reports must carry identity metadata (family, tier, format, eval_set_hash, leakage_fixture_hash); manifest_coherence fails without it.
  • Reports are signed (HMAC-SHA256). Set OPENMED_RELEASE_GATE_KEY for a real signing key; GateReport.verify(key) checks the repro hash and signature.
  • No raw PHI in the report. Gate evidence is offsets, hashes, and labels — never plaintext identifiers. Keep it that way in any wrapper you write.

Standards & references

よくある質問

AIスキル「Evaluating With Leakage Gates」では何ができますか?

OpenMedの匿名化モデルまたは臨床NERモデルを、F1ではなく残存するPHI漏えいを基準にリリース可否を判定する、漏えい優先のリリースゲートG1a~G8で評価します。合成ゴールデンセットでOpenMed評価ハーネスを実行したい場合、匿名化モデルをRELEASABLEまたはQUARANTINEDと判定したい場合、直接識別子の再現率の下限を適用したい場合、重大な漏えいをゼロにする必要がある場合、しきい値を調整したい場合、または署名付きゲートレポートを作成したい場合に使用します。OpenMedの匿名化に関する文脈で「release gate」「leakage」「is this model safe to ship」「G1a」「G3」「quarantine」「recall floor」「calibration thresholds」といった語句が出た場合に起動します。

TypingMindでEvaluating With Leakage Gatesを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Evaluating With Leakage Gatesはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにEvaluating With Leakage Gatesをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/maziyarpanahi/openmed/tree/master/skills/evaluating-with-leakage-gatesを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Evaluating With Leakage Gatesを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Evaluating With Leakage Gatesで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもEvaluating With Leakage Gatesを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Evaluating With Leakage Gates」は無料ですか?

はい。maziyarpanahiがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇