JEV-35B-NVFP4决策API全字段参考:/v1/decide的strategy、thinking、threshold逐一详解

原创2026-10-15 13:35:141,715 阅读

JEV-35B-NVFP4决策API全字段参考:/v1/decide的strategy、thinking、threshold逐一详解

JEV-35B-NVFP4 是一个 35B 参数、NVFP4 量化的 System 1 决策模型,用 vLLM 部署后,一次 POST /v1/decide 请求即可对最多 256 个候选选项给出经过校准的概率。本文逐一详解该决策 API 的全部请求字段——strategy、thinking、threshold、think_budget 等,帮你一次读懂、直接上手。

1分钟了解 /v1/decide 决策API

JEV-35B-NVFP4 把「快速直觉判断(System 1)」和「深度推理(System 2)」装在同一个引擎里:

  • System 1(本模型的主打能力):一次前向读取全部候选项,直接输出每个选项的校准概率,中位延迟约 215ms(文本,单卡 B200)。
  • System 2:基础模型(Qwen3.5-35B-A3B)的原生思考模式,按需启用,用于低置信度问题的「兜底复核」。

部署只需两步(需 32GB 以上显存的单卡,NVFP4 量化让权重只占 23.3 GiB):

hf download autotrust/JEV-35B-NVFP4 --local-dir JEV-35B-NVFP4
bash JEV-35B-NVFP4/serve.sh    # vLLM 服务,默认端口 8000

启动脚本见 serve.sh,API 路由实现见 serve_decide.py。最简请求长这样:

curl localhost:8000/v1/decide -H 'Content-Type: application/json' -d '{
  "kind": "choice",
  "state": "客户留言:同一笔订单被扣了两次款。",
  "question": "这张工单应该分给哪个团队?",
  "options": ["billing", "shipping", "technical support", "account security"]
}'

请求字段速查表

/v1/decide 支持的全部请求字段如下(定义见 serve_decide.py 中的 DecideRequest):

字段 类型 取值 默认值 作用
kind string noul / score / choice 必填 决策类型
state string / object / list 文本、JSON、或图文混合列表 "" 决策所依据的上下文
question string — 必填 针对 state 的一个问题
options string[] 2–256 个字符串 无 choice 类型专用候选项
strategy string auto / single / tournament / permute auto 选项的读取策略
thinking string default / off / auto / on default System 2 思考开关
threshold float 0–1 0.8 auto 模式下触发思考的置信度阈值
think_budget int token 数 不限制 System 2 思考的最大 token 数
reasoning_effort string xhigh / medium / low 无 基础模型推理强度(本模型不可用)
chat_template_kwargs object 键值对 无 透传给基础模型 chat 模板
return_reasoning bool — false 是否返回 System 2 的思考原文
debug bool — false 返回 System 1 / 2 的完整分布
system2_only bool — false 跳过 System 1,只走思考通道

基础四字段:kind、state、question、options

kind:决定输出的「形状」

取值 含义 概率对应选项
noul 是/否判断(nou + l,法语「是否」的缩写风格) 固定 ["false", "true"]
score 打 0–5 分 固定 ["0","1","2","3","4","5"]
choice 多选一 你自己传入的 options(2–256 个)

三类决策共用一个 264 槽位的决策头(见 adapter_vllm/decision_head.json):noul 占 2 槽、score 占 6 槽、choice 占 256 槽(标签 A–Z、AA–JU)。

state:支持文本、JSON 与图文混合

state 有三种形态,可自由切换:

{"kind": "choice", "state": "工单原文……", "question": "……", "options": ["A", "B"]}
{"kind": "noul", "state": {"order_id": 1024, "charged_twice": true}, "question": "是否属于重复扣款?"}
{"kind": "choice", "state": ["看这张截图:", {"image": "https://example.com/ui.png"}], "question": "下一步点哪里?", "options": ["提交按钮", "返回按钮"]}

第三形态里 state 是列表,字符串算文本、含 image 键的对象算图片(URL 或 data: 编码),单次最多 8 张图。机器人手臂抓放、看图点按钮等演示(结果见 reports/demos-nvfp4/)用的就是图文混合形态。

question 与 options

question 是关于 state 的一句话提问;options 仅 choice 类型需要,长度 2–256。选项会被编号为 A)、B)……写入 prompt 供模型一次读完——选项顺序即标签顺序,与传入顺序一一对应。

strategy:256 个候选项如何被一次读完

strategy 控制「选项数量超过决策头原生槽位时怎么读」。四种取值:

取值 行为
single 一次 pass 读全部选项,标签 A–P 之后接 Q–Z、AA…
tournament 先按每组 ≤16 个并行分组赛,各组冠军 + 高分候补组成 ≤16 个的决赛圈,两轮概率加权合成
permute 用 4 种选项排列各跑一遍 single pass,取概率均值,消除顺序偏置
auto 使用模型内置默认策略

⚠️ 对 JEV-35B-NVFP4 有一个关键事实:它的 choice 决策头是 256 槽的「宽头」(wide head),原生就能一次读完 256 个选项。因此只要 options 不超过约 256 个(接口上限),无论传什么 strategy,实际都走单次 pass——tournament 和 permute 是为 16 槽窄头模型(如 JEV-27B、GEV)准备的。响应中的 adaptation 字段会告诉你实际走的路径:"native"(原生一次读完)或具体策略名。

thinking:System 1 快答与 System 2 深想之间的开关

thinking 是本文标题三大字段里最核心的一个,控制是否启用自适应思考:

取值 行为
off 只走 System 1,一次前向出结果(本模型默认值)
auto System 1 先答;若最高选项概率 < threshold,自动唤起 System 2 思考后融合
on 无条件走 System 2 思考
default 使用模型内置默认(本模型为 off)

