CodeAct: Code As Action Space of LLM Agents - Pros and Cons
Using Code as Action for LLM Agents improves accuracy by up to 20% compared to using JSON or Text for modular function calling approaches!
Code allows for intermediate state caching, and draws on training data for native pythonic structures which can solve the problem more easily (e.g. for loop, min, max).
Code also allows for multiple actions to be done together, which can solve potential planning issues of LLMs.
Code also allows for native error-correction by iterating on the error feedback the environment gives.
My take - Using code is a good way to bypass the current inadequate planning abilities of LLM Agents. It is not a long-term solution. We need to figure out how to plan better, so that LLM Agents can be much better and more responsive. Code is only good for tasks within the training set, so that a variant of the code structure can be easily replicated for the new tasks.
My slides: https://github.com/tanchongmin/TensorFlow-Implementations/blob/main/Paper_Reviews/Code%20as%20Actions.pdf
Github: https://github.com/xingyaoww/code-act
Paper: https://arxiv.org/abs/2402.01030
~~~
Related links:
TaskGen Repo: https://github.com/simbianai/taskgen
LLMs as a System of Multiple Expert Agents to solve the ARC Challenge: https://www.youtube.com/watch?v=sTvonsD5His
~~~
0:00 Introduction and TaskGen implementation
6:23 Main highlight of paper - Code Action space has higher success rate compared to Text/JSON
9:31 Other examples of Code as Actions
12:05 Recap: Reasoning and Acting (ReAct) Framework
17:00 CodeAct: ReAct with Code as Action
27:17 CodeAct Agent’s 4 steps
30:51 CodeAct Prompt
35:20 CodeAct Expert Feedback prompt
37:12 Three kinds of Action Formats
47:15 Text/JSON vs Code (Part 1)
55:30 Text/JSON vs Code (Part 2)
1:02:30 Why is code better?
1:10:48 Recap: ARC Challenge
1:14:19 CodeAct even works better for some models over Text/JSON for atomic API calls
1:17:44 Can CodeAct self-learn?
1:24:36 Discussion
1:34:27 Additional Slides
~~~
AI and ML enthusiast. Likes to think about the essences behind breakthroughs of AI and explain it in a simple and relatable way. Also, I am an avid game creator.
Discord: https://discord.gg/bzp87AHJy5
LinkedIn: https://www.linkedin.com/in/chong-min-tan-94652288/
Online AI blog: https://delvingintotech.wordpress.com/
Twitter: https://twitter.com/johntanchongmin
Try out my games here: https://simmer.io/@chongmin