# Andrew Ng Explores The Rise Of AI Agents And Agentic Reasoning | BUILD 2024 Keynote

https://www.youtube.com/watch?v=KrRD7r7y7NY

[00:00] Please welcome Andrew.
[00:02] [Applause]
[00:13] In thank you, it's such a good time to be a builder.
[00:16] I'm excited to be back here at snowfake build.
[00:20] What i' like to do today is share you where I think are some of ai's biggest opportunities.
[00:26] You may have heard me say that I think AI is the new electricity.
[00:30] That's because a has a general purpose technology like electricity.
[00:32] If I ask you what is electricity good for, it's always hard to answer because it's good for so many different things.
[00:39] And new AI technology is creating a huge set of opportunities for us to build new applications that weren't possible before.
[00:47] People often ask me, hey Andrew, where are the biggest AI opportunities?
[00:52] This is what I think of as the AI stack.
[00:54] At the lowest level is the semiconductors and then on top of that lot of the cloud infr to including of Course Snowflake and then on top of that.
[01:03] Are many of the foundation model trainers and models, and it turns out that a lot of the media hype and excitement and social media buzz has been on these layers of the stack, kind of the new technology layers.
[01:16] When if there's a new technology like generative AI, the buzz is on these technology layers, and there's nothing wrong with that.
[01:21] But I think that almost by definition there's another layer of the stack that has to work out even better, and that's the application layer.
[01:31] Because we need the applications to generate even more value and even more revenue so that, you know, to really afford to pay the technology providers below.
[01:39] So I spend a lot of my time thinking about AI applications, and I think that's where a lot of the best opportunities will be to build new things.
[01:48] One of the trends that has been growing for the last couple years, in no small part because of generative AI, is faster and faster machine learning model development.
[01:58] Um, and in particular, generative AI is letting us build things.
[02:03] Faster than ever before, take the problem of, say, building a sentiment cost vario, taking text and deciding is this a positive or negative sentiment for reputation monitoring, say.
[02:14] Typical workflow using supervised learning might be that will take a month to get some label data and then, you know, train AI model that might take a few months and then find a cloud service or something to deploy on that'll take another few months.
[02:28] And so for a long time, very valuable AI systems might take good AI teams six to 12 months to build, right?
[02:36] And there's nothing wrong with that; I think many people create very valuable AI systems this way.
[02:39] But with generative AI, there's certain classes of applications where you can write a prompt in days and then deploy it in, you know, again, maybe days.
[02:51] And what this means is there are a lot of applications that used to take me and used to take very good AI teams months to build that today you can build in maybe 10 days or so.
[02:59] And this opens up the opportunity to experiment with build.
[03:06] New prototypes and and ship new AI products.
[03:09] That's certainly the prototyping aspect of it, and these are some of the consequences of this trend, which is fast experimentation is becoming a more promising path to invention.
[03:21] Previously, if it took six months to build something, then you know we better study it, make sure there is user demand, have product managers look at it, document it, and then spend all that effort to build it, hopefully it turns out to be worthwhile.
[03:33] But now for fast-moving AI teams, I see a design pattern where you can say, you know what, it takes us a weekend to throw together a prototype.
[03:42] Let's build 20 prototypes and see what sticks, and if 18 of them don't work out, we'll just ditch them and stick with what works.
[03:47] So fast iteration and fast experimentation is becoming a new path to inventing new user experiences.
[03:55] Um, one interesting implication is that evaluations, or evals for short, are becoming a bigger bottleneck for how we build things.
[04:04] So it turns out back in the supervised learning world, if you're collecting 10,000 data.
[04:08] Points anyway to trade a model, then you know if you needed to collect an extra 1,000 data points for testing, it was fine whereas extra 10% increase in cost.
[04:18] But for a lot of large language model-based apps, if there's no need to have any training data, if you made me slow down to collect a thousand test examples, boy, that seems like a huge bottleneck.
[04:28] And so the new development workflow often feels as if we're building and collecting data more in parallel rather than sequentially.
[04:35] Um, in which we build a prototype and then as it becomes more important and as robustness and reliability becomes more important, then we gradually build up that test set here in parallel.
[04:46] But I see exciting innovations to be had still in how we build evals.
[04:50] Um, and then what I'm seeing as well is the prototyping of machine learning has become much faster, but building a software application has lots of steps.
[05:00] Does the product work, you know, the design work, does the software integration work, a lot of plumbing work?
[05:06] Um, then after deployment, Dev Ops and L.
[05:08] Ops, so some of those other pieces are becoming faster, but they haven't become faster at the same rate that the machine learning modeling pot has become faster.
[05:17] So you take a process and one piece of it becomes much faster.
[05:19] Um, what I'm seeing is prototyping is not really really fast, but sometimes you take a prototype into robust reliable production with guard rails and so on.
[05:30] Those other steps still take some time.
[05:33] But the interesting dynamic I'm seeing is the fact that the machine learning part is so fast, it's putting a lot of pressure on organizations to speed up all of those other parts as well.
[05:41] So that's been exciting progress for our view.
[05:46] And in terms of how machine learning development, um, is speeding things up, I think the mantra "move fast and break things" got a bad rep because, you know, it broke things.
[05:57] Um, I think some people interpret this to mean we shouldn't move fast, but I disagree with that.
[06:04] I think the better mantra is "move fast and be responsible."
[06:08] I'm seeing a lot of teams.
[06:10] Able to prototype quickly, evaluate, and test robustly, so without shipping anything out to the wider world that could, you know, cause damage or cause, um, meaningful harm, I'm finding smart teams able to build really quickly and move really fast but also do this in a very responsible way.
[06:25] And I find this exhilarating that you can build things and ship things in a responsible way much faster than ever before.
[06:32] Now, there's a lot going on in AI, and of all the things going on in AI, um, in terms of technical trend, the one trend I'm most excited about is agentic AI workflows.
[06:44] And so, if you were to ask what's the one most important AI technology to pay attention to, I would say it is agentic AI.
[06:50] Um, I think when I started saying this, you know, near the beginning of this year, it was a bit of a controversial statement.
[06:58] But now the word AI agents has become so widely used, uh, by technical and non-technical people, it's become, you know, a little bit of a hype term.
[07:08] Uh, but so let me just share with.
[07:10] You how I view AI agents and why I think they're important approaching just from a technical perspective.
[07:16] The way that most of us use large language models today is with what something is called zero shot prompting.
[07:23] And that roughly means we would ask it to uh give it a prompt, write an essay or write an output for us.
[07:31] And it's a bit like if we're going to a person or in this case going to an AI and asking it to type out an essay for us by going from the first word, writing from the first word to the last word all in one go without ever using backspace, just right from start to finish like that.
[07:47] And it turns out people, you know, we don't do our best writing this way uh, but despite the difficulty of being forced to write this way, large language models do, you know, not bad, pretty well.
[07:56] Here's what an agentic workflow is like uh, to generate an essay we ask an AI to first write an essay outline and ask you do you need to do some web research?
[08:06] If so, let's download some web pages and put into the context of the large language model.
[08:09] Then let's write the first.
[08:11] Draft, and then let's read the first draft and critique it and revise the draft and so on.
[08:15] And this workflow looks more like, um, doing some thinking or some research and then some revision and then going back to do more thinking and more research.
[08:25] And by going round this loop over and over, um, it takes longer, but this results in a much better work output.
[08:31] So in some teams I work with, we apply this agentic workflow to processing complex tricky legal documents, or to, um, do healthcare diagnosis assistance, or to do very complex compliance with government paperwork.
[08:45] So many times I'm seeing this drive much better results than was ever possible.
[08:50] And one thing I'm want to focus on in this presentation I'll talk about later is devise of visual AI where agentic repal are letting us process image and video data.
[09:00] But to get back to that later, um, it turns out that there are benchmarks that show, seem to show, agentic workflows deliver much better results.
[09:10] Um, this is the HumanEval benchmark, which is a.
[09:12] Benchmark for open AI that measures learning out large model's ability to solve coding puzzles like this one.
[09:20] Um, my team collected some data.
[09:23] Turns out that um on this Benchmark, I think it was POS K Benchmark, POS K metric, GB 3.5 got 48% right on this coding Benchmark.
[09:33] GB4, huge improvement, you know, 67%.
[09:36] But the improvement from GB 3.5 to GBD4 is dwarfed by the improvement from GBT 3.5 to GB 3.5 using an agentic workflow, um, which gets over up to about 95%.
[09:49] And GBD4 with an agentic workflow also does much better, um.
[09:53] And so it turns out that in the way builders built agentic reasoning or agentic workflows in their applications, there are, I want to say, four major design patterns which are reflection, tool use, planning, and multi-agent collaboration.
[10:12] And to demystify agentic workflows a little bit.
[10:14] Let me quickly step through what these workflows mean.
[10:19] I find that agentic workflows sometimes seem a little bit mysterious until you actually read through the code for one or two of these.
[10:24] Go, oh that's it, you know, that's really cool, but oh, that's all it takes.
[10:28] But let me just step through, um, to, for, for concreteness, what reflection with LLMs looks like.
[10:36] So I might start off, uh, prompting an LLM, there, a coder agent LLM, so maybe an assistant message to your roles to be a coder and write code.
[10:43] Um, so you can tell, you know, please write code for certain tasks, and the LLM may generate codes.
[10:50] And then it turns out that you can construct a prompt that takes the code that was just generated and copy-paste the code back into the prompt and ask it, you know, here is some code intended for a task.
[11:01] Examine this code and critique it, right?
[11:04] And it turns out you prompt the same LLM this way, it may sometimes, um, find some problems with it or make some useful suggestions out of the code, then you.
[11:14] Prompt the same LM with the feedback and ask you to improve the code and become with a new version.
[11:21] And uh maybe foreshadowing two use you can have the LM run some unit tests and give the feedback of the unit test back to the LM.
[11:28] Then that can be additional feedback to help it iterate further to further improve the code.
[11:31] And it turns out that this type of reflection workflow is not magic, doesn't solve all problems.
[11:37] Um, but it will often take the baseline level performance and lift it uh to to better level performance.
[11:43] And it turns out also with this type of workflow where we're think of prompting an LM to critique his own output, use it own criticism to improve it, this may be also foreshadows multi-agent planning or multi-agent workflows where you can prompt one prompt an LM to sometimes play the role of a coder and sometimes prom on to play the role of a CR of a Critic.
[12:06] Um to review the code so such the same conversation but we can prompt the LM you know differently to tell sometimes work on the code, sometimes try to make.
[12:15] Helpful suggestions and this same results in improved performance.
[12:19] So this is a reflection design pattern.
[12:24] Um, and second major design pattern is to use in which a large language model can be prompted to generate a request for an API call to have it decide when it needs to search the web or execute code or take a task like, um, issue a customer refund or send an email or pull up a calendar entry.
[12:41] So to use is a major design pattern that is letting large language models make function calls.
[12:47] And I think this is expanding what we can do with these agentic workflows.
[12:52] Um, real quick, here's a planning or reasoning design pattern in which if you were to give a fairly complex request, you know, generate image or where girls reading a book and so on, then an LM, this example adapted from the hugging GTP paper, an LM can look at the picture and decide to first use a, um, open pose model to detect the pose.
[13:12] And then after that, generate picture of a girl.
[13:14] Um, after that, you'll.
[13:17] Describe the image, and after that, use TTS to generate the audio.
[13:21] But so in planning, you look at a complex request and pick a sequence of actions to execute in order to deliver on a complex task.
[13:30] Um, and lastly, multi-agent collaboration is that design pattern alluded to where, instead of prompting an LM to just do one thing, you prompt the LM to play different roles at different points in time.
[13:44] So the different agents simulate agents interacting with each other and come together to solve a task.
[13:49] And I know that some people may wonder, you know, if you're using one, why do you need to make this one play the role with multiple agents?
[13:57] Um, many teams have demonstrated significantly improved performance for a variety of tasks using this design pattern.
[14:04] And it turns out that if you have an LM sometimes specialize on different tasks, maybe one at a time, have it interact, many teams seem to really get much better results using this.
[14:14] I feel like maybe, um, there's.
[14:18] An analogy to if you're running jobs on a processor on a CPU, you why do we need multiple processes?
[14:23] It's all the same process there, you know, at the end of the day, but we found that having multiple FS of processes is a useful extraction for developers to take a task and break it down to subtask.
[14:33] And I think multi-agent collaboration is a bit like that too.
[14:35] If you were big task, then if you think of hiring a bunch of agents to do different pieces of task, then interact, sometimes that helps the developer um build complex systems to deliver a good result.
[14:48] So I think with these four major agentic design patterns, agentic reasoning workflow design patterns, um it gives us a huge space to play with to build rich agents to do things that frankly were just not possible, you know, even a year ago.
[15:04] Um and I want to one aspect of this I'm particularly excited about is the rise of not not just large language model B agents but large multimodal based a large multimodal model based agents.
[15:17] So um give an image.
[15:21] Like this, if you were wanted to uh use a LMM, large multimodal model, you could actually do zero shot PR.
[15:29] And that's a bit like telling it, you know, take a glance at the image and just tell me the output.
[15:33] And for simple image thoughts, that's okay.
[15:36] You can actually have it, you know, look at the image and uh right give you the numbers of the runners or something.
[15:42] But it turns out just as with large language model-based agents, SL multi-model-based agents can do better with an iterative workflow where you can approach this problem step by step.
[15:53] So detect the faces, detect the numbers, put it together.
[15:58] And so with this more iterative workflow, uh you can actually get an agent to do some planning, testing, right code, plan, test, right code and come up with a more complex plan as articulated expressing code to deliver on more complex thoughts.
[16:11] So what I like to do is, um, show you a demo of some work that uh Dan Malone and I and the H AI team has been working on on building.
[16:23] Agentic workflows for visual AI tasks.
[16:27] So if we switch to my laptop, um, let me have an image here of a uh soccer game or football game.
[16:41] And um, I'm going to say, let's see, count the players in the vi.
[16:43] Oh, and just so fun, if you're not how to prompt it after uploading an image, this little light bulb here, you know, gives some suggested prompts you may ask for this uh.
[16:53] But let me run this, so count players on the field, right?
[16:57] And what this kicks off is a process that actually runs for a couple minutes, um, to think through how to write code uh in order to come up a plan to give an accurate result for uh counting the number of players in the few.
[17:10] This is actually a little bit complex because you don't want the players in the background, just be in the few.
[17:13] I already ran this earlier, so we just jumped to the result, um, but it says the cod has selected seven players on the field and.
[17:26] I think that should right 1 2 3 4 5 six seven.
[17:30] Um and if I were to zoom in to the model output.
[17:33] Now 1 2 3 4 five six seven I think that's actually right.
[17:39] And the part of the output of this is that um it has also generated code uh that you can run over and over.
[17:48] Um actually generated python code uh that if you want you can run over and over on the large collection of images.
[17:59] And I think this is exciting because there are a lot of companies um and teams that actually have a lot of visual AI data have a lot of images um have a lot of videos kind of stored somewhere.
[18:12] And until now it's been really difficult to get value out of this data.
[18:18] So for a lot of the you know small teams or large businesses with a lot of visual data visual AI capabilities like the vision agent lets you take all this data.
[18:27] Previously shove somewhere in BL storage and and you know get real value out of this.
[18:31] I think this is a big transformation for AI.
[18:32] Um, here's another example.
[18:35] You know, this says, um, given a video, split this, another soccer game or football game.
[18:43] So given video, split the video clips of 5 seconds, find the clip where goal is being scored, display a frame so output.
[18:50] So Rand is already because takes a little the time to run, then this will generate code, evaluate code for a while, and this is the output.
[18:56] And it says true 1015, so it think those a go St, you know, around here, around between the right, and there you go, that's the goal.
[19:11] And also as instructed, you know, extracted some of the frames associated with this.
[19:15] So really useful for processing, um, video data.
[19:21] And maybe here's one last example, uh, of of of the vision agent, which is, um, you can also ask it FR program to split the input.
[19:27] Video into small video chunks every 6 seconds.
[19:29] Describe each chunk and store the information at Panda's data frame along with clip names and end time.
[19:35] Return the Panda's data frame.
[19:38] So this is a way to look at video data that you may have and generate metadata for this, uh, that you can then store, you know, in Snowflake or somewhere, uh, to then build other applications on top of.
[19:50] But just to show you the output of this, um, so you know clip name, start time, end time, and then there actually written code, um, here.
[20:00] Right, wrote code that you can then run elsewhere if you want, uh, let me put in a Streamlit app or something that you can then use to then write a lot of, you know, text descriptions for this.
[20:15] Um, and using this capability of the vision agent to help write code, my team at Landing AI actually built this little demo app that, um, uses code from the vision agent.
[20:26] So instead of us using the write code have.
[20:28] the Vision agent write the code to build
[20:30] this metadata and then um indexes a
[20:34] bunch of videos so let's see I say
[20:36] browsing so skar airborne right I
[20:39] actually ran this earlier hope it works
[20:42] so what this demo shows is um we already
[20:45] ran the code to take the video split in
[20:47] chunks store the metadata and then when
[20:50] I do a search for skier Airborne you
[20:52] know it shows the clips uh that have
[20:55] high
[20:57] similarity right right oh marked here
[20:59] with the green has high similarity well
[21:02] this is getting my heart rate out seeing
[21:03] do that oh here's another one whoa all
[21:08] right all right and and the green parts
[21:11] of the timeline show where the skier is
[21:13] Airborne let's see gray wolf at night I
[21:18] actually find it pretty fun yeah when
[21:20] when you have a collection of video to
[21:22] index it and then just browse through
[21:24] right here's a gray wolf at night and
[21:26] this timeline in green shows what a gr
[21:29] wolf and Knight is and if I actually
[21:30] jump to different part of the video
[21:33] there's a bunch of other stuff as well
[21:35] right there that's not a g wolf at night
[21:37] so I that's pretty cool
[21:40] um let's see just one last example so
[21:47] um yeah if I actually been on the road a
[21:50] lot uh but if sear if your luggage this
[21:53] black luggage right
[21:56] um there this but it turns out turns out
[21:59] there actually a lot of black Luggage So
[22:00] if you want your luggage let's say black
[22:02] luggage with
[22:04] rainbow strap this there a lot of black
[22:08] luggage out
[22:09] there
[22:11] then you know there right black luggage
[22:14] with rainbow strap so a lot of fun
[22:16] things to do um and I think the nice
[22:18] thing about this is uh the work needed
[22:22] to build applications like this is lower
[22:25] than ever before so let's go back to the
[22:27] slides
[22:30] um
[22:33] and in terms of AI opportunities I spoke
[22:37] a bit about agentic workflows and um how
[22:42] that is changing the AI stack is as
[22:44] follows it turns out that in addition to
[22:48] this stack I show there's actually a new
[22:51] emerging um agentic orchestration layer
[22:54] and there little orchestration layer
[22:56] like L chain that been around for a
[22:58] while that are also becoming
[22:59] increasingly agentic through langra for
[23:02] example and this new agentic
[23:04] orchestration layer is also making
[23:06] easier for developers to build
[23:08] applications on top uh and I hope that
[23:10] Landing ai's Vision agent is another
[23:13] contribution to this to makes it easier
[23:15] for you to build visual AI applications
[23:17] to process all this image and video data
[23:21] that possibly you had but that was
[23:22] really hard to get value all of um until
[23:25] until more recently so but fire when I
[23:28] you what to think are maybe four of the
[23:30] most important AI Trends there's a lot
[23:32] going on on AI is impossible to
[23:34] summarize everything in one slide if you
[23:36] had to make me pick what's the one most
[23:38] important Trend I would say is a gentic
[23:40] AI but here are four of things I think
[23:42] are worth paying attention to first um
[23:45] turns out agentic workflows need to read
[23:47] a lot of text or images and generate a
[23:49] lot of text so we say that generates a
[23:51] lot of tokens and their exciting efforts
[23:54] to speed up token generation including
[23:56] semiconductor work by Sova Service drop
[23:59] and others a lot of software and other
[24:01] types of Hardware work as well this will
[24:02] make a gentic workflows work much better
[24:05] second Trend I'm about excited about
[24:07] today's large language models has
[24:09] started off being optimized to answer
[24:11] human questions and human generated
[24:14] instructions things like you know why
[24:16] did Shakespeare write mcbath or explain
[24:18] why Shakespeare wrote Mac beath these
[24:19] are the types of questions that L
[24:21] langage models are often as answer on
[24:23] the internet but agentic workflows call
[24:25] for other operations like to use so the
[24:28] fact that large language models are
[24:30] often now tuned explicitly to support
[24:32] tool use or just a couple weeks ago um
[24:35] anthropic release a model that can
[24:37] support computer use I think these
[24:39] exciting developments are create a lot
[24:41] of lift rate create a much higher
[24:43] ceiling for what we can now get atic
[24:45] workloads to do with L langage models
[24:48] that tune not just to answer human
[24:50] queries but to tune EXA explicitly to
[24:53] fit into these erative agentic workflows
[24:57] um third
[24:58] data engineering's importance is rising
[25:01] particularly with unstructured data it
[25:03] turns out that a lot of the value of
[25:05] machine learning was a Structure data
[25:07] kind of tables of numbers but with geni
[25:10] we're much better than ever before at
[25:12] processing text and images and video and
[25:14] maybe audio and so the importance of
[25:17] data engineering is increasing in terms
[25:19] of how to manage your unstructured data
[25:21] and the metad DAT for that and
[25:22] deployment to get the unstructured data
[25:24] where it needs to go to create value so
[25:26] that that would be a major effort for a
[25:28] lot of large businesses and then lastly
[25:31] um I think we've all seen that the text
[25:32] processing revolution has already
[25:34] arrived the image processing Revolution
[25:36] is in a slightly early phase but it is
[25:38] coming and as it comes many people many
[25:40] businesses um will be able to get a lot
[25:42] more value out of the visual data than
[25:45] was possible ever before and I'm excited
[25:48] because I think that will significantly
[25:49] increase the space of applications we
[25:51] can build as well so just wrap up this
[25:56] is a great time to be a builder uh gen
[25:59] is learning us experiment faster than
[26:01] ever a gentic AI is expanding the set of
[26:03] things that now possible and there just
[26:05] so many new applications that we can now
[26:08] build in visual AI or not in visual AI
[26:11] that just weren't possible ever before
[26:13] if you're interested in checking out the
[26:15] uh visual AI demos that I ran uh please
[26:19] go to va. landing.ai the exact demos
[26:21] that I ran you better try out yourself
[26:24] online and get the code and uh run code
[26:26] yourself in your own applications so
[26:28] with that let me say thank you all very
[26:31] much and please also join me in
[26:32] welcoming Elsa back onto the stage thank
[26:34] you