融合公式(serve_decide.py):设 System 1 概率为 p1、System 2 概率为 p2,最终 p = 0.5 × p1 + 0.5 × p2。等权混合是为了保住 System 1 的校准性——单独看 p2 往往接近 one-hot、过度自信。

两点注意:

  • score 类型不支持 auto/on(会返回 400),因为 6 档打分没有「思考后复核」的训练基础;
  • 官方说明中,该 NVFP4 模型的 thinking 通道尚未做系统评测(Limitations 一节),生产环境建议以 off 为主,把校准概率本身用于置信度门控。

threshold:置信度阈值如何决定「想不想」

threshold(默认 0.8)只在 thinking: "auto" 时起作用:

System 1 先算出 p1 → 若 max(p1) < threshold → 触发 System 2 思考 → 按 0.5:0.5 融合

调参建议:

  • 调低(如 0.5):更多请求触发思考,准确上限更高,但延迟从 ~200ms 涨到秒级;
  • 调高(如 0.95):几乎只在 System 1「五五开」时才思考,平均延迟接近纯 System 1;
  • 该默认值来自 qwen 系 profile(serve_decide.py),也可用环境变量 JEV_DECIDE_THRESHOLD 全局覆盖。

其余字段速览:think_budget、debug、system2_only 等

  • think_budget:System 2 思考的最大 token 数,不设则用到上下文窗口为止。机器人演示里就是靠它把思考限制在可控范围内。
  • reasoning_effort(xhigh/medium/low):透传给基础模型的推理强度,但 JEV-35B-NVFP4 的 chat 模板没有该变量(见 chat_template.jinja),传入会收到 400 错误,提示改用 think_budget 控制长度。
  • return_reasoning:为 true 时,thinking 响应块里附带 System 2 思考原文,便于人工审计。
  • debug:为 true 时在 thinking 块中返回 system1、system2 两组完整分布,用于校准分析。
  • system2_only:跳过 System 1,直接要 System 2 的答案分布——适合调用方自己已有 p1、只想取 p2 做融合的场景(score 类型不支持)。

响应字段详解

成功响应是一个 JSON 对象:

字段 说明
options 最终生效的选项列表(noul/score 为固定选项)
probabilities 与 options 对齐的概率数组,已按类型温度校准
choice / choice_index 概率最大的选项及其下标
adaptation 实际读取路径:native 或所用 strategy
protocol 协议版本 jev27-bare-v1
usage prompt_tokens / completion_tokens / total_tokens
elapsed_seconds 端到端耗时
num_model_requests 内部引擎调用次数(tournament 为多轮,thinking 开启再 +1)
thinking 请求涉及思考时出现:mode、threshold、used、think_tokens、think_seconds、finished_within_budget 等

概率的「可信度」来自 calibration.json:每类决策拟合了专属温度(noul 0.984、choice 1.012、score 1.008,基于上万条拟合数据),诊断集 ECE 约 0.0016——也就是说 probabilities 可以直接当真实概率用于阈值决策,而不只是排序。

三个实战请求示例

① 基础分类(纯 System 1,最快)

{"kind": "choice", "state": "客户留言:同一笔订单被扣了两次款。",
 "question": "这张工单应该分给哪个团队?",
 "options": ["billing", "shipping", "technical support", "account security"]}

② 低置信度自动复核(auto + 自定义阈值)

{"kind": "noul", "state": {"score": 71, "baseline": 65},
 "question": "这个分数提升是否统计显著?",
 "thinking": "auto", "threshold": 0.9, "think_budget": 512, "return_reasoning": true}

System 1 认为「是/否」都不到 0.9 把握时,才让基础模型想一想再融合。

③ 图文决策(机器人手臂式拆解问题)

{"kind": "noul",
 "state": ["从顶视相机看:", {"image": "data:image/png;base64,..."}],
 "question": "目标方块在夹爪的左侧吗?", "thinking": "off"}

官方演示把机械臂控制拆成「左/右?上/下?」这样的二值小问题,成功率 65–75%,中位单次决策 226ms,详见 reports/demos-nvfp4/arm_servo.json。

默认值速查与配置文件对照

默认项 值 定义位置
策略 strategy single serve_decide.py 的 qwen profile
思考 thinking off 同上
阈值 threshold 0.8 同上
融合权重 mix 0.5 同上
选项上限 max_options 256 serve_decide.py
校准温度 每类 1 个 calibration.json
决策头槽位 264(noul 2 / score 6 / choice 256) judge_config.json

想快速确认运行中服务的实际默认值,直接访问 GET /v1/decide/info 即可,它会返回 protocol、温度、strategy/thinking/threshold 默认值和推理控制能力。

FAQ

Q1:为什么我的 strategy 写了 tournament,响应里 adaptation 却是 native? A:JEV-35B-NVFP4 的 choice 头是 256 槽宽头,所有 ≤256 的选项都原生一次读完,tournament/permute 只在窄头模型(16 槽)上才生效。

Q2:thinking: "auto" 和 "on" 有什么区别? A:auto 只在 System 1 最高概率低于 threshold 时才思考,大多数请求仍是百毫秒级;on 每次思考,延迟稳定在秒级。

Q3:传了 reasoning_effort 却报 400? A:JEV-35B-NVFP4 的基础模型模板没有 reasoning_effort 变量(那是 Qwen3.8 系模型的能力),请改用 think_budget 限制思考长度。

Q4:概率可以直接做业务阈值吗? A:可以。三类决策都经过温度校准(ECE ≈ 0.0016),且官方建议高风险场景配合置信度门控使用。


本文基于仓库内 serve_decide.py、calibration.json、judge_config.json 与 README.md 的实际内容整理;演示数据见 reports/demos-nvfp4/。

登录后查看全文
JEV-35B-NVFP4