Morethaninformation/dsh-eval ↗★ 0

dsh-eval

Local model benchmark for DeepSeek Harness: eight auto-judged cases (long HTML closure, two-bone IK, strict JSON, exact arithmetic with/without thinking, node --check, log counting, long-context summary) run against any OpenAI-compatible endpoint as background jobs.

包名
dsh-eval
兼容性
待验证
版本
0.1.0
许可证
MIT
最近更新
2026年11月12日

同名包的其他仓库

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Morethaninformation/dsh-eval

dsh-eval

把「本地模型评测」做成 DeepSeek Harness 里的三个 agent 工具:对任意 OpenAI 兼容端点跑 8 个自动判分用例,给出分数与逐例说明。

English: a small benchmark plugin for DeepSeek Harness. Eight auto-judged cases (long HTML closure, two-bone IK, strict JSON, exact arithmetic with and without thinking, node --check, exact log counting, long-context summary) run as background jobs against any OpenAI-compatible endpoint.

全套约 6 分钟(两个长用例各生成 2–3 万字符),所以任务在 DSH 宿主进程里后台跑,工具立刻返回 job id。

工具

工具作用关键参数
eval_start启动一次评测,立即返回 jobIdbase(端点,默认 http://172.16.10.29:8000)、key(可用 $DSH_EVAL_KEY)、only(逗号分隔用例)、timeoutSec(单例超时,默认 420)
eval_status查进度/结果:传 jobId 查单个,不传列出全部jobId
eval_cancel取消任务,已跑完的用例保留结果jobId

同一时刻只允许一个 job 在跑;再开会被拒绝并提示当前进度。

用例(全部自动判定)

id考什么判据
html-svg-closure长结构化输出能否一次闭合有 doctype 与 、/`` 数量相等、≥3000 字符、未被上限截断
ik-constrained按几何约束写代码出现 acos/cos/`sqrt
exact-json严格格式服从整段可 JSON.parse 且字段与数组长度完全匹配
arithmetic多步精确算术(关思考)输出含 375581(= 362880 + round(362880×3.5%))
arithmetic-thinking同一题开思考(对照)同上
node-script-syntax产出可执行代码从 ```js 代码块抽出后 node --check 通过
log-count给定材料精确统计严格 JSON 且 error=3, warn=2
long-summary长 prompt + 结构约束恰好 5 行以 - 开头

请求统一带 chat_template_kwargs: { enable_thinking: }:思考也会吃掉 max_tokens,所以除对照用例外默认关闭。

安装

本包自带 bundle patch(cordis.patch.yml,插入一行 id: evaluator / name: dsh-eval)。

从 GitHub 直接装:

dsh plugin --profile desktop add github:morethaninformation/dsh-eval

或用 Release 里的预构建 tarball(不必从源码构建,也不需要 pnpm 拉依赖):

dsh plugin --profile desktop add https://github.com/morethaninformation/dsh-eval/releases/latest/download/dsh-eval.tgz

装完重启一次 DSH,eval_start / eval_status / eval_cancel 会出现在工具列表里。卸载: dsh plugin --profile desktop remove dsh-eval。

用法

eval_start({ key: process.env.DSH_EVAL_KEY })            // 全量 8 例
eval_start({ only: "exact-json,log-count" })             // 只跑快用例
eval_status({ jobId: "eval-1a2b3c4d" })                   // 轮询

状态行形如:

eval-a8799f40  [done]  8/8  score 7/8
  endpoint http://172.16.10.29:8000  model qwen3.8-flash-next-iq3_xxs
| case | 结果 | 用时 | 输出 | token | 说明 |

状态文件

每个 job 一个 JSON:%USERPROFILE%\.dsh\dsh-eval-state\.json(环境变量 DSH_EVAL_STATE_DIR 可覆盖),同目录 debug.log 记录每次 start/status 的 pid。

用文件而不是进程内存,是因为宿主可能在不同调用之间重新加载插件。key 不落盘,只存在运行中的进程里。

行为要点

  • 后台执行:eval_start 立刻返回,评测在宿主进程里继续跑,回合结束也不停。
  • 逐例落盘:每跑完一例就写状态文件,中途崩溃/重启也能看到已完成的部分。
  • 判分不靠模型自评:闭合、JSON、算术、语法、计数全是确定性检查。
  • 单例超时:默认 420 秒,超时判失败并继续下一例,不会卡死整套。
  • 不求模型名:端点的 /v1/models 拿不到也能跑,只是状态行里显示 (未取到)。

坑(改代码前先读)

  1. render(_args, value) 收到的 value 是 execute 的返回值,不是 schema 的某个字段 —— eval_status 返回 { count, jobs },所以渲染要写 renderJobs(v.jobs ?? [])。写错会显示成空列表("没有评测任务"),看起来非常像"状态丢了"。
  2. 输出 schema 不允许属性级 required,内部字段(如 timeoutS)必须在返回前剥掉,否则 additionalProperties: false 会报 invalid output。
  3. 沙箱下给子进程接管道会 EPERM,node --check 必须 stdio: "ignore" 只看退出码。
  4. 状态目录别用 tmpdir():宿主不同上下文会拿到不同 TEMP,两个工具会看到两套目录。

自测

node test/apply.mjs                  # 假 ctx:注册、离线判据、状态读写
node test/apply.mjs --net       # 追加两个真实用例(约 3 秒)

限制

  • 只支持 OpenAI 兼容的 /v1/chat/completions(流式);不支持 Anthropic 风格端点。
  • 用例是中文 prompt,判据写死;换语言要改 lib/cases.js。
  • 分数是"结构化任务可用性"的粗筛,不代表通用能力;算术一项对 3-bit 量化模型基本必挂。

License

MIT