ALFWorld: 具身智能交互式环境决策基准与 SkillOpt 规划流全景
展示具身 Agent 在 ALFWorld 离散文本模拟器中的闭环拓扑。环境返回当前房间的文本观察(Observation)和可用动作列表(Admissible Commands),SkillOpt 通过记忆库与 Meta-Skill 指引 LLM 进行行动决策;一旦发生死锁或超步淘汰,系统反思并重构行动规划技能(Action Policy Skill)。
/mnt/xieshan/datasets/skillopt/alfworld/json_2.1.1/• game.tw-pddl (World Logic)
• traj_data.json (Oracle Demos)
Room graph, Receptacles, Objects, Light states, Inventory
data/alfworld_path_split/• train: 39 | val: 18 | test: 134
Agent 依规划生成动作
take alarmclock 1Max 50 steps timeout
捕获死循环/未知指令
"Nothing happens."标记死锁阶段
解构复杂具身目标
(Find ➔ Take ➔ Locate Lamp ➔ Toggle)
在
valid_unseen 环境验证保证规划泛化能力
二进制指标 (达成最终环境 PDDL Goal)
阶段性子目标完成率百分比
Oracle Path Length / Agent Steps
对齐展示 ALFWorld 真实测试样本(look_at_obj_in_light-AlarmClock...)。展现从初始环境感知、动作决策死锁,到自然语言梯度干预并生成结构化规划技能的完整推演过程。
加载 game.tw-pddl 仿真器,初始化房间家具、道具位置与智能体背包,提取初始观测文本。
[Goal]: "look at the clock under the lamp" [Observation]: "You are in the middle of a room. Looking quickly around you, you see a bed 1, a desklamp 1, a drawer 1, a sidetable 1, and a garbagecan 1." [Inventory]: Nothing in hand. [Initial Policy]: "You are an embodied helper. Explore the room, find the required item, and complete the user task using valid commands."
Agent 拿到 AlarmClock 后,直接尝试执行 examine alarmclock 1,而忽略了“必须在开着的台灯光源下”的前提条件,导致动作被环境判定为无效,连续 10 步空转直至超时失败。
Step 1: go to sidetable 1 ➔ "On the sidetable 1, you see an alarmclock 1." Step 2: take alarmclock 1 from sidetable 1 ➔ "You pick up the alarmclock 1." Step 3: examine alarmclock 1 ➔ "Nothing happens. (Not enough light to see detail)" Step 4: look at alarmclock 1 ➔ "Nothing happens." ... [Looping same invalid action for 30 steps] ... Step 50: Timeout! Task marked FAILED.
Analyst 解析环境反馈,定位死锁根源:任务属于 look_at_obj_in_light 类型,必须先 use/turn on desklamp 使光源激活,然后在光源处使用对象。
[Textual Reflection]: "For 'look_at_obj_in_light', taking the object is step 1. Step 2 MUST be locating a light source (desklamp/floorlamp), turning it on, and then inspecting the item." [Mutated Policy Skill]: "### Sub-Goal Decomposition for Light Inspection: 1. Locate and pick up target item [OBJ]. 2. Search room for a light source [LAMP] (desklamp, floorlamp). 3. Execute `go to [LAMP]` followed by `use [LAMP]` to turn on the light. 4. Execute `use [OBJ]` or `examine [OBJ]` at the illuminated location."
将新技能部署到相同测试环境中重跑,Agent 遵循分层子目标,在第 5 步即达成环境 Goal 状态。
Step 1: go to sidetable 1 ➔ "On sidetable 1, you see alarmclock 1." Step 2: take alarmclock 1 from sidetable 1 ➔ "You pick up the alarmclock 1." Step 3: go to desklamp 1 ➔ "You arrive at desklamp 1." Step 4: use desklamp 1 ➔ "You turn on the desklamp 1. The desk is brightly illuminated." Step 5: use alarmclock 1 with desklamp 1 ➔ "Task Completed! (Reward = 1.0)"
在
skillopt/envs/alfworld/adapter.py 中维护滑动窗口哈希。若智能体连续 3 步重复相同命令或环境返回相同状态,强制在 Prompt 中插入反思注入语句("You have tried this action multiple times with no effect, select another strategy")。
每步环境提供上百条语法合法的候选指令。系统基于当前语义目标进行语义过滤(Top-K Rerank),将候选动作压缩至 15 条以内,极大降低决策幻觉率与 API 开销。
基于 TextWorld 的序列化能力,在关键转折点(如拿到关键道具前)保存内存 Snapshot。当遭遇不可逆失败时,支持 Rollout 进行局部分支重试,用于高价值反思。
禁止在 Prompt 中硬编码具体房间物件名称(如 "sidetable 1"),强制 Proposer 将策略抽象为具身范型("receptacle containing target object"),确保策略在未见过的房间布局中依然稳健。
Stage 0 (痛点触发): 传统的 LLM Agent 面对多步具身任务极易“顾头不顾尾”,往往在探索中耗尽步数。人工调试 Few-Shot Prompt 难以覆盖全部 6 大任务类型(Pick, Clean, Heat, Cool, Examine, Put Two)。
Stage 1 (强化学习 vs 文本梯度): 传统强化学习(如 PPO)优化 ALFWorld 需要数百万步交互且难以调试策略;SkillOpt 将失败轨迹直接当做代码/提示词 bug 提交给 Analyst,反思出模块化 Sub-Goal,相当于在自然语言空间中直接优化策略网络(Policy Network)。
Stage 2 (跨任务知识沉淀): 经过数个 Epoch 迭代后,生成的 Meta-Skill 沉淀出通用具身常识库(如:“要加热物品必须先找微波炉;要检查物品必须先开灯”),实现了跨场景零样本泛化。
| 文件 / 契约要素 | 格式 / 类型 | 说明与环境职责 |
|---|---|---|
game.tw-pddl |
PDDL / TextWorld |
定义世界的逻辑原语、动作先验、谓词逻辑与最终胜出判断条件。 |
initial_state.pddl |
PDDL State |
物体初始分布(如 alarmclock 在 sidetable 1,desklamp 在 desk 1)。 |
traj_data.json |
JSON |
专家标准轨迹与多人类语言描述标注(Turk Annotations)。 |
split_manifest.json |
Manifest JSON |
记录划分:Train (39) / Val (18) / Test (134),覆盖 6 大交互任务类。 |
| 评测模型 / 策略配置 | Seen Tasks (成功率) | Unseen Tasks (成功率) | 平均步数 (越低越好) | 相对增益幅度 |
|---|---|---|---|---|
| ReAct (Zero-Shot Baseline) | 48.0% | 44.0% | 28.4 | Baseline |
| Reflexion (Shinn et al.) | 67.0% | 62.0% | 21.3 | +18.0pp |
| SkillOpt (Ours - Qwen-2.5-7B) | 78.4% | 73.1% | 15.6 | +29.1pp |
| SkillOpt (Ours - GPT-4o-mini) | 88.5% | 84.2% | 12.8 | +40.2pp |