Completes the evalstone-built-in llmmap model library (conf.json + model.pt + templates.json) so clone-only environments can run llmmap without depending on /data1/xii mounts. 12MB inference weight.
指纹 / 模型安全类 Benchmark(llmmap · llm_verify · llm_fingerprint_detector)
本目录包含三个非 EvalScope 数据集管线的特殊 benchmark。它们把被测端点当作
"未知模型"做身份识别与欺诈检测,并产出与 EvalScope 同构的报告
(output/<folder>/<bench>/seed_<seed>/reports/<bench>.json,含 score 字段),
因此 bash/collect_results.py 可以像普通 benchmark 一样把它们汇总进 Excel/CSV。
| benchmark | 工具 | 做什么 | 得分含义(0~1) |
|---|---|---|---|
llmmap |
LLMmap | 发送 8 条指纹查询 → open-set 与 52 个已知模板比距离 | 有 --expected-model 时 = Top-1 身份匹配 flag;否则 = 距离置信度 |
llm_verify |
llm-verify | 32 条取证探测(identity/capability/fingerprint)→ 红旗+裁决 | NO_FRAUD_SIGNALS=1.0 / INCONCLUSIVE=0.5 / SUSPICIOUS=0.25 / FRAUD_DETECTED=0.0 |
llm_fingerprint_detector |
llm-fingerprint-detector | 单 token 输出分布采样 → JSD 距离 | max(0, 1-meanJSD);无参考时跑自一致模式(采两次互比) |
运行
# 整个指纹套件
python bash/run.py --suite fingerprint \
--model <served-model-name> --api-url http://localhost:30000/v1
# 只跑其中一个
python bash/run.py --datasets llm_verify --model ... --api-url ...
# detector 提供同协议参考指纹(硬比较),缺省为自一致模式
python bash/run.py --datasets llm_fingerprint_detector \
--detector-reference /path/to/reference.json [--detector-preset strict]
# 已知真实身份时,llmmap 输出严格匹配得分(1.0/0.0)
python bash/run.py --datasets llmmap --expected-model GLM-5.2 ...
依赖与环境(重要)
三个工具仓库默认位于 /data1/xii(可用 --tools-root 覆盖),
各执行器需要不同的解释器,均可用 CLI 或环境变量覆盖:
| 执行器 | 默认解释器 | 环境变量 | 要求 |
|---|---|---|---|
| run_llmmap.py | /root/miniconda3/envs/llmmap/bin/python |
LLMMAP_PYTHON |
torch + transformers + 本地缓存的 e5 嵌入模型 |
| run_llm_verify.py | /root/miniconda3/envs/llmverify/bin/python |
LLMVERIFY_PYTHON |
fastapi + httpx + pydantic |
| run_llm_detector.py | sys.executable(任意) |
DETECTOR_NODE |
Node ≥18.17 且仓库已 npm run build |
在 evalstone 的 Docker 容器内运行时,若容器里没有这些解释器/仓库, 要么把
/data1/xii与 conda 环境挂载进容器,要么在宿主机上运行指纹套件。
实现注意(踩过的坑)
- 对被测端点默认注入
chat_template_kwargs.thinking=false关闭思考链 (可用--thinking关闭该行为);思考模型会烧 max_tokens 并扭曲指纹。 - LLM Verify 的适配器在 api_key 为空时会因 httpx 拒绝空 Bearer 头而全失败, runner 已自动填占位 key。
- LLMmap 在超过一半查询失败时直接判 0 分报错,避免用空回答算出假距离。
结果示例(Qwen3-4B @ CPU :30002)
分类 Benchmark 得分 实测时间(h) 总样本数
模型安全与指纹 llmmap 0.7115 0.0836 8 ← Top-1=Qwen/Qwen2.5-3B-Instruct
模型安全与指纹 llm_verify 0.25 0.0601 32 ← SUSPICIOUS(仅延迟红旗)
模型安全与指纹 llm_fingerprint_detector 0.9239 0.0671 4 ← 自一致 match, meanJSD=0.076