Your Fine-Tuned Model Is Tech Debt: A 50x ROI House of Cards — Dan Bjornn, Lease End https://www.youtube.com/watch?v=4loPnxvWWhg AI Engineer · 16 min · 157 sentences · sentence-level transcript from YouTube's caption track; each line begins at the time shown [00:14] All right. [00:14] Hello everybody. [00:16] Thank you for coming. [00:17] I'm Dan Bujorn. [00:18] I'm a senior data scientist at Lease End. [00:21] Lease End. [00:22] We connect people who are coming to the end of their auto lease with financing uh options so that they can buy out their lease and keep their car. [00:32] Now, as part of this uh we uh built a an LLM based application in late 2024 to help our customers connect with uh with our sales team. [00:47] This application allowed them to send messages through text. [00:51] uh they could ask questions about the sales process, they could schedule calls, uh they could get reminders, all of this stuff. [00:58] Our first solution used a workflowbased approach uh built on top of uh a rag system where we searched a vector database of messages that we had already seen and classified [01:12] with the customer's intent. [01:15] So for example, uh a message saying call me tomorrow would be classified as the customer wants to uh wants to talk later. [01:26] A message saying I've got time now would be classified as uh the customer wants to talk right now. [01:33] U this has worked but not super amazing. [01:36] there's a lot of nuance in in messages and and conversation and this rags approach just couldn't quite pick up on that nuance and so we started to look for [01:48] uh for new options to improve this and naturally being a data scientist my first thought was hey let's start fine-tuning this seemed like a fun thing to do and I was sure that this was the right call [02:01] um there's a few reasons for that first of all uh we needed better accuracy Our entire system uh was built upon us getting the user's intent correct. [02:14] Did they want to talk now? [02:16] Do they want to schedule a call? [02:17] Do they want to opt out? [02:19] All of this hinged on that decision. [02:21] And so we needed to make sure that we got that first and foremost. [02:25] Next, uh we could use smaller models with fine-tuning. [02:30] And so this would lower the cost and also lower latency. [02:34] So this was really important for us because we were uh responding to thousands of messages a day in real time and so it it uh would help us scale a lot. [02:46] Then next like I said we were classifying the intent of the user and so this was a very narrow structured task that we were trying to do and so it lent itself very nicely to supervised fine-tuning. [02:58] uh we would bucket uh that conversation in one of six different categories and the model would learn the differences between those. [03:07] Uh so seemed like a great option there. [03:10] Lastly, uh I believe that this would help us have a little bit more control over our destiny with the the model providers. [03:20] The idea was that we had the data and all we would need to do is pass that into a new model, go through the fine-tuning process and we could get [03:31] similar results no matter uh what we decided to use. [03:35] So we could be model agnostic. [03:38] So this was the approach that we took. [03:41] Um, and I built a pipeline to collect examples, run LLM as judge, uh, classifications to label our data. [03:51] I'd manually review that, create holdout sets, go through the fine-tuning process, check my metrics. [03:58] This was a data scientist's dream. [04:00] And, uh, the numbers sure helped. [04:03] Within a year, this application had helped us bring in $12 million of revenue at a 50x ROI. [04:11] Um, it was pretty awesome, but uh, the whole time it was quietly accumulating debt underneath that we didn't see. [04:20] So, I want to show a couple examples of how this application could get things wrong. [04:27] Uh first of all uh the confused confirmer is a situation where um when customers set up an appointment with a sales rep, we send them a confirmation message to let them know that it's been scheduled and give them the details of that. [04:44] Uh so a conversation may look like this. [04:48] We reach out and say, "Hi Tracy, just confirming your lease and call with your advisor is set for Thursday at 2 p.m. We'll call you then." [04:56] Tracy then sends us a message back saying, "Sounds good." [05:01] And then our LLM responds with, "Great. [05:04] I'm calling you right now. [05:06] Uh, it's not what we want. [05:07] We just confirmed a an appointment for a following day." [05:12] And then all of a sudden, we start calling them. [05:14] This led to frustrated customers and some missed opportunities. [05:19] The next one, um, I've come to lovingly call the overeager puppy. [05:24] Um the the conversation looks like this. [05:29] So first, hi James, this is Alex with Lease End reaching out about your upcoming lease maturity. [05:36] James then says, hi, good morning. [05:38] And good morning. [05:41] I'm giving you a call. [05:43] Um just like a puppy that gets so excited that somebody's giving it attention, our model decided to to give a call right there. [05:53] Um, obviously this is not what James wanted. [05:56] This actually did happen in production. [05:58] Um, very embarrassing there. [06:01] Uh, but this is a these are a couple examples of of where it went wrong. [06:06] And and don't get me wrong, the the app did well. [06:09] The revenue numbers show that that it was working, but it could also mess up pretty spectacularly. [06:17] Um the big issue wasn't how to fix it, but how to make it the fix manageable. [06:24] The the fine-tuning process was pretty complex. [06:28] Uh first we needed to gather examples of the problems that we started to see. [06:33] Um then we needed to ask ourselves uh do we have enough examples for uh to go through fine-tuning? [06:43] If not, we synthesized those examples. [06:46] uh we passed it through an LLM, it created some some possible examples there. [06:51] We'd have to validate those, which was a very manual process uh because we wanted to make sure it had the best training data possible. [06:59] And then once we had enough, uh we labeled those with the the categorization bins and we validated validated those through a manual review. [07:09] Surprisingly, the fine-tuning process was the shortest part of all of this. [07:14] uh normally took about an hour depending on the size of the data that we had but uh we never got it on the first iteration. [07:23] Uh normally what happened was we would uh we would fine-tune and we'd evaluate this and uh we fix the problem that we were just trying to solve but then we caused regressions and other things. [07:36] And so this turned into kind of a whack-a-mole process where we would solve something new, but then other old issues kept popping up that we had to to whack down. [07:47] Um, this whole process took about a week to gather the data, label everything, go through the fine-tuning process, and iterate and then deploy. [07:56] So it was costly. [07:58] Um, therefore, we needed to triage all of these issues that we ran into. [08:04] We asked ourselves three questions before we did any any retraining. [08:09] How frequent is the issue? [08:12] Is it something that customers are seeing every day? [08:14] Is it one off? [08:16] Um, one big exception to this was if it was hurting the customer experience too much. [08:23] So for example of this would be uh somebody repeatedly stating what their uh their preference for a call time is and then the uh the model ignoring that. [08:36] Another one would be a customer scheduling a call. [08:40] We tell them that we've scheduled it for them but we don't return the payload in in the proper way and so the the call never gets scheduled and so we don't follow up with them. [08:51] So these kinds of things needed to be fixed right away. [08:53] But before we did that, uh we asked the last question, is there any thing that we can do in order to prevent a retrain? [09:02] Can we have some kind of a band-aid fix to get out there so we don't have to go through a whole week-long process uh for one or two issues? [09:11] And so we we ranked our own bugs uh based on how much customer pain we could tolerate at the moment. [09:19] Um, so not a great situation to be in with a production system. [09:23] This led to what I've come to call the calcification tax. [09:27] Uh, the more we used the model, the more rigid everything became. [09:32] This manifested in a couple different ways. [09:35] First, we were locked into our model. [09:38] You remember when I said that uh fine-tuning would give us uh more freedom in what model we did? [09:45] That was not the case. [09:47] Um within providers there's nuance between one model version to another and so that changes the the training data that you need to provide it. [09:58] Um across model provisors uh it's extremely different the structure of the data you need to pass to it be different. [10:06] The amount of the training data to get good results the way to interact with the training interface. [10:13] All of this caused a lot of complexity and so it was just too costly for us to switch. [10:18] And so um to we kept it the same model for consistency because we already had a lot to do with uh with each retraining process and we couldn't afford [10:30] to uh upgrade the model. [10:34] So uh the other way that this locked in was architecture. [10:40] We built this app in uh late 2024 when workflows were kind of the um gold standard if you wanted good u production results and uh the AI world moves very fast [10:57] and we couldn't adapt to that because we were so locked into this just trying to keep it running and we couldn't take advantage of the new architectures um and [11:08] and improve performance that Okay, so earlier this year I had an aha moment. [11:15] Um, we started using cloud code for our coding tasks and I noticed that we never needed to change the model depending on what task we're using. [11:27] Um, we just changed the skill, the resources that we passed it, the context. [11:33] Um, you drop in the better better context, you get better results. [11:37] And I thought, why can't we do this with our messaging app? [11:43] Um, this was obviously difficult for me to admit because I was the champion for fine-tuning. [11:49] And, uh, luckily we were able to piggyback on a project that was already happening. [11:55] Um, and so we migrated our workflow approach to a series of skills, tools, and resources that the skills could could load into or load up. [12:07] um and get that context. [12:09] And so we pushed this as one of our first production tests of our our new agentic framework that that was being built already. [12:18] Now uh I want to compare the process before and after our rebuild. [12:24] Uh before we already went through the kind of the training cycle, but there was this triage cycle beforehand where we needed to make sure that we had reached a critical mass [12:35] of problems before we would even attempt to uh fine-tune again to improve everything. [12:43] Like I said, this took about a week, so it was a long process, costly. [12:48] Uh after the rebuild um it was a simple process of you find a problem you adjust the simp system prompt or the skill that was affected. [13:00] We validated performance on a curated set that we have been collecting over the time that this was in production. [13:06] We iterate a few times and then we deploy that simply by uploading MD files to an S3 bucket. [13:14] um this whole process from discovering a problem to deploying the fix we reduced down to less than an hour. [13:22] So it extremely improved all of this and we could be far more reactive give our our customers way better performance or better experience there. [13:34] Now I'll be honest it did cost us a little bit more per message. [13:38] we were using better models. [13:40] Um, so the API costs were a little higher, but accuracy went way up. [13:48] I said before that accuracy was the key to to getting all of this right. [13:53] Um, and we did that. [13:55] Accuracy uh was far better with this than it ever was with fine-tuning. [14:00] Um, next, like I said, we reduced our uh our fixed process from days down to minutes. [14:09] Next, we were able to unfreeze our model and finally get that freedom from a vendor that we never had with fine-tuning. [14:17] Um, our agentic framework was built model agnostic. [14:22] So, we could use open AI, we can use uh anthropic, we can use any other model that we want. [14:27] The important part is the context that we're providing to that model. [14:32] And then lastly, while it cost us a little more per message, the total cost went down because we were spending far less time trying to keep it up and running and [14:45] fine-tuning to uh to keep it working properly. [14:49] So before you fine-tune, I'd ask you, can you cross your reason off of this list? [14:56] So, I thought we would get better accuracy. [15:00] Uh, the rebuild beat the fine-tuned model. [15:04] I thought we would get lower cost of the volume we were doing. [15:07] Um, I was looking at the wrong costs. [15:10] We we paid more per message, but the total cost ended up going down with our rebuild, lower latency. [15:16] We we did see marginal gains on these smaller models, but they were so small that in practice it really didn't make any difference. [15:26] And then maybe you've got a narrow or structured task. [15:30] Our textbook case still became tech debt. [15:35] And lastly, vendor control. [15:37] It's not as simple as just plugging the data in. [15:40] The other two situations where you you might have privacy and data control or you need some offline offline solution. [15:49] I would say this these are the situations where a fine-tuned model may be useful. [15:56] But you need to be cautious. [15:57] There are other solutions out there. [16:00] Um but um you need to make sure that it's not uh not causing issues in the long run. [16:07] So finally fine-tune only when you literally cannot call a frontier model and even then your decision still has to beat the the tax. [16:18] Thank you.