Stanford Webinar - Agentic AI: A Progression of Language Model Usage — Transcript
Full transcript
- 0:10my name is inso so uh today uh we like
- 0:14to uh go over agent AI aent language
- 0:17model as a progression of language model
- 0:20usage so here is the outline of the
- 0:23today's talk uh we'll go over uh the
- 0:26overview of language model and how we
- 0:29use and then and the common limitations
- 0:31and then um some of the method that
- 0:34improves towards this common limitation
- 0:37and then we'll transition it to uh what
- 0:39is the Agent B language model and its
- 0:42design
- 0:45patterns so uh language model is a
- 0:48machine learning model that predicts the
- 0:51next coming word given the input text as
- 0:54in this example if the input is the the
- 0:57students open there then
- 1:00um language model uh can predict what's
- 1:04the most likely word coming uh next as a
- 1:07next word so if the language model is
- 1:10trained with the large corpers it is a
- 1:13predict it is generating the probability
- 1:16of next coming word in this example uh
- 1:20as you could see books and laptops have
- 1:23a high higher probability than other
- 1:26other words in the vocabulary so um the
- 1:29so the completion of this whole sentence
- 1:32could be uh the students open their
- 1:34books and then if you want to keep
- 1:36generating um the what's coming next
- 1:38then we can uh uh turn them in as an
- 1:41input and then uh um put it into the
- 1:44language model and then language model
- 1:46continuously generating the next coming
- 1:49word then how uh these uh language
- 1:53models are trained largely uh two two
- 1:57parts pre-training part and then
- 1:59posttraining part and then um first
- 2:02pre-training portion is the one that
- 2:04language models are trained with lot
- 2:08with large copers uh text are collected
- 2:10from internet or books or different type
- 2:14of text publicly available text and then
- 2:17trained with the next token or next word
- 2:20prediction objectives so once the models
- 2:24uh is finished in this pre-training
- 2:26stage models are fairly good at
- 2:28predicting um any words coming uh next
- 2:32as a word um given the inputs um however
- 2:36um this type uh the pre-train model uh
- 2:39itself is um is not easy to use so the
- 2:44hence the posttraining uh steps are
- 2:46coming and then these uh post trining
- 2:49stage um uh would includes uh
- 2:51instruction following training as well
- 2:53as reinforcement learning with human
- 2:55feedback and what this uh training stage
- 3:00uh means is uh um we could prepare a
- 3:04data set such a way that the specific
- 3:07instruction or question and then the
- 3:09answers or the uh generated output that
- 3:12is what the uh user would expect or uh
- 3:16more uh more uh um uh related to the
- 3:20questions and answers so that's how uh
- 3:23the models are trained so that it's
- 3:25easier to use and then also it'll
- 3:27respond to a specific uh
- 3:30and then uh once this done and then uh
- 3:33additional training uh method uh is uh
- 3:37um uh aligning to Humane preference by
- 3:41using uh reinforcement learning with
- 3:42human feedback which uhu U is using
- 3:45human uh preference to align the model
- 3:49by using uh rewards
- 3:52schemes and um let's take a quick look
- 3:55really quick look on the instruction
- 3:58data set this is the template that uh we
- 4:01uh uh we would use to train the model in
- 4:04instruction following training phase as
- 4:07you can see uh there's a specific uh
- 4:09instructions will be substituted in and
- 4:11then expected output will be substituted
- 4:14in and then this is fed to the model and
- 4:16the model is only uh trained on the uh
- 4:20the response part that is uh generating
- 4:22the uh or generating the output based on
- 4:25the given
- 4:27instructions all right so language model
- 4:31uh that is trained on pre-training stage
- 4:33as as well as post-training stage um is
- 4:36quite capable of uh uh generating the
- 4:40generating text given instruction uh
- 4:43essentially it has a lot of uh World
- 4:46Knowledge that could easily generating
- 4:48the outputs um so uh these are rapidly
- 4:52developing and then uh could uh these
- 4:55models are used in various of
- 4:57application domains that you uh you um
- 5:00we and you we use day-to-day work such
- 5:03as AI coding Assistance or domain
- 5:06specific AI co-pilots or uh most widely
- 5:10known cat GPT and related conversational
- 5:14interfaces and then in order to use
- 5:17these type of models as for your uh your
- 5:21um applications or specific U um um
- 5:25tools you could use uh uh the cloud
- 5:29based cloud-based API calls towards the
- 5:33model provider or the model servers or
- 5:37um some other ways that you could also
- 5:39host uh the models on your local local
- 5:43machines or even uh mobile machines uh
- 5:46for the for the models that are small
- 5:48enough or to host on these uh compute
- 5:52constraint
- 5:54environments so what does it mean by uh
- 5:57using API calls so so uh we step back
- 6:01the mo uh language model uh is taking
- 6:04the input uh natural language input text
- 6:07and then uh generating the output so
- 6:10that means we need to prepare a certain
- 6:12certain form of free form text natural
- 6:16language text as an instruction or
- 6:19question and then put them in a specific
- 6:22format that you could make an API code
- 6:24towards the model provider and then the
- 6:28model provider takes that uh usually on
- 6:30the cloud environment and then generate
- 6:33the output and then uh respond to your
- 6:36API calls with the generated output then
- 6:39your software around that uh software
- 6:42that based on this model will parse the
- 6:44output and then use it as as is or uh
- 6:48maybe you could uh uh make a followup um
- 6:52llm API CS to further generate the uh
- 6:56output
- 7:00so
- 7:01um um the input to the model is again
- 7:06free form text so how you prepare your
- 7:09input um also known as a prompting is um
- 7:13critical so there are uh uh there are
- 7:16well-known uh best practices um uh
- 7:19strategy how you prepare your prompt and
- 7:22here are some of them and such as write
- 7:25a clear and very descriptive and detail
- 7:29instructions that will uh that will help
- 7:31the model to uh generate the output that
- 7:33you want and uh you could include um
- 7:36couple of examples the form that you
- 7:39want to you want to see as in the style
- 7:42or form and um also you could provide
- 7:46the pro uh Pro provide the references or
- 7:49context such a way that model uh rely on
- 7:52that uh context that you
- 7:54provide and um instead of just as the as
- 7:58the model to answer right away you could
- 8:01ask model to uh mod give model to time
- 8:04to think about it such as um reasoning
- 8:07uh in uh enable reasoning or um uh using
- 8:11Chain of Thought or Co method and um the
- 8:15next one is uh instead of asking model
- 8:19really complex task you could uh break
- 8:22them down and then ask them chain in um
- 8:25sequence um also chain the complex
- 8:28prompts
- 8:30and the last one is something that um as
- 8:34as a good engineering practice have a
- 8:36good way of system systemic trace and
- 8:39logging will help you and um also
- 8:42automated evaluation is always helpful
- 8:45to develop your essential to develop
- 8:47your progress on your
- 8:49application so let's take uh um a quick
- 8:53look at on each items what that means to
- 8:56get more familiar with so write clear
- 9:00and descrip descriptive instruction um
- 9:03as an example on the on the left instead
- 9:05of asking short um request you could
- 9:09describe in detail so that model um
- 9:13knows what you are asking uh because
- 9:15model doesn't understand model cannot
- 9:18read your mind so uh that means you need
- 9:21to describe what you what the
- 9:23model what you want the model to
- 9:26generate the output for you so this is
- 9:28always useful
- 9:30um uh for um for using language model in
- 9:34general and include few examp few sh
- 9:37examples so um meaning that um give
- 9:41model um the example input and output
- 9:44they you you would expect um as in this
- 9:47case um you have some type of consistent
- 9:51style output then um what is the
- 9:53consistent style uh you provide an input
- 9:56uh as um example input and example
- 9:59output that you ask and then you can
- 10:02finally you ask your original questions
- 10:05then it's going to be uh the uh model
- 10:07will generate the output based on your
- 10:09input so few shot examples uh is always
- 10:13helpful to generate output that you want
- 10:16to uh you want to uh
- 10:19generate so provide relevant context and
- 10:23references this is really helpful for
- 10:27many of the cases that are related to uh
- 10:30uh generate generating text based on
- 10:33some factual information so llm can
- 10:36generate um easily generate some uh
- 10:39incorrect output um also known as a
- 10:42hallucination um for those uh uh topics
- 10:45that it doesn't it doesn't know or it's
- 10:48not too confident about so for those
- 10:51type of cases providing context or
- 10:54references would always helpful so here
- 10:57is the example uh a prompt template that
- 11:01you would want to use um in um cases
- 11:04such as retrieval of Med generation that
- 11:06we will uh will will look at in the
- 11:08following slides um saying that uh only
- 11:12answer based on the input based on the
- 11:15um article that you you provide you
- 11:17could substitute your uh related
- 11:20reference and then only answer based on
- 11:23these references um uh if you if the
- 11:26model cannot find the answer you could
- 11:28just say that um cannot find the answer
- 11:31then model will likely generate the
- 11:33answer based on your
- 11:39references so this is um um important
- 11:43part that uh keep models time to think
- 11:46in other words instead of ask direct
- 11:48question you ask model to um think
- 11:52through it or um come up with its own
- 11:54solution and then finally generate uh
- 11:57finally uh compare and generate the
- 12:00output so this is also known as a chain
- 12:03of dot um so here is one example that
- 12:06might not um that might not work in um
- 12:11um some um medium siiz model um you
- 12:15could ask model saying that uh evaluate
- 12:19the students uh solution is correct or
- 12:22not and then provide a solution
- 12:24description and then finally give uh
- 12:27student solution and um since you uh
- 12:31since the system prompt or your original
- 12:34request is saying that um just answer it
- 12:37is correct or wrong model might not get
- 12:39it right however for the same model that
- 12:43might not get the right answer for this
- 12:46if you uh prepare your prompt in a way
- 12:49that um you could ask first work out
- 12:52your own solution to the problem first
- 12:55and then compare Your solution to the
- 12:57student solution then by doing this
- 13:00model will generate its own solution and
- 13:03then uh as it does it'll it'll have an
- 13:05opportunity to um uh provide good uh
- 13:08attentions to all these inputs that it's
- 13:11it's um Pro from the original input as
- 13:14well as the output that it generated and
- 13:17then uh turn towards the right answers
- 13:20so reasoning chain of do is always
- 13:23helpful to uh to generate the out uh
- 13:27generate output that you want
- 13:31see so here's an uh interesting one uh
- 13:35probably easy to implement for your
- 13:37application so instead of uh asking uh
- 13:40your request that includes say multiple
- 13:43task in one request you could uh prepare
- 13:46your prompt in um um small simple stages
- 13:51so how you do uh um is prepare simple
- 13:55prompt and then generate the output and
- 13:58then PR pend the output to the next um
- 14:02stage two prompt and then generate the
- 14:05output and then uh again I prepend the
- 14:08output from the previous stage and then
- 14:10generate the output you know third stage
- 14:12like here and then finally generate the
- 14:15output that You' want to see so um by
- 14:18doing this you may need to do it
- 14:20manually or Um this can be done um by
- 14:24llm as we'll see in the uh following
- 14:27slides uh but having a simple um clear
- 14:31task per each request would uh would be
- 14:35a good way to do
- 14:40it okay so this may not be uh obvious
- 14:44but um because uh uh many type of uh uh
- 14:51as in as with many engineering uh
- 14:54application or development having a good
- 14:56way of keeping uh tracing logging will
- 14:59definitely helpful helpful for your
- 15:01development for debugging as well as
- 15:04auditing so same principle applies to um
- 15:07language model based development so keep
- 15:10track of the log is always good and so
- 15:14um that also uh relates to relates to
- 15:19having a um automated evaluation from
- 15:22the early stage of your development will
- 15:24definitely help you uh in other words
- 15:27you need to prepare uh question and
- 15:29answer pair uh ground uh ground truth
- 15:32answer pair so that you could compare
- 15:35that against the um generated output and
- 15:39um you could use a human to evaluate
- 15:42that but that's usually costly and then
- 15:45time um time consuming so you may use to
- 15:48use uh you may use a language model as a
- 15:51judge um meaning that you could ask um
- 15:55language model to evaluate um model
- 15:58generated output as well uh with um
- 16:01ground truth output so that model can
- 16:04score the generated outputs quality so
- 16:07that you can use that uh against your um
- 16:10currently developed uh uh your own
- 16:13applications this will help this will be
- 16:16uh very important because um uh the
- 16:19language models are continuously uh and
- 16:22rapidly improving as well as the
- 16:24methodology and then tools that you are
- 16:26using uh for developing uh language
- 16:29model is also rapidly developing uh in
- 16:32other words without clear evaluation it
- 16:36is hard to make uh forward progress or
- 16:39even hard to change the model uh uh
- 16:42change the different type of models uh
- 16:44because uh because the models are
- 16:47rapidly developing uh also means that
- 16:50the some models are rapidly deprecating
- 16:53which means you may uh need to force to
- 16:55change your uh language model that you
- 16:58are using in your application so having
- 17:01uh a good uh evaluation methodology up
- 17:04front uh from the beginning will
- 17:06definitely
- 17:09help all right so this is a um this is
- 17:13simple idea but uh will be helpful for
- 17:17um uh many applications so instead of
- 17:19taking your input prompt as is and then
- 17:23process it you may have uh um some
- 17:26software or some model that you could
- 17:28detect the intention and then send it to
- 17:31a different uh prompt handlers so or uh
- 17:35this is also known as The Prompt router
- 17:37So based on the input uh query type you
- 17:41may need to use Simple prompt together
- 17:44with simple language model and then this
- 17:47will um both help help in terms of um
- 17:51operation cost as well as um generate a
- 17:55more appropriate output and together
- 17:57with the um
- 17:59more relevant prompt with the language
- 18:03model that is more cap capable of that
- 18:05type of um
- 18:10query all right so um maybe um Petra if
- 18:17there um this may be a good moment that
- 18:19we could take question if there's any if
- 18:22you could see yeah thank you so much
- 18:26inso and such an inspirational talk
- 18:28already thank you so much we will get to
- 18:30like more details about agent uh um AI
- 18:34just shortly we did want to kind of
- 18:35provide you with some sort of a
- 18:37background and kind of the progression
- 18:38of like what has been going on in the
- 18:40field uh but I think maybe let's ask uh
- 18:44one question uh that came up it's a
- 18:47little bit specific but might be what
- 18:49more people are wondering about and is
- 18:51there any optimal amount of data to
- 18:54perform a good training or like anything
- 18:56that you could advise people around kind
- 18:58of the data um data available or like
- 19:01data being
- 19:03used okay um maybe I I'll be uh short on
- 19:08this um so in I assume the training here
- 19:11is meaning that uh fine-tuning uh the
- 19:14llms part of in add additional um
- 19:17training on top of Open Source language
- 19:19model um if um
- 19:23yeah depends on your uh task it it would
- 19:27definitely uh varying because it's hard
- 19:29to say one or the other but um if you uh
- 19:34uh if you have your enough uh data set
- 19:37or or text that you would want to see
- 19:39then you may come up with the simple
- 19:42question and answer pair or instruction
- 19:44following data set format and then you
- 19:47could also you make use of language
- 19:49model to further generate more um so if
- 19:52you need it more but uh I would think uh
- 19:56you start with um say 10
- 19:59uh tens of data samples of data set
- 20:02first and then see whether that makes
- 20:04the model behave what you actually see
- 20:07it to be behaved and then uh and then
- 20:10you could add uh based on the result or
- 20:13signals from the initial quick test then
- 20:15you could uh additionally add more data
- 20:18set data set samples uh possibly uh uh
- 20:21use language model to augment it or
- 20:24synthetic data that you could
- 20:25create great question thank you so much
- 20:29I see like questions started coming in
- 20:31which is wonderful uh I think we will
- 20:33pause the question for now and we will
- 20:35try to get to as many as we can at the
- 20:37end but please keep them coming it
- 20:39definitely makes the session kind of
- 20:40more engaging and also let us know what
- 20:42you're interested in thank you thank you
- 20:45Petra all right so uh so far we've been
- 20:48looked at uh overview of language model
- 20:52um great u u very powerful models that
- 20:55are out there many models out there and
- 20:58then how we use um however um even um
- 21:03there are still um limitations for um
- 21:06models that are available um that are
- 21:09listed here such as Hallucination is a
- 21:12well-known issue that uh models uh uh a
- 21:16model can um sometimes or often times uh
- 21:20generate the incorrect or incorrect
- 21:23information particularly if it's related
- 21:25to um some computation or some other
- 21:28specific
- 21:29area so this is also uh uh this is a
- 21:32problem that is uh that we want to avoid
- 21:36in your uh application domain and other
- 21:40thing is uh there's always a knowledge
- 21:42cut up in data set preparation so model
- 21:45provider model Creator prepare data set
- 21:48however they need to uh at some point
- 21:51cut up the data cut up uh their data set
- 21:53collection and then use it so model may
- 21:56not know may may have not seen the
- 21:59recent uh recent information or news as
- 22:02part of their uh pre-training data
- 22:05set um lack of attribution so model can
- 22:09answer lot of World Knowledge Questions
- 22:12and um can answer those type of general
- 22:16questions however it may not tell it
- 22:18it's not going to tell you where they
- 22:21drew this um the answer from particular
- 22:25specific um U data source um data
- 22:29privacy is uh one fact that uh model
- 22:33model Creator you generate uh prepare
- 22:36the data set using publicly available
- 22:39data source um that means uh model um
- 22:43have not seen your pro proprietary data
- 22:46set from uh your organization or
- 22:48particular um
- 22:50domain and uh limited context length um
- 22:54although it's uh rapidly increasing um
- 22:58um however um it always uh um um it's U
- 23:02um fine balance uh because um providing
- 23:07a longer context will give more
- 23:09information context information to the
- 23:11model however it comes with operational
- 23:15um cost as well as the speed uh the lat
- 23:19latency of generate latency in uh uh
- 23:22text
- 23:24Generations so um in order to uh address
- 23:29these common limitations um retrievable
- 23:32augmented generation is uh one way to
- 23:36handle this such as it it could reduce
- 23:38the hallucination by using the actual
- 23:42related relevant reference um it uh also
- 23:46um address the citation because uh it
- 23:50knows where this reference is coming
- 23:53from and then U this this will allow you
- 23:57as a application developer or um or
- 24:01system developer to prepare system so
- 24:04that you could you could use your own
- 24:06proprietary data set or the text and
- 24:09then uh it could use the um um good use
- 24:13of small number of context links um
- 24:16because it only uh select um relevant
- 24:19data set so how it works is you could
- 24:23pre pre- uh index your uh your own U
- 24:27data set or your own text uh by turn
- 24:31them into uh turn turn them into smaller
- 24:34chunk chunk of text and then convert
- 24:37them into in embedding space using embed
- 24:41embedding model and then uh stage them
- 24:44as part of your database or vector
- 24:46database and then when the request or
- 24:50query came you could all you could turn
- 24:53this query into embedding space so that
- 24:56you could do a nearest name neighboring
- 24:58search and then select K top K uh uh
- 25:02relevant information relevant chunk text
- 25:05Chunk and then uh place them as part of
- 25:08your prompt um some of the slide that we
- 25:11see previously as uh you put the
- 25:14reference as part of the prompt and then
- 25:16use that as uh as the model only only
- 25:20make use of this reference so this is uh
- 25:24one good way to make use of your own
- 25:27proprietary data and then similar method
- 25:29is um can be used in the actual um AI
- 25:34search or um uh so that you instead of
- 25:38using index data set you could also rely
- 25:41on web search or different type of
- 25:43search so that you could provide
- 25:45information as part of the
- 25:48index and uh one of the thing also uh
- 25:51mention here is uh uh there are many
- 25:55method or ideas for or retrieval a
- 25:59generation uh more um commonly used is
- 26:02me method is something that uh we've
- 26:05just mentioned we've just talked about
- 26:07meaning that turn them turn the text
- 26:09Chunk into embedding space and then do a
- 26:11nearest neighboring search however there
- 26:13are many method and then you could also
- 26:16um uh use Knowledge Graph base so if you
- 26:20could uh uh generate a knowledge gra
- 26:23graph from your text source and then
- 26:25that could also help to uh extract the
- 26:28more relevant um information um also
- 26:32known as graph rack is one part of it
- 26:35however there's many method and then you
- 26:37may need to look into the right method
- 26:39or um uh if uh right method and uh make
- 26:44use of
- 26:47those all right tool usage so language
- 26:50model being uh most widely used form is
- 26:54a text in and text output um which means
- 26:57that it could answer many uh many type
- 27:01of queries however it's not it uh it's
- 27:04not going to execute or extract uh
- 27:08information from the external so that's
- 27:10where this tool usage uh came to rescue
- 27:14or also known as a function calling so
- 27:17with this method you could uh get uh
- 27:21real time information or you could uh um
- 27:24actually do a computation by generating
- 27:27uh software
- 27:28uh computer code so what does it mean is
- 27:32uh let's look at uh an example here so
- 27:36um if you uh uh if you have ai chat Bo
- 27:41that if you ask what is the weather in
- 27:44uh say San Francisco then model will not
- 27:46know it by in itself so however if you
- 27:51tell model model previously if um as
- 27:55part of the prompt saying that if you as
- 27:57uh weather related question generate an
- 28:00output in a form that um the software
- 28:04that the parts the output can make an
- 28:06API call so as in this example model
- 28:11will generate the
- 28:12output um in a way that uh hey this is
- 28:16the this is the case for Tool usage so
- 28:19it generates an output um as in the form
- 28:23as in the form here get weather and then
- 28:25input argument to this API call or
- 28:28function call is uh the place that we
- 28:31ask so then software receives this text
- 28:34output from the model and then pars and
- 28:37then uh actually make an API call
- 28:40towards the weather provider and then
- 28:43get the weather um information and then
- 28:46again provide back to Lang P back to the
- 28:49language model and then language model
- 28:51will generate more human friendly or
- 28:55helpful output based on this uh API
- 28:58based
- 29:01result and um for some cases uh a model
- 29:05can also generate a software of uh
- 29:07software code that uh can be executed as
- 29:11part of the sandbox outside of the
- 29:14language model by the software that is
- 29:17coordinating all these
- 29:21activities all right so
- 29:23um agentic language model so uh there
- 29:27can many definitions uh one definition
- 29:31uh is um it could interact with
- 29:34environment so uh compared to simple
- 29:37language model usage generally uh
- 29:40um uh use Simple language model usage as
- 29:44you see in here text input and text
- 29:47output agentic agentic language model
- 29:51usage could be language model uh could
- 29:55do something with environment by uh
- 29:58generating tool usage or retrieval
- 30:01request and then from the environment
- 30:04anything outside of uh language model
- 30:07could uh generate um could provide an
- 30:10output could provide an information that
- 30:14can be fed in fed back to language model
- 30:17as an OBS observation and then the whole
- 30:20thing uh the agentic language model
- 30:23which includes language model um at its
- 30:25core with the software around it will uh
- 30:29proc process it and then also put them
- 30:32in a memory and uh as with any uh as
- 30:36with its conversational history which
- 30:39can be taken as a memory um so this is a
- 30:44one way of definition of agentic
- 30:47language
- 30:48model the other way to look at it is
- 30:51this um language uh agent uh language
- 30:54model usage can be uh can be
- 30:58defined as it could reason as well as it
- 31:01could action it could do an action so
- 31:04also called react vision and action so
- 31:07reasoning part is uh something that you
- 31:11could encourage model to reason about by
- 31:14a method such as by using a method such
- 31:16as chain of
- 31:18thoughts and then uh doing an action uh
- 31:21using uh method that we have seen
- 31:23previous slides as in retrieval or
- 31:26search engine or actually using
- 31:28calculator by making an API call or
- 31:31different type of API call such as
- 31:33weather API that we have seen and um uh
- 31:37also generating a python code so that uh
- 31:40you could run as part of your sandbox
- 31:43sandboxes so by combining this reasoning
- 31:46and action model can do a lot more
- 31:49complex task than uh simple uh input and
- 31:53output type of interaction
- 31:58so here is uh let's uh look at a a
- 32:02little more detail on this U what does
- 32:04it mean by uh reasoning an action so
- 32:07reasoning part um instead of uh doing
- 32:10the uh doing the task that is asked uh
- 32:14you could prepare your prompt such a way
- 32:17that uh ask model to break down the task
- 32:21and then make a plan so instead of
- 32:24chaining instead of breaking down the
- 32:27task by your S as we seen in the
- 32:29previous U chaining uh chaining The
- 32:31Prompt slide you could ask model to uh
- 32:35break down and then uh prepare your task
- 32:38so in other in other words plan the plan
- 32:41the uh actions and then based on that
- 32:44breaking down model can generate
- 32:46different actions uh by uh by making an
- 32:50API call or or tool usage so that it
- 32:54could it could extract or collect uh
- 32:58additional information from the external
- 32:59world and then by combining all these
- 33:03put them in a memory so that it knows uh
- 33:06model knows what's what's been happening
- 33:09and then based on that finally draw an
- 33:12answer for you so let's look at the uh
- 33:16concrete example here so if you have a
- 33:20um customer support AI agent then how it
- 33:24might look how it might work so uh as a
- 33:28customer um um ask can I can I get a
- 33:32refund for product full then um agentic
- 33:36system will break down this task break
- 33:39down this request task into the
- 33:42following four different type of actions
- 33:46um check the refund policy check the
- 33:48customer information and then check the
- 33:50products and then finally um collect and
- 33:54then uh decide what to do in each St
- 33:58um language model will speed out the API
- 34:01calls so that it could uh collect the
- 34:04information um for example check the
- 34:07refund policy um language model could
- 34:10ask a retrieval system um uh against the
- 34:14pre-indexed uh company policy refund
- 34:17policy and from there it could retract
- 34:19the information and then put them in its
- 34:21own context and then using that also uh
- 34:25request a customer order information
- 34:28it could either ask customer back to in
- 34:31a chat format collect more information
- 34:34or you could uh look it up uh in the
- 34:36system because uh uh depends on how this
- 34:40chat system is uh prepared um the same
- 34:43thing for the product uh uh so that it
- 34:46could collect more information and then
- 34:48finally draw the uh conclusion based on
- 34:50the policy and then product information
- 34:53as well as the customer uh order
- 34:56information and then uh um send the
- 34:59request uh to the followup system uh as
- 35:02a m API call as well as the send prepare
- 35:07uh say response draft and then uh that's
- 35:10going to be handled by final um
- 35:16approv all right so um workflow is
- 35:20generally like this so in it sense uh
- 35:24agentic language model system is
- 35:26generally um lamb is making uh language
- 35:29model is making iterative calls by
- 35:33reviewing the document of test and then
- 35:35making an external tool calls um things
- 35:39that uh an example um if you want to do
- 35:44some research uh of certain uh matters
- 35:48you could prepare your agent to do a
- 35:50research uh web search or different type
- 35:53search and then keep summarize them and
- 35:56then um either ly and then finally
- 35:58prepare the report to you or to to your
- 36:02system um another example could be
- 36:05software uh assistant agent that uh you
- 36:09could uh ask uh this software agent
- 36:11software U um agent or S agent that um
- 36:16ask the issues of certain type of
- 36:19software buo issues then this agent will
- 36:22look it up and review this issue and
- 36:25then uh collect the relevant
- 36:28um a piece of code or files and then
- 36:31review them and then propose the output
- 36:33or it could also um execute in its uh
- 36:37sandbox environment and then uh test the
- 36:40correct test the fix and then uh get the
- 36:43output and then iteratively try to find
- 36:45the fix and then finally uh propose the
- 36:48pull request or the um um changes to uh
- 36:54to uh users or
- 36:56developers uh um these are the uh ways
- 36:59that we can use language model in agent
- 37:02format and by uh by doing iterative
- 37:06language model
- 37:09calls um so the difference um main um
- 37:16reasons and reasons and difference uh
- 37:19why this U agentic language model usage
- 37:22is uh getting more widely used is um
- 37:26given that if you have the same model if
- 37:30you could if you ask just direct request
- 37:33to the model model may not be able to
- 37:36handle it um um however if you put your
- 37:40uh task in this type of agentic format
- 37:44or patterns then model will do uh more
- 37:47complex task um even using uh model that
- 37:51may not be able to do it if you don't do
- 37:54this uh way so that's one of the reason
- 37:57that agent language model is uh uh
- 38:00pushing the boundary so that the things
- 38:03that we can do with AI agent is more
- 38:07complex or or different domains that uh
- 38:10we can rely
- 38:14on all right so um here are the real
- 38:17world applications um software
- 38:19development um code generation or bug
- 38:22fixing or um type of uh this type of U
- 38:27development uh is widely investigated or
- 38:31being researched by different
- 38:33organizations as well as their companies
- 38:35that trying to provide these Services as
- 38:38decision on the right side and uh
- 38:41research and Analysis that um gather
- 38:44information synthesize it and then
- 38:46provide a summary for uh for the users
- 38:49and then task automation is one uh one
- 38:51of the area that agentic method could be
- 38:55uh uh could be uh used
- 39:00all right so uh to uh to uh to make it
- 39:05more clear here are some of the design
- 39:08patterns that you could use uh uh use
- 39:11agentic language model um planning is
- 39:14critical because uh by asking uh a model
- 39:19to breaking down break down the task to
- 39:22make it simpler task or clear uh task so
- 39:26that the Lang model later can make an
- 39:29API call or you or use the tool usage so
- 39:33planning is critical and then reflection
- 39:36is something that um model can generate
- 39:39in itself and then uh um the next next
- 39:45uh model call can uh can
- 39:48criticize uh the output that uh actually
- 39:52came from the same model so by doing
- 39:54this uh the output could be improved and
- 39:57then tool usage is uh is something that
- 40:00anything uh uh something that outside of
- 40:03the language model that you need a
- 40:04realtime information or different type
- 40:07of um uh information then you can use
- 40:09this and then uh multi-agent
- 40:11collaboration is one way to handle
- 40:15this reflection uh is uh a pattern that
- 40:19quick to implement and then uh uh leads
- 40:22to good performance and let's uh use a
- 40:25concrete example here so if you want to
- 40:27refactor a uh programming code um
- 40:31instead of ask model to improve it right
- 40:33away if you do this pattern um as in
- 40:36this example saying that you ask the you
- 40:39ask a model saying that here's the code
- 40:41and then check the code and provide uh
- 40:44constructive
- 40:45feedback and then um take that feedback
- 40:50to the second prompt as in this uh
- 40:53example you could uh also prepare prompt
- 40:55saying that here is the code and the
- 40:58feedback which came from the model
- 41:00itself and then ask the model to uh V
- 41:03Factor it and then this uh this way of
- 41:07reflection will likely generate better
- 41:09output or better uh fix for the s for
- 41:13the code that you are asking to the
- 41:16model tool usage is something that we've
- 41:19seen it before um ask model to U
- 41:23generate the API patterns so that you
- 41:26can use the API function prototype to
- 41:29make an actual code um or if uh if the
- 41:33task is related to uh actual computation
- 41:36or some different form um you could also
- 41:40ask model to generate a program as an
- 41:43output and then you can run that on uh
- 41:46safe sandbox environment that that uh
- 41:49that your software uh or software
- 41:52scaffolding around the language model
- 41:54can execute and then provide an input
- 41:57provide uh the execution output back to
- 42:00the model so that model can syn
- 42:02synthesize
- 42:04it all right so multi-agent is um is an
- 42:09interesting way to implement uh or U
- 42:12accomplish your complex task so um you
- 42:16could split up the task uh uh or you
- 42:19could split up your task and then assign
- 42:22those task in a different agent that are
- 42:25dedicated for specific task
- 42:27um and then this agent is uh in this
- 42:31case in this uh context could be just
- 42:35just as a different prompt or different
- 42:38Persona so you could uh the prompt you
- 42:42usually consist of you are an helpful AI
- 42:45agent you could change that into a
- 42:48different Persona to different agent and
- 42:51also you may or may not use the same
- 42:54model or the different model uh based on
- 42:56the T
- 42:57so let's use a concrete example here so
- 43:01if you build a multi-agent system for
- 43:04smart home automation you could create a
- 43:06different agent a climate uh control
- 43:09agent a lighting light lightning
- 43:11lighting control agent and so on and
- 43:14then these are are the software piece
- 43:17that includes a different prompt with a
- 43:19Persona as well as handling external
- 43:22triggers and then those are the ones
- 43:25that uh work internally and then um that
- 43:28coordinate these agents U essentially a
- 43:32model prompt together with soft
- 43:35scaffolding around it coordinate the
- 43:36whole
- 43:39activity all right so that brings up to
- 43:43our summary so um the the uh agentic
- 43:50language model usage is a progression or
- 43:53extension to a existing language model
- 43:56usage method so for those for the best
- 43:59practice that you have used in language
- 44:01model um simple for simple cases uh are
- 44:06most of them are applicable um however
- 44:09you could use different uh additional
- 44:12methods such as more uh retrieval Search
- 44:15tool usage and then uh prepare different
- 44:18type of prompts and then uh workflow so
- 44:21that you could use language model as
- 44:24it's in its core as a reasoning or in
- 44:27turn and then you could use a tool usage
- 44:31or other other other retrieval method to
- 44:35interact with the external world and
- 44:37then uh Co combine these result and then
- 44:41uh such a way that you could you could
- 44:44achieve a complex task um instead of
- 44:48simple um um input and output type of
- 44:51language model
- 44:52usage and that said Petra
- 44:57thank you so much insub this has been
- 44:59really great so so much information
- 45:02hopefully this is useful for everybody
- 45:04we keep collecting the questions we got
- 45:07so many we will try to get as many as we
- 45:09can but yeah please feel free to keep
- 45:11them coming um maybe the first question
- 45:15for you in top and let's focus on the
- 45:17agentic AI um is about the evaluation
- 45:21and do you have some recommendations for
- 45:23a good strategy for evaluating agents be
- 45:27on just using an llm as a judge it seems
- 45:29it should be a little bit more
- 45:31complicated to do the evaluation on
- 45:33agents at least that's kind of the
- 45:34general notion the questions and people
- 45:36are wondering how that could be
- 45:38done right um I think this is a great
- 45:42question um so um just to uh uh make a
- 45:45quick context llm as a judge is commonly
- 45:49used method that you actually use llm to
- 45:52evaluate the model generated output
- 45:55against the uh ground truth answer or
- 45:58some type of reference information which
- 46:00works great and then why we used and
- 46:03also I we use that as well for the um I
- 46:08think one thing that I uh we I've
- 46:11recently tried is um
- 46:14agentic uh judging method meaning that I
- 46:18use uh a reflection type of reflection
- 46:22type of pattern that we have seen
- 46:25previously um uh instead of just ask one
- 46:28question right away to llm as a judge I
- 46:31ask um first llm is uh uh provide
- 46:35initial reference uh and then feedback
- 46:39and then I also ask again uh another um
- 46:43llm call or different prompt saying that
- 46:46hey um this is feedback from other other
- 46:49um your Junior engineer um if you are a
- 46:52senior engineer how would you compare
- 46:54the junior Engineers evaluation um
- 46:57against the um the output that you are
- 47:00evaluating so I find that this
- 47:03reflection pattern was helpful to get
- 47:06the better evaluation instead of just
- 47:09one shot um llm as a judge output um
- 47:13however I think there can be a more
- 47:15creative way to improve your evaluation
- 47:19stage using uh agent patterns um because
- 47:23the evaluation it is really really
- 47:26important I can't emphasize uh uh uh
- 47:30more because U that will help you to
- 47:33advance best or change models and
- 47:36different type of um um changing the
- 47:38prompt and so on and so forth so I think
- 47:41that was a great
- 47:43question thank you so much inso uh we
- 47:46got a few questions about kind of
- 47:49augmenting the AI agents for specific
- 47:52uses and making sure that kind of they
- 47:55they get shaped in a way you need for
- 47:57your application like on the
- 47:59technological side like what is there to
- 48:01do what is there to use we got many
- 48:04questions kind of like going to this
- 48:06idea so if you have some some kind of
- 48:08information it would be
- 48:10helpful right um again I think this is a
- 48:13great question um I
- 48:17would so fun uh one thing first thing
- 48:20came up to my mind is if you have a
- 48:24task um which is simple already uh uh
- 48:27which is simple then you just use
- 48:29language model simple use cases however
- 48:32if you see a little more involved or
- 48:35complex test you could um experiment
- 48:37with simple agentic test even if it's a
- 48:41agentic agentic language model usage
- 48:45could be uh many could be uh you can
- 48:48define agentic Language model in many
- 48:50many different ways uh but if you uh uh
- 48:54have a little more involved task you
- 48:55could uh do um iterative language model
- 48:58call even that could improve your output
- 49:02so um I think it um it all depends on
- 49:06your test case uh uh test um actual
- 49:10application domain but uh instead of
- 49:13trying to apply trying to look for the
- 49:16test that you could apply language Model
- 49:18turn that into turn that around that um
- 49:21how this test cannot be solved with the
- 49:24simple uh cases so simple language model
- 49:27usage so try to apply
- 49:29simple simple uh usage first and then
- 49:33try to improve it using different uh um
- 49:37um patterns um same for I think a
- 49:41slightly uh tangential but um
- 49:44fine-tuning cases also if you could uh
- 49:47have a test uh if you have a task that
- 49:50in you want to uh solve um try to use
- 49:54the existing model first and whether it
- 49:56makes sense or not and then uh from
- 49:58there you could decide how to do it then
- 50:01you could uh uh prepare small uh data
- 50:04samples and then try it and then make a
- 50:06progress and then a really quick
- 50:08iteration instead of trying to invest um
- 50:11up front uh too
- 50:15much thank you andp uh few questions
- 50:19came in um and I will kind like this is
- 50:22like a kind of giant question on its own
- 50:24so I will kind of let you choose how you
- 50:26want to respond to that but a lot of
- 50:28questions about kind of ethical
- 50:30considerations how to avoid
- 50:32hallucinations like how to avoid kind of
- 50:34like using data that might be um like
- 50:38unethical or like there might be
- 50:39something kind of behind them um what
- 50:42would be your recommendation again like
- 50:44this question is so big but maybe like
- 50:46looking for something that you you would
- 50:47say about
- 50:48this all right yeah um another great
- 50:52question um yes due to um it's a
- 50:58probabilistic uh generation uh in nature
- 51:02Hallucination is always there uh
- 51:05although a lot of people are working on
- 51:07it so it's a problem as well as the um
- 51:11um the contents um uh contents output uh
- 51:15has a concern could be a con concerning
- 51:19so I think a model provider themselves
- 51:22is checking um the generated output in
- 51:25terms of different categories
- 51:27um as well as your application U provide
- 51:31application Builder yourself uh also add
- 51:35some uh guard rails God rails being um
- 51:38checking the output uh using small small
- 51:41L small language model so that you could
- 51:44quickly check the output or some type of
- 51:46uh uh I guess a criteria using
- 51:49classifier or some type of things so
- 51:51that you could actually filter them out
- 51:53to see um I it could be either U on the
- 51:57final generation stage or it could be in
- 52:01taking uh in the input stage that the
- 52:03query comes in so that you could
- 52:05actually avoid it this can be uh uh can
- 52:08backfire but I I think uh uh as a
- 52:12Enterprise or business you may be on the
- 52:16safer side so they're making sure
- 52:18generated input generated output as well
- 52:21as the uh inputs queries that being
- 52:25requested uh could be be more um safe or
- 52:28um reasonable U cases so this is
- 52:33evolving but I think of fundamentally it
- 52:35is something that uh check the output
- 52:37using type of classifier or or even
- 52:41decoder type model to uh check
- 52:44it thank you so much and a little plugin
- 52:48we do have generative AI program that
- 52:50also covers a lot of kind of the ethical
- 52:52aspects of kind of llms it's not a
- 52:55technical program but like I'm kind of
- 52:56reaching to people who are asking about
- 52:58this sort of very important
- 53:01questions uh maybe last question ins up
- 53:04for you um and you know we are not going
- 53:07to be endorsing of course like it's
- 53:09temper but like a question is like how
- 53:11to get started are there any open source
- 53:13models to recommend is there anything
- 53:15kind of people can do to kind of start
- 53:17testing this out like start playing with
- 53:20this great question I
- 53:24I so one thing um that uh uh as a take
- 53:29on message here is uh start simple and
- 53:33then uh experiment it and then uh
- 53:35iterate it so that's and also agentic
- 53:38language model is sounds complex fancy
- 53:41but it isn't progression and extension
- 53:43of language model usage so um to start
- 53:48um I think um you could um there are
- 53:52many language model usage framework and
- 53:55also a agentic
- 53:57framework uh that you could use however
- 54:00to start I would suggest to uh use uh
- 54:05playground type of environment um say uh
- 54:09uh model provider generally have their
- 54:11playground that you could um type uh
- 54:14your uh your prompt or input so that you
- 54:16can see the output right away so that
- 54:19you can experiment it really quickly and
- 54:21then uh once you get familiar with it
- 54:24and then use the API to uh to make a
- 54:27call from your call your program and
- 54:30then see what's going on um in that way
- 54:32you gain insights as well as uh practice
- 54:37uh best practice for uh prompt uh prompt
- 54:40preparing so once you have that you
- 54:43could uh U int intelligently decide
- 54:46whether it makes sense for you to
- 54:48actually continue your own code base or
- 54:50make use of uh widely available
- 54:53libraries so in short um start simple uh
- 54:57work on a playground first and then make
- 54:59a simple API calls and then decide
- 55:01whether you want to use uh more extended
- 55:04uh libraries or just continue your own
- 55:06way um this this applies for language
- 55:10model usage as well as agentic uh uh uh
- 55:13language model usage as well because
- 55:15there's also many agentic language model
- 55:19framework out
- 55:21there thank you so much and to close us
- 55:25I would like in this session
- 55:27uh in the last minute in so you know the
- 55:29field is progressing so fast there is so
- 55:31much happening basically every week we
- 55:34see news about something new coming up
- 55:36in any of these fields um are there any
- 55:39resources you study you follow anything
- 55:42you would recommend people to kind of
- 55:44keep track of to stay up to dat in llms
- 55:47agentic AI in this
- 55:51field
- 55:52um um difficult question but great
- 55:55question I
- 55:57um there um I think it's a little hard
- 56:02but I I picked some um um uh some uh
- 56:07experts who are known this field I
- 56:09follow them uh either in uh forly
- 56:13Twitter uh or YouTube channel and then
- 56:17from there I get more updated
- 56:19information and then do my own uh
- 56:22diggings um but I think uh uh find out a
- 56:26good uh starting point is good thing and
- 56:29then I I think a reference here um uh
- 56:32you can screenshot it and uh this can be
- 56:34a good starting point uh because it
- 56:37includes some uh uh agentic uh uh usage
- 56:41uh courses as well as a good type of
- 56:44courses um either from Stanford as well
- 56:46as different uh uh places so um
- 56:51yeah thank you so much insa this has
- 56:53been really great so much helpful
- 56:55information and you know you're
- 56:57absolutely the best person to hear this
- 56:58from thank you so much for taking the
- 57:00time thank you also everyone uh who
- 57:02joined us live thank you for your time
About this transcript
This page contains the full transcript of Stanford Webinar - Agentic AI: A Progression of Language Model Usage by Stanford Online, generated from the public captions YouTube serves with the video. The transcript has 8,078 words across 1,117 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.