llm-as-a-verifier-dsh
LLM-as-a-Verifier for dsh with the Best-of-N conversation mode built in: rank N candidates with a fine-grained verifier (expected grade over the logprob distribution), on demand via the verify tool or automatically on every turn of a Best-of-N session. In
安装
dsh plugin --profile web add github:aispin-dev/llm-as-a-verifier-dsh
需要可复现安装时,可在仓库后追加 #commit 固定提交。
LLM-as-a-Verifier for dsh with the Best-of-N conversation mode built in: rank N candidates with a fine-grained verifier (expected grade over the logprob distribution), on demand via the verify tool or automatically on every turn of a Best-of-N session. In
该插件未提供要点说明,请参考仓库 README。
- 安装并启动 DeepSeek Harness:
npx @deepseek-ai/dsh web - 在终端执行上面的安装命令(CLI 会解析插件并核验来源)
- 用 dsh plugins list 确认已安装,必要时重启 Harness 生效
插件以当前 dsh 进程的权限运行,安装时可能执行代码。请先通读仓库源码与许可证,确认无破坏性命令与越权访问;本站只做索引,不对第三方插件安全性作担保。
| 代码仓库 | github.com/aispin-dev/llm-as-a-verifier-dsh |
| 许可证 | MIT |
| 主要语言 | main |
| 下载量 | 2 |
| GitHub 星标 | 0 |
| 最近推送 | 2026-08-21 |
| 收录日期 | 2026-09-19 |
| 分类 | 会话与消息 |
事实信息来自公开插件目录快照(2026-10-01),介绍文案由本站再加工。
以下为插件仓库 README 全文(原始内容,由公开目录抓取整理)。
# LLM-as-a-Verifier for dsh — Best-of-N (Bo5) conversation mode
**English** | [中文文档](#中文文档)
> **Give DeepSeek V4 Flash test-time scaling: V4 Flash + Bo5 self-verification reaches Fable-5-level scores** — 88% on Terminal-Bench 2.1, frontier-model accuracy at a fraction of the cost (≈11× cheaper).
An independent dsh-native implementation of the test-time selection method from [LLM-as-a-Verifier](https://arxiv.org/abs/2607.05391) (arXiv:2607.05391, MIT). Method by the paper's authors; this implementation by [Aispin](https://github.com/aispin-dev).
## The paper's idea, in one minute
Cheap models can *generate* great answers — they just can't *recognize* which one is great. LLM-as-a-Verifier closes that gap:
1. **Sample N candidates** from a cheap model (DeepSeek V4 Flash): slightly different attempts at the same task.
2. **Grade with a fine-grained verifier** — the same cheap model, asked to grade *pairs* of candidates on an A–T letter scale. The score is not the sampled letter: it is the **expectation over the grade token's logprob distribution**, Σ p(token)·φ(letter) — the model's full belief, not one dice throw.
3. **Both orderings per pair** cancel the verifier's position bias; repeated evaluations alternate slots.
4. **Select the best** — the paper's core result: *V4 Flash sampling 5 candidates + self-verification matches Fable-5-level frontier scores on Terminal-Bench 2.1 (88.0%) at ~1/11 the cost.*
This plugin packages that pipeline as a dsh plugin with a conversational twist: **every assistant turn becomes Best-of-N automatically** — you see one answer, the model produced five.
## One plugin, three faces
| Face | Entry | Use |
|---|---|---|
| **Tool** | `verify` tool | On demand — "use the verify tool to compare A/B/C", the agent calls it |
| **Service** | `ctx.verifier.verify({ task, candidates })` | For code — orchestration lines, other plugins |
| **Mode** | Best-of-N conversation mode | Invisible — Bo-N sessions sample every turn N ways, verify, replay only the winner |
## Install
From npm (the recommended path — resolves every dependency through your profile):
```bash
dsh plugin --profile add @aispin/plugin-verifier
```
Or plain npm:
```bash
npm install @aispin/plugin-verifier
```
**Zero-config**: the verifier inherits dsh's configured provider state (credentials + settings seams) — if you've configured DeepSeek on the Models page, it just works. Try it locally:
```bash
git clone https://github.com/aispin-dev/llm-as-a-Verifier-dsh.git
dsh plugin --profile add /path/to/llm-as-a-Verifier-dsh
```
## Best-of-N: three-state switch (hot)
```
① settings global (Web UI panel) → ② session preset ("Bo-N mode") → ③ profile config default → off
```
The Web settings panel offers the tiers with **transparent cost cards**:
| Tier | Model calls | Tokens | Latency |
|---|---|---|---|
| Off | 1 | 1× | 1× |
| Fast · Bo-3 | ~9 | 2–3× | ~7–15s |
| Precise · Bo-5 | ~16 | 3–5× | ~12–30s |
| Custom | 2–8 ways | linear | linear |
Every turn's footer meters the real spend: `⚡ Best-of-N · 5 选 1 → 候选 #2 · 20.0/20 · 24.3s · 10.8K tok`
## What's inside (implementation parity with the paper)
- **Fine-grained reward**: expected grade over the top-20 logprob distribution, A=20…T=1 grouped band scale, grading at temperature 1.0 (the natural belief distribution — never collapsed)
- **PPT pivot tournament** (the paper's O(N·k) selection): random Hamiltonian ring (each candidate lands exactly once per slot — bias cancels inside the ring) → top-k pivots → only non-pivot×pivot pairs graded. Live-verified: Bo-5 grading calls 20 → 11 (−45%)
- **Prefix-cache prompt layout** (paper v0.2.0, −3.4× uncached tokens): criteria at the prompt tail; role + scale + task + candidates form the shared prefix
- **Capability-adaptive grading**: logprobs endpoints (DeepSeek official) get expected-grade scoring; logprob-less endpoints (MiniMax, various gateway providers) auto-degrade to letter-sampling grading with double evaluation — any OpenAI-compatible endpoint works (`autoDegrade: false` for strict mode)
- **Fail-open discipline**: any breakdown degrades to a normal answer with an explanatory footer — never a dead turn
## License
MIT © 2026 Aispin. The method is from [LLM-as-a-Verifier](https://arxiv.org/abs/2607.05391) (arXiv:2607.05391, MIT). Not affiliated with the paper's authors or DeepSeek.
---
# 中文文档
> **给 DeepSeek V4 Flash 测试时扩展能力:V4 Flash + Bo5 自验证达到 Fable 5 级评分**——Terminal-Bench 2.1 上 88%,以前沿模型级别的准确率、约 1/11 的成本完成任务。
[LLM-as-a-Verifier](https://arxiv.org/abs/2607.05391)(arXiv:2607.05391, MIT)测试时选择方法的 dsh 原生独立实现。方法归论文作者,实现归 [Aispin](https://github.com/aispin-dev)。
## 论文的思想,一分钟讲清
便宜模型能*生成*好答案——只是认不出*哪个*是好答案。LLM-as-a-Verifier 补上这一环:
1. **采样 N 个候选**(DeepSeek V4 Flash):同一任务的多个略有差异的尝试。
2. **细粒度验证器评分**——同一个便宜模型,对候选**两两成对**按 A–T 字母量表打分。分数不是采样出的那个字母,而是 **grade token 对数概率分布上的期望值** Σ p(token)·φ(letter)——模型的完整信念,不是掷一次骰子。
3. **每对双向各评一次**抵消验证器的位置偏置;重复评估交替 A/B 槽位。
4. **选出最佳**——论文核心结论:*V4 Flash 采样 5 条候选 + 自验证择优,在 Terminal-Bench 2.1 上达到 Fable 5 级前沿评分(88.0%),成本约 1/11*。
本插件把这套管线做成 dsh 插件,并加上对话形态:**每个回答自动变成 Best-of-N**——你看到一条答案,模型实际做了五条。
## 一个插件,三张面孔
| 面孔 | 入口 | 用法 |
|---|---|---|
| **工具面** | `verify` 工具 | 有感——对话里说"用 verify 工具比较 A/B/C",模型主动调用 |
| **服务面** | `ctx.verifier.verify({ task, candidates })` | 代码消费(编排线、其他插件) |
| **模式面** | Best-of-N 对话模式 | 无感——选中模式的会话,每轮后台 N 路采样 + 择优,只把胜者呈现给用户 |
## 安装
npm 安装(推荐——依赖经你的 profile 完整解析):
```bash
dsh plugin --profile add @aispin/plugin-verifier
```
或直接 npm:
```bash
npm install @aispin/plugin-verifier
```
**零配置**:验证器继承 dsh 已配置的 provider 状态(credentials + settings seam)——在 Models 页面配过 DeepSeek 即可直接用。本地试用:
```bash
git clone https://github.com/aispin-dev/llm-as-a-Verifier-dsh.git
dsh plugin --profile add /path/to/llm-as-a-Verifier-dsh
```
## Best-of-N:三态开关(热生效)
```
① settings 全局(Web 设置面板)→ ② session preset("Bo-N 模式")→ ③ profile config 默认 → 关
```
Web 设置面板的档位卡直接标注**消耗透明**:
| 档位 | 模型调用 | token | 延迟 |
|---|---|---|---|
| 关闭 | 1 次 | 1× | 1× |
| 快速经济 · Bo-3 | ~9 次 | 2–3× | ~7–15s |
| 精准 · Bo-5 | ~16 次 | 3–5× | ~12–30s |
| 自定义 | 2–8 路 | 线性 | 线性 |
每轮回答尾部 footer 显示实际开销:`⚡ Best-of-N · 5 选 1 → 候选 #2 · 20.0/20 · 24.3s · 10.8K tok`
## 实现要点(与论文对齐)
- **细粒度奖励**:top-20 logprob 分布上的期望分(A=20…T=1 分组带量表),评分温度 1.0(读自然信念分布,绝不坍缩)
- **PPT 概率枢轴锦标赛**(论文 O(N·k) 选择算法):随机哈密顿环(每候选恰好在 A/B 槽各一次——环内天然消位置偏置)→ top-k 枢轴 → 只补非枢轴×枢轴对。实测 Bo-5 评分调用 20 → 11(−45%)
- **前缀缓存布局**(论文 v0.2.0,未缓存 token −3.4×):criteria 置于 prompt 尾部,角色+量表+任务+候选构成跨调用共享前缀
- **能力自适应评分**:有 logprobs 的端点(DeepSeek 官方)用期望分;没有的(MiniMax、部分网关)自动降级采样评分(每对双评补偿方差)——任何 OpenAI 兼容端点都能当评审(`autoDegrade: false` 切严格模式)
- **Fail-open 纪律**:任何断裂降级为普通回答并在 footer 说明原因,绝不杀死对话轮
## 许可
MIT © 2026 Aispin。方法来自 [LLM-as-a-Verifier](https://arxiv.org/abs/2607.05391)(arXiv:2607.05391, MIT)。与论文作者及 DeepSeek 无隶属关系。
数据来源:公开的 DeepSeek Harness 插件目录与各插件 GitHub 仓库。本站为独立第三方目录,与 DeepSeek、幻方(High-Flyer)及插件作者均无隶属或背书关系。