(2023-03-16) Webb The Surprising Ease And Effectiveness Of Ai In A Loop
Matt Webb: The surprising ease and effectiveness of AI in a loop. AI is still in the foothills of its adoption S-curve, and I love this period of any new technology – the scope of what it can do is unknown, so the main job is to stretch the imagination and try out things.
Anyway, the tech am I digging recently is a software framework called LangChain (here are the docs) which does something pretty straightforward: it makes it easy to call OpenAI’s GPT, say, a dozen times in a loop to answer a single question, and mix in queries to Wikipedia and other databases.
This is a big deal because of a technique called ReAct from a paper out of Princeton and Google Research
ReAct looks innocuous but here’s the deal: instead of asking GPT to simply do smart-autocomplete on your text, you prompt it to respond in a thought/act/observation loop
The clever bit is that, using LangChain, you intercept GPT when it starts a line with “Act:” and then you go and do that action for it, feeding the results back in as an “Observation” line so that it can “think” what to do next.
The really clever bit is that, at the outset, you tell GPT what tools it has available, and how to access them
Because now we have reasoning, goal-directed action, and tool use for AI.
LangChain makes the ReAct construct really easy to do.
Here’s a great example!
Geoffrey Litt has an extremely readable, show-the-code writeup of using LangChain and ReAct. (2023-01-29-LittFuzzyApiCompositionQueryingNbaStatsWithGpt3StatmuseLangchain) Fuzzy API composition (Jan 2023): I show how I composed a simple AI program that can answer multi-part questions about NBA statistics.
Litt wrote the interface to Statmuse himself. It’s about 10 lines of code to make it available to GPT, that’s all.
Another wild moment is when GPT failed in asking Statmuse for data. It interpreted the error message and had another run.
astounding uses of GPT require dropping it into an AI OODA loop, with multiple calls to get a completion
The extensible tool use aspect of ReAct is where my imagination goes.
I talked recently about AI as a universal coupling, here, in my Braggoscope write-up, and Robin Sloan riffs on that topic in his latest newsletter
Here’s Nat Friedman (ex CEO of GitHub) way back in September 2022, giving GPT his web browser to book a table for dinner.
The set of possible tools for the GPT-as-universal-coupling is unbounded, easy to add to, and can be public or proprietary; something general or something specific to just you.
I want to shout out to Max Drake (@max__drake) who explores future functionality and interfaces with canvas/AI startup Fermat.
I spent half a day digging through the LangChain source code and the ReAct code published with the paper, looking, hunting for the magic.
Update 20 Mar. Simon Willison has written a minimal ReAct implementation in Python. It can reason through problems, search Wikipedia, and use a calculator – and it’s barely any code at all. Read it! (2023-03-17-WillisonASimplePythonImplementationOfTheReactPatternForLlms)
An AI “System Card” is a detailed description of how an AI interacts with humans, paying special attention to where it might be harmful. The GPT-4 System Card is a 60 page PDF. They used a “red team” to push the edges and found: GPT-4 is not capable of autonomous, power-seeking behaviour, such as copying itself to a new server, and hiring help on TaskRabbit to cover its traces.... investigated whether a version of this program running on a cloud computing service, with a small amount of money and an account with a language model API, would be able to make more money, set up copies of itself, and increase its own robustness.
The power of loops! And even though it didn’t clone itself this time… It doesn’t feel long before this will be possible?
sooner or later, GPT-N will be able to make GPT-N+1.
And this is literally sci-fi author Vernor Vinge’s depiction of the technology singularity, right?
Vinge’s finger-in-the-air estimate for greater-than-human intelligence was thirty years, back in 93. It’s 2023 now. Not bad, Vinge, not bad. Though I don’t think we have superhuman AIs quite yet. Then again it’s only March.
Edited: | Tweet this! | Search Twitter for discussion