Latest / Agentic Conversations (formally mlops.community) / Holistic Evaluation of Generative AI Systems // Jineet Doshi // #280
Transcript
- 0:00So my name is Janet Doshi, I'm a staff AI scientist at Intuit and
- 0:09I'm caffeine free so I do not drink.
- 0:12I neither like tea or coffee. Try to keep it natural.
- 0:21Welcome back to the End Alarms Community podcast.
- 0:23I am your host Dimitrios, and today this is the holistic view
- 0:28of evaluation. We break down three different
- 0:32ways that you can evaluate your Gen AI systems and talk about
- 0:40LMS as a judge. Some best practises, some
- 0:43challenges, different ways that you can do them.
- 0:48Oh. I felt like I've had a lot of
- 0:52conversations on evaluation in the past two years.
- 0:55This really took all of those conversations that I've had.
- 0:59You know, maybe there was a sliver over here, a nice little
- 1:02chunk over there and it wrapped him up, put a little bow tie on
- 1:07top of it and served it as a present.
- 1:11So Christmas came early for y'all.
- 1:13Hope that some of the stuff we're saying in this makes you
- 1:18have better AI systems. Let's jump into the
- 1:23conversation. And as always, if you enjoyed
- 1:27it, share it with just one friend.
- 1:32And if you are sticking around on Spotify, I've got just the
- 1:36song for you today because I want to give your recommender
- 1:43system something new. And as always, we're sharing a
- 1:49song to cruise into this podcast conversation with.
- 1:55This one today is called Sunsets, and it's by Living
- 2:02room. Yes, sunsets by living room.
- 2:10And we'll drop the link into the description or just go ahead and
- 2:15Shazam it right now. So good.
- 3:04This conversation came about because I was given a talk two
- 3:08years ago now, not this last paid in an AI summit, but the
- 3:12one before that around LMS and AIM production.
- 3:18And you were at that talk and afterwards, or actually even
- 3:21before I went on, we got to chatting and you were saying,
- 3:26you know, one thing that is very important that I'm not seeing
- 3:29enough people talking about is evaluating.
- 3:33But evaluation on a systems level.
- 3:36And you had ample experience because of your work at Intuit
- 3:40and building out, what is it, Intuit Assist that's powering
- 3:44over 100 million customers, which is insane, just in
- 3:47general, insane scale. And so that planted the seed in
- 3:51my head. And here we are two years later,
- 3:54finally getting around to having the evaluation conversation.
- 3:57So it's great to have you here, man.
- 3:59Yeah. Thank you, Dimitris, for having
- 4:01me. Yeah, absolutely.
- 4:04This is like a very important topic because it kind of goes
- 4:08like right to the core of like building trustworthy ML systems,
- 4:14which is like extremely important.
- 4:17So yeah, happy to talk about this.
- 4:19And yeah, I also do want everyone to know like the views
- 4:25that I express are my own and yeah, it should not be
- 4:30associated with any organisation or entity.
- 4:33There we go, Just as a disclaimer and we'll put that
- 4:36one front and centre so nobody gets twisted.
- 4:41But there is a lot of cool stuff that's happening at into it.
- 4:45You guys are powering a lot of models.
- 4:49What was it? Hundreds of thousands or 10s of
- 4:51thousands? Right.
- 4:53So when I joined into it like 6 1/2 years ago, at that time like
- 5:00basically we had like single digit models in production to
- 5:04now like Fast forward to now where we really like invested a
- 5:09lot in AI and we are at the point where we have like
- 5:14thousands of models in production making 58 billion
- 5:18predictions a day. Like that's the scale at which
- 5:22we are at now. 58 billion, that is such a large amount I, my
- 5:29mind can't even fathom how many zeros that is.
- 5:32And I can assume that they're not all LLMS. You have a mix of
- 5:37traditional and Gen AI in there. But what you've been noticing,
- 5:42right, that when it comes to the Gen AI type of products that
- 5:49you're putting out, you need to really think wisely about
- 5:54evaluation and how you are going about recognising if the system
- 6:01in general is performing. And so I think when we kicked
- 6:05off this conversation way back when, you were saying, yeah, you
- 6:09have to look at the model output, but you have to look at
- 6:12the model output on many different vectors.
- 6:15And you also have to look at the system.
- 6:19So retrieval evaluation can be one thing.
- 6:22So how are you chunking things and looking at that?
- 6:25There's and even looking at the how are you embedding and the
- 6:30embedding model? And that is becoming more and
- 6:34more mainstream. But I'm wondering if you want to
- 6:38give us a lay of the land on why you feel vows are challenging
- 6:43and why it still feels like it's an open problem even two years
- 6:47later. Yeah, yeah.
- 6:49Absolutely, Yeah. So I mean, evaluating generative
- 6:52AI systems is it is quite challenging.
- 6:56And I think there's like no right or wrong.
- 7:00There's it's all like dependent on the use case at the end of
- 7:04the day. So like when we look back and
- 7:07see like, OK, why is fundamentally evaluating LLMS
- 7:10challenging, right. So if we go back to like the
- 7:14classical ML space essentially like it feels like a long time
- 7:19ago, but it wasn't that long ago.
- 7:22So with the classical ML models, essentially what we would do is
- 7:28we would train like your usual tree based models or SVMS on a
- 7:32very specific task. Like those were all very task
- 7:36specific models every like the problem was very well defined
- 7:40and the output was like very limited, right?
- 7:43Like the model would essentially output the probability of
- 7:47classification or like some number if it was a regression
- 7:51problem. And the metrics as well were
- 7:53pretty well defined. So essentially it was like these
- 7:58models were trained on very niche tasks and the outputs were
- 8:03very limited, well defined, and the metrics were also very well
- 8:07defined. So if it's classification, you
- 8:09look at accuracy, precision, recaller, you see like what have
- 8:13you. Same with regression.
- 8:16It had it's own set of metrics. But then when these LLMS kind of
- 8:21came about, it completely flipped the script, right?
- 8:25Like everything I felt like went upside down in a way because now
- 8:30suddenly these LLMS are producing open-ended outputs.
- 8:35Like you can ask it to like write a poem about Pytorch and
- 8:39it'll do that. And there's like no one right
- 8:44way of doing that. There's like millions of
- 8:46possible right answers. And the other pieces, the
- 8:51breadth as well, right? Like earlier we had very task
- 8:54specific models, but now like one single model is able to do
- 8:58so many different tasks, right? It can write a poem, it can
- 9:02summarise, it can do Q&A. There's like so many different
- 9:08things that these LLMS can do, which again begs the question,
- 9:12like how do you measure intelligence like on a broader
- 9:16scale? And I feel this is something we
- 9:20haven't really solved even for humans.
- 9:23Like we have things like IQ tests, but again, those are far
- 9:26from perfect. So that's why I feel like it's,
- 9:30it's a very essential and challenging topic.
- 9:36You know, one thing that I have thought about so much when it
- 9:40comes to evals is if there will be a product to solve the
- 9:49evaluation problems and if that product is an eval product or if
- 9:55it's part of a greater platform that you're doing AI development
- 10:01on. And I know that you've, you've
- 10:06had some experience already. Do you feel like it's going to
- 10:09be a product? I'm not sure about the product
- 10:16piece, but it is absolutely essential like to have evals at
- 10:21I would say the entire ML life cycle.
- 10:23So like right when you choose your data to like when you're
- 10:28building or like training or fine tuning the model offline to
- 10:33then OK, even once it's in production, we still need evals
- 10:36to constantly monitor and make sure like there's no drift and
- 10:41everything's like working as expected.
- 10:43So I feel like evals at the end of the day are essential across
- 10:48the entire like ML life cycle. Again, whether that's classical
- 10:51ML or Genii, I think that doesn't matter.
- 10:55Yeah. What are some different
- 10:57approaches that you have in mind when you are doing evals?
- 11:01Have you experimented with ways that have deemed to be more
- 11:07successful or less successful? Sure.
- 11:11Yeah. So I, I'm guessing you're
- 11:12referring specifically to LLMS engineering systems.
- 11:15Yeah. So yeah, So in that space again,
- 11:20there's I feel there's no right or wrong.
- 11:22There's like different techniques that are out there
- 11:26and each one comes with it's own trade off at the end of the day.
- 11:29So we have to like be aware of the pros and cons of each of
- 11:34them and make those decisions based on the use case.
- 11:39But in general, I feel like we can think of the different
- 11:44evaluation techniques for gener systems into like 3 higher level
- 11:49categories. So the first category is I, what
- 11:53I would say like some more traditional NLP techniques.
- 11:58So again, when LLMS came about and people realised, OK, like if
- 12:02everything is a big challenge, like how do we approach this?
- 12:06The first thought process was NLP as a field has existed for
- 12:11multiple decades, right? Like that's not me.
- 12:13So can we like borrow all of the great work that people have done
- 12:19already in that domain and see like how, how we can reuse some
- 12:24of that. So if we like dive a little
- 12:27deeper into that. So one approach is essentially
- 12:32that LLMS again usually create have open-ended outputs, but
- 12:37essentially can we like tweak our evaluation test set to
- 12:43essentially have multiple choice questions and like almost
- 12:48artificially force the LLM to pick options and force a close
- 12:53like a close ended output versus an open-ended output.
- 12:56And then by doing that, like all of the traditional evaluation
- 13:02metrics suddenly become applicable.
- 13:05Of course, like it's easy to compute and like everything is
- 13:10well defined. But of course, the corn here is
- 13:13we cannot really evaluate on a lot of the open-ended tasks.
- 13:17It's it's more helpful when it's like knowledge based or
- 13:21reasoning based tasks that we can evaluate on an extension of
- 13:26that was also like in the like the tech similarity space, where
- 13:32again, if you do have like long form output from the LLN and
- 13:37let's say you have some reference answer, the idea is
- 13:40that you can convert both of them into like an embedding
- 13:44space or like into like an N gramme space.
- 13:47And then like let's like do the comparison in that space.
- 13:52So again, there's like pretty well studied metrics like board
- 13:56score, bot score, cosine similarity at the distance that
- 14:01exist in that space, which again have been used like across the
- 14:07board by different teams. So one of the advantages of
- 14:10doing that is basically with in the embedding space, your
- 14:17answers can be like language agnostic in a way, right?
- 14:21Like if your LLM output is in English, let's say, but your
- 14:25reference answer is in Spanish, The idea is start in the
- 14:29embedding space at least as long as the embeddings are good
- 14:33quality, they capture the semantics and the similarity
- 14:38scores would would be like higher there.
- 14:44But then of course that's also that also leads to a con of that
- 14:48approach. Like something to keep in mind
- 14:50is it is heavily dependent on the choice of the embedding
- 14:54models. So if you're looking at like
- 14:56domains, specific evaluations where it's like you have the
- 15:00legal language or the medical domain where the language tends
- 15:05to have like quirks and nuances of its own, you need to pick an
- 15:10embedding model that kind of captures that.
- 15:14Because if it doesn't, then. Invite you in the ass.
- 15:17Things failure and also some of these metrics there have been
- 15:21studies that have been shown that they do not always like
- 15:25align with human judgement. So that's something to keep and.
- 15:29To underpin this is the traditional NLP type of
- 15:33evaluation. So that's what you are.
- 15:36That's like the first bucket that you see as one way to do
- 15:40it. Yes, absolutely there's some
- 15:42more techniques there as well like benchmarks is another
- 15:47pretty I would say popular widely used technique.
- 15:51Again, there's thousands of benchmarks out there increasing
- 15:54like everyday things like you know, MMLU, super glue squad,
- 15:59like these are like very well known benchmarks so that.
- 16:04Just a quick shout out to the Pro LLM benchmarks that our
- 16:08friends at Process Setup. And the reason is because they
- 16:13don't give any of that data out publicly and they're constantly
- 16:18creating new data sets. So it feels like it's high
- 16:23quality benchmarks, you know, and I know there's a lot of
- 16:26discussion about how benchmarks are essentially bullshit since
- 16:31you can over fit to them if the data is public.
- 16:35And so the Pro LLM benchmarks feel like, hey, this is a good
- 16:40way to do it. And it's got 10 different ways
- 16:44to evaluate the models. So it's not just one type of
- 16:48benchmark. You get different benchmarks
- 16:50like there's a Stack Overflow benchmarks, there's function
- 16:54calling benchmarks for agents, etcetera, etcetera.
- 16:58But I don't mean to derail it, keep going.
- 17:01What's the other buckets? Yeah, sure.
- 17:04So, yeah, since we're on benchmarks, like as you
- 17:06mentioned, there's a lot of open source benchmarks as well that
- 17:10are out there. And like these benchmarks are
- 17:13really like across the board, right?
- 17:15Like benchmarks for testing physics or knowledge or
- 17:19reasoning or even for things like hallucinations or toxicity.
- 17:25Like all of these different vectors we kind of want to test
- 17:30before putting production, right?
- 17:32So that's why they're pretty popular.
- 17:33Like you can combine, of course, multiple benchmarks together and
- 17:38see across the board across the different factors like how your
- 17:42model is performing, which is helpful.
- 17:45But yes, at the same time, again, benchmarks have their own
- 17:47limitations as well. Like lot of them are again,
- 17:50fairly multiple choice type of questions.
- 17:54So again, like we cannot really evaluate like the long form or
- 17:59open-ended type of tasks. Are you grabbing benchmarks and
- 18:04adding them to your test sets just to get like a sanity check
- 18:09on your models? And if there is something that
- 18:13feels like it's not really working, like toxicity score for
- 18:17some reason is really high on this model, then you can go and
- 18:21you can curate your own data set and try to dig into it a little
- 18:25bit more. Is that something that you've
- 18:28experimented with? Yeah.
- 18:31So benchmarks, I would say it's very use case specific at the
- 18:36end of the day. Like yes, there's a lot of like
- 18:39open source benchmarks out there, but at the end of the
- 18:42day, you have to like look at what exact use case your models
- 18:45trying to solve and if whatever benchmark you pick is applicable
- 18:51for that use case. Well, in some cases, yes, off
- 18:54the shelf benchmarks are good enough.
- 18:57But again, depending on like how niche your use cases, there have
- 19:02been times where again, you almost have to create your own
- 19:06benchmark as well. Yeah.
- 19:09And then like use that because again, you don't have like an
- 19:15open benchmark for your specific needs.
- 19:18One more point on the benchmark piece though, while we're at it.
- 19:22I like you raised an important point about essentially like
- 19:27training data leakage at the end of the day, because again, these
- 19:30LLMS are trained on like Internet skilled data.
- 19:35If the benchmarks become part of their training data, then of
- 19:38course that leads to like inflated numbers in terms of
- 19:44performance or something to keep in mind.
- 19:47There have been a lot of benchmarks that I've had to be
- 19:49updated because of this problem. I think Lu was one of them.
- 19:56MMLU also I think had to be updated to like we do because of
- 20:00this problem. So, yeah, again, one of the
- 20:03challenges I would say in this space.
- 20:06And what are the other buckets that you see?
- 20:10Sure. So the other two I would say
- 20:13higher level buckets, 1 was like the traditional NLP kind of
- 20:18approaches. The second bucket I would
- 20:21probably put under is like human based approaches so where you
- 20:26have essentially manual labelers so.
- 20:31Expensive. Yeah.
- 20:33And like that is one of the disadvantages of that approach
- 20:39for sure. But yeah, it's still at the end
- 20:43of the day, it's still like considered to be like golden in
- 20:49terms of like lot of different use cases.
- 20:52So with like like whenever like manual labelling is involved,
- 20:57like from experience, what like I've seen as it's really
- 21:02important to have like a well defined criteria for the
- 21:05labelers. Because at the end of the day,
- 21:08again, when subjective things get involved, it's like, OK, if
- 21:13this is a three out of five answer for you, it could be like
- 21:17a 5 out of five for me, like based on like subjective factor.
- 21:20So it's really important to like have a good like training and
- 21:28like a good definition of of like all these different
- 21:31criterias to ensure consistency across like human labels.
- 21:35And even within, I think human labelling, there's some
- 21:40interesting approaches. So again, it doesn't always have
- 21:43to be absolute scoring. There are there is this idea of
- 21:47arenas as well where essentially you have like different models
- 21:50are kind of facing off against each other.
- 21:53So the idea that is sometimes it's easier to just give
- 21:56preferences rather than absolute scores.
- 21:59Like you can say, OK, this answer is better than this
- 22:02versus OK, this is like a three out of five or this is like a
- 22:05four out of five. So there's like chat bot arena
- 22:10is like quite popular. There's like a bunch of such
- 22:13arenas out there as well. And then ultimately you can
- 22:15aggregate these preference scores and create a leaderboard
- 22:20from from that one. I would say like extreme version
- 22:25of this is like just hiring your own red team.
- 22:29There's a lot of companies that are doing that now where, again,
- 22:34like the the idea is, has been around for quite some time in
- 22:39the cyber security space. So now that's kind of being
- 22:42applied here, which is pretty interesting to me, where you
- 22:45have these specialists who are like trained on essentially like
- 22:50trying to break these models and trying to evaluate them before
- 22:54like you expose them to like millions of your customers.
- 22:57Yeah. I've even seen red teams, so red
- 23:00teams as a service, but also I've seen companies that are
- 23:04creating agents or a SAS platform that is basically
- 23:09agents as red teams. And so it's not humans that have
- 23:14been trained to break models, it is models that have been trained
- 23:20to break models. Yes, that is a fairly common
- 23:25approach and it's increasing in popularity now.
- 23:28So that was actually going to be my third bucket which is model
- 23:33based evaluations essentially. But before we go there, I think
- 23:38while we're at the human evaluations piece, like just a
- 23:43quick, I think pros and cons there is like the advantage is
- 23:47of course that like with manual labelling, you can evaluate
- 23:53across like a wide array of different spectrum.
- 23:57Like you can really do holistic evaluations, whether it's not
- 24:01just for quality, but also for like toxicity bias, like things
- 24:05like that. It is again still considered
- 24:09golden for lot of different use cases.
- 24:12But of course, the disadvantage is that it can't scale that
- 24:15easily. And then for domain specific
- 24:20evaluations like again, if you are in the legal space or the
- 24:23medical space or the finance space, you have to ensure that
- 24:28your evaluators are experts in that domain.
- 24:32They have domain knowledge essentially, which again can be
- 24:35difficult many times and expensive.
- 24:39And. Expensive.
- 24:40So yeah. And that's why which brings me
- 24:42to the third bucket which has really picked up I think off
- 24:46late, which is model based evaluation.
- 24:49So essentially using like LLM as a judge kind of approach.
- 24:55So that high level hypothesis there is like if you use a more
- 25:00capable model, essentially as a judge, can it provide the same
- 25:05type of benefits as that of a human evaluator but without some
- 25:10of the bombs? And again, there have been
- 25:13studies that have shown promising results along that
- 25:17front, but still it's not, I would say it's still not a
- 25:20solved problem because like even with LLM as a judge based
- 25:24approaches, there are challenges to keep in mind.
- 25:29Like again, there's been a lot of studies that I've shown that
- 25:33essentially the performance of LLM as a judge at the end of the
- 25:36day boils down to your choice of judge.
- 25:39And like things like prompt formatting, like how do you
- 25:42format the prompt of the judge? And there is like a by.
- 25:45Choice of judge? You mean the model?
- 25:47Yes. Judging.
- 25:49Yeah. Which model do you pick as a
- 25:51judge? How do you format the Proms?
- 25:55There's like some sensitivity to these parameters.
- 26:00And also there have been a lot of studies that have shown that
- 26:04it's important to keep in mind that sometimes, again, these
- 26:07LLMS to have biases. So like verbosity bias is one of
- 26:12them, where essentially LLMS sometimes tend to prefer answers
- 26:17that are longer versus shorter ones, even though the shorter
- 26:20ones might be of like similar quality.
- 26:23There's also positional bias to keep in mind, which is some
- 26:27somehow LLMS tend to prefer answers at the first position
- 26:33somehow versus the others. So again, things to keep in
- 26:38mind. There is something fascinating
- 26:40when it comes to LLMS as a judge because so much research is
- 26:44going on in this area. I love reading about how folks
- 26:50are doing it and the one that struck me as a really cool idea
- 26:59is LMS as a jury. So instead of saying, because as
- 27:03you were mentioning you, if you just have one LLM as a judge,
- 27:08then you really got to know the prompt.
- 27:11Here is the best prompt that I can get and the model is the
- 27:15best model that I should be using.
- 27:17But I've seen others who say, well, let's just grab a bunch of
- 27:21LLMS and different prompts, different models, and then we
- 27:26can take the average of all of those and see if it is higher or
- 27:31lower than what we are ready to deal with.
- 27:36Yes, absolutely. And that's another very
- 27:39interesting like idea that has come about.
- 27:42I have seen like a lot of studies around that as well.
- 27:46And with regards to like bias mitigation strategy, that is
- 27:50definitely something which does provide promising results.
- 27:56But then again, there's trade-offs there, which is like
- 27:59when you have a jury now again, your Evas become more expensive
- 28:04and like time consuming. So again, there's like some
- 28:08trade off decisions to be made. And then again, when you have a
- 28:11jury, it's like, OK, how do you, how do you consider like all the
- 28:16different outputs from different judges?
- 28:18Like, you know, how do you weight them separately, do
- 28:20weight them equally? Like then you go into like those
- 28:24kind of details. There's that detail and there's
- 28:28another way that I've seen it done, which is you have one LLM
- 28:32as a judge, but then you have another LLM judging the judge.
- 28:36And so it's saying, hey, let's see if this matches up the the
- 28:42LLM as a judge said this and you give both of the answer and what
- 28:47the LLM as a judge said to another LLM and say, does this
- 28:51make sense? And so then it will judge the
- 28:54judge. And So what are some LLM as a
- 28:57judge best practises that you've been seeing?
- 29:01Yeah. So this technique has definitely
- 29:05picked up quite a bit of late because essentially what we've
- 29:09seen is it provides the flexibility that human
- 29:13evaluators provide, but of course it's much more scalable
- 29:16if done right. So there has been a lot of work
- 29:20that's gone in I think over the last couple of years in the
- 29:23space and they have been some now well defined set of like
- 29:29best practises while using LLM as a judge.
- 29:34So the first thing is like, how do you validate the validator,
- 29:38right? We spoke about that a bit.
- 29:40So essentially one idea that has worked for a lot of people is
- 29:45like to have a golden data set first, which is like created by
- 29:50domain experts by manual labelling which you have
- 29:54complete confidence on, and then use that to calibrate the judge.
- 29:58So you would pick your, your judge model, you would finalise
- 30:03the prompt and all of that stuff based on that to ensure that
- 30:08there is a high correlation with that data set.
- 30:12So at least you have some confidence.
- 30:15Again, like any ML model, drifts do happen.
- 30:19So the judge is expected to drift overtime.
- 30:22So again, it's very important to like monitor the judge and
- 30:26recalibrate as needed overtime. The judge is usually again, it
- 30:32can be used to do either like absolute scoring or pair wise
- 30:36comparisons. For more subjective type of use
- 30:42cases, pair wise comparisons are usually better than absolute
- 30:47scores. But again, if you're do using
- 30:50absolute scoring, another really good practise, and again, a lot
- 30:56of studies have been published around this, is to have the
- 31:00judge use as low of a precision scale as possible.
- 31:06So like for. So what I mean by that is
- 31:08essentially having the judge preferably output A0 or A1
- 31:12versus it outputting like a score between zero to 100.
- 31:17Again, just like humans, they can be a lot of confusion for
- 31:21the LLM as a judge as well, which is like, you know, how do
- 31:24I differentiate between a 60 out of 100 and an 80 out of 100
- 31:28answer? So like essentially it's really
- 31:31good to keep it simple. It's also helpful to like add
- 31:37few short examples to the prompts.
- 31:40Again, you're kind of giving that reference to the judge.
- 31:43So that has shown to be like pretty helpful, asking the judge
- 31:50to output reasons with every evaluation.
- 31:54That's another very like important point that has helped
- 31:58especially with debugging. So when you ask the judge to
- 32:01really reason like why it thinks something is not good or
- 32:06something is good, you can check it's reasoning and like use that
- 32:11to iterate. And then there's some really
- 32:14interesting work that has gone on recently where there's this
- 32:18idea of grading notes that was introduced like I think just
- 32:22couple of months ago, which has also shown to really improve the
- 32:26performance of LLM as a church, especially on domain specific
- 32:30evaluations. So essentially the idea of these
- 32:33grading notes is for your evaluation set for each row, you
- 32:39would kind of add like a more detailed like version of what to
- 32:45look for. So if it's, let's say, like a
- 32:47code execution task, you would say, OK, like, please check if
- 32:53basically from the input file, like are all the columns right?
- 32:58Like is the formatting of all of the inputs right?
- 33:02Like check for essentially like any null type errors or like
- 33:09those type of exceptions. So essentially like adding these
- 33:12kind of granular notes to the church really helps, especially
- 33:18in in like the domain specific evaluations where the judge
- 33:24might not have all the knowledge.
- 33:27I after reading a few research papers, I'm like, man, I swear
- 33:35some of these researchers got to be so high and they're eating
- 33:38pizza in their dorm room or they're just enjoying life and
- 33:43they're thinking, you know, it would be awesome if we just had
- 33:46more LLM calls. That's what we need the to
- 33:50remedy the problem here, we'll just have more LLMS. Yeah, I
- 33:57think you heard on a very important challenge with this is
- 34:02at the end of the day, like who validates the validator or like
- 34:06how do you validate the validator given the validator
- 34:09itself is another AI in this case, right.
- 34:12So one of the like the best practises like I've seen like
- 34:17different people use in the industry is essentially you kind
- 34:23of have like a golden test set, which is again very trustworthy.
- 34:28So let's say, again, you have like domain experts who would
- 34:33essentially create that golden data set, like do those Evas for
- 34:38you, you have that golden data set.
- 34:40And then you use that to kind of calibrate the judge in the 1st
- 34:45place. And you first like establish
- 34:48some form of correlation with that golden data set where then
- 34:52you can say, OK, the judges like whatever, 80 percent, 90%
- 34:56correlated with my golden data set.
- 34:58So then I have a fair amount of confidence that OK, this judges
- 35:04is going to do like fairly well. But again we are dealing with
- 35:09challenges of overfitting there as well, the classic bias versus
- 35:13variance trade off in ML systems.
- 35:16And then another thing to keep in mind with that is of course
- 35:19that like every ML system there is going to be drift with time.
- 35:24So it's like you constantly have to monitor the judge again, like
- 35:28you know, is there drift in the judges judgments overtime?
- 35:32Like how frequently do we need to retrain and things like that?
- 35:37And. You're bringing up a great point
- 35:39that I just literally finished writing A blog post on, which is
- 35:45the costs associated with this type of stuff and it came about.
- 35:49My blog post came about because I, I saw yet another person on
- 35:54the Internet posting about how the cost per token is going
- 35:57down. And I, I wrote, yeah, cost per
- 36:01token is going down, but cost per answer is going up.
- 36:06And I didn't really explain myself good enough I guess with
- 36:10that comment. And the person replied like no,
- 36:14any given model anything, the best models, the tokens cost are
- 36:18all just plummeting. And I'm like, yeah, I didn't say
- 36:21cost per response is going up. I said cost per answer.
- 36:27And what I meant by that is if you look at the whole system and
- 36:30you look at everything that has to do with going into getting
- 36:34you a quality answer, you as that end user getting that
- 36:38quality answer. All of this that we're talking
- 36:40about LLM calls like up the wazoo because we've got a judge
- 36:45and a jury and the judger that's judging the jury.
- 36:48And also all of the human resources that are going into
- 36:54building out the system. If you're using agents, like
- 36:58don't even talk about how many more LLM calls you need because
- 37:02of the all of the agents. And that's not even factoring in
- 37:07this golden data set that you need to pay humans to curate.
- 37:12And now there's a tonne of other factors that I go into in depth
- 37:17in the blog post, but that's like the gist of it.
- 37:20The cost per answer. No one can say that that is
- 37:24going up or that is going down. That is 100% going up.
- 37:30Yeah. I think that kind of boils down
- 37:32to, I think the systems that we are now designing like we are
- 37:38taking on more complex tasks. And as you rightly mentioned,
- 37:42when you look into like RAG or agentic workflows, like some of
- 37:46these systems are extremely complex involving like multiple
- 37:50LLM calls. Sometimes there is a lot going
- 37:53on behind the scenes. So, yeah, as like these models
- 37:58get better, I feel we are also trying to tackle bigger tasks,
- 38:02bigger challenges which like creates very complex systems
- 38:07which has an impact on on the cost.
- 38:10But there have been again, some interesting, there has been some
- 38:14interesting work in that space as well where I have seen a lot
- 38:19of folks again try to use like small language models rather
- 38:23than large language models in again.
- 38:27That's so funny you say that because there's a whole part of
- 38:30the blog that I wrote where I said, all right, this is where
- 38:34folks are going to come in and saying, but what about open
- 38:37source, small domain specific models?
- 38:41And I said, OK, that's kind of arguing my point though, because
- 38:45let's think about that. Who is gathering the data to
- 38:49fine tune those models? If they are fine-tuned?
- 38:53What are you using the GPU cost to fine tune the models?
- 38:57The people that actually know how to fine tune the models, how
- 39:00much do they cost? Are you hosting those models and
- 39:04are you renting GPU's to host those models on your own?
- 39:07How much is that? And you better have some good
- 39:09alerting set up. So there's all this extra cost
- 39:12that comes into it that I do see is not part of the LLM call
- 39:17itself. But if you again are looking at
- 39:20it in this systematic way, in a holistic way, you recognise that
- 39:25the cost per answer is going up. Yeah.
- 39:30Again, that's a valid point that even with small language models,
- 39:35we have to factor in like all of these different costs.
- 39:39At the end of the day, I think it boils down to the use case.
- 39:42Like again, is your use case like specific enough that a
- 39:47small language model could work versus having like a more
- 39:51capable like large language model?
- 39:54So I think a lot of these design and create off decisions have to
- 39:57be made kind of like specific to the use case.
- 40:00And you, you said it perfectly with the complexity, we, we
- 40:04expect so much more from AI these days and their
- 40:08capabilities that inevitably that just translates to more
- 40:13complexity in the systems that we design.
- 40:16And so since we expect more, we're not just going and
- 40:22creating a system that hits an API once and then comes back
- 40:28with an answer, no, we've got to set up a whole rag system and or
- 40:32we've got agents that we want to actually go out and do things or
- 40:36plan and reason around these things and then go and execute.
- 40:39So it, it's interesting to think about that when you're looking
- 40:44at these different systems and I know that you have thought about
- 40:48evaluating RAG and evaluating agents in different ways.
- 40:54And so let's like jump into that.
- 40:56What are some things that you keep top of mind when you are
- 40:59evaluating RAG system? Yeah.
- 41:03So that's a very good question. So as we like develop more
- 41:08complex systems along the way, again evaluate evaluation
- 41:13remains like a challenge. It is very important to keep in
- 41:18mind like with these complex systems that we need to evaluate
- 41:22the parts and kind of the sum of the parts ultimately.
- 41:26So in like the more traditional software sense, it's like you
- 41:29need to do unit testing and integration test at the end of
- 41:32the day for the whole system end to end, right.
- 41:35So when we talk about, it's really important to like
- 41:39evaluate different parts of the rack system.
- 41:42Like you want to know how well is the retrieval doing?
- 41:46Like is the retrieval actually fetching relevant like chunks
- 41:52from the vector database for you?
- 41:54So there again, there has been a lot of work again done in the
- 41:58space because that's essentially a search problem.
- 42:00So there are more traditional metrics like your MRR and BCG
- 42:06reciprocal. I mean, recall at K, precision
- 42:09at K. So these metrics have existed
- 42:12for quite some time, again, because the search problem has
- 42:15existed for quite some time, like multiple decades.
- 42:18So I do see like reuse of some of that work within like
- 42:24retrieval systems as well. But then of course, there's
- 42:28scope for newer techniques as well, like LLM as a judge.
- 42:31Again, I've seen like lot of open source packages and tools
- 42:36out there using LLM as a judge just to like evaluate the
- 42:41retrieval system. And that's just the retrieval
- 42:44system piece, right? Then we go on to the answer
- 42:47generation system, like, OK, once you retrieve relevant
- 42:50chunks, you want to make sure that the LLM that's answering
- 42:56eventually is, is generating good answers.
- 42:58And then you want to test the whole system end to end, right?
- 43:01Like right from where you have a user query to all the way into
- 43:07like generating the final answer.
- 43:08Like, how good is that system? How consistent is that system?
- 43:13Like is there any like, bias in there?
- 43:17Is it producing like toxic outputs?
- 43:19Like, yeah, there's, I think there's absolutely a need to
- 43:24like, think of it holistically. Yeah.
- 43:28So when you are doing unit tests, you're thinking about the
- 43:33different pieces where you can add that evaluation in.
- 43:37And you mentioned one, which is how's it retrieving?
- 43:41Are you also doing it on the on the embedding model or are you
- 43:50doing it on like where are all the places that you're putting
- 43:53in unit tests, I guess as you set up your system and your rag?
- 43:57Right. So again, that's a very good
- 44:00question with a system like RAG, which again there's so many
- 44:05bells and whistles that she can pull like each of those things
- 44:11kind of requires it's own set of evals, right.
- 44:13Like OK, what kind of chunking strategy do you want to use?
- 44:17What kind of embedding model do you want to use again to make a
- 44:22lot of those decisions if you'll evals and Even so, yeah, if you
- 44:31want to ensure like success of the complete bigger access them,
- 44:37I feel like you need all these evals like at the individual
- 44:40level and then at the system level as well.
- 44:45And the, yeah. And then the integration tests,
- 44:47what do those look like? Sure.
- 44:49So the integration test in this case would be you're just
- 44:52testing the whole system like end to end, So right from when
- 44:55you get the user query interact system to your final output,
- 45:00right. And again, so a lot of the
- 45:02foundational techniques that we discussed earlier come into play
- 45:06here. So like you can have your own
- 45:09benchmark, you can create your own benchmark or you can reuse
- 45:13an existing benchmark from the open source domain.
- 45:17We can have like again, human evaluators, we can have a red
- 45:21team as well try to evaluate the system or again, we can always
- 45:27have like LLM as a judge based approaches there.
- 45:31So. And so when I traditionally
- 45:36think about tests in software development, it is a very
- 45:42instantaneous thing that you know, if my tests failed or
- 45:46passed, right. But with this, as soon as you
- 45:50start bringing humans into the mix or if you start bringing LLM
- 45:55calls into the mix, are you still getting that instantaneous
- 46:00feedback to know if your tests fail or pass?
- 46:03And are you doing these types of extended tests?
- 46:08I guess what does, what does it look like?
- 46:11Is it a monthly thing that you're bringing a human in and
- 46:15asking it to look and looking at the drift and really having deep
- 46:21examination there? Or is it more of we do it once
- 46:26and then it's more of like a yearly maintenance?
- 46:29How do you see that? Right.
- 46:33So yeah, evaluations are again very important, I feel in the
- 46:37entire life cycle of the project.
- 46:40So like I think what we discussed and now was kind of
- 46:43offline evals. So like all the evals should do
- 46:46before you launch the model. And then there's this again,
- 46:50completely different world out there of like online evals or
- 46:53production evals as well, right. So once you launch the system,
- 46:57you constantly want to monitor and make sure it's producing
- 47:01like the right quality of outputs.
- 47:03So even for that, yes, there are different ways of doing that.
- 47:08So like establishing feedback loops with your customers, like
- 47:12again, the classic thumbs up comes down.
- 47:15And again, so not everyone likes to provide those kind of inputs.
- 47:20So sometimes you also have to look at like more implicit kind
- 47:24of signals like are they trying to search for help somewhere
- 47:27else rather than like, you know, are they abandoning your system
- 47:31like more frequently? So there's like lot of some of
- 47:35these implicit systems that can be used in this signals.
- 47:38And then again, I've seen approaches where again, when you
- 47:42use LLM as a judge like essentially deploying the same
- 47:46thing online as well. And you're having the LLM
- 47:50judgements kind of like on a daily basis or on an hourly
- 47:54basis as well in some use cases. But on the cadence piece, I do
- 48:00feel like it is very important to have evals like as frequent
- 48:06as possible so you can monitor for like drift and quality and
- 48:11things like that. Why do you feel like maintaining
- 48:15production ML systems is such a challenge and under appreciated?
- 48:24Yeah, it is. I think it is one of those
- 48:27things which I feel like people don't think of that as like, oh,
- 48:33this is like something cool to do, but it is extremely
- 48:37essential to ensure like a good experience for customers
- 48:41eventually in production, right. So with software, again,
- 48:45traditional software systems, when we speak about maintenance,
- 48:49it was more around like ensuring that we take care of technical
- 48:53debt, we ensure that all the dependencies, all the different
- 48:57libraries that are up to date. But with ML systems, there is
- 49:01like an added layer of complexity to that whole thing,
- 49:04right? So you have all of the software
- 49:08based maintenance that you still need to do.
- 49:11And on top of that, now there is all this data level stuff that
- 49:16you need to look into as well, right?
- 49:17Like is your data drifting in production versus what to train
- 49:21the model on? Are there any issues with your
- 49:24features or is there any drift in the model itself?
- 49:27Like is the models prediction kind of drifting over time and
- 49:31trying to debug, OK, why that is?
- 49:34And then again, constantly having to retrain the systems,
- 49:37the models to make sure that they are up to date, like with
- 49:42what's going on in your product and with customers expectations.
- 49:46And again, at the rate of rate at which I feel like the whole
- 49:51AI space is moving again, just essentially keeping up with all
- 49:55of that progress, right? Ensuring that we have like
- 50:01again, good quality models, if there are better models out
- 50:04there, if there are better techniques out there, again, how
- 50:07do we again incorporate that into the system?
- 50:12Again, there's new and new better tools that are coming out
- 50:15everyday. So again, it's like, OK, now how
- 50:19do we incorporate that into our system?
- 50:22So as you can see, it is, there's basically, it ends up
- 50:26being like a very huge task, which I feel is like sometimes
- 50:33overlooked because like people want to go and build things from
- 50:38scratch without like realising, like even the current systems in
- 50:43production, like maintaining them.
- 50:46Is is is like an absolutely like a big, I would say like resource
- 50:53requirement for sure. Yeah, it's a beast, especially
- 50:57as you start to add more models into production and you start to
- 51:02try to recognise which models are creating value.
- 51:06How can we get more of those types of models, right.
- 51:10And so Speaking of along that line, how do you look at
- 51:18evaluating and identifying the right use cases for different AI
- 51:25and ML applications? At the end of the day, I think
- 51:30like you just have to be very like surgical about like where
- 51:35to where you really want to deploy like MLAI modules when
- 51:41there's like a lot of like background work.
- 51:44I feel that goes into that where you would be talking essentially
- 51:48with like all the product people design with like engineers, like
- 51:54basically the whole cross functional team and really
- 51:57trying to like identify like what is a hypothesis at the end
- 52:02of the day. Like if we had AAI model and ML
- 52:06model here in this space, like what's a hypothesis?
- 52:09Like how can it move the needle versus like, let's say a rules
- 52:14based approach or like something like that?
- 52:17So and then essentially once you have that hypothesis, then it's
- 52:22all about like, OK, how can we go and validate that hypothesis
- 52:26as quickly as possible? So can we like launch like
- 52:31essentially MVP, like a minimal viable product in there, do some
- 52:36quick testing, see if like basically essentially validate
- 52:40that hypothesis and then OK, if we see like good promising
- 52:45results, then OK, now let's scale this to like a full blown
- 52:49system. So I think that's usually the
- 52:52approach I've seen right being taken.
- 52:55What are some things that you haven't been able to figure out
- 52:59recently? A.
- 53:01Lot of lot of things I think remain like big challenges.
- 53:06I think evaluation is definitely like evaluation of generative AI
- 53:10systems particularly is, is definitely like very important
- 53:17and still remains like a challenge.
- 53:20Again, I think we spoke about RAG, but now again with the
- 53:24advancements in like agentic workflows, I think again, we are
- 53:28essentially entering a space where the with the systems, the
- 53:33evaluations also getting more complex.
- 53:35So with agents, again, depending on like how many steps are there
- 53:41in your agentic flow, Again, I think the same concept applies
- 53:45where you need to evaluate every step output and then you again
- 53:49need to evaluate the whole end to an output.
- 53:52Also, depending on how many tools your agent is calling or
- 53:56has access to, the evaluation complexity like increases quite
- 54:01a bit because we're tool calling again, we are essentially
- 54:04looking at two things, right at the end of the day, like is the
- 54:09LLM picking the right tool for the task?
- 54:11And then B are the right parameters being passed to the
- 54:16to the tool that's picked. So there's two factors that
- 54:20you're evaluating for each tool. And then as again, the agent has
- 54:24access to like more and more tools, that adds, again,
- 54:27significant complexity. Yeah.
- 54:31But at the same time, I do see a lot of interesting ideas, lot of
- 54:35interesting approaches coming up.
- 54:38So I know one of the ideas I was basically thinking about is like
- 54:44with cloud launching, like essentially computer use, right?
- 54:48Like it's like, what if you could simulate users now with
- 54:55cloud where it's like literally you have cloud play like
- 55:00different personas and then go and kind of do the testing of
- 55:06these agentic systems or, or like rag world flows.
- 55:10I feel it's pretty fascinating right now.
- 55:12It's like, yeah, we have more complex systems and we're trying
- 55:17to come up with solutions for them.
- 55:19And now we do have more capable tools and more capable models.
- 55:24Again, I think when we think about multimodal LLMS, that's a
- 55:28completely different beast all together.
- 55:31I feel like we were barely figuring out the text output and
- 55:35now we also are now in domains where we have to look at OK
- 55:38image outputs and speech and audio and like what have you.
- 55:42So yeah, I personally find it pretty fascinating.
- 55:49I'd like this idea of COD computer use going and stress
- 55:56testing or validating your AI workflow that you've built or
- 56:02your RAG pipeline and you are able to see if you have
- 56:09different ways of synthetic data generation in a way trying to
- 56:15use your product and use it with different persona prompts.
- 56:22Yeah, absolutely. It's a fascinating idea.
- 56:25Some of it is already used, I think in the self driving space
- 56:29where you have companies like Waymo, Cruise, Tesla, where like
- 56:37they simulate lot of these cases like in in the virtual world and
- 56:43they use like RL essentially to create like this huge model from
- 56:49all that feedback. So I feel like again, with
- 56:54open-ended output where again, there's infinite different
- 56:57possibilities out there, I do see that idea like being pretty
- 57:03interesting. So I think it's fairly new
- 57:06again, I would probably love to see that more studies and like
- 57:09results from that. I know there's a bunch of
- 57:12startups as well, like working in that space, trying that idea
- 57:17out. So I think it's going to be
- 57:19pretty interesting.