NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划 精华

发布于 2024-5-9 10:43
浏览
0收藏

在AI规划领域,传统的规划器(如Fast Downward)虽然功能强大,但它们需要将输入任务建模为PDDL(Problem Domain Definition Language)格式,这是一个繁琐且容易出错的过程。相比之下,使用大型语言模型(LLMs)进行规划可以接受几乎任何文本输入,但不保证计划的质量和完整性。为了结合这两种方法的优点,一些研究工作开始利用LLMs自动化PDDL创建过程的部分内容。然而,这些方法仍然需要不同程度的专家输入。

为此提出了NL2Plan,这是一个首个与领域无关的离线LLM驱动规划系统。NL2Plan使用LLM逐步从简短的文本提示中提取必要信息,然后创建一个完整的PDDL描述,包括领域和问题描述,最终由传统规划器求解。

NL2Plan及其六个步骤的流程图。在“类型提取”步骤中,生成一组对象类型,然后由“类型层级”步骤将其结构化为树形结构。接下来,“动作提取”步骤创建一个自然语言动作描述的列表,而“动作构建”步骤则在PDDL(规划领域定义语言)中将其形式化。“任务提取”是最后一个由大型语言模型(LLM)驱动的步骤,它创建初始状态和目标描述。最后,“规划”步骤使用自动规划器生成计划或显示所建模的任务无法解决。在每个由LLM驱动的步骤中,人类或LLM实例都可以选择性地对解决方案提供进一步的反馈。用户只需要与NL2Plan交互以提供自然语言任务。

NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划-AI.x社区


NL2Plan的六个步骤:

  1. 类型提取 (Type Extraction):
  • 利用LLM定义任务中应包含的对象类型。
  • 例如,对于物流规划问题,可能需要定义城市、位置、机场、飞机、卡车和包裹等类型。
  1. 层次结构构建 (Hierarchy Construction):
  • 组织在类型提取步骤中定义的类型,形成层级结构。
  • 确定哪些类型是其他类型的子类型,例如,飞机和卡车可以是车辆的子类型。
  1. 动作提取 (Action Extraction):
  • 描述基于已定义类型和世界知识,任务中应该可用的动作。
  • 动作以名称、描述和使用示例的形式呈现,LLM还可以推理出应包含哪些其他动作。
  1. 动作构建 (Action Construction):
  • LLM一次定义一个动作,生成其参数、前提条件和效果。
  • 动态创建新谓词以供当前和后续动作使用,并通过自动验证工具进行验证。
  1. 任务提取 (Task Extraction):
  • 生成PDDL问题规范,包括对象、初始状态和目标条件。
  • 接受自然、非结构化的初始状态和目标条件描述,与以前的方法相比,NL2Plan不需要程序化和结构化地生成这些状态。
  1. 规划 (Planning):
  • 使用经典规划器解决生成的PDDL任务。
  • 如果规划器未能找到计划,NL2Plan会得出结论,即建模的PDDL任务无法解决,并返回“未找到计划”。​

NL2Plan步骤的说明性输入输出对

NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划-AI.x社区


自动LLM驱动的类型提取反馈子步骤的说明性示例。检查清单在NL2Plan的不同步骤中会有所不同

NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划-AI.x社区


NL2Plan在四个规划领域上进行了评估,成功解决了10个任务中的15个,明显优于直接应用LLM的链式思考推理方法,后者仅解决了2个任务。此外,NL2Plan在两个失败案例中没有返回无效计划,而是报告未能解决任务。

生成计划的总结。勾号表示成功的计划,叉号表示失败的计划,而“∼”表示有疑问的计划。在后两种情况下,描述了缺陷。

NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划-AI.x社区

NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划-AI.x社区

使用PDDL表示还允许用户理解NL2Plan如何解释任务以及它为什么以某种方式进行规划,这使得生成的计划是可解释的,并减少了应用LLMs的黑箱特性。NL2Plan从简单输入生成PDDL的能力,也使其成为协助人类为新领域创建领域描述的工具。

附录:

Blocksworld领域的任务和计划示例。CoT(任务描述)动作描述和NL2Plan名称已被缩短。成功的计划用绿色标记。失败的计划及其第一个无效动作用红色标记。可能与用户意图不同或类似的可疑计划用橙色标记。

NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划-AI.x社区

ISR领域的任务和计划示例。CoT动作描述和NL2Plan名称已被缩短。成功的计划用绿色标记。失败的计划及其第一个无效动作用红色标记。可能与用户意图不同或类似的可疑计划用橙色标记。“将顶点添加到集合”的动作被实现为“重新配置集合”的动作,将第一个参数添加到集合中并移除第二个参数。

NL2Plan: 基于最小文本描述的鲁棒性大模型驱动任务规划-AI.x社区

NL2Plan Step Prompt Schemas and Examples

  • Type Extraction step

# Role
Your task is to identify the different types of objects which exist and are relevant in a domain. [Further task details.]
# Example
[Chain-of-Thought Example]
# Task
## Domain
The AI agent here is a logistics planner that has to plan to transport packages within the locations in a city through a truck and
between cities through an airplane. In a city, all the locations are connected. Similarly, cities are directly connected allowing airplanes
to travel between them. Also, there is no limit to how many packages a truck or plane can carry.
Currently, I’ve got four packages to ship. . .
## Types
First, we need types related to locations and transportation.
‘‘‘
- city: Each city contains an airport and other locations.
- location: Places within cities trucks can visit.
- airport: A location where planes land and take off.
‘‘‘
Next, we consider the transportation vehicles.
‘‘‘
- plane: A type of vehicle used for transporting packages between cities.
- truck: A type of vehicle used for transporting packages within a city.
‘‘‘
Lastly, we need the to define the items being transported.
‘‘‘
- package: An item that needs to be transported from one location to another.
‘‘‘
  • Type Hierarchy step

# Role
Your task is to identify the different types of objects which exist and are relevant in a domain. [Further task details.]
# Example
[Chain-of-Thought Example]
# Task
## Domain
The AI agent here is a logistics planner that has to plan to transport packages within the locations in a city through a truck and
between cities through an airplane. In a city, all the locations are connected. Similarly, cities are directly connected allowing airplanes
to travel between them. Also, there is no limit to how many packages a truck or plane can carry.
Currently, I’ve got four packages to ship. . .
## Types
First, we need types related to locations and transportation.
‘‘‘
- city: Each city contains an airport and other locations.
- location: Places within cities trucks can visit.
- airport: A location where planes land and take off.
‘‘‘
Next, we consider the transportation vehicles.
‘‘‘
- plane: A type of vehicle used for transporting packages between cities.
- truck: A type of vehicle used for transporting packages within a city.
‘‘‘
Lastly, we need the to define the items being transported.
‘‘‘
- package: An item that needs to be transported from one location to another.
‘‘‘
  • Action Extraction step

# Role
Your task is to identify what actions an AI Agent would have available in a domain. [Further task details.]
# Example
[Chain-of-Thought Example]
# Task
## Domain
The AI agent here is a logistics planner that has to plan to transport packages. . .
Currently, I’ve got four packages to ship. . .
##Types:
- object: Everything is an object
- city: Each city contains. . .
- location: Places within cities. . .
- airport: A location where planes. . .
- vehicle: Vehicles transport packages.
- truck: A type of vehicle. . . .
- plane: A type of vehicle. . .
- package: An item that needs to. . .
##Actions
###Package related actions
Packages need to be loaded onto vehicles and unloaded at the destination.
‘‘‘
load package
A package is loaded onto a vehicle at a location. Requires that the package and the truck to be at the same location. Example:
package 1 is loaded onto truck 1 at location 1.
‘‘‘
‘‘‘
unload package
A package is unloaded from a vehicle at a location. Requires the package to be on the vehicle and the vehicle to be at the destination
location. Example: package 2 is unloaded from plane 1 at airport 1.
‘‘‘
[Further headers and actions.]
  • Action Construction step

