Nicholas

Evals, error analysis, and better prompts: A systematic approach to improving your AI products | Hamel Husain (ML engineer)

Nicholas

Hamel Husain , an AI consultant and educator, shares his systematic approach to improving AI product quality through error analysis, evaluation frameworks, and prompt engineering. In this episode, he demonstrates how product teams can move beyond “vibe checking” their AI systems to implement data-driven quality improvement processes that identify and fix the most common errors. Using real examples from client work with Nurture Boss (an AI assistant for property managers), Hamel walks through practical techniques that product managers can implement immediately to dramatically improve their AI products. What you’ll learn: 1. A step-by-step error analysis framework that helps identify and categorize the most common AI failures in your product 2. How to create custom annotation systems that make reviewing AI conversations faster and more insightful 3. Why binary evaluations (pass/fail) are more useful than arbitrary quality scores for measuring AI performance 4. Techniques for validating your LLM judges to ensure they align with human quality expectations 5. A practical approach to prioritizing fixes based on frequency counting rather than intuition 6. Why looking at real user conversations (not just ideal test cases) is critical for understanding AI product failures 7. How to build a comprehensive quality system that spans from manual review to automated evaluation — Brought to you by: GoFundMe Giving Funds —One account. Zero hassle: https://gofundme.com/howiai Persona —Trusted identity verification for any use case: https://withpersona.com/lp/howiai —

Published
Published Oct 13, 2025
Uploaded
Uploaded Jun 13, 2026
File type
POD
Queried
0

Full transcript

Showing the full transcript for this episode.

AI-generated transcript with timestamped sections.

0:00-1:32

[00:00] What are the fundamental concepts folks need to know of getting to higher quality products? The most important thing is looking at data. Looking at data has always been a thing, even before AI. There's just a little bit of a twist on it for AI, but really the same thing applies. When you see a real user input like this, you actually look at what users are prompting your AI with. You realize it's very vague. Absolutely. That's the whole interesting bit. It's like once you see that people are talking like that, you might actually want to simulate stuff that looks [00:30] if that's what the real distribution of the data or that's what the real world looks like. I'm sure our listeners expect some like magical system that does this automatically. And you're like, no, man, just spend three hours of your afternoon, go through, read some of these chats, look at some of them with your human eyes, put one sentence notes on all of them, and then run a quick categorization exercise and get to work. And you see this have actual real impact on quality and reducing these errors. Yeah, it has an immense quality. It's so powerful that some [01:00] with just this process that they're like, that's great, Hamill, we're done. And I'm like, no, wait, we can do more. [01:09] Welcome back to How I AI. I'm Claire Vo, product leader and AI obsessive here on a mission to help you build better with these new tools. Today, I have such an educational episode for people like me that are building AI products. [01:22] We have Hamil Hussein, who is going to demystify debugging errors in your AI product. [01:28] writing good evals and show us how he runs his entire business

1:32-3:06

[01:32] using Claude and a GitHub repo. Let's get to it. [01:36] This episode is brought to you by GoFundMe Giving Funds, the zero-fee DAF. I want to tell you about a new product GoFundMe has launched called Giving Funds, a smarter, easier way to give, especially during tax season, which is basically here. GoFundMe Giving Funds is the DAF, or donor advice fund, from the world's number one giving platform, trusted by 200 million people. It's [02:06] contribute money or appreciated assets, get the tax deduction right away, potentially reduce capital gains, and then decide later where to donate from 1.4 million nonprofits. There are zero admin or asset fees, and while the money sits there, you can invest and grow it tax-free, so you have more to give later, all from one simple hub with one clean tax receipt. Lock in [02:36] GoFundMe community of 200 million and start saving money on your tax bill, all while helping the causes you care about the most. Start your giving fund today in just minutes at gofundme.com slash howiai. [02:53] We'll even cover the DAF pay fees if you transfer your existing DAF over. That's GoFundMe.com slash HowIAI to start your giving fund.

3:06-4:38

[03:06] Hamill, I'm really excited for this particular episode because I have been building products for a very long time. And this has been one of a few times in my career where... [03:19] The how and what of products that I'm building are so different than what I've built in the past. They're technically different. They're different from a user experience perspective. And then they have these non-deterministic models on the back end that I'm somehow, as a product leader, responsible for making output high quality, consistent, reliable, interesting user experiences. [03:49] what you're gonna show us today, [03:51] is [03:52] how to approach that systematically, that quality of product building in an AI world systematically, and how you use different techniques to get AI products, which are new to all of us. [04:04] from good to great. [04:06] yeah i'm happy to be here excited to talk about it so you know this is such a new thing for product managers i'm curious if you could start with [04:15] the fundamentals. What are the fundamental concepts or things that you think folks building AI products really need to know about the process of getting to higher quality products? And then I know you're going to show us a couple examples of how to do that. [04:29] So the fundamentals really come down to the most important thing is [04:32] looking at data. And I believe [04:35] from working with many product managers.

4:38-6:12

[04:38] in the past is [04:39] Looking at data has always been a thing, even before AI. [04:43] You know, like, [04:44] I'm pretty sure that [04:45] product managers, [04:47] that can like write a little bit of SQL or okay with spreadsheets, looking at numbers, looking at metrics. You know, that feels like it's kind of [04:54] table stakes for being a good product manager nowadays. [04:58] And so there's just a little bit of a twist on it for AI, but really the same thing applies. [05:03] And it's just like, okay, how do you do that for AI? And that's what we teach. [05:09] And that's what I'm going to show you today. [05:11] Great. And I cannot agree more. I think one of the most transformational skills I learned as a young baby chicken product manager was being able to write SQL and actually do my own. [05:23] data analysis and exploration, but I think the surface area is so broad now with AI and the data is different. So why don't you show us what we should be looking at when we're building these AI products? [05:33] Yeah. [05:34] So let me share my screen a bit. Let me give you some background first. [05:40] So this is one of my clients. [05:42] The name of the company is called Nurtureboss. [05:44] And [05:45] As you can see, it's an AI assistant for apartment [05:50] managers or property managers. [05:54] And really, you can kind of get an idea from their website, which I'm showing right now. [05:59] You know, it's a virtual leasing assistant, so... [06:02] you know, they help with the whole top of funnel of like helping set up appointments, helping prospective residents like find their apartments, setting up appointments.

