LLM Agent Overview

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Agent Architectures

Basic Reflection Reflexion Actor Language Agent Tree Search Plan-​And-​Execute Reasoning without Observation LLMCompiler

Flow: Based on Reflexion: Language Agents with Based on Language Agent Tree Search Based on Plan-​and-​Solve Prompting: Based on ReWOO: Decoupling Reasoning Based on An LLM Compiler for Parallel
User query is input Verbal Reinforcement Learning (10/10/2023) Unifies Reasoning Acting and Planning in Improving Zero-​Shot Chain-​of-​Thought from Observations for Efficient Augmented Function Calling (02/06/2024)
An initial response is generated with Language Models (12/05/2023) Reasoning by Large Language Models Language Models (05/23/2023)
the first prompt (i.e. essay writer) Flow: (05/26/2023) LLMCompiler pulls on the idea of directed
The response is fed then into a second User query is input Uses LLMs as agents, value functions, and Combines multi-​step planner with variable acyclic graph from compiler design to
reflection prompt (i.e. essay grader) Initial response is generated, along optimizers with the framework of a Monte Flow: substitution for effective tool use to reduce automatically generate an optimized
Reflection step generates critiques with self-​critique, and suggested tool Carlo tree search User query is input token consumption and execution time orchestration for parallel function calling in
and ideas for improvements queries Initial planning prompt comes up with with a full chain of tool use in a single step. a ReAct style setting.
Reflection and initial response is fed Flow: a step-​by-​step approach to completing
into the original prompt to generate a User query is input the query Flow: Flow:
revised draft Initial response is generated as the User query is input User query is input
This repeats N times until it is output starting root node (either an answer Planner generates a plan in the form Planner takes in the input and
back to the user. or a tool execution) of a task list, with special variables as generates a task list with placeholder
the arguments to allow for variables for subsequent task
The first step of the plan is given to substitution dependencies, as well as "thought"
the agent, which generates or lines for reasoning through the plan
executes a tool
Suggested tool queries are executed The original query, original plan, and
(i.e. web searches for more past step output are given to a re-​
information) planner prompt that either updates
Original response, reflection, and the plan, or returns the output to the
additional context from executed Reflection prompt generates a user.
tools, are sent through a revision reflection on the output, a score for
prompt the output, and determines if a
Updates the answer, creates new self-​ solution is found A task fetching unit then parses the
reflection, creates new suggested tool plan, and determines the inter-​
queries dependencies of each step. Tasks that
have no interdependencies are
The plan is parsed, and each step is fetched together and sent to an
executed by the LLM agent executor
As each step is executed, the output is
substituted into the placeholder
Updated step is given back to the variable of the next step, and fed back
agent to execute or generate into the LLM agent
This repeats N times until the final Updated generation, with context of When all steps are complete, the plan
answer is output back to the user An additional N candidates are prior steps, input and plan are given and the "evidence" from tool
generated with the context of the back to the re-​planner execution is fed to a Solver prompt,
prior output and reflection, and tree is This repeats N times until the re-​ which generates and returns a final
expanded planner determines the answer is response to the user The output of the executor is fed back
adequate, and returns to the user. into the task fetching unit to resolve
dependencies, repeating back and
forth until plan is executed
The output of the full executed plan is
then sent to the "Joiner" prompt,
which either determines the final
answer from the context, or appends
a thought to the end of the original
Reflection prompt grades, scores, and plan, and sends it back to the planner
determines each new candidate to replan
Scores for best "trajectory" are If needed to replan, a continuation of
updated the plan is created (not a completely
Starting again from the "best" child new one) and goes through the above
node in the tree, N candidates are loop until the Joiner determines
generated for the next step with enough information is there to return
context of the prior output, reflection an output to the user
and scoring is executed, etc....
Cycle repeats until either high enough
determined score is determined or
max search depth is reached.

Agent Testing
Basic Reflection Reflexion Actor Language Agent Tree Search Plan-​And-​Execute Reasoning without Observation LLMCompiler

Input: What are the


current trends in
digital marketing for
tech companies?
Models: GPT-4-​
Turbo
Report Report Report Report Report Report

Time: 118.99s Time: 69.04s Time: 29.52s Time: 24.72s Time: 21.64s Time: 11.29s
Tokens: 18.106 Tokens: 24,608 Tokens: 8,493 Tokens: 2,922 Tokens: 5,828 Tokens: 2,745
🚨 NOTE 🚨 LangSmith Trace LangSmith Trace LangSmith Trace LangSmith Trace LangSmith Trace LangSmith Trace
These agents are NOT set up to
perform the same
task/prompt/tools or generate
the same output.

This is NOT a scientific


comparison, or determination of
a "best" agent architecture.

Even further
optimizations
make this very
Optimization of fast, albeit this is
plan-​and-​execute
not tuned for full
style agents is
report generation
apparent. Higher
Forced revision tokens yet still less
Surprisingly quick despite processing time
makes tokens generating a lot of
possibilities. Can run away
increase with exponentially if search
long inputs like depth is high. Using LLM as
a scorer however may be
website text very indeterministic Forcing a planning stage
makes it a bit more
efficient than series of
revisions. Tends to
generate decent responses
quicker with its own
guidance

It's making things


up, nothing here is
grounded in any
tool use/external
research. Slow for
processing, token
usage is high

You might also like