“ The agent runs in a loop of Thought, Action, Observation, Thought, ...
The Thought and Action (with the Action Input to the action) are the parts which are generated by an LLM
The Observation is generated by using a tool (for example the print outputs of Python or the text result of a Google search)”
Really neat to see the parallels to OODA loops, which are a frequent feature (implicit or explicit) of human decision-making processes.
I had never heard of those, or PDCA before, but I'm working on a startup in this space (AI Agents), and found PDCA by just using bing's suggestions i.e. OODA loops vs ...
Anyhow, I think PDCA looks more promising actually, a little more logical/analytical IMHO.... but don't take my word for it, here's what gpt4 had to say :
Which would be a better framework for AI agents working in steps and loops to complete tasks? OODA or PDCA?
Both the OODA loop and PDCA (Plan, Do, Check, Act) cycle can be applied as frameworks for AI agents to go through retrospection phases or steps while performing tasks. The choice between the two depends on the specific context and the desired outcome of the retrospection process. Let's examine both frameworks in this context:
OODA loop:
Observe: The AI agent gathers information about its current task, the environment, and any potential obstacles.
Orient: The AI agent processes and analyzes the collected information, updates its understanding, and identifies possible actions.
Decide: The AI agent chooses the best course of action based on the available information.
Act: The AI agent executes the chosen action, observes the results, and adjusts its approach as needed.
In this context, the OODA loop is well-suited for situations where the AI agent needs to make rapid decisions and adapt quickly to changing circumstances, such as real-time or highly dynamic environments.
PDCA cycle:
Plan: The AI agent develops a plan or strategy for accomplishing its task, based on its knowledge and understanding of the problem.
Do: The AI agent executes the plan, carrying out the necessary actions to complete the task.
Check: The AI agent evaluates the results of its actions, comparing them to the desired outcome or goal.
Act: The AI agent makes adjustments or improvements to its plan based on the results of the evaluation, and then iterates through the PDCA cycle again.
In this context, the PDCA cycle is more focused on continuous improvement and learning, making it a better fit for situations where the AI agent has a clearly defined goal or objective and can iteratively refine its approach over time.
Ultimately, the choice between the OODA loop and PDCA cycle depends on the specific requirements and goals of your AI agent. You may even find that a hybrid approach, combining elements from both frameworks, is the most effective solution for your AI agent's retrospection process.
The real secret to the OODA loop was Boyd's observation that there is a positive feedback loop between the orientation -> observation that is devoid of input from the external world and if you can trigger that part of the OODA loop you can get your adversary to behave in a way which takes them away from their goals.
Mostly people just see it as a circle in a PowerPoint slide and it has close to zero utility in that form.
Cool stuff. I think agents are the most promising and potentially revolutionary part of the current LLM developments. Moreover, they're quite easy to write yourself, you don't need something like Langchain, the prompt structure is simple and it's a bit of text templating (it's all based on the ReAct paper[0]).
That said, the bit about "The trick to avoid hallucination" in the attached blog post is a very neat idea. Obvious in hindsight, as it often is:
> So the trick is that we send a stop pattern which in this case is when we see Observation: in it’s output, because then it has created a Thought, an Action and used a tool and hallucinates the Observation: itself :D
> This stop parameter is a normal parameter of the OpenAI API by the way, so nothing special to implement there.
In general, it's magical when you put these things in a feedback loop. The way they can automatically respond to errors and adjust their actions is really cool - take a look at the last gif here[1].
This is cool. I haven't seen any good/useful agents built using GPT4 yet, doesn't seem for lack of trying, but maybe some good libraries for building them will help. There's some good ideas in this one.
That said, while I am very, very impressed with GPT4 for lots of uses right now, so far it's just not clear to me that feeding it back into itself is fruitful at this point.
When I use GPT4 for coding, I give it MUCH higher level instructions than I use on a search engine, much closer to the actual problem I'm solving. But I'm still breaking the problem down into smaller problems; I need to read the output, fix errors or instruct it to fix errors, and then have it build more features on. It's similar with creative processes, brainstorming, and other writing.
These agents largely strike me as an attempt to replace this whole fact-checking/editing type routine with the LLM itself; but seeing as it's the thing the LLM is not yet good at, I'm not sure how much progress can be made there, vs just waiting for GPT5 and hoping it's another big leap in capabilities.
Yeah it's possible that running everything more than once produces better output, at a multiple of the price and time. Presumably you usually ask that question when you have some reason to think the answer can be improved, though.
Yes, I think there is tons of value in plugins. I also think some of the stuff going into agents is very valuable right now; prompt management, context management. (And some downstream stuff of those things, hallucination reduction, fitting it into essentially some DSL, stuff like that.)
Just not sure feeding it back to itself does much at the moment.
That doesn't really sound like an agent, so maybe "is an agent" isn't binary, in how I'm thinking about it anyway.
If it 0-shots something and executes it and halts, not an agent, if it observes output and loops once, that's a minimal agent. I'm not super skeptical of a couple loops; I just don't know that GPT4 has what it takes to drive a larger number of loops.
Hypothetically one could argue but practically I’d argue it will eventually need to train and fine tune itself and for that we need boost in computing. At least this is my guess.
Maybe another Winter was staved off by the heat of a million GPU suns (energy consumption notwithstanding).
In the future, we'll spray our GPUs with little spritzes from a water bottle, because something-something harvesting of photosynthetic electron leakage.
I did similar experiments with GPT4 and Soulver[1], though I "tuned" it by teaching it Soulver interactively before continuing to prompt. It can then be used in the same way. My primary goal was to add basic calculation capabilities to GPT, that are: a) guaranteed to halt (all Soulver sheets are functions) and b) readable by both GPT and the user (a Python program may be too dev-oriented for normal people).
It worked quite well. To well almost: I started a meta-conversation where I asked another GPT4 instance to come up with conversations SoulverGPT could have with a user where the addition of solving is beneficial. This worked, and eventually even found a bug in Soulver - essentially fuzzing the language.
Also did some early experiments but didn't go very far. If someone wants to investigate: use structural code analysis tools (parser-parser-generators) like Comby[1] to factor existing code, letting GPT remix it instead of generating test cases all by itself.
A tool like this with a single-step mode (a UI to preview what it will do before it does it) might be nice. Ideally you could collect traces of a repetitive task and eventually turn the traces into a script that doesn't need the LLM, and therefore isn't so expensive to run.
Works great thank you for sharing! Faster than Langchain on baisc stuff so far and I do love the simple nature of it. Might make a Reddit tool real quick and a PR for it.
If I had GPT-4 API access, it would have found that on the first try. Sigh.
--
I've noticed it does skip the thought process sometimes.
Question: Who is the president? What year whas he born. Name one other famous person born in that year.
Thought:
Final answer is The current president of the United States is Joe Biden, born in 1942. Some other famous people born in the same year include Harrison Ford, Muhammad Ali, and Aretha Franklin.
What all these tools need to adopt is sending 10-20 requests out and finding the "best" response. I think it's incorrect that we try to get the tool to work right the first time. Auto-GPT has JSON parse errors 20-50% of the time. Instead, with enough parallel responses we can increase the likelihood one of them is "really good". The next challenge is figuring out which answer is really good and continuing with that.
This makes so much more sense than langchain! I read all the docs for langchain, but the abstractions seemed broken and it wasn't obvious what was happening at the LLM level. In contrast, I grokked the entire llm_agents API within 5 minutes.
Glad to hear that as this was exactly my goal: make this more accessible, because the actual things needed to run it are super simple.
To be fair to langchain, though: I like it a lot and it offers a lot more than my repo, but yeah definitely not the best place to understand how it all plays together.
Well, unfortunately you’re not gonna make a 10 million seed round. Because, hey, if people can understand, what are you doing, it can’t be worth that much… ;-)
37 comments
[ 3.0 ms ] story [ 82.2 ms ] threadReally neat to see the parallels to OODA loops, which are a frequent feature (implicit or explicit) of human decision-making processes.
I had never heard of those, or PDCA before, but I'm working on a startup in this space (AI Agents), and found PDCA by just using bing's suggestions i.e. OODA loops vs ...
Anyhow, I think PDCA looks more promising actually, a little more logical/analytical IMHO.... but don't take my word for it, here's what gpt4 had to say :
Which would be a better framework for AI agents working in steps and loops to complete tasks? OODA or PDCA?
Mostly people just see it as a circle in a PowerPoint slide and it has close to zero utility in that form.
That said, the bit about "The trick to avoid hallucination" in the attached blog post is a very neat idea. Obvious in hindsight, as it often is:
> So the trick is that we send a stop pattern which in this case is when we see Observation: in it’s output, because then it has created a Thought, an Action and used a tool and hallucinates the Observation: itself :D
> This stop parameter is a normal parameter of the OpenAI API by the way, so nothing special to implement there.
In general, it's magical when you put these things in a feedback loop. The way they can automatically respond to errors and adjust their actions is really cool - take a look at the last gif here[1].
[0]: https://arxiv.org/abs/2210.03629
[1]: https://github.com/cube2222/duckgpt
That said, while I am very, very impressed with GPT4 for lots of uses right now, so far it's just not clear to me that feeding it back into itself is fruitful at this point.
When I use GPT4 for coding, I give it MUCH higher level instructions than I use on a search engine, much closer to the actual problem I'm solving. But I'm still breaking the problem down into smaller problems; I need to read the output, fix errors or instruct it to fix errors, and then have it build more features on. It's similar with creative processes, brainstorming, and other writing.
These agents largely strike me as an attempt to replace this whole fact-checking/editing type routine with the LLM itself; but seeing as it's the thing the LLM is not yet good at, I'm not sure how much progress can be made there, vs just waiting for GPT5 and hoping it's another big leap in capabilities.
Just not sure feeding it back to itself does much at the moment.
If it 0-shots something and executes it and halts, not an agent, if it observes output and loops once, that's a minimal agent. I'm not super skeptical of a couple loops; I just don't know that GPT4 has what it takes to drive a larger number of loops.
Maybe another Winter was staved off by the heat of a million GPU suns (energy consumption notwithstanding).
In the future, we'll spray our GPUs with little spritzes from a water bottle, because something-something harvesting of photosynthetic electron leakage.
It worked quite well. To well almost: I started a meta-conversation where I asked another GPT4 instance to come up with conversations SoulverGPT could have with a user where the addition of solving is beneficial. This worked, and eventually even found a bug in Soulver - essentially fuzzing the language.
[1] https://github.com/soulverteam/SoulverCore
[1] https://comby.dev/blog/2022/04/11/comby-decomposer-compiler-...
https://imgur.com/a/kJvjJH3
If I had GPT-4 API access, it would have found that on the first try. Sigh.
--
I've noticed it does skip the thought process sometimes.
Question: Who is the president? What year whas he born. Name one other famous person born in that year. Thought:
Final answer is The current president of the United States is Joe Biden, born in 1942. Some other famous people born in the same year include Harrison Ford, Muhammad Ali, and Aretha Franklin.
So even though there was a thought, I didn't print it
Some kind of ensemble agent which is more robust, might play with that idea.
Though the project makes a decent GUI to use ChatGPT if anyone is interested: https://github.com/blipk/gptroles
You can run and edit code snippets in the chat interface
To be fair to langchain, though: I like it a lot and it offers a lot more than my repo, but yeah definitely not the best place to understand how it all plays together.