# Role
You are defining the preconditions and effects (represented in PDDL format) of an AI agent’s actions. [Further task details.]
# Example
[Chain-of-Thought Example]
# Task
## Domain
The AI agent here is a logistics planner that has to plan to transport packages. . .
Currently, I’ve got four packages to ship. . .
##Types:
- object: Everything is an object
- city: Each city contains. . .
- location: Places within cities. . .
- airport: A location where planes. . .
- vehicle: Vehicles transport packages.
- truck: A type of vehicle. . . .
- plane: A type of vehicle. . .
- package: An item that needs to. . .
## Future actions
The following actions will be defined later and together they make up the entire domain:
- load package: A package is loaded. . .
- unload package: A package is unloaded. . .
[Remaining actions.]
## Action
load package
A package is loaded onto a vehicle at a location. Requires that the package and the truck to be at the same location. Example:
package 1 is loaded onto truck 1 at location 1.
### Available Predicates
No predicate has been defined yet.
### Action Parameters
First, we need to know which vehicle and package are being loaded:
‘‘‘
- ?v - vehicle: The vehicle being loaded.
- ?p - package: The package being loaded.
‘‘‘
Lastly, we need to know where the loading is taking place:
‘‘‘
- ?l - location: The location where the loading happens.
‘‘‘
### Action Preconditions
To be able to load at ?l it’s specified that:
1: The vehicle is at the location.
2: The package is at the location.
For this we need a predicate:
- “at” to define where something is. This should work for both packages and vehicles, so let’s define “(at ?o - object ?l - location)”
Let’s specify this in PDDL:
‘‘‘
(and ; All these have to hold
(at ?v ?l) ; The vehicle is at the location
(at ?p ?l) ; The package is at the location
)
‘‘‘
### Action Effects
So, what happens when the action is performed?
- The package is no longer at the location
- The package is instead inside the vehicle
For this, we need a new predicate
- “loaded” to specify when and where a package is loaded. “(loaded ?p - package ?v - vehicle)”
Specifying this in PDDL we get:
‘‘‘
(and ; All these have to hold
(not (at ?p ?l)) ; The package is not at the location
(loaded ?p ?v) ; The package is instead loaded in the vehicle
)
‘‘‘
### New Predicates
We used two new predicates. Those have to be specified and re-iterated:
‘‘‘
- (at ?o - object ?l - location): true if the object ?o (a vehicle or package) is at the location ?l
- (loaded ?p - package ?v - vehicle): true if the package ?p is loaded in the vehicle ?v
‘‘‘
  • Task Extraction step

# Role
Your task is to estimate the initial state and the goal state for a PDDL problem based on a domain description and the available
actions. [Further task details.]
# Example
[Chain-of-Thought Example]
# Task
## Domain
The AI agent here is a logistics planner that has to plan to transport packages. . .
Currently, I’ve got four packages to ship. Two are in a London storage and the rest in Paris. Those from London should be
sent to Addr1 in Berlin and to Addr2 in Paris. Those from Paris should both be moved to the London storage.
##Types:
- object: Everything is an object
- city: Each city contains. . .
- location: Places within cities. . .
- airport: A location where planes. . .
- vehicle: Vehicles transport packages.
- truck: A type of vehicle. . . .
- plane: A type of vehicle. . .
- package: An item that needs to. . .
## Predicates
- (at ?o - object ?l - location): true if the object ?o (a vehicle or package) is at the location ?l
- (loaded ?p - package ?v - vehicle): true if the package ?p is loaded in the vehicle ?v
[Further predicates.]
## Object Instances
There are four packages. The first two start in London, and the remaining two start in Paris:
‘‘‘
- L1 - package: The first London package
- L2 - package: The second London package
- P1 - package: The first Paris package
- P2 - package: The second Paris package
‘‘‘
[Further object instances.]
## State
The London packages all start in the London storage:
‘‘‘
(at L1 LStorage): The first London package location
(at L2 LStorage): The second London package location
‘‘‘
[Further initial predicates.]
## Goal
The goal is for L1 to go to Addr1 and for L2 to be delivered to Addr2, as well as for both P1 and P2 to be transported to London
storage. Here’s how we can define the goal:
‘‘‘
(and ; All these have to hold
(at L1 Addr1)) ; L1 is delivered
(at L2 Addr2)) ; L1 is delivered
(at P1 LStorage)) ; L1 is delivered
(at P2 LStorage)) ; L1 is delivered
)
‘‘‘


NL2Plan: Robust LLM-Driven Planning from Minimal Text Descriptions
https://arxiv.org/pdf/2405.04215

本文转载自 PaperAgent​,作者: PaperAgent

收藏
回复
举报
回复
相关推荐