OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Feature] glm VLM 后端应将 per-call thinking 参数映射到 reasoning_effort(GLM-5.3 强制思考)

Open hantianxingchen opened this issue 1 month ago • 2 comments

问题

openviking/models/vlm/backends/openai_vlm.py 中每步调用可传 thinking: bool 参数(如 session/memory/vision_message_normalizer.py 传 thinking=False,session/train/ 下多个组件传 thinking=True),但该参数只对 DashScope 端点生效(_supports_enable_thinking() 仅匹配 dashscope)。glm provider 下这个参数没有任何通路:glm_vlm.py 的 normalize_glm_config 只填默认 provider/model/api_base,per-call thinking 被静默丢弃。

当前 reasoning_effort 只从全局 vlm 配置读取,与每步的 thinking 参数无关联——导致提取链路(官方设计 thinking=False)与训练链路(thinking=True)无法差异化控制深度。

背景:GLM-5.3 的参数行为(open.bigmodel.cn 实测,2026-10-31)

请求参数 reasoning_content 耗时 说明
thinking: {"type":"disabled"} 74~370(多次波动) 3.2s 不报错但半生效,行为不可靠
reasoning_effort: "low" 0 3.1s 严格零思考,可靠
reasoning_effort: "max" 575 6.7s
不传(默认=max) 605 6.4s GLM-5.3 强制思考,无法关闭

GLM-5.3/5.3-FLASH 已不支持关闭思考,深度只能经 reasoning_effort(low/high/max)控制。

建议修复

provider == "glm" 时将 per-call thinking 参数映射到 reasoning_effort:

  • thinking=False → reasoning_effort: "low"
  • thinking=True → 用户显式配置的 reasoning_effort(默认 "high")

这样 vision_message_normalizer 等结构化提取步骤自动获得零思考档,训练链路保留深思考,全局配置仅作默认值兜底。

环境

  • openviking 0.5.2.1(PyPI)+ [local-embed]
  • vlm: provider=glm, model=glm-5.3, api_base=https://open.bigmodel.cn/api/paas/v4

hantianxingchen avatar Nov 01 '26 09:11 hantianxingchen

Hi @qin-ctx, I'd like to take this one. My plan is to follow the existing volcengine_vlm.py behavior in glm_vlm.py, scoped to glm-5* models: thinking=True uses the configured reasoning_effort (or high if unset), and thinking=False maps to low.

One catch: thinking defaults to False, so calls that don't pass it explicitly would now get low instead of the configured effort. Is that OK, or should I only map when thinking is passed explicitly?

kathy1207 avatar Nov 02 '26 01:11 kathy1207

感谢报告和参数验证。当前普通 session commit 的文本提取默认沿用配置中的 reasoning_effort,并非固定传入 thinking=False;配置 reasoning_effort: "low" 已可降低这部分推理开销。当前显式传 False 的图片描述步骤,也不能作为仅支持文本的 GLM-5.3 的正常使用场景。

另外,GLM-5.3 官方说明将 low 定义为轻量推理,并不保证零思考。把布尔参数自动映射成不同型号、不同阶段的推理档位需要新增一套参数语义,当前报告尚未证明这部分收益足以承担长期维护成本。

本项按不计划支持关闭,不采用所提的 False → low、True → 配置值/high 自动映射方案。

qin-ctx avatar Nov 02 '26 07:11 qin-ctx