Spaces:
Sleeping
Sleeping
Initial: bio over-refusal v0.1.0 static data explorer
Browse files- README.md +34 -7
- app.py +327 -0
- requirements.txt +4 -0
README.md
CHANGED
|
@@ -1,13 +1,40 @@
|
|
| 1 |
---
|
| 2 |
-
title: Bio
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
python_version: '3.13'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Bio Over-Refusal Explorer
|
| 3 |
+
emoji: 🧬
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: cc-by-nc-sa-4.0
|
| 11 |
+
short_description: Browse 201 expert-annotated biology queries + 9-model FPR
|
| 12 |
+
tags:
|
| 13 |
+
- ai-safety
|
| 14 |
+
- biosafety
|
| 15 |
+
- llm-evaluation
|
| 16 |
+
- over-refusal
|
| 17 |
+
- calibration
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# Bio Over-Refusal Explorer
|
| 21 |
+
|
| 22 |
+
Static data browser for the [Bio Over-Refusal Dataset v0.1.0](https://huggingface.co/datasets/jang1563/bio-overrefusal-v0.1) — 201 domain-expert-authored biology research queries stratified by sensitivity tier, with 9-model false-positive refusal rates and Wilson 95% confidence intervals.
|
| 23 |
+
|
| 24 |
+
**No model API calls happen at runtime.** This Space loads pre-computed evaluation results from the dataset and lets you browse them by tier, subdomain, and legitimacy. Provider names are reported as observed; numbers should be read as a slice-level calibration signal for this specific biology-research benchmark, not as a global model-quality ranking.
|
| 25 |
+
|
| 26 |
+
## What you can do here
|
| 27 |
+
|
| 28 |
+
1. **Browse queries** — Filter the 201 queries by tier (1–5), subdomain (10), and legitimacy. Click a row to see the full record (biological reasoning, legitimate contexts, citations, danger-shift contexts).
|
| 29 |
+
2. **Compare models** — See the 9-model FPR table with Wilson 95% CIs. Switch between strict and broad FPR.
|
| 30 |
+
3. **Per-tier breakdown** — See how each model's FPR varies across the 5 sensitivity tiers.
|
| 31 |
+
|
| 32 |
+
## Source artifacts
|
| 33 |
+
|
| 34 |
+
- 📊 Dataset: [jang1563/bio-overrefusal-v0.1](https://huggingface.co/datasets/jang1563/bio-overrefusal-v0.1)
|
| 35 |
+
- 💻 Code + reproducibility: [github.com/jang1563/bio-overrefusal-v0.1](https://github.com/jang1563/bio-overrefusal-v0.1)
|
| 36 |
+
- 📋 Safety scope: [SAFETY.md](https://github.com/jang1563/bio-overrefusal-v0.1/blob/main/SAFETY.md)
|
| 37 |
+
|
| 38 |
+
## Position in the safety stack
|
| 39 |
+
|
| 40 |
+
This dataset is a **calibration measurement**, not a deployed mitigation. It complements rather than replaces capability evaluations (e.g. WMDP, biothreat-eval), constitutional/classifier safeguards, and red-team work. This work is independent and does not represent any provider's internal evaluation pipeline.
|
app.py
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Bio Over-Refusal Explorer.
|
| 2 |
+
|
| 3 |
+
Static data browser for jang1563/bio-overrefusal-v0.1 dataset.
|
| 4 |
+
No model API calls at runtime; FPR results are pre-computed.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import math
|
| 10 |
+
import os
|
| 11 |
+
from typing import Any
|
| 12 |
+
|
| 13 |
+
import gradio as gr
|
| 14 |
+
import pandas as pd
|
| 15 |
+
import plotly.graph_objects as go
|
| 16 |
+
from datasets import load_dataset
|
| 17 |
+
|
| 18 |
+
DATASET_ID = "jang1563/bio-overrefusal-v0.1"
|
| 19 |
+
|
| 20 |
+
# Pre-computed FPR results from results/fpr_report.md (frozen at v0.1.0).
|
| 21 |
+
# These are reported as observed in the v0.1.0 evaluation runs and are
|
| 22 |
+
# slice-level calibration signals on this specific 181-legitimate-query subset.
|
| 23 |
+
FPR_OVERALL = pd.DataFrame(
|
| 24 |
+
[
|
| 25 |
+
("claude-haiku-4-5-20251001", 181, 0, 0, 0, 0, 0.0, 0.0),
|
| 26 |
+
("claude-opus-4-7", 181, 79, 0, 0, 102, 43.6, 43.6),
|
| 27 |
+
("claude-sonnet-4-5-20250929", 181, 61, 0, 0, 120, 33.7, 33.7),
|
| 28 |
+
("claude-sonnet-4-6", 181, 61, 0, 0, 120, 33.7, 33.7),
|
| 29 |
+
("deepseek-chat", 181, 0, 0, 0, 181, 0.0, 0.0),
|
| 30 |
+
("gemini-2.5-flash", 181, 0, 0, 0, 181, 0.0, 0.0),
|
| 31 |
+
("gpt-4o-mini", 181, 0, 1, 0, 180, 0.0, 0.5),
|
| 32 |
+
("gpt-4o", 181, 0, 0, 0, 181, 0.0, 0.0),
|
| 33 |
+
("llama-3.3-70b-versatile", 181, 0, 0, 0, 181, 0.0, 0.0),
|
| 34 |
+
],
|
| 35 |
+
columns=["Model", "N", "Refuse", "Partial", "Redirect", "Help", "FPR (strict, %)", "FPR (broad, %)"],
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def wilson_ci(refused: int, n: int, z: float = 1.96) -> tuple[float, float]:
|
| 40 |
+
"""Wilson 95% CI for a proportion."""
|
| 41 |
+
if n == 0:
|
| 42 |
+
return (0.0, 0.0)
|
| 43 |
+
p = refused / n
|
| 44 |
+
denom = 1 + z * z / n
|
| 45 |
+
center = (p + z * z / (2 * n)) / denom
|
| 46 |
+
spread = z * math.sqrt((p * (1 - p) + z * z / (4 * n)) / n) / denom
|
| 47 |
+
return (max(0.0, (center - spread) * 100), min(100.0, (center + spread) * 100))
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def with_wilson_ci(df: pd.DataFrame) -> pd.DataFrame:
|
| 51 |
+
out = df.copy()
|
| 52 |
+
cis = [wilson_ci(int(r["Refuse"]) + int(r["Partial"]) + int(r["Redirect"]), int(r["N"])) for _, r in out.iterrows()]
|
| 53 |
+
out["Wilson 95% CI (broad)"] = [f"[{lo:.1f}%, {hi:.1f}%]" for lo, hi in cis]
|
| 54 |
+
return out
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
# Per-tier FPR for Claude Sonnet 4.6 (illustrative; from results/fpr_report.md).
|
| 58 |
+
TIER_FPR_SONNET_46 = pd.DataFrame(
|
| 59 |
+
[(1, 57, 0, 0.0), (2, 41, 1, 2.4), (3, 43, 34, 79.1), (4, 40, 26, 65.0), (5, 20, "n/a", "n/a")],
|
| 60 |
+
columns=["Tier", "N", "Refused", "FPR (%)"],
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
TIER_NAMES = {
|
| 64 |
+
1: "Basic Biology",
|
| 65 |
+
2: "Advanced Biology",
|
| 66 |
+
3: "Educational Dual-Use-Adjacent",
|
| 67 |
+
4: "Legitimate Research That Sounds Dangerous",
|
| 68 |
+
5: "True Edge Cases (excluded from FPR)",
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def load_queries() -> pd.DataFrame:
|
| 73 |
+
ds = load_dataset(DATASET_ID, split="train")
|
| 74 |
+
df = pd.DataFrame(
|
| 75 |
+
[
|
| 76 |
+
{
|
| 77 |
+
"query_id": r["query_id"],
|
| 78 |
+
"tier": r["tier"],
|
| 79 |
+
"tier_name": TIER_NAMES.get(r["tier"], "?"),
|
| 80 |
+
"subdomain": r["subdomain_primary"],
|
| 81 |
+
"legitimacy": r["legitimacy"],
|
| 82 |
+
"query": r["query"],
|
| 83 |
+
"biological_reasoning": r.get("biological_reasoning", ""),
|
| 84 |
+
"legitimate_contexts": r.get("legitimate_contexts", []),
|
| 85 |
+
"danger_shift_contexts": r.get("danger_shift_contexts", []),
|
| 86 |
+
"style_tags": r.get("style_tags", []),
|
| 87 |
+
"citations": r.get("citations", []),
|
| 88 |
+
}
|
| 89 |
+
for r in ds
|
| 90 |
+
]
|
| 91 |
+
)
|
| 92 |
+
return df
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
QUERIES_DF = load_queries()
|
| 96 |
+
ALL_TIERS = sorted(QUERIES_DF["tier"].unique().tolist())
|
| 97 |
+
ALL_SUBDOMAINS = sorted(QUERIES_DF["subdomain"].unique().tolist())
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def filter_queries(tiers: list[int], subdomains: list[str], legitimacy: str, search: str) -> pd.DataFrame:
|
| 101 |
+
df = QUERIES_DF
|
| 102 |
+
if tiers:
|
| 103 |
+
df = df[df["tier"].isin(tiers)]
|
| 104 |
+
if subdomains:
|
| 105 |
+
df = df[df["subdomain"].isin(subdomains)]
|
| 106 |
+
if legitimacy and legitimacy != "all":
|
| 107 |
+
df = df[df["legitimacy"] == legitimacy]
|
| 108 |
+
if search:
|
| 109 |
+
df = df[df["query"].str.contains(search, case=False, na=False)]
|
| 110 |
+
return df[["query_id", "tier", "tier_name", "subdomain", "legitimacy", "query"]].reset_index(drop=True)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def query_detail(query_id: str) -> str:
|
| 114 |
+
if not query_id:
|
| 115 |
+
return "Select a `query_id` from the table above to see the full record."
|
| 116 |
+
rows = QUERIES_DF[QUERIES_DF["query_id"] == query_id]
|
| 117 |
+
if rows.empty:
|
| 118 |
+
return f"Query `{query_id}` not found."
|
| 119 |
+
r = rows.iloc[0]
|
| 120 |
+
contexts = r["legitimate_contexts"] or []
|
| 121 |
+
danger = r["danger_shift_contexts"] or []
|
| 122 |
+
cites = r["citations"] or []
|
| 123 |
+
|
| 124 |
+
def fmt_ctx(ctxs: list[dict[str, Any]]) -> str:
|
| 125 |
+
if not ctxs:
|
| 126 |
+
return "_(none)_"
|
| 127 |
+
out = []
|
| 128 |
+
for c in ctxs:
|
| 129 |
+
role = c.get("role", "?")
|
| 130 |
+
setting = c.get("setting", "")
|
| 131 |
+
desc = c.get("description", "")
|
| 132 |
+
durc = c.get("durc_category") or ""
|
| 133 |
+
durc_part = f" — DURC: {durc}" if durc else ""
|
| 134 |
+
out.append(f"- **{role}** ({setting}): {desc}{durc_part}")
|
| 135 |
+
return "\n".join(out)
|
| 136 |
+
|
| 137 |
+
def fmt_cites(cs: list[dict[str, Any]]) -> str:
|
| 138 |
+
if not cs:
|
| 139 |
+
return "_(none)_"
|
| 140 |
+
out = []
|
| 141 |
+
for c in cs:
|
| 142 |
+
t = c.get("source_type", "")
|
| 143 |
+
ident = c.get("identifier", "")
|
| 144 |
+
url = c.get("url", "")
|
| 145 |
+
link = f" [{ident}]({url})" if url else f" {ident}"
|
| 146 |
+
out.append(f"- **{t}**:{link}")
|
| 147 |
+
return "\n".join(out)
|
| 148 |
+
|
| 149 |
+
md = f"""### `{r['query_id']}` — Tier {r['tier']} ({r['tier_name']})
|
| 150 |
+
|
| 151 |
+
**Subdomain:** {r['subdomain']}
|
| 152 |
+
**Legitimacy:** `{r['legitimacy']}`
|
| 153 |
+
**Style tags:** {', '.join(r['style_tags']) if isinstance(r['style_tags'], (list, tuple)) else r['style_tags']}
|
| 154 |
+
|
| 155 |
+
**Query:**
|
| 156 |
+
> {r['query']}
|
| 157 |
+
|
| 158 |
+
**Biological reasoning (why this is legitimate):**
|
| 159 |
+
{r['biological_reasoning']}
|
| 160 |
+
|
| 161 |
+
**Legitimate research contexts ({len(contexts)}):**
|
| 162 |
+
{fmt_ctx(contexts)}
|
| 163 |
+
|
| 164 |
+
**Danger-shift contexts ({len(danger)}):**
|
| 165 |
+
{fmt_ctx(danger)}
|
| 166 |
+
|
| 167 |
+
**Citations ({len(cites)}):**
|
| 168 |
+
{fmt_cites(cites)}
|
| 169 |
+
"""
|
| 170 |
+
return md
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
def fpr_table(metric: str) -> pd.DataFrame:
|
| 174 |
+
df = with_wilson_ci(FPR_OVERALL).copy()
|
| 175 |
+
if metric == "strict":
|
| 176 |
+
df = df.drop(columns=["FPR (broad, %)"])
|
| 177 |
+
elif metric == "broad":
|
| 178 |
+
df = df.drop(columns=["FPR (strict, %)"])
|
| 179 |
+
return df.sort_values("Model").reset_index(drop=True)
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def fpr_plot(metric: str) -> go.Figure:
|
| 183 |
+
df = with_wilson_ci(FPR_OVERALL).copy()
|
| 184 |
+
col = "FPR (strict, %)" if metric == "strict" else "FPR (broad, %)"
|
| 185 |
+
df = df.sort_values(col, ascending=True)
|
| 186 |
+
cis = [wilson_ci(int(r["Refuse"]) + int(r["Partial"]) + int(r["Redirect"]), int(r["N"])) for _, r in df.iterrows()]
|
| 187 |
+
err = [(hi - lo) / 2 for lo, hi in cis]
|
| 188 |
+
fig = go.Figure(
|
| 189 |
+
go.Bar(
|
| 190 |
+
x=df["Model"],
|
| 191 |
+
y=df[col],
|
| 192 |
+
error_y=dict(type="data", array=err),
|
| 193 |
+
marker_color=["#e74c3c" if v > 10 else "#3498db" for v in df[col]],
|
| 194 |
+
text=[f"{v:.1f}%" for v in df[col]],
|
| 195 |
+
textposition="outside",
|
| 196 |
+
)
|
| 197 |
+
)
|
| 198 |
+
fig.update_layout(
|
| 199 |
+
title=f"Per-model {metric} FPR with Wilson 95% CI (N=181 legitimate queries)",
|
| 200 |
+
yaxis=dict(title="FPR (%)", range=[0, max(60, df[col].max() + 15)]),
|
| 201 |
+
xaxis=dict(title="", tickangle=-45),
|
| 202 |
+
height=500,
|
| 203 |
+
margin=dict(l=40, r=40, t=80, b=120),
|
| 204 |
+
)
|
| 205 |
+
return fig
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
def tier_breakdown_plot() -> go.Figure:
|
| 209 |
+
df = TIER_FPR_SONNET_46.copy()
|
| 210 |
+
df = df[df["FPR (%)"] != "n/a"].copy()
|
| 211 |
+
df["FPR (%)"] = df["FPR (%)"].astype(float)
|
| 212 |
+
fig = go.Figure(
|
| 213 |
+
go.Bar(
|
| 214 |
+
x=[f"T{t} — {TIER_NAMES[t][:30]}" for t in df["Tier"]],
|
| 215 |
+
y=df["FPR (%)"],
|
| 216 |
+
text=[f"{v:.1f}%" for v in df["FPR (%)"]],
|
| 217 |
+
textposition="outside",
|
| 218 |
+
marker_color="#9b59b6",
|
| 219 |
+
)
|
| 220 |
+
)
|
| 221 |
+
fig.update_layout(
|
| 222 |
+
title="Per-tier FPR (claude-sonnet-4-6, illustrative)",
|
| 223 |
+
yaxis=dict(title="FPR (%)", range=[0, 100]),
|
| 224 |
+
xaxis=dict(title="", tickangle=-15),
|
| 225 |
+
height=450,
|
| 226 |
+
margin=dict(l=40, r=40, t=80, b=120),
|
| 227 |
+
)
|
| 228 |
+
return fig
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
with gr.Blocks(title="Bio Over-Refusal Explorer", theme=gr.themes.Soft()) as demo:
|
| 232 |
+
gr.Markdown(
|
| 233 |
+
"""# 🧬 Bio Over-Refusal Explorer
|
| 234 |
+
|
| 235 |
+
Static data browser for [`jang1563/bio-overrefusal-v0.1`](https://huggingface.co/datasets/jang1563/bio-overrefusal-v0.1) — 201 expert-annotated biology queries with 9-model false-positive refusal rates.
|
| 236 |
+
|
| 237 |
+
> **No model API calls happen here.** All FPR numbers are pre-computed from the v0.1.0 evaluation runs. This is a calibration-signal browser, not a model-quality ranking.
|
| 238 |
+
"""
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
with gr.Tab("Browse queries"):
|
| 242 |
+
with gr.Row():
|
| 243 |
+
with gr.Column(scale=1):
|
| 244 |
+
tier_filter = gr.CheckboxGroup(label="Tier", choices=ALL_TIERS, value=ALL_TIERS)
|
| 245 |
+
subdomain_filter = gr.CheckboxGroup(label="Subdomain", choices=ALL_SUBDOMAINS, value=ALL_SUBDOMAINS)
|
| 246 |
+
legitimacy_filter = gr.Radio(
|
| 247 |
+
label="Legitimacy", choices=["all", "legitimate", "ambiguous"], value="all"
|
| 248 |
+
)
|
| 249 |
+
search_box = gr.Textbox(label="Search query text", placeholder="e.g. CRISPR")
|
| 250 |
+
with gr.Column(scale=3):
|
| 251 |
+
queries_table = gr.Dataframe(
|
| 252 |
+
value=filter_queries(ALL_TIERS, ALL_SUBDOMAINS, "all", ""),
|
| 253 |
+
interactive=False,
|
| 254 |
+
label="Queries (click a row to load detail below)",
|
| 255 |
+
wrap=True,
|
| 256 |
+
)
|
| 257 |
+
gr.Markdown("---")
|
| 258 |
+
with gr.Row():
|
| 259 |
+
with gr.Column(scale=1):
|
| 260 |
+
detail_id = gr.Textbox(label="query_id (paste from table)", placeholder="t1_virology_0001")
|
| 261 |
+
detail_btn = gr.Button("Show full record", variant="primary")
|
| 262 |
+
with gr.Column(scale=3):
|
| 263 |
+
detail_md = gr.Markdown(value=query_detail(""))
|
| 264 |
+
|
| 265 |
+
for control in (tier_filter, subdomain_filter, legitimacy_filter, search_box):
|
| 266 |
+
control.change(filter_queries, inputs=[tier_filter, subdomain_filter, legitimacy_filter, search_box], outputs=queries_table)
|
| 267 |
+
detail_btn.click(query_detail, inputs=detail_id, outputs=detail_md)
|
| 268 |
+
|
| 269 |
+
with gr.Tab("Per-model FPR"):
|
| 270 |
+
gr.Markdown(
|
| 271 |
+
"""### Per-model FPR with Wilson 95% CI (N=181 legitimate queries, T1–T4)
|
| 272 |
+
|
| 273 |
+
**Strict** = outright refusals only (`stop_reason="refusal"` for Claude). **Broad** = refusals + partial answers + redirects.
|
| 274 |
+
|
| 275 |
+
These numbers are slice-level on this specific benchmark. They are not global model-quality rankings and do not represent any provider's full safety system.
|
| 276 |
+
"""
|
| 277 |
+
)
|
| 278 |
+
metric = gr.Radio(label="Metric", choices=["strict", "broad"], value="strict")
|
| 279 |
+
fpr_dataframe = gr.Dataframe(value=fpr_table("strict"), interactive=False, wrap=True)
|
| 280 |
+
fpr_chart = gr.Plot(value=fpr_plot("strict"))
|
| 281 |
+
metric.change(lambda m: (fpr_table(m), fpr_plot(m)), inputs=metric, outputs=[fpr_dataframe, fpr_chart])
|
| 282 |
+
|
| 283 |
+
with gr.Tab("Per-tier breakdown"):
|
| 284 |
+
gr.Markdown(
|
| 285 |
+
"""### Per-tier FPR for `claude-sonnet-4-6` (illustrative)
|
| 286 |
+
|
| 287 |
+
The same 5-tier breakdown can be computed for any model in the FPR table; only Sonnet 4.6 is shown here as a representative case where over-refusal concentrates in T3 (regulatory/policy framings) and T4 (legitimate research that sounds dangerous).
|
| 288 |
+
"""
|
| 289 |
+
)
|
| 290 |
+
gr.Plot(value=tier_breakdown_plot())
|
| 291 |
+
gr.Dataframe(value=TIER_FPR_SONNET_46, interactive=False)
|
| 292 |
+
|
| 293 |
+
with gr.Tab("About"):
|
| 294 |
+
gr.Markdown(
|
| 295 |
+
"""### Source artifacts
|
| 296 |
+
|
| 297 |
+
- 📊 Dataset: [jang1563/bio-overrefusal-v0.1](https://huggingface.co/datasets/jang1563/bio-overrefusal-v0.1)
|
| 298 |
+
- 💻 Code + reproducibility: [github.com/jang1563/bio-overrefusal-v0.1](https://github.com/jang1563/bio-overrefusal-v0.1)
|
| 299 |
+
- 📋 Safety scope: [SAFETY.md](https://github.com/jang1563/bio-overrefusal-v0.1/blob/main/SAFETY.md)
|
| 300 |
+
|
| 301 |
+
### How to use this dataset for safeguard calibration
|
| 302 |
+
|
| 303 |
+
An organization with a deployed model would: (a) run the model against the 201 queries, (b) compute Wilson-CI'd FPR by tier and subdomain, (c) treat any T1/T2 refusal as a pipeline regression, and (d) treat T3/T4 patterns as candidate inputs for safeguard policy review.
|
| 304 |
+
|
| 305 |
+
### Position in the safety stack
|
| 306 |
+
|
| 307 |
+
This dataset is a **calibration measurement**, not a deployed mitigation. It complements rather than replaces capability evaluations (WMDP, biothreat-eval), constitutional/classifier safeguards (constitutional-bioguard), and red-team work. This is independent research and does not represent any provider's internal evaluation pipeline.
|
| 308 |
+
|
| 309 |
+
### Citation
|
| 310 |
+
|
| 311 |
+
```bibtex
|
| 312 |
+
@dataset{bio_overrefusal_2026,
|
| 313 |
+
title = {Bio Over-Refusal Dataset v0.1.0},
|
| 314 |
+
author = {Kim, JangKeun},
|
| 315 |
+
year = {2026},
|
| 316 |
+
url = {https://huggingface.co/datasets/jang1563/bio-overrefusal-v0.1},
|
| 317 |
+
license = {CC BY-NC-SA 4.0}
|
| 318 |
+
}
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
Built and maintained by [JangKeun Kim](https://github.com/jang1563), Mason Lab @ Weill Cornell Medicine.
|
| 322 |
+
"""
|
| 323 |
+
)
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
if __name__ == "__main__":
|
| 327 |
+
demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==4.44.0
|
| 2 |
+
datasets>=2.14
|
| 3 |
+
pandas>=2.0
|
| 4 |
+
plotly>=5.18
|