ModelTrace README

The project's README from github.com/xqy2006/ModelTrace. As one markdown file: README.md.

ModelTrace

ModelTrace 是一个本地运行的主动模型归因工具。它通过三条独立的长整数生成挑战提取输出指纹,在统一候选库中自动判断模型家族和具体版本。

运行

python -m pip install -r requirements.txt
python start.py

页面地址为 http://127.0.0.1:7860/。

GitHub Pages

static/index.html 是不依赖后端的手动测试版本,归因计算和指纹库读取都在浏览器本地完成。仓库附带的 GitHub Actions 会将 static/ 部署到 GitHub Pages。

使用

API Key 只用于当前页面发起请求,不写入磁盘。 自动采集会在对应的 *_reference.jsonl 中保存实际 user prompt、base prompt、system prompt 和 user prefix;拟合后的 *_bank.json 与 unified_bank.json 只保存统计指纹和校准参数。

指纹方法

Codex 任务内监测插件

ModelTrace Guard 按工具调用次数,在后台从原 Codex 任务的冻结快照分别 fork 进行普通检测和异常复测,测后清理临时分支。正常结果静默保存,主任务无需等待检测。用户可调整工具间隔、复测次数(默认 3)、有效期和十种语言,不设每轮或任务累计探针上限。网页仪表盘提供完整历史分页和实时提醒;首次不一致要求智能体告知并暂停工作,额外复测全部不一致时停止原任务并拦截后续受支持的工作工具。探针由 Codex 自身生成并消耗对应推理额度,评分使用插件附带的 ModelTrace 指纹库,页面刷新不消耗模型额度。

安装后在 Codex CLI 的 /hooks 中审阅并信任插件 hooks,再在目标任务中开启监测。安装、配置和结果解释详见插件使用说明。

核心算法

所有模型使用同一个全局特征空间、同一套特征与权重:

0.75 × 去除环境方向后的 Hellinger 模型中心相似度
+ 0.25 × 有序块数字序列特征

建库时使用共享环境的平均偏移估计主要干扰方向。归因时先从数字分布和有序特征中投影掉这些方向,再同时与全部模型中心比较。三份回答分别评分后取平均,并使用与查询数量对应的校准温度转换为概率。

具体模型概率由一次全局 softmax 得到,家族概率是该家族下各模型概率之和:

P(具体模型) = softmax(β × 全局模型得分)
P(模型家族) = Σ P(该家族中的具体模型)

结果是当前候选库内、均匀先验下的闭集概率。未收录模型仍会被归到最相似的现有候选。

项目结构

app.py              Web 接口
fingerprint.py      指纹提取与归因
bank_builder.py     指纹库构建与概率校准
challenge_suite.py  自动建库挑战
enrollment.py       API 调用与指纹采集
rebuild_unified_bank.py  重建统一全局库
data/               参考数据与指纹库
static/             页面资源
templates/          页面模板

指纹库说明

项目中现有指纹库共包含两个模型家族、17 个模型:

gpt-5.4
gpt-5.5
gpt-5.6-luna
gpt-5.6-terra
gpt-5.6-sol
gpt-6-astra
gpt-6-sol
gpt-6-luna
claude-haiku-4-5-20251001
claude-sonnet-4-6
claude-sonnet-5
claude-sonnet-5-5
claude-opus-4-6
claude-opus-4-7
claude-opus-4-8
claude-opus-5
claude-opus-5-5

GPT 采集自官方订阅 Codex,Claude 采集自 OAIPro。

声明

测试结果仅供参考,并非判断模型的决定性证据

注意该项目为归因工具,只对指纹库内的模型尽可能去判断属于哪种模型,若待测模型不在指纹库中,得到任何结果都是有可能的

目前已知因系统提示词严重影响模型偏好,在Claude Code中得到的测试结果存在较大偏差,建议不要在Claude Code中测试

致谢

感谢 hanlinwenyuan/hlwy-ai-checker。该项目较早将语言模型的随机数字生成偏差用于第三方 API 渠道一致性检查,为 ModelTrace 提供了重要参考。

LINUX DO

ModelTrace (xqy2006/ModelTrace)

Searching Database…

What is this?ModelTrace is a locally-run active model attribution tool: it sends three fixed challenge prompts to a target model, extracts an output fingerprint, and matches it against a known-model library to guess the model family and specific version.
Is this an app I install, or just a page I open?It's a static, backend-free web page (static/index.html, also deployed to GitHub Pages) plus an optional Codex plugin called ModelTrace Guard that runs background monitoring inside Codex sessions.
How do I run a test?Open the GitHub Pages site or static/index.html locally. For manual testing, copy the three challenge prompts to the target model and paste back its outputs; for automatic testing, enter the Base URL, API Key and model name and it handles the requests itself.
Do I need an API key to use it?Only for the automatic testing mode, which supports OpenAI Chat Completions and Anthropic Messages compatible endpoints. Manual testing needs no key at all — you just paste model outputs yourself.
Does it always correctly identify the model?No — results are only probabilities within the current fingerprint library, not proof. A model that isn't in the library will still be matched to whichever known model is closest, so an unfamiliar model can produce a confident-looking but wrong result. System prompts also skew results heavily, so testing inside Claude Code specifically is known to be unreliable.
Does it run only in a browser, or do I need to install anything?It runs entirely in the browser with no backend required for the manual/API modes; only the Codex Guard plugin needs to be installed inside Codex CLI.
What does the Codex plugin ModelTrace Guard actually do?It monitors a running Codex task in the background by periodically forking the frozen task snapshot to run normal and re-verification probes without blocking the main task, and silently logs consistent results while alerting and pausing the agent on repeated inconsistencies.
What's currently in the fingerprint library?Two model families covering 17 models total: GPT data collected from an official Codex subscription, and Claude data collected via OAIPro.
How does the attribution algorithm score a model?All models share one global feature space; the tool projects out an estimated interference direction, scores the three responses against every model center, averages the scores, and converts them to probabilities with a global softmax plus a calibration temperature.
What inspired this project?The author credits hanlinwenyuan/hlwy-ai-checker, an earlier project that used LLM random-number-generation bias to check third-party API channel consistency.
Creator
xqy2006
Size
3.9 MB
Stars
1.7K
Updated
CommitOct 09
Age
1mo
Commits · 90 Days