# KnowAgent: Knowledge-Augmented Planning for LLM-Based Agents

This <mark style="color:blue;">**March 2024**</mark> paper introduces <mark style="color:blue;">**KNOWAGENT**</mark>, a novel framework designed to improve the planning capabilities of language agents, particularly Large Language Models (LLMs).

These agents are integral in AI for tackling complex problem-solving tasks but struggle with sophisticated challenges that require generating executable actions, a limitation attributed to the lack of inherent action knowledge in the models.

{% embed url="<https://arxiv.org/abs/2403.03101>" %}

KNOWAGENT addresses these challenges by *<mark style="color:yellow;">**integrating an external action knowledge base and employing a knowledgeable self-learning strategy.**</mark>*&#x20;

This approach aims to guide the planning process more effectively, enabling the synthesis of more reasonable and coherent action trajectories, thereby enhancing the model's performance in planning tasks.

The framework operates in several steps:

<mark style="color:green;">**Action Knowledge Base Creation**</mark>

An extensive database of action planning knowledge relevant to specific tasks is developed.&#x20;

This knowledge base serves as an external guide for the model's action generation, providing a repository of actions and their corresponding outcomes.

#### <mark style="color:green;">**Knowledge Integration**</mark>

The action knowledge is converted into a text format that the model can understand and use.&#x20;

This integration *<mark style="color:yellow;">allows the model to incorporate external knowledge into its planning process</mark>*, aiding in the generation of more accurate and viable action sequences.

#### <mark style="color:green;">**Knowledgeable Self-Learning**</mark>

The model undergoes a self-improvement phase where it *<mark style="color:yellow;">**refines its understanding and application of the action knowledge through iterative learning**</mark>*. This phase enhances the model's planning accuracy and adaptability.

<figure><img src="https://2886306417-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FACdZfCIcHTZMeD7FP1N0%2Fuploads%2F4q0tRpqY7FnrcsdQdtoU%2Fimage.png?alt=media&#x26;token=1abe1a4a-4dca-495a-abf8-60b0ea978b60" alt=""><figcaption><p>The Path Generation process of KNOWAGENT</p></figcaption></figure>

### <mark style="color:purple;">Background</mark>

The background section elaborates on how language agents model their interaction with the external world, focusing on generating internal thoughts, executable actions, and observing feedback from the environment.

It describes a *<mark style="color:yellow;">**planning trajectory as a series of thoughts, actions, and observations**</mark>*. This sequence helps the agent make decisions and plan its next steps based on previous interactions.

In the KNOWAGENT approach, the paper introduces a sophisticated methodology where the agent uses external action knowledge to enhance its planning capabilities. This method comprises three main steps:

<mark style="color:blue;">**Action Knowledge Definition:**</mark> This part focuses on defining the <mark style="color:yellow;">**action knowledge**</mark> that guides the agent. This knowledge is stored in an action knowledge base, detailing various actions the agent can perform and the associated rules or guidelines for these actions.

<mark style="color:blue;">**Planning Path Generation:**</mark> Using the action knowledge, the agent <mark style="color:yellow;">generates planning paths</mark>. These paths are sequences of actions that the agent could take to achieve its goals. The process involves converting the action knowledge into textual descriptions that the language model can understand and use to formulate plans.

<mark style="color:blue;">**Knowledgeable Self-Learning:**</mark> The agent iteratively refines its planning paths based on the outcomes of its actions. This <mark style="color:yellow;">**self-learning mechanism**</mark> allows the agent to improve its planning capabilities over time, using feedback from its environment and the results of previous plans to make better-informed decisions.

### <mark style="color:purple;">Results</mark>

This section of the paper discusses the experimental setup, results, and analysis of the KNOWAGENT model, which aims to improve the planning capabilities of language agents by integrating explicit action knowledge.&#x20;

<mark style="color:green;">**Main Results**</mark>

* KNOWAGENT consistently outperforms prompt-based methods across different datasets and model sizes.
* The model shows significant improvements over <mark style="color:blue;">**ReAct**</mark>, particularly on the 13b model, highlighting KNOWAGENT's effectiveness in planning path generation.
* Results demonstrate KNOWAGENT's superiority in planning, especially in mitigating planning hallucinations, by adhering to the defined action knowledge.

<details>

<summary><mark style="color:green;">What is the ReAct model?</mark></summary>

The React model, detailed in a paper at ICLR 2023, introduced a novel approach that combined reasoning and acting through language models to enhance task solving in language reasoning and interactive decision-making contexts.&#x20;

The model, referred to as ReAct, interleaves verbal reasoning traces and task-specific actions, enabling dynamic updates to action plans and integration of external information, such as data from APIs like Wikipedia.

</details>

<mark style="color:green;">**Planning Path Generation and Refinement**</mark>

* KNOWAGENT synthesises and refines trajectories using an iterative self-learning process that incorporates action knowledge to filter and merge trajectories, enhancing planning accuracy.
* Ablation studies on action knowledge show that incorporating action knowledge significantly improves model performance and planning quality.

<mark style="color:green;">**Error Analysis**</mark>

* KNOWAGENT shows limitations in handling complex queries and summarising extensive textual data, indicating areas for future improvement in long-text processing and reasoning capabilities.

<mark style="color:green;">**Distilled Knowledge vs. Manually Designed Knowledge**</mark>

* The comparison between manually crafted and distilled action knowledge (from GPT-4) reveals that distilled knowledge is more concise and efficient for simpler tasks.
* For complex tasks requiring longer action sequences, manually designed knowledge outperforms the distilled approach, emphasizing the value of human input in constructing action knowledge.

<mark style="color:green;">**Performance Metrics**</mark>

* The effectiveness of KNOWAGENT is quantified using F1 scores and success rates, with detailed results presented in tables, showing KNOWAGENT's superior performance in planning tasks.

<mark style="color:green;">**Knowledgeable Self-Learning**</mark>

* The iterative fine-tuning process of KNOWAGENT leverages action knowledge to progressively refine the model's planning capabilities, demonstrating the model's ability to learn and improve over iterations.

This detailed analysis highlights KNOWAGENT's innovative approach to enhancing the planning capabilities of language agents by leveraging external action knowledge, demonstrating its effectiveness through comprehensive experiments and analyses.

### <mark style="color:purple;">Conclusion</mark>

KNOWAGENT addresses planning hallucinations by using external action knowledge to inform the generation of synthetic trajectories, enhancing agents' planning proficiency.

The framework employs a self-learning mechanism, translating action knowledge into text for the model's better understanding and utilizing it to guide action generation, demonstrating significant performance improvements over other methods.

Experiments validate KNOWAGENT's efficacy across different models and tasks, establishing its potential in reducing planning errors and enhancing overall agent performance.