6:13-7:43

[06:13] questions about rent, so on and so forth, kind of like trying to reduce the toil of property managers, still having humans in the loop. [06:20] And so when they came to me, they had already prototyped something out. [06:24] you know, kind of vibe checking it, just like everyone does. [06:28] and put everything together, but [06:30] They wanted to know like, OK, how do we actually make it work well? [06:34] because... [06:35] The AI fails in weird ways and doesn't always do the right thing. [06:39] But it feels like [06:41] okay every time you fix a prompt we're not really sure like maybe we're breaking something else [06:46] Or is it really improving things as a whole? We don't really know. We're just guessing. We're just kind of like looking at it. [06:52] and is getting vibes. [06:54] And that... [06:55] is a very uncomfortable feeling of trying to scale a product. [06:58] Okay, so the first thing that I'll jump right into is this idea of traces. [07:04] So traces are [07:06] this concept from engineering, but it doesn't have to be scary. It's basically like, and it's very topical for AI because [07:14] with AI usually have [07:16] many different events. [07:18] are especially like for a chat bot, you have multi-turn conversations where you're going back and forth with an AI. There might be retrieval of information. [07:27] They might be calling some tools and external tools, internal tools, so on and so forth. [07:32] And so you want to log these traces. [07:35] And there's... [07:35] Um, [07:36] There's many different ways to go about it, but just to [07:39] kind of show you exactly what happened at Nurture Boss,

7:43-9:17

[07:43] Let's go into what that looks like. [07:45] So this is a... [07:48] platform called Braintrust. There's a lot of them. This is one called Phoenix, which is like the same exact data in here. [07:54] It doesn't really matter. You can see like they're both the same, right? Like [07:58] So what we have here, let me just go into a single trace. [08:02] This is what I would call a trace. I can make this bigger so you can see in a full screen. [08:07] And you can see what [08:10] an AI interaction looks like in this product. So you have [08:13] Okay. The system prompt, you are an AI assistant working as a leasing team member. [08:19] at some apartment these are all fictitious because these have all been scrubbed for [08:24] PII stuff. [08:26] Your primary role is to respond to text messages. [08:29] So this is receiving text messages. Okay, and you have a whole host of rules like respond, you know, provide accurate information, answer any question. [08:37] for residents. [08:39] Do the following... [08:40] you know, [08:41] provide this website, for example, [08:44] If you'd ask for a rental application, provide this on and so forth, all these rules, right? [08:48] And this is a real user saying, "Hello." [08:52] There's what's up to four month rent. I don't even know what that means. I got you. I got you. Let me read it. [08:59] "Hello, hello there. [09:00] What's up? [09:02] two, four month rest. I thought I had it. I thought I had it. [09:06] Yeah. [09:08] It's unclear. [09:09] But okay, I mean like... [09:11] It's fine. This is real. This is the real world. These are real traces. So, um, you know, and then there's a,

9:17-10:56

[09:17] There's a tool call here, get communities information, it's calling this tool. [09:22] This internal tool, [09:24] and the tool called Result. [09:27] comes back with this information. And this is all hidden from the user. The user is not seeing this tool call result. [09:33] You're like, okay, [09:35] Here's information you can use about the community, blah, blah. [09:38] It's not even sure this is the right tool call. We'll get to that in a moment. [09:43] And then the assistant goes, "Hello, we are currently offering update." So this is like back to the user. This is what the AI responds to the user with. [09:50] Hello, we are currently offering up to eight weeks rent free as a special promotion. Please note, [09:55] the applicable... [09:57] Lease specials and concessions can vary, blah, blah, blah. Okay. [10:01] So like is this and I have a cheat sheet for myself about what is actually right and wrong. [10:07] Okay, so like... [10:09] The comment here is, [10:11] the [10:12] User is probably asking about lease terms. [10:16] and stuff like that, not about specials. [10:19] So like, it's not really clear like this is the right [10:23] This is not like what we want. And this is so realistic, right? Like everyone has experienced AI. Like this is like, [10:29] It's kind of, it's being helpful, but it's not really doing what you want to. And it's actually pretty challenging because it's not really clear what the user wants. You could go in a lot of different directions of this. [10:37] You know, when I'm testing my own AI, this is such an eye opening example, because when I'm testing my own AI, [10:43] I ask it good questions and I spell correctly and I'm very clear. But when you see a real user input like this, you actually look at what users are prompting your AI with. You realize it's very vague.

10:56-12:30

[10:56] They say stuff like, what's up? [10:58] So the question, there's no clear question. And so I really do think looking at real user data kind of can get a developer or PM out of their own mind on how they think users are going to interact with the system. [11:13] Absolutely. It's very critical. [11:15] that you do this. [11:18] Now, you might not have this data. [11:20] And I just jumped right into a real example just to set things off. And we can go into all these different rabbit holes. Like, what if you don't have data and stuff? I just want to like ground it and like, okay. [11:29] So it sets a stage like [11:31] This is kind of one... [11:33] foundation is that you have to have data. [11:35] There's different ways to get it. One is you can log it from your real system. [11:39] And you have these things to look at. [11:41] Another way is like, okay, you can have synthetic data. [11:44] where you... [11:45] sort of generate with an LLM [11:48] you can generate questions like this, you know, hello, what's, you know, it might be hard to generate. [11:54] stuff that looks like that because I don't even know, we don't know what it means. And probably an LLM won't generate stuff like that. [12:00] But... [12:01] That's the whole interesting bit. It's like once you see that people are talking like that, you might actually want to simulate [12:08] stuff that looks like that because that's what [12:10] If that's the real distribution of the data or that's what the real world looks like, you might want to [12:16] Challenge your LLM. [12:18] or your AI system appropriately. [12:21] Okay, so let's step back here. So you have the system, it's doing, it's like, there's stuff like this happening. We can look at another trace if you want, just to kind of get an idea.

12:31-14:06

