Code for When Jev Helps and Hurts: Delegating High-Level Decisions in LLM Agent Workflows.
论文 When Jev Helps and Hurts: Delegating High-Level Decisions in LLM Agent Workflows(Jev 何时有益、何时有害:LLM 智能体工作流中的高层决策委托)的配套代码。
Paper / 论文 · HTML · Configuration / 配置
Tongxi Wu, Kai Chen, Yukun Wang, Xinfeng Li, Yanqi Bao, and Yang Gao
Which decisions should an LLM agent delegate to a specialized decision model? We study selected high-level decisions across OfficeQA Pro, ALFWorld, and SpreadsheetBench. Jev receives task context, execution evidence, and bounded options or assessment criteria. Its response selects an action or changes how the workflow proceeds; the host LLM handles the remaining generation.
LLM 智能体应将哪些决策委托给专门的决策模型?我们在 OfficeQA Pro、ALFWorld 和 SpreadsheetBench 三个工作流中研究部分高层决策。Jev 接收任务上下文、执行证据,以及有限的候选选项或判断标准,其返回结果用于选择动作或调整工作流的执行过程;其余生成任务由主 LLM 完成。
We found that delegation can help one host and hurt another, and its effect can reverse across workflows. Adding more decision points does not consistently improve performance or reduce host-token use. Some gains also come from changes to context, computation, and execution rules, making workflow controls necessary to identify the contribution of Jev's judgments.
我们发现,决策委托可能帮助某个主模型,也可能损害另一个主模型的表现,其效果还可能在不同工作流之间发生反转。增加委托决策点并不总能提高任务表现或减少主模型的 token 用量。部分收益也来自上下文、计算步骤和执行规则的变化,因此需要通过工作流对照来识别 Jev 判断本身的贡献。
We organize ten candidate decision functions across planning, execution, feedback, and control. The experiments evaluate selected functions individually and in combination; their concrete implementations depend on the workflow.
我们将十类候选决策功能划分为规划、执行、反馈和控制四个阶段,并对其中选定的功能进行单点与组合评测。各功能的具体实现随工作流而变化。
| Stage | # | High-level Replacement Point | Description | Jev |
|---|---|---|---|---|
| Planning | 1 | Strategy Selection | Select a strategy for solving the task, such as retrieval, computation, direct reasoning, or interaction. | Choice |
| Planning | 2 | Plan / Replan Decision | Determine whether the current plan needs to be adjusted or replaced with a new plan. | Noul |
| Planning | 3 | Task Requirement Interpretation | Identify the task's key constraints and expected output format, and determine which type of processing rules to apply next. | Choice |
| Execution | 4 | Tool-use Decision | Determine whether the current step requires an external tool call. | Noul |
| Execution | 5 | Tool Selection | Select an appropriate tool from the predefined set of available tools. | Choice |
| Execution | 6 | Information Acquisition Strategy | Determine which type of information to acquire or inspect next, rather than directly generating search queries or operation parameters. | Choice |
| Feedback | 7 | Information Sufficiency | Determine whether the available evidence is sufficient to support subsequent actions or whether more information is needed. | Noul / Score |
| Feedback | 8 | Result Verification | Determine whether the current execution result satisfies the task requirements and intended goals. | Noul / Score |
| Feedback | 9 | Failure Recovery | After an execution failure, decide whether to retry, adjust the strategy, or replan. | Choice |
| Control | 10 | Termination / Escalation | Decide whether to continue execution, end the task, or escalate. | Choice |
| 阶段 | 编号 | 高层替换点 | 定义 | Jev 接口 |
|---|---|---|---|---|
| 规划 | 1 | 策略选择 | 选择解决任务的策略,例如检索、计算、直接推理或交互。 | Choice |
| 规划 | 2 | 规划/重规划决策 | 判断是否需要调整当前计划,或用新计划替换当前计划。 | Noul |
| 规划 | 3 | 任务需求解读 | 识别任务的关键约束和预期输出格式,确定后续应采用的处理规则。 | Choice |
| 执行 | 4 | 工具使用决策 | 判断当前步骤是否需要调用外部工具。 | Noul |
| 执行 | 5 | 工具选择 | 从预定义的可用工具集中选择合适的工具。 | Choice |
| 执行 | 6 | 信息获取策略 | 选择下一步应获取或检查哪类信息,而非直接生成搜索词或操作参数。 | Choice |
| 反馈 | 7 | 信息充分性 | 判断现有证据是否足以支持后续操作,或是否需要更多信息。 | Noul / Score |
| 反馈 | 8 | 结果验证 | 判断当前执行结果是否满足任务要求和预期目标。 | Noul / Score |
| 反馈 | 9 | 失败恢复 | 执行失败后,选择重试、调整策略或重新规划。 | Choice |
| 控制 | 10 | 终止/升级处理 | 决定继续执行、结束任务,或升级处理。 | Choice |
This repository provides implementations for evaluating single-point and combined decision delegation on OfficeQA Pro, ALFWorld, and SpreadsheetBench. It includes decision controllers, baseline workflows, Skill prompts, YAML configurations, evaluation metrics, and offline tests. Benchmark data must be obtained separately using the data preparation instructions.
本仓库提供 OfficeQA Pro、ALFWorld 和 SpreadsheetBench 上单点与组合决策委托的评测实现,包含决策控制器、基线工作流、Skill 提示词、YAML 配置、评测指标和离线测试。基准数据需按照数据准备说明单独获取。
| Workflow | Main single-point settings | Additional settings |
|---|---|---|
| OfficeQA Pro | #3 task interpretation, #7 evidence sufficiency, #8 verification | Selected combinations, protocol and recomputation controls |
| ALFWorld | #2 held-object actions, #3 task classification, #6 search, #7 pickup, #9 recovery | Selected combinations and a full-history host control |
| SpreadsheetBench | #6 workbook inspection, #7 readiness to write, #8 verification | Selected combinations and host verification |
| 工作流 | 主要单点设置 | 其他设置 |
|---|---|---|
| OfficeQA Pro | #3 任务解读、#7 证据充分性、#8 结果验证 | 部分组合配置、协议与复算对照 |
| ALFWorld | #2 持物行动、#3 任务分类、#6 搜索、#7 拿取、#9 失败恢复 | 部分组合配置、完整历史的主模型对照 |
| SpreadsheetBench | #6 工作簿检查、#7 编写代码前的充分性判断、#8 结果验证 | 部分组合配置、主模型验证对照 |
See the configuration guide for decision settings, workflow controls, and their corresponding Skill prompts.
各决策设置、工作流对照及对应的 Skill 提示词见配置指南。
configs/ Baselines, delegation settings, and controls
ckpt/ Skill prompts (Markdown)
skillopt/envs/*_jev_ctrl/ Workflow-specific decision controllers
skillopt/envs/{officeqa,alfworld,spreadsheetbench}/
Base environments, execution, and scoring
skillopt/model/jev_client.py Jev HTTP client
scripts/ Evaluation, data preparation, and analysis
data/ Task identifiers and ALFWorld path manifests
tests/ Offline controller and metric tests
目录说明:configs/ 保存基线、委托配置与对照设置;ckpt/ 保存 Markdown 格式的 Skill 提示词。skillopt/envs/*_jev_ctrl/ 实现各工作流的决策控制器,其对应基础环境负责执行与评分。skillopt/model/jev_client.py 是 Jev HTTP 客户端;scripts/ 包含评测、数据准备和分析脚本;data/ 保存任务 ID 与 ALFWorld 路径清单;tests/ 包含控制器和指标的离线测试。
Use Python 3.10 or later; Python 3.11 is recommended for ALFWorld dependencies. Run the commands below from a clone of this repository.
请使用 Python 3.10 或更高版本;考虑到 ALFWorld 的依赖兼容性,建议使用 Python 3.11。克隆仓库后,在仓库根目录运行以下命令。
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# For ALFWorld episodes, also install:
pip install -e ".[alfworld]"Set the host API credentials and the Jev key locally:
在本地配置主模型 API 凭据和 Jev 密钥:
cp .env.example .env
# Edit .env, then export its values into this shell:
set -a
source .env
set +aOPENAI_COMPATIBLE_BASE_URL and OPENAI_COMPATIBLE_API_KEY configure the
OpenAI-compatible host backend. TYPESAFE_API_KEY configures Jev. YAML files
select the host model; change it with --cfg-options model.target=MODEL_ID.
Use separate credentials or endpoints through the role-specific
TARGET_OPENAI_COMPATIBLE_* variables when needed. The Jev model and endpoint
are set by env.jev_model and env.jev_endpoint in each delegation config.
OPENAI_COMPATIBLE_BASE_URL 和 OPENAI_COMPATIBLE_API_KEY 用于配置兼容 OpenAI 接口的主模型后端,TYPESAFE_API_KEY 用于配置 Jev。主模型由 YAML 文件选择,可通过 --cfg-options model.target=MODEL_ID 修改。如需为目标模型单独指定凭据或接口地址,可使用 TARGET_OPENAI_COMPATIBLE_* 环境变量。Jev 的模型名称和接口地址分别由各委托配置中的 env.jev_model 和 env.jev_endpoint 指定。
Download the original data separately. See data/README.md for sources, expected layouts, and preparation commands. The release retains the original task ordering for ALFWorld and SpreadsheetBench.
请单独下载原始基准数据。数据来源、目录结构和准备命令见 data/README.md。本仓库保留了 ALFWorld 和 SpreadsheetBench 的原始任务顺序。
| Benchmark | Evaluation set | Required local input |
|---|---|---|
| OfficeQA Pro | 133 questions | Pro CSV and parsed Treasury Bulletin documents |
| ALFWorld | 134 unseen tasks | ALFWorld data directory, selected by ALFWORLD_DATA |
| SpreadsheetBench | 280 held-out tasks | Verified 400 archive, joined with the released IDs |
| 基准 | 评测集 | 所需本地数据 |
|---|---|---|
| OfficeQA Pro | 133 道问题 | Pro CSV 与解析后的 Treasury Bulletin 文档 |
| ALFWorld | 134 个未见任务 | 由 ALFWORLD_DATA 指定的 ALFWorld 数据目录 |
| SpreadsheetBench | 280 个预留测试任务 | Verified 400 压缩包,与仓库中的任务 ID 对应 |
The examples use gpt-5.4-mini as the host model. Configure your API credentials
before running an evaluation.
以下示例使用 gpt-5.4-mini 作为主模型。运行评测前,请先配置 API 凭据。
python scripts/eval_only.py \
--config configs/officeqa_jev_ctrl/point8.yaml \
--skill ckpt/officeqa_jev_ctrl/gpt5.5_skill_ctrl.md \
--split valid_unseen \
--out_root outputs/officeqa_point8For matched #8 controls, substitute attribution_control.yaml,
attribution_code_only.yaml, attribution_llm.yaml, or attribution_jev.yaml.
Use configs/officeqa/pro_eval.yaml with
ckpt/officeqa/gpt5.5_skill.md for the native workflow.
运行与 #8 匹配的对照时,将配置替换为 attribution_control.yaml、attribution_code_only.yaml、attribution_llm.yaml 或 attribution_jev.yaml。原生工作流使用 configs/officeqa/pro_eval.yaml,并搭配 ckpt/officeqa/gpt5.5_skill.md。
python scripts/eval_only.py \
--config configs/alfworld_jev_ctrl/combo6_2.yaml \
--skill ckpt/alfworld_jev_ctrl/gpt5.5_skill_combo6_2.md \
--split valid_unseen \
--out_root outputs/alfworld_combo6_2Use configs/alfworld/pro_eval_fullhist.yaml with
ckpt/alfworld/gpt5.5_skill.md for the full-history host-only control.
The short-history baseline is configs/alfworld/pro_eval.yaml.
Individual ALFWorld settings use different Skill files, listed in the
configuration map.
完整历史的主模型对照使用 configs/alfworld/pro_eval_fullhist.yaml,搭配 ckpt/alfworld/gpt5.5_skill.md。短历史基线为 configs/alfworld/pro_eval.yaml。不同 ALFWorld 委托配置使用的 Skill 文件不同,详见配置说明。
python scripts/eval_only.py \
--config configs/spreadsheet_jev_ctrl/verify8_react_jev.yaml \
--skill ckpt/spreadsheetbench/gpt5.5_skill.md \
--split valid_unseen \
--out_root outputs/spreadsheet_point8Use configs/spreadsheetbench/pro_eval_react.yaml for native ReAct, or
configs/spreadsheet_jev_ctrl/verify8_react_llm.yaml for host verification.
The executor runs the generated Python scripts in a dedicated working directory
and removes API credentials from their process environment.
原生 ReAct 使用 configs/spreadsheetbench/pro_eval_react.yaml;由主模型进行验证的对照使用 configs/spreadsheet_jev_ctrl/verify8_react_llm.yaml。执行器在独立工作目录中运行生成的 Python 脚本,并从其进程环境中移除 API 凭据。
Append --cfg-options model.target=MODEL_ID env.workers=1 to switch the host
and reduce concurrency. For a small trial, also append --test_env_num 1.
valid_unseen selects the held-out test split in the data loaders.
添加 --cfg-options model.target=MODEL_ID env.workers=1 可切换主模型并降低并发数。如需先运行一个任务,可再添加 --test_env_num 1。数据加载器中的 valid_unseen 对应预留的 test 划分。
Each run writes results.jsonl, eval_summary.json, and workflow-specific
metrics and traces under its output directory. Reusing an output directory
can resume completed records; use a new directory for a fresh comparison.
每次运行都会在输出目录中写入 results.jsonl、eval_summary.json,以及工作流对应的指标和轨迹。复用输出目录可以接续已有记录;进行独立对比时应使用新的输出目录。
The analysis scripts accept run directories and expose their arguments with
--help:
分析脚本以运行结果目录为输入,可通过 --help 查看参数:
python scripts/summarize_officeqa_jev.py --help
python scripts/summarize_alfworld_jev.py --help
python scripts/analyze_spreadsheet_jev.py --helpThe summaries report task accuracy or success together with separate token and call counts for the host model and Jev.
汇总结果同时报告任务准确率或成功率,以及主模型与 Jev 各自的 token 用量和调用次数。
python -m pytest tests -qThese tests cover decision routing, combination behavior, error handling, path resolution, and metrics with local fixtures and mocked model responses.
这些测试使用本地测试数据和模拟模型响应,检查决策路由、组合行为、错误处理、路径解析和评测指标。
@misc{wu2026jevhelpshurts,
title = {When Jev Helps and Hurts: Delegating High-Level Decisions in LLM Agent Workflows},
author = {Tongxi Wu and Kai Chen and Yukun Wang and Xinfeng Li and Yanqi Bao and Yang Gao},
year = {2026},
eprint = {2611.39088},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
url = {https://arxiv.org/abs/2611.39088}
}The evaluation code builds on SkillOpt. This project uses the MIT license. The upstream SkillOpt notice is retained in LICENSES/SkillOpt-MIT.txt. ALFWorld vendored code, the paper figure, and benchmark data have separate notices; see THIRD_PARTY_NOTICES.md.
评测代码基于 SkillOpt。本项目采用 MIT 许可证,上游 SkillOpt 的许可声明保留在 LICENSES/SkillOpt-MIT.txt。ALFWorld 中引入的第三方代码、论文图片和基准数据各有相应的许可说明,详见 THIRD_PARTY_NOTICES.md。
