NL2Plan: 基于最小文本描述的魯棒性大模型驅(qū)動任務(wù)規(guī)劃 精華
在AI規(guī)劃領(lǐng)域,傳統(tǒng)的規(guī)劃器(如Fast Downward)雖然功能強大,但它們需要將輸入任務(wù)建模為PDDL(Problem Domain Definition Language)格式,這是一個繁瑣且容易出錯的過程。相比之下,使用大型語言模型(LLMs)進(jìn)行規(guī)劃可以接受幾乎任何文本輸入,但不保證計劃的質(zhì)量和完整性。為了結(jié)合這兩種方法的優(yōu)點,一些研究工作開始利用LLMs自動化PDDL創(chuàng)建過程的部分內(nèi)容。然而,這些方法仍然需要不同程度的專家輸入。
為此提出了NL2Plan,這是一個首個與領(lǐng)域無關(guān)的離線LLM驅(qū)動規(guī)劃系統(tǒng)。NL2Plan使用LLM逐步從簡短的文本提示中提取必要信息,然后創(chuàng)建一個完整的PDDL描述,包括領(lǐng)域和問題描述,最終由傳統(tǒng)規(guī)劃器求解。
NL2Plan及其六個步驟的流程圖。在“類型提取”步驟中,生成一組對象類型,然后由“類型層級”步驟將其結(jié)構(gòu)化為樹形結(jié)構(gòu)。接下來,“動作提取”步驟創(chuàng)建一個自然語言動作描述的列表,而“動作構(gòu)建”步驟則在PDDL(規(guī)劃領(lǐng)域定義語言)中將其形式化?!叭蝿?wù)提取”是最后一個由大型語言模型(LLM)驅(qū)動的步驟,它創(chuàng)建初始狀態(tài)和目標(biāo)描述。最后,“規(guī)劃”步驟使用自動規(guī)劃器生成計劃或顯示所建模的任務(wù)無法解決。在每個由LLM驅(qū)動的步驟中,人類或LLM實例都可以選擇性地對解決方案提供進(jìn)一步的反饋。用戶只需要與NL2Plan交互以提供自然語言任務(wù)。
NL2Plan的六個步驟:
- 類型提取 (Type Extraction):
- 利用LLM定義任務(wù)中應(yīng)包含的對象類型。
- 例如,對于物流規(guī)劃問題,可能需要定義城市、位置、機(jī)場、飛機(jī)、卡車和包裹等類型。
- 層次結(jié)構(gòu)構(gòu)建 (Hierarchy Construction):
- 組織在類型提取步驟中定義的類型,形成層級結(jié)構(gòu)。
- 確定哪些類型是其他類型的子類型,例如,飛機(jī)和卡車可以是車輛的子類型。
- 動作提取 (Action Extraction):
- 描述基于已定義類型和世界知識,任務(wù)中應(yīng)該可用的動作。
- 動作以名稱、描述和使用示例的形式呈現(xiàn),LLM還可以推理出應(yīng)包含哪些其他動作。
- 動作構(gòu)建 (Action Construction):
- LLM一次定義一個動作,生成其參數(shù)、前提條件和效果。
- 動態(tài)創(chuàng)建新謂詞以供當(dāng)前和后續(xù)動作使用,并通過自動驗證工具進(jìn)行驗證。
- 任務(wù)提取 (Task Extraction):
- 生成PDDL問題規(guī)范,包括對象、初始狀態(tài)和目標(biāo)條件。
- 接受自然、非結(jié)構(gòu)化的初始狀態(tài)和目標(biāo)條件描述,與以前的方法相比,NL2Plan不需要程序化和結(jié)構(gòu)化地生成這些狀態(tài)。
- 規(guī)劃 (Planning):
- 使用經(jīng)典規(guī)劃器解決生成的PDDL任務(wù)。
- 如果規(guī)劃器未能找到計劃,NL2Plan會得出結(jié)論,即建模的PDDL任務(wù)無法解決,并返回“未找到計劃”。?
NL2Plan步驟的說明性輸入輸出對
自動LLM驅(qū)動的類型提取反饋子步驟的說明性示例。檢查清單在NL2Plan的不同步驟中會有所不同
NL2Plan在四個規(guī)劃領(lǐng)域上進(jìn)行了評估,成功解決了10個任務(wù)中的15個,明顯優(yōu)于直接應(yīng)用LLM的鏈?zhǔn)剿伎纪评矸椒?,后者僅解決了2個任務(wù)。此外,NL2Plan在兩個失敗案例中沒有返回?zé)o效計劃,而是報告未能解決任務(wù)。
生成計劃的總結(jié)。勾號表示成功的計劃,叉號表示失敗的計劃,而“~”表示有疑問的計劃。在后兩種情況下,描述了缺陷。
使用PDDL表示還允許用戶理解NL2Plan如何解釋任務(wù)以及它為什么以某種方式進(jìn)行規(guī)劃,這使得生成的計劃是可解釋的,并減少了應(yīng)用LLMs的黑箱特性。NL2Plan從簡單輸入生成PDDL的能力,也使其成為協(xié)助人類為新領(lǐng)域創(chuàng)建領(lǐng)域描述的工具。
附錄:
Blocksworld領(lǐng)域的任務(wù)和計劃示例。CoT(任務(wù)描述)動作描述和NL2Plan名稱已被縮短。成功的計劃用綠色標(biāo)記。失敗的計劃及其第一個無效動作用紅色標(biāo)記??赡芘c用戶意圖不同或類似的可疑計劃用橙色標(biāo)記。
ISR領(lǐng)域的任務(wù)和計劃示例。CoT動作描述和NL2Plan名稱已被縮短。成功的計劃用綠色標(biāo)記。失敗的計劃及其第一個無效動作用紅色標(biāo)記??赡芘c用戶意圖不同或類似的可疑計劃用橙色標(biāo)記?!皩㈨旤c添加到集合”的動作被實現(xiàn)為“重新配置集合”的動作,將第一個參數(shù)添加到集合中并移除第二個參數(shù)。
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
- “l(fā)oaded” 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
本文轉(zhuǎn)載自 ??PaperAgent???,作者: PaperAgent
