pick-a-pii-model
它能做什么
这项技能教智能体如何选择一个在本地设备上运行、用于查找文本中个人信息的模型。它使用已保存的模型列表,因此选择过程可以离线完成。
适用场景
- ✓当团队需要在笔记本电脑、Apple Silicon Mac 或手机上运行的个人数据检测器的时候。
- ✓当项目包含特定语言的文本,需要为其选择合适的默认隐私模型的时候。
- ✓当用户即将发布隐私模型,需要先确认它能识别直接标识符的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/pick-a-pii-model/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想在 Mac 上找出英文医疗记录中的个人姓名,应该使用哪个离线模型?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会读取内置的模型列表,并按语言、文件格式和大小进行筛选。它优先推荐默认模型,并建议在发布前进行基准测试。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Pick an on-device PII model
Use the committed registry to build an offline shortlist. Treat the language default as the safety baseline, but never treat model size or format as proof of recall.
Procedure
- Identify the input language and script before choosing a model.
- Choose the runtime:
pytorchfor local CPU/GPU and mobile export sources,mlx-fpormlx-8bitfor Apple Silicon. - Read
get_default_pii_model(language)as the baseline. - Filter
get_pii_models_by_language(language)by runtime and device budget. - Prefer the baseline when it fits; otherwise select a compatible candidate.
- Benchmark the candidate on direct identifiers, critical leakage, scripts, and the target quantization before shipping.
Runnable offline shortlist
This snippet reads only the bundled manifest; it does not download weights.
from openmed import get_default_pii_model, get_pii_models_by_language
LANGUAGE = "en"
TARGET_FORMAT = "mlx-fp" # Use "pytorch" for CPU or as an export source.
MAX_PARAMETERS_M = 150
baseline_id = get_default_pii_model(LANGUAGE)
models = get_pii_models_by_language(LANGUAGE)
shortlist = [
(key, info)
for key, info in models.items()
if TARGET_FORMAT in info.formats
and info.size_mb is not None
and info.size_mb <= MAX_PARAMETERS_M
]
shortlist.sort(
key=lambda item: (
item[1].model_id != baseline_id,
item[1].size_mb,
item[0],
)
)
if not shortlist:
raise RuntimeError("No compatible PII model fits the requested budget")
registry_key, selected = shortlist[0]
print(
{
"registry_key": registry_key,
"model_id": selected.model_id,
"format": TARGET_FORMAT,
"parameters_m": selected.size_mb,
"recommended_confidence": selected.recommended_confidence,
"is_language_default": selected.model_id == baseline_id,
}
)
print("Benchmark this candidate against the language default before release.")
For Android, Core ML, ONNX, or browser deployment, select a compatible
pytorch source and use the target export workflow. Re-run PII recall after
conversion or quantization.
Selection rules
- Reject an unsupported language instead of silently falling back to English.
- Prefer audited script coverage over a model's name or marketing description.
- Treat parameter count as a rough capacity signal, not download size, latency, peak memory, or quality.
- Measure latency and peak memory on the real target device.
- Fail closed when conversion or quantization drops direct-identifier recall or introduces residual critical leakage.
- Cache approved weights locally and set offline mode for steady-state use.
Repository example
Read the PII model comparison example for registry inspection and model-by-model inference.
常见问题
它会下载模型吗?
不会。候选列表只读取随附的列表,不下载模型权重。
较小的模型一定更安全吗?
不一定。这项技能指出,模型的大小或格式并不能证明它能很好地找出个人信息。
它支持哪些格式?
它提到用于 CPU 和 GPU 的 PyTorch 格式,以及用于 Apple Silicon 的 MLX 格式。
详情
作者的原始描述
Select an on-device OpenMed PII model from the committed registry by language, runtime format, and size budget, then require recall validation before deployment. Use when an agent must choose a local PII detector for CPU, Apple Silicon, or a mobile export without relying on live model discovery.
repo: maziyarpanahi/openmed
热度
- GitHub 星标
- 5.8k
- 排名
- #14719
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
annotating-variants
5.8k帮你的智能体预测基因变异的作用,把 HGVS 名称转换为基因组位置,并使用免费的公共注释工具添加人群频率。
ask-openmed
5.8k帮你的智能体为临床文本请求选择合适的 OpenMed 工作流程,并在可能涉及患者数据时,先进行隐私检查。
assembling-fhir-bundles
5.8k把多份 FHIR 健康记录打包成一个事务 Bundle,可直接发送给 EHR 系统,并正确链接其中的内部引用。
auditing-deid-leakage
5.8k扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。