[12:31] And this is not pre-scripted. I didn't memorize what's going on in these traces. We're just looking at them naturally. [12:38] So this is something, this is another apartment complex, Meadowbrook apartments, same idea. So we won't read the whole system prompt again. Okay. [12:46] Okay, so we'll scroll down here. Let's get to what the user is asking. Walk-in T-O-R. So this must be another text message situation. And the assistant says, our team tries their best to accommodate walk-ins. [13:00] me get you... No, that's hilarious. Like, I don't... Why is the LLM... [13:04] That's surprising. Like, why is it saying me get you to someone who can help? Maybe it's trying to mimic the user somehow. [13:14] And then it does like... [13:15] Yes. [13:17] And then, okay, great. So it seems like this one maybe is okay. Let's see what we ended up annotating. [13:24] Yeah, we said this one is okay. There's some metadata down here about our labels, which we'll talk about next. But yeah, so you can see this is a real system. There's many different things that can happen here. [13:35] So the question becomes like, okay, [13:38] So we talked about this like writing SQL and data, but like, how do you take that same mindset to this? Like, what do you even do with this? [13:47] You have this like crazy [13:49] like interactions like how do you analyze this without [13:54] without getting stuck. Because like this seems like intractable. [13:59] Right? [14:00] No, I was just thinking, I was like, what is the SQL query I write to get like the first prompt?

14:06-15:38

[14:06] And... [14:07] Like, how do you query for give me all the first prompts that include typos, like give me all the first prompts that are ambiguous questions. It just feels almost insurmountable. And then, you know, you showed us two examples and it's two of probably thousands and thousands and thousands. So going through it. [14:23] manually is probably not super scalable. So I'm curious, what is the systematic [14:29] kind of solution here. [14:30] Okay. So the systematic solution is something called error analysis. [14:37] So error analysis just means [14:40] It's kind of a counterintuitive process that's extremely effective. [14:45] And it's dumb? [14:46] But it's accessible to everybody and it works. [14:50] And it's not something that I made up. [14:52] um it's been around in machine learning for a really long time because actually machine learning has the same problem like before like generative ai [14:59] We had these stochastic systems [15:01] They can do like a whole number of things. And like, how do you actually like analyze that and like figure out like what's going wrong and improve it? [15:08] So, [15:09] Thank you. [15:10] Error analysis has two steps. The first step is writing notes. [15:15] It's called Open Coding. [15:17] and it's basically like journaling what is wrong so if we go back to like that [15:21] That other trace that we saw, so let me just go back to it, like the first one. [15:27] we would step into this trace. [15:30] And we would say, [15:32] Okay, like... [15:32] Every observability tool has their own... [15:35] let's say, different ways to take notes.

15:38-17:12

[15:38] I already have a note in here. Assistant should have asked follow-up questions about [15:44] you know, [15:45] about the question, what's up with four month rent? Because it's unclear user intent. [15:49] And just writing notes about what is going on. [15:51] - Yep. - Okay? [15:52] And you do that for like 100 traces. [15:55] Randomly sample 100 traces and you do that. [15:58] And you stop at the most upstream error you find. So you read this and you see what's going on. And you're like, hmm. [16:04] Okay, the user intent. [16:06] Seems like... [16:07] We didn't do a good job of like clarifying that what the hell that they're [16:11] they need. And so I think that's the most upstream problem in this sequence of events. So I'm going to go ahead and just write that as a note. [16:19] Yeah. And you say focus on the most upstream problem because you presume that if you can get [16:24] early intent, early kind of clarity, [16:27] correctness, right. [16:29] the rest of the system is more likely to be correct downstream. Yeah, because it's causal in nature. So as we have the sequence of events, whether it's like user prompts, tool calls, [16:42] retrieval for rag, [16:44] whatever it may be, [16:45] any error at any point along the chain, [16:48] you know, like... [16:49] will cause downstream problems. And so to simplify our lives for this purposes of error analysis, it's a heuristic. [16:56] You know, eventually you do want to care about the different errors and different downstream, but when you're starting out, just focus on the upstream error. [17:03] because we're trying to make it tractable. [17:04] And this is like the way that you're going to get results fast. So basically what you do is you go through and you collect a bunch of notes.

17:14-18:45

[17:14] And then what you do is you can take [17:17] These notes: [17:18] and you can like download them or whatever. [17:21] and you can categorize those notes. [17:24] And you can even put these notes into like [17:27] chat gbt is like hey here's all my notes like can you bucket these into categories and you kind of have to go back and forth with it a little bit like hey these are my notes [17:35] These are the categories. [17:36] I think you're missing a category. [17:39] whatever. [17:41] Now with Nurture Boss, what we ended up doing is, [17:44] We actually made one of the things that we [17:47] highly recommend a lot of people think about is to make your own custom annotation tool. [17:53] Like there's, you see this is here, [17:55] in brain trust and it's also here in Arise Phoenix. They're very similar. You can see this is a very similar [18:01] looking UI and you have, they even called it error analysis. [18:06] here. [18:07] And you can like add your notes, like, you know, whatever. And you can save those notes and same thing. [18:13] If you're going to be looking at a lot of data, you don't want to slow yourself down. [18:17] And [18:18] You want to be able to have like very human readable [18:21] sort of... [18:23] you know, output. [18:24] Sometimes this markdown stuff is not that readable. [18:28] And you want to make sure that [18:30] Okay, like it makes sense to you and you can fly through it as fast as possible. So, um, [18:35] you know, [18:37] It's really easy to divide code. [18:39] this stuff. [18:40] Because ultimately what you're doing is showing data.

18:46-20:17

