(2024-02-24) Nextra Llm Agents

Nextra: on LLM Agents. ...involve LLM applications that can execute complex tasks through the use of an architecture that combines LLMs with key modules like planning and memory

To better motivate the usefulness of an LLM agent, let's say that we were interested in building a system that can help answer the following question: What's the average daily calorie intake for 2023 in the United States?

The question above could potentially be answered using an LLM that already has the knowledge needed to answer the question directly.

Now let's give the system a more complex question like the following: How has the trend in the average daily calorie intake among adults changed over the last decade in the United States, and what impact might this have on obesity rates? Additionally, can you provide a graphical representation of the trend in obesity rates over this period?

To answer such a question, just using an LLM alone wouldn't be enough

A possible solution is to build an LLM agent that has access to a search API, health-related publications, and public/private health database to provide relevant information related to calorie intake and obesity.

LLM Agent Framework

Generally speaking, an LLM agent framework can consist of the following core components:
User Request - a user question or request
Agent/Brain - the agent core acting as coordinator
Planning - assists the agent in planning future actions
Memory - manages the agent's past behaviors

Agent

A large language model (LLM) with general-purpose capabilities serves as the main brain, agent module, or coordinator of the system

prompt template that entails important details about how the agent will operate, and the tools it will have access to (along with tool details).

Planning

Planning Without Feedback

The planning module helps to break down the necessary steps or subtasks the agent will solve individually to answer the user request

Popular techniques for task decomposition include Chain of Thought (opens in a new tab) and Tree of Thoughts (opens in a new tab) which can be categorized as single-path reasoning and multi-path reasoning, respectively

Planning With Feedback

you can leverage a mechanism that enables the model to iteratively reflect and refine the execution plan based on past actions and observations.

Two popular methods for this reflection or critic mechanism include ReAct (opens in a new tab) and Reflexion (opens in a new tab).

Memory

The memory module helps to store the agent's internal logs including past thoughts, actions, and observations from the environment, including all interactions between agent and user

Short-term memory -

Long-term memory -

Tools

such as Wikipedia Search API, Code Interpreter, and Math Engine. Tools could also include databases, knowledge bases, and external models.

Notable LLM-based Agents

LLM Agent Tools

LLM Agent Evaluation

Challenges


Edited:    |       |    Search Twitter for discussion