[18:46] Nurture boss situation. [18:48] So as you might have gathered, like they have multiple channels that customers can contact them on. They have like text message, which we saw. They have email. [18:57] They have a chat bot on the website, so on and so forth. So they just wanted something they could, like, navigate faster. It's just, like, Vibe Coded, essentially. I mean, they have... We were developers, but, you know, we're using AI in our process and do this very fast. It's, okay, like... [19:13] What channel is the trace from? [19:16] And then like some other filters about like, hey, did we already annotate this or not? And then just kind of have some statistics at the top. [19:22] This is what the annotation [19:25] like looks like it's kind of very similar but just like dialed into what we wanted and like you know we just took notes [19:32] Thank you. [19:32] And then for Nurture Boss what we did is [19:36] "Okay, we had an automated process that would [19:39] summarize, categorize those notes into what are the biggest issues. And then we would just, something very simple like counting. Counting is always powerful. As you know, as a product manager, you can go into a system, the SQL experience, like writing SQL queries, you know how powerful counting is. Counting remains powerful. And so you can count these issues, right? So like, okay, [20:04] For Nurture Boss, [20:05] I don't know if you can see my screen if it's too small. I can try and zoom in more. Yeah, yeah, that's great. [20:10] is [20:11] Okay, what are the most [20:13] One of the biggest issues after doing that error analysis exercise, which only took...

20:18-21:55

[20:18] you know, a few hours. - Yeah. - It's like, okay, we're having a lot of transfer and handoff issues. We're trying to transfer the customer to a human. [20:28] we're having a lot of tour scheduling issues. So like they're trying to schedule a tour, but like, [20:32] rescheduled tours. In this case, we found that like [20:36] Someone's asking to reschedule. There is no rescheduled tour. [20:39] But like the AI doesn't know that. It just keeps scheduling more tours. [20:43] which is bad. [20:44] you know, [20:45] follow-up, so AI not following up, [20:49] when the user has a question, [20:52] you know sometimes incorrect information provided okay so like you see like these are kind of the count and now [20:57] We have... [20:59] Now we're not lost. [21:00] Now we know [21:02] what we should be working on. We know, okay, you know what, we should fix this, like, [21:05] transfer handoff issue in this tour scheduling issue. We have confidence like [21:10] You know what? [21:11] We're not paralyzed anymore. [21:14] We know. [21:15] Okay. [21:16] This is what we need to fixate on our AI. [21:18] This episode is brought to you by Persona, the B2B identity platform helping product, fraud, and trust and safety teams protect what they're building in an AI-first world. In 2024, bot traffic officially surpassed human activity online. [21:33] And with AI agents projected to drive nearly 90% of all traffic by the end of the decade, it's clear that most of the Internet won't be human for much longer. That's why trust and safety matters more than ever. Whether you're building a next-gen AI product or launching a new digital platform, Persona helps ensure it's real humans, not bots or bad actors, accessing your tools.

21:56-23:25

[21:56] With Persona's building blocks, you can verify users, fight fraud, and meet compliance requirements, all through identity flows tailored to your product and risk needs. You may have already seen Persona in action if you verified your LinkedIn profile or signed up for an Etsy account. It powers identity for the Internet's most trusted platforms, and now it can power yours too. Visit withpersona.com slash howiai to learn more. [22:24] I love this just to recap. So you're taking these traces of these real conversations and you know, you don't even have to read all of it. You have to read till you hit hit a snag right to hit an obvious sort of like incorrect or high friction part of the experience. [22:41] You have Vibe coded an app that makes it really easy for the team generally to go in, annotate these, rate them sort of like good quality, bad quality. [22:50] automatically categorize them, count them, and then you have a prioritized list and you're like, here are the problems that I need to go solve. And what I love about this is [23:00] You know, I'm sure our listeners expect some like magical system that does this automatically. And you're like, no, man, just spend. [23:07] three hours of your afternoon, go through, read some of these chats, look at some of them with your human eyes, [23:14] put one sentence notes on all of them and then run a quick categorization exercise and and get to work and you see this have actual [23:22] real impact on quality and reducing these errors?

23:26-25:15

[23:26] Yeah, it has an immense quality. [23:28] It is so powerful that [23:30] Some of my clients are so happy with just this process. [23:35] that they're like, that's great, Hamill. We're done. And I'm like, no, wait, we can do more. You've paid for more. They're like, no, this is so great. I just feel... [23:45] Like I know what to do. [23:47] And so they find so much value in this process [23:52] that and it is like very important this is something that no one talks about like people when you talk about evals like well how do you write an eval [23:58] What eval do you do? What tools should you use? Before you get into all that stuff, you need to have some grounding. [24:05] in like what eval you should even write. [24:08] because there's infinite [24:10] So like in this case, we wrote an eval about tour scheduling issues and we wrote an eval about transfer handoff issues. [24:16] And we felt really good about that because we knew that is a real problem. And we knew how to write the eval because we saw the error. [24:24] And we knew how to find data to test that eval because, again, we already tagged it and we saw that error, which is exactly the way you want to do it. [24:33] Yeah. And what I also like about this is it does take the burden off your users. I mean, so many people try to collect this data by like putting a little thumbs up and thumbs down or little comments. Like I even have that on parts of my product. And yes, it is useful, but it only gives you a sliver of the kind of self-identified errors in the app. And users are highly tolerant of things. [24:56] systems. And so sometimes those errors just don't get escalated by user. They'll either abandon or they'll just work through too many steps to get to the outcome that they want. They'll have a quality experience. And so I ain't just taking the burden on yourself and saying you're responsible for looking at the data. You can create simple ways to categorize it.

25:15-26:46

[25:15] And then you have a prioritized list. Now, if your client is willing to go the next step and do something about this, [25:23] and write evals and fix prompts. What are your kind of next steps here? What's another example of where we go from here? [25:31] I just want to talk about this. [25:33] for a minute, like, okay, so this particular technique is so powerful. [25:37] And not that many people know about it. [25:39] So I actually recently did a training with OpenAI showing [25:44] the people at OpenAI, like, you know, how this works for domain-specific evals. If you want to learn more about, like, this... [25:52] We had... [25:53] Jacob, the founder of Nurture Boss, walked through this whole process in two minutes. You can find it on this page if you would like. [26:00] Okay, so to get to your question, like what do you do now? Okay, so you have [26:05] Like, [26:06] you know, you've done your error analysis [26:09] you have like prioritized these things. [26:12] So like now what do you do? [26:13] So now you get into... [26:16] writing [26:18] the evals. [26:19] So now... [26:21] you have to decide what kind of evals do you want. There's different kinds of evals. So there's reference-based evals. [26:27] which is like you know what the right answer is, and maybe you can write some code. You don't need like an LLM... [26:33] to do the eval for you. [26:35] are [26:36] If it's more subjective in nature, [26:38] then [26:39] Maybe this transfer handoff issue, maybe it's more subjective in nature. [26:44] then you need an LLM judge.

26:47-28:17

[26:47] And so... [26:48] what you can do is you can start to write those evals. And so, [26:53] I have this blog post here. [26:56] about evals in general. [26:58] So, [26:59] There's this diagram. It's really hard to put this whole thing into a diagram, honestly. [27:04] But... [27:05] Because it's a non-linear process. [27:10] But really what you want to do is... [27:13] Okay, we already covered like logging traces. [27:16] And there's two different kinds of [27:18] But there's different kinds of evaluators. [27:20] or evaluations there's the kind of like unit tests [27:23] which is like what I would say, like code-based evals. [27:26] And then there's like models. [27:28] So like LLMs. [27:30] you know code base eval so like you know for example what is what do you [27:34] kinds of things that [27:35] be good for codebase eval is like, okay, if you have like user IDs showing up in the response or something like that, [27:41] Okay, you can test for that in code. [27:43] Um, [27:44] I have to say you're saving my life here because I was thinking, what is one of these unit tests I need to write? And that is exactly one of them, which is... [27:52] My tool calls need UUIDs and users definitely do not. So that's a great example of one for anybody that's writing a chatbot that does a lot of kind of tool calling. [28:02] Yeah, because they can show up by accident. Like, you and I have the UID in the system prompt. [28:06] And it inadvertently shows up in the output for some reason or another, and you don't want that. [28:11] OK, you want to write these tests with-- [28:15] No matter what kinds of tests you write,

28:18-29:52

[28:18] You want to create test cases? [28:20] And sometimes you can gather those from your traces, sometimes [28:24] sometimes you might want to generate synthetic data. [28:27] And so [28:29] You know, this is like a prompt for... [28:32] a different real estate agent [28:34] assistant called reach out [28:36] which is for residential real estate. [28:38] And this is kind of like... [28:40] A simplified version of your prompt, write 50 different instructions that a real estate agent can give to their assistant. It creates context. [28:47] on their CRM. Contact details can include name, phone, email, whatever. [28:51] And basically, you know, it can generate synthetic inputs to a system that then you can then [28:56] log traces from. [28:59] I'm going to jump around a little bit, so we'll kind of come back to that. Okay, we already covered logging traces. [29:05] You know, this is another, like, custom... [29:08] log annotation thing. [29:10] yet again, because we really... [29:13] emphasize this, that it's really important to remove all friction doing this, so it won't linger on this too much. [29:19] and basically [29:22] you know, [29:23] One kind of thing you want to do is like, okay, if you're using LLM as a judge, [29:28] or anything else. What you want to do is [29:32] So one thing that's usually skipped when we talk about LLM as a judge is like people are just using LLM as a judge. [29:39] Off the shelf. [29:40] Like they're like writing a prompt. They're saying, okay, judge it. [29:44] and then reporting that. Let me actually go to a different blog post that is a little bit better for LLM Judge.

29:53-31:24

[29:53] Which is this one. [29:54] OK, so LM as a judge. So you often see-- [29:57] Sometimes in LM eval land, [30:00] Like a dashboard that looks like this. [30:02] helpfulness truthfulness conciseness score tone [30:06] Whatever. [30:07] what the hell does that mean does anyone know what that means nobody knows no one understands concretely like if the helpfulness score is 4.2 and it goes to 4.7 [30:17] Like, do you really know like what's wrong? What changes? No. [30:22] And so there's a lot of guidance in how to [30:26] create an alum as a judge [30:29] It's probably too much for this podcast to tell you all of the things. And this blog post is quite long. [30:36] like enumerating how to do it correctly. [30:39] But the main things that you need to keep in mind is like, one, you need to have binary outputs. Like, is it good or bad? [30:46] for a specific problem. So for like, [30:48] you know, the handoff problem for nurture boss, like, [30:51] okay, was there a problem or not? And you want specific evaluators for specific problems? [30:56] Number two is like you need to hand label some data. [31:01] which you already kind of do an error analysis. [31:04] And you want to compare the judge to the [31:07] hand-labeled data so that you can trust the judge. The last thing you want to do is like throw up a judge on the dashboard like this. [31:13] And then, like... [31:16] people don't know if they can trust it. And the worst thing you do as a product manager is like start showing people evals. [31:22] And then at some point,

31:24-32:55

[31:24] the people's perception [31:26] of the product or their experience of the project doesn't uh doesn't match the eval so like hey [31:32] Like it's broken, but the evals are showing that it's good. [31:35] And that's the moment like people lose trust in you. [31:39] And then it's going to be really hard to regain that trust. [31:43] And so the way that... [31:44] you make sure you can trust these [31:47] automated LLM evals is to [31:50] you know, [31:51] measure it. [31:52] sort of agreement with [31:55] these hand labels. Yep. [31:58] So what I'm hearing from you in terms of LMS judge is these general buckets with arbitrary ratings against them, not useful and will often work against you. You want to write specific binary outcome evals for specific tasks. So you want a set of evals that are like. [32:16] Does this get scheduled correctly? Yes or no. And so you're making a list of evals that the LLM as a judge is evaluating that gives you a pass/fail or yes/no true/false binary. [32:30] outcome, very simple. And then you're doing the additional layer of work of validating that the eval itself is valid by actually looking at that outcome and saying, [32:40] do I actually agree with, [32:42] with this [32:43] LLM as a judge evaluation of the quality of this output and that those steps [32:49] together are going to give you a much more comprehensive view of [32:53] how your product's performing, and then that

32:55-34:27

[32:55] that second layer of human evaluation, [32:58] it's going to give you more confidence that either your LLMS judge is good and is evaluating your outputs correctly or [33:06] you actually need to tune that judge itself to get to higher quality evaluations. Is that kind of a summary of what you do as well? Yes, and the thing that's really important is like it's really difficult to write any LM judge prompt if you don't do this because the research shows, and there's some research that my co-instructor for the course that I'm teaching, there's a paper called Who Validates the Validators? And the research shows that [33:34] people are really bad at [33:36] writing specifications or requirements until they need to react to what an LLM is doing. [33:41] to clarify and help them externalize what their [33:45] what they want. And it's like only going through this process of sort of, okay, [33:50] writing detailed notes and critiquing [33:53] things that you can then like start refining the LM judge. [33:58] Great. And so we've covered sort of traces and errors, annotation. You have kind of how to build... [34:08] unit tests that are automated tests. Of course, you're looking at it manually. You're doing LLM as judge. [34:13] the correct way [34:15] Now tell me, I've identified all these problems. [34:17] I have these evals that give me data. [34:19] How do I write a good prompt? Like, are there some techniques or, you know, what do I, what do I do? Are there things that you found consistently?

34:28-36:04

[34:28] in the next step of improving your system instructions, improving your tools, [34:33] where you actually have to go solve these problems are effective. [34:39] - Yeah, so when you get to the errors that you have, [34:45] So you're going to use these evals, and you're going to deploy it at scale. [34:49] It's like you're not looking at all your data. You're looking at a sample of data. [34:53] and you're going to score your LM as a judge against like a sample of label data. And you're going to deploy that at scale [35:00] and you're going to look at where are their errors. [35:05] And it's pretty like, [35:07] You have to make a judgment call on like, [35:10] how do you improve your system based on the errors you're finding? [35:14] Like, is it a retrieval problem? [35:16] Is it a [35:17] prompting issue? Is it [35:20] Should you be putting more examples in the prompt? [35:23] And [35:24] you know, [35:25] This is not really a silver bullet there, I would say. Um... [35:29] you know, retrieval is its own sort of beast. [35:32] it tends to like retrieval tends to be the Achilles heel of a lot of AI products um [35:39] you know, where things tend to go wrong. But sometimes, yeah, it's just like, especially in the beginning, you're going to find a lot of low hanging fruits. Like, for example, in Nurture Boss, [35:48] the [35:49] System prop didn't take... [35:50] contain today's date. [35:52] So when the person said, "Hey, can you do a... [35:55] schedule for tomorrow ai had no idea what like we don't know what tomorrow is but didn't didn't tell the user that right we just guessed so like you know

36:05-37:32

[36:05] That's really obvious. So there'll be like obvious things you can fix. [36:08] And then there's like lesser obvious things you can fix. You can try like prompt engineering. So there's a spectrum of like, okay, prompt engineering, [36:15] all the way to like fine tuning. [36:18] Most people shouldn't get into fine-tuning. [36:21] I will say that if you do all this eval stuff, [36:24] Fine-tuning is basically free. [36:26] Because... [36:27] you have all this infrastructure set up. [36:30] to do all these measurements and curate data like high signal data that is difficult [36:36] in that difficult data that those difficult examples where your ai is not getting right that's exactly [36:43] the stuff you want to fine tune on. That's like the very high value stuff for fine tuning. So, [36:48] um [36:49] And yeah, fine tuning is not so hard. In the ReChat case, we had to do fine tuning to get the extra mile. [36:55] But in most cases, it's prompt engineering. There's no magic prompt engineering tricks. It's really like, I would say, there's a lot of experimentation. [37:02] that you should engage in. [37:04] Well, and one of the things that I found so interesting as an AI builder that comes from a software engineering background is now I have a natural language surface for bugs in terms of my system instructions and prompts. And I had this experience recently on ChatPRD where we were really having a hard time with tool calling. Like one of our tools just was intermittently not being called no matter what the user would say. And it was really hard to pin down. And we have this, you know, monster system prompt.

37:34-39:05

[37:34] in the prompt. [37:36] that were just incorrect. They were incorrect. It was about UUIDs, but it was like incorrect. And as soon as I deleted those two words, which had just been, you know, typed in by somebody and pushed in the repo, blah, blah, blah. [37:46] our quality of that tool calling shot right up. And so [37:51] I just have to, you know, we have to as product people, as engineers start thinking of the full surface area of our product. And it's not the construction of the agent or the chat bot itself. It really goes down into what words are going in and out of your system. And it's a complicated surface area. [38:08] to debug and keep track of because it's unstructured, but it's super high impact in my experience. [38:14] Yeah, definitely. When it comes to tool calls, actually, let me show you one thing that always comes up is people wonder, how do you evaluate agents? [38:23] Because like... [38:24] You know, there's so many different [38:27] Handoffs. [38:29] Like, how do you actually, like... [38:31] do it in real life, [38:33] So let me see if I can share that. [38:35] Okay, so I'm sharing like... [38:39] the book that we give students in our class. But let me go to the table of contents. So there's all these different areas. We'll kind of skim towards the agent part of it. [38:50] Thank you. [38:51] So, [38:52] There's like analytical tools you can use for everything. You know, for agents, you can build these transition matrices. [38:59] So... [39:00] going from one step to the other [39:03] Where are the errors located?

39:05-40:38

[39:05] in like what agent handoffs or what steps being handed off to what other steps. So like in this case, okay, we have this like generate SQL to execution SQL. [39:15] That's where a lot of this, like... [39:16] errors are happening and then you can narrow it down. So as you get more advanced into evals, it's a very deep subject. [39:24] there's a lot of analytical tools you can use to kind of go about things. [39:30] It is very interesting, like as a product manager, you can [39:34] get really far with AI-assisted notebooks. [39:38] Yeah, what I was going to say about this from a product manager perspective is this is really put from the frame of errors and evals, but even just [39:48] analytics for agentic systems figuring out what your users are trying to do I haven't thought of this idea of actually mapping out the different conversation to tool or tool to tool handoffs and even if. [40:03] All of this was working effectively. A product manager's ability to see the data of its agent's behavior from a tool to tool handoff perspective and really identify like where are users trying to get value out of the system also can do things like drive roadmap ideas, right? If you're saying, okay, people are just... [40:22] write in SQL, executing SQL, like we need to dig into what other things around that could we build for users that are interesting. So I like it from the error perspective. I also like it just from the product discovery perspective. [40:34] Yeah, definitely. That's very true. Yeah, I like that.

40:38-42:09

[40:38] Okay, so you've shown us how to... The other thing that I like that you've shown us, [40:44] is that [40:45] There's no way to do this than just... [40:47] do it. Like I, people want these tricks. They want some hack. They want some off the shelf solution. And you're saying like, honestly, look at the data. [40:56] Build yourself a solution if you have to. [40:59] validate it yourself do the hard work and if you do the hard work you can actually create these leaps in [41:04] product quality and experience. But right now, you just got to look at the data and make some decisions and make things better. So I think this has been super illuminating in terms of helping people like me that are building AI products, make them higher quality. Let's spend just a couple minutes on a totally different topic, which you are running this business. You're running a course. You are clearly an expert in AI. What tools are in your stack for kind of running your day-to-day [41:34] - Yeah, so I do a lot of writing, and I do a lot of communication with clients. [41:39] And, you know, I also want to reduce my own toil. And so... [41:45] Let me share my screen again. [41:46] It's probably easiest to show you, Claude. [41:48] Project. [41:49] So I have all these cloud projects. [41:51] Um, [41:53] So, okay, I have like one for copywriting. [41:56] I have a legal assistant. [41:58] I have consulting proposals. Consulting proposals is pretty interesting. [42:02] So it's basically like an example of consulting proposals [42:07] It's, um... [42:08] you know,

42:09-43:44

[42:09] um so it's kind of funny i have skill level partner of palantir is expert generative ai blah blah [42:14] and I give it some instructions on the other, let's say, proposals I have, [42:20] Um... [42:21] And, you know, I have like this prompt. [42:24] you know, whatever... [42:26] get to the point, writing short sentences, whatever. And basically I have a lot of examples, and basically anytime I have a, [42:32] intake call with a client who wants a proposal [42:36] I... [42:37] Give this the transcript. [42:39] And then it's basically almost ready. It's like, it takes me about a minute. [42:44] to kind of edit it and get it going. So that's proposals. You know, I have one for the course, which is like, [42:52] you know, a lot of context about my course, which is like, [42:56] the entire book [42:58] I have an FAQ that's very extensive that I've published. There's all the transcripts, all the Discord messages, office hours. [43:07] And again, my prompt is like, hey, your job is to help course instructors to create standalone interesting FAQs. [43:13] This is like a writing prompt that I have everywhere. Do not add filler words. [43:20] Don't repeat yourself. Get to the point. Yeah, yeah, yeah. It's very, you have to really, you know... [43:26] And so, OK, like, yeah. [43:28] And it's just, you know, this stuff here... [43:31] Um, [43:32] So this is like one for the course. [43:34] There's... [43:37] You know, there's one that helped me create these things called Lightning Lessons, which is basically like, you know, this lead magnet. Um...

43:45-45:25

[43:45] - So there's all kinds of stuff like this. - I see you and I share general counsel here. [43:52] - Oh, okay. - With Claude AI. - Oh yeah, right, exactly. Yeah, there you go. So there's that and also have like, you know, my own, [44:00] software that I have. So I have, let me see if I can find it. [44:06] I mean, I'm not really advertising it, but I have like YouTube chapter creation. And I basically have this thing that [44:14] will create [44:15] blog posts [44:16] like out of YouTube videos. So like, let me show you an example. [44:20] So, uh... [44:23] Like this one, basically what I do is I take a YouTube video and it becomes an annotated presentation. So you don't have to watch the video. [44:31] Like you can just... [44:32] especially if the video has slides, what it'll do is [44:35] It will screenshot all the slides and then have a summary under each slide about what was said. [44:40] So you can consume like a one-hour... [44:43] presentation and like [44:44] you know, whatever, five minutes. And that's really good because like, you know, I have, I teach a lot and I have a lot of content [44:50] And so I distribute notes. [44:53] So all of that, so like a lot of that stuff, educational stuff is part of my workflow. [44:58] And this uses Gemini. Essentially what it does is it pulls the transcript... [45:04] It pulls the video, I can put in the slides all at once. [45:08] and I have a lot of examples and I give it to it and it produces this. [45:12] Yeah, I've heard this in a couple of podcasts that we've done recently that folks really like Gemini for video information and just seems to be the fan favorite for taking basically YouTube videos or other video content.

45:25-46:57

[45:25] and turning it into text or other other applications that you can extract from that so [45:31] Try the Gemini models for that, folks, if you're listening. Yeah, it's absolutely brilliant. It's amazing. [45:53] a little spin and then you're using Gemini models to extract out content and share it as templates. And then you have, oh, look at these prompts. We got a GitHub with prompts. [46:04] Yeah, so I give GitHub with prompts. This one is private. [46:07] But just to give you an idea, conceptually, it's basically a mono repo. [46:11] of everything. [46:13] The reason that is is because [46:16] I like to have clawed [46:18] code, open hands, you name it. And basically what I say is because all these things are all interrelated, right? Like a lot of these projects. So like, you know, this is my blog is in here. This is my blog, for example. This is that. [46:32] that like YouTube thing I just showed you, this Haml project. This is like something else that fetches Discord. This is about copywriting proposals, whatever. [46:40] And I just point... [46:41] AI at this depot [46:44] And you know, there's like Claude rules in here that says like, [46:47] "Okay, what is this repo about? And where do you find stuff?" [46:52] you know, this is like if you need to work, like, [46:55] For writing, you should look here.

46:57-48:27

[46:57] you know, so on and so forth. So my friend, you have buried the lead here because we could have done an entire episode on just this repo. What this makes me think of is, you know, five years ago, there was this big like, [47:12] note taking second brain where do you put all your information so you can have access to it forever [47:19] And I see this and my little engineering brain goes, [47:22] Obviously, it should go in a repo and it should be a combination of data sources, notes, articles, things that I've written, things that I like. [47:31] and prompts and tools to actually do something with that. So you have given me [47:36] a personal project that I'm going to go work on in the next couple days. Because I think this is this is how I, as somebody who lives with [47:43] cursor or Claude code as sort of co-pilots for everything I do. [47:47] This is how I would want to organize things. [47:49] my data and my prompts to be able to do something with it. [47:52] - Yeah, I don't wanna be locked in, right? Like to any one provider. And so this is how I do that. [47:58] - Amazing, okay, we might have to have you back to go through this thing in detail. This has been so great. I have two lightning round questions for you, and then I will get you out of here, I know you're a busy guy. My first question is, you know, a lot of what you showed us [48:14] requires someone, a person, to go through with their human eyes, read things, and evaluate. And I'm curious, whose role do you think this is? Is this the product manager's role? Is it the engineer's role? Is it the subject matter expert's role? Who does this?

48:27-49:57

[48:27] I think the subject matter expert [48:29] is very central [48:31] A lot of times the product manager is the subject matter export, SME in a lot of organizations. They're kind of the person that everyone looks to for the taste. [48:41] of like, "Hey, this is what should be happening with the user." [48:44] So I would say a lot of times it is the product manager, [48:47] that should be doing that annotation [48:51] Now, when it gets into the analysis, it's really interesting. It would be good if a product manager [48:56] Like the more you can do the better just like the sequel and the stuff that you know about and [49:00] At some point, you probably need a data scientist. [49:04] when it gets advanced. [49:06] Um, [49:08] But the more you learn, the better, and vice versa. The more data scientists learn more product skills, it's going to be better. [49:15] It's hard to predict, like, [49:17] you would, you know, there's always this tension or this kind of, [49:21] Okay, can we collapse roles? Can we collapse the product role in this like [49:26] data scientist type [49:27] AI role. [49:29] I'm not sure. Um, [49:31] It's yet to be seen. I don't think so. [49:34] um there's a lot of service area actually there's like there's something called ai engineer [49:38] There's AI product manager. [49:40] And there's also like [49:42] still this data scientist. [49:44] aspect. So those three roles are still... [49:46] operating on this problem. [49:49] And there's definitely a lot of service area for all of them, especially as you scale. [49:54] The one other thing that I would call out or my hope is,

49:57-51:28

[49:57] in addition to sort of like the technical building teams who are sort of proxies in my mind for the subject matter experts. So a lot of times the product manager is a proxy for like the leasing agent. In this example, they understand that user. They understand what high quality is. But, you know, I would really love to see folks that are in operational or more functional roles come in and actually contribute to the quality of the products because you know what makes customers. [50:21] good user experience you know what makes a good leasing agent you know how they should speak and what they should do and i think there is an opportunity for folks to lean in and bring that expertise to bear in a way that scales across a company that if you're willing and brave to do it i think product teams would welcome in kind of like non-technical colleagues into this process to add some more kind of user empathy and subject matter expertise [50:49] Yeah, definitely. Yeah, the more you can... [50:51] bring like the actual [50:53] required taste in the product sense into the process. [50:57] Yeah, because that's essentially what you're doing when you're annotating. Yep. Doing this error analysis. And the error analysis is the foundation for everything. [51:04] Yep. Okay. And then my final question, ask everybody, I know you're very structured and you'll tell me you'll look at the data and then figure out exactly what to say. [51:12] You have to admit, sometimes AI is very frustrating and doesn't do what you want it to. Do you have any back pocket prompting techniques you use? Do you yell? Are you all caps? What's your strategy? [51:25] AI has frustrated me the most is writing. Mm-hmm.

51:28-53:01

[51:28] Because like writing, I don't want the writing to sound like AI. Yeah. And it's hard. You know, that's the last thing you want in certain situations for your writing to sound like AI. [51:38] And not that AI is like wrong, it's just that, yeah, you want to make sure your like flavor is coming across. And so, um... [51:46] So one thing is like, okay... [51:49] I showed you my writing prompt, a little bit of it. I can share it with you separately also. [51:53] is provide lots of examples. [51:56] but then also take it step by step. So for writing, what I do is have it write an outline, [52:01] And then I have it right [52:02] the first one or two sections and edit it very carefully. Now [52:06] One tip is: [52:08] Use something like AI Studio. [52:10] that allows you to edit the output [52:12] of what the LLM is giving you. [52:14] That's really important. [52:16] Because what that ends up doing is it creates examples for the LLM in... [52:21] Thank you. [52:21] - Kind of right there. - Yeah, in line. Yep. - Yeah. And so, [52:26] Yeah, you want to edit the output. [52:29] And, you know, yeah, something like a notebook or AI studio, there's not too many things that let you edit the output. [52:34] But once you do that, once you do that hard work, [52:37] of like that those examples especially like the thing you're trying to write now [52:42] then it starts to work really well. [52:44] Yeah, it was one of the most important things that I built into my AI product was, [52:49] every asset that gets generated has a real-time editor for the user to update. And then those updates go back into the model because I just think if the central value proposition your product is writing, which mine is,

53:02-54:46

[53:02] it's one of the hardest stylistic challenges I've seen. AI struggle with it all sounds like slop. Like I can identify AI writing from a mile away. And so, yeah, I found this like, [53:14] incremental optimization first outline then draft then edit then refine process takes a while there's some latency in the experience but it ends up netting [53:23] higher quality, and then just like use it as a draft, edit it, [53:26] get the system to be better. So that's... [53:29] really, really great feedback. This is for chat PRD. Yep. [53:34] Yeah. Very cool. Yeah. You know, I have high standards for writing too. So it was important to me. Well, this was so great. Where can we find you and how can we be helpful? [53:43] Yeah, haml.dev is my website. You can also find me, Haml Hussain, on Twitter. [53:49] And yeah, I'm teaching a course on Maven, as you know. [53:52] about evals that go into all these subjects very deeply. [53:57] But yeah, that's where to find me. Great. Yeah. And for our listeners that don't know, Lenny's list is on Maven, including a How I AI section that I think features your course. So you can check it out there. Thank you so much for the time. It was super educational, very practical. I'm going to take these tips right away and go improve. [54:16] my own product. Have a great day. [54:18] Yeah. Thank you for having me on. [54:28] You can also find this podcast on Apple Podcasts, Spotify, or your favorite podcast app. Please consider leaving us a rating and review, which will help others find the show. You can see all our episodes and learn more about the show at howiaipod.com. See you next time.

Want to learn more?

Ask about this episode