RecSys, Topic Modeling and Agents: Bridging the GenAI-Traditional ML Divide
Summary
- Recontextualizing GenAI: Understand when generative AI outperforms traditional ML and when classical algorithms remain superior.
- Unified evaluation: MLflow provides a common platform for benchmarking traditional ML against GenAI with fair performance comparison.
- Avoiding reinvention: Learn which problems don't benefit from GenAI and where traditional techniques remain the optimal solution.
RecSys, Topic Modeling and Agents: Bridging the GenAI-Traditional ML Divide

Talk by Dan Pechi, Sr GenAI Product Specialist, Databricks
The rise of GenAI has led to a complete reinvention of how we conceptualize Data + AI. In this breakout, we will recontextualize the rise of GenAI in traditional ML paradigms, and hopefully unite the pre- and post-LLM eras. We will demonstrate when and where GenAI may prove more effective than traditional ML algorithms, and highlight problems for which the wheel is unnecessarily being reinvented with GenAI. this video will also highlight how MLflow provides a unified means of benchmarking traditional ML against GenAI, and lay out a vision for bridging the divide between Traditional ML and GenAI practitioners.
Databricks Named a Leader in the 2025 Gartner® Magic Quadrant™ for Data Science and Machine Learning Platforms: https://www.databricks.com/blog/databricks-named-leader-2025-gartner-magic-quadrant-data-science-and-machine-learning
Build and deploy quality AI agent systems: https://www.databricks.com/product/artificial-intelligence
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements
FAQs
When is traditional ML better than GenAI?
Traditional ML often outperforms GenAI for well-defined problems with structured data, need for interpretability, and constrained compute budgets. Recommendation systems, topic modeling, and many classification tasks remain domain-specific algorithms' stronghold.
How does MLflow enable fair comparison?
MLflow provides a unified platform to track experiments, metrics, and models for both traditional ML and GenAI approaches. This enables side-by-side comparison of accuracy, latency, cost, and other factors to determine the best approach.
Which ML platforms support both traditional ML and deep learning frameworks?
This video demonstrates MLflow and the Databricks Data and AI platform enabling unified benchmarking of traditional ML (scikit-learn, XGBoost) and deep learning (PyTorch, TensorFlow). It shows how to compare accuracy, latency, and cost across both paradigms using the same tracking infrastructure. The platform helps teams avoid reinventing the wheel by choosing the right algorithm based on data and requirements.
Which platforms support both traditional ML and custom foundation model training?
This video bridges traditional ML and GenAI by showing how the Databricks Data and AI platform supports both custom model training and foundation model fine-tuning on a single infrastructure. It highlights use cases where traditional approaches outperform GenAI (recommendation systems, topic modeling, forecasting) and where GenAI excels. MLflow provides unified evaluation, helping teams measure true ROI.
how do i share an internal app securely with the right people?
This video provides insights into how do i share an internal app securely with the right people. It demonstrates best practices and real-world applications on the Databricks Data and AI platform.
Full transcript
Um, so. I'm a senior Genaii product specialist here at Data Bricks. Um, I work with a lot of our startups and digital native businesses. Um, but in my role, uh, kind of work between research, product, and actually talking with customers, hearing what actually matters and what is impactful for you all. Um, one big thing that I think is a big takeaway in startups and digital natives in addition to enterprise customers is we see people thinking about Genai as being this big scary thing that requires all this reenablement and relearning.
And hopefully by the end of today's talk, you'll see that hey, Genai is maybe not all that scary and it's actually more familiar than we might think. Um, analyze this through the lenses of Rexus topic modeling and everyone's favorite subject uh because this couldn't be 2025 and talking about AI without agents. So, um, yeah, a high level overview. I mean, does the clicker click? It doesn't. Okay, that's fine. Um, so yeah, we'll kind of talk about what it means to reinvent the wheel and cover these three areas and then then we'll have a very beautiful demo.
But before we begin, um, this is an agent architecture. Does anyone want to guess and tell me what year this is from? Any numbers like please shout them out. When was this agent architecture designed? Okay. I mean people said like 50s and stuff. No, uh it's from 1993. But uh you know the more broadly illustrative point here is that uh agents and a lot of these other genai paradigms or at least the problems that they solve are not uncommon and have been around for a while, right?
Um let's talk about it from our perspectives though, right? What does it mean to reinvent the wheel with all this? We've probably seen all sorts of crazy genai for things that probably don't need genai for. Um, but before Genai, we had this like familiar paradigm of what we consider preferred qualifications for someone looking to do AI and ML, right? Um, I'm not going to go through all of these. Um, but, you know, these are some of the things that we would consider when it comes to evaluation, when it comes to, you know, the broader life cycle of, you know, building AI and ML models as part of broader products, right?
And there's also a postg AI world in which, you know, some of this is the same, right? Um but there are some things that are going to be different. Um I highlight the orange ones um as being pretty similar and we'll highlight this as part of this talk as well. Um but you know some fun ones I'll call out um are just these libraries right um cool you know sklearn and pietorch but you know have you actually built something with lane chain have you built something with mcp ds pi so on and so forth these paradigms didn't exist two years ago right so there is some relearning to do there is some uh you know upgrading of the wheel right um but you know what's nice is we can still see there are parallels in some cases and then in some cases there aren't right oh you no pre-training and fine-tuning well you know how about parameter efficient fine-tuning or you know any of these other you know concepts that prior to I'll say like 2022 2023 did not exist at all right um these are things that you know when you're looking for someone who does these things um ideally they can explain to you what prompt caching might mean for instance um so as it turns out there are some ways in which we're not just maybe reinventing the wheel here but there are fundamentally new things with genai that are challenging and we hear this even more so for ROI and delivering ROI right um you know all of these things existed before Gen AI especially the claim that oh there's no ROI here right um with Gen AI we see that especially to be the case right and a lot of this is just inertia and industry adoption right we are all working to enable ourselves myself included on this new paradigm and it means that we kind of need to uh you know be up to date with things but we also see all sorts of other fun ways in which you know people look at genai differently from there being ROI um McKenzie put out a report in the early days saying we're going to get crazy employee productivity gain How are you supposed to measure that, right?
How are you supposed to build KPIs around that? You know, you don't have like an AB test of, you know, employee A used Genai and then employee B didn't and we see some fundamental difference there, right? Um there's other things around costs. Um and you know, we might also need subject matter expert feedback that doesn't exist for a logistic regression model necessarily, right? There's statistical tests, there's key metrics where if you don't do well on that metric, it's bad. as opposed to hey I'm working with my payroll team and the payroll team said that the agent hallucinated great like what do you make of that how do you track that right it's challenging there's other things here but you know big pe picture here think about use cases right um when we think about traditional ML right you know we'll say oh this is a forecasting problem let's solve it that way right people kind of just said oh chat GPT oh nice like let's let's build chat GPT and you know maybe there will be profits No, like same thing, right?
We need to think about use cases first and where certain models fit the bill for being necessary there or not. So, uh the more things change, the more they stay the same. This is to say we have a lot of different problems that existed before and after. Again, thinking about this from a use case level. Um that had traditional solutions um and then there's LLM based solutions. Some of these models might not even involve uh you know actual machine learning in some cases.
Um we'll highlight some of these but this is all to say that you know there's a new way of doing these things and part of this talk is to differentiate when that might actually be helpful or not right. Um I was talking with someone today about time series forecasting. They have an ARMA model. Do you really need to use a large language model that's you know perhaps like millions of times the size of it and probably costs more to like host and all that?
There's some cases where it's even more obvious, right? Um, someone has a paper on doing linear regression with language models. If you are doing that in industry, your boss is probably not going to be very happy. So, um, you know, just to kind of summarize this, has a nice tweet here. Um, we kind of have this thought that we can throw an LLM at it, it being any of these problems that we might have had before. Um, whether it's actually the right solution, right, is an entirely different question.
Um, but people kind of are using and in some cases abusing LLMs to solve problems that, you know, again may or may not actually require us to reinvent this wheel, right? So again, we're solving the same problems, but there might be alternative Genai solutions. How do we start to think about whether one might be better than the other? Um, you know, the point of this talk is not to give you a prescriptive best practice like, oh, if your data looks like this, go use the Genai version of the solution.
If it looks like that, go use the traditional one. Um, you know, what we'll show is the data works platform lets you kind of experiment and evaluate with all of these things side by side. Um, because we've been doing traditional ML for a very long time. Um, and Genai is, you know, fits in neatly with this broader way in which we think about models and models combining with data to provide data intelligence. So, let's talk about topic modeling.
This is the easiest kind of way in which we can illustrate this out. Um, you might have heard of latent deers allocation. Um, we'll walk through this in a demo as well. Um, but I'm not going to get into the specifics there. Um, LDA has been around for a while. TF is another one. Um, it is kind of an out-of-the-box solution, right? Look at this nice little code snippet. That's effectively all you need. Um, thanks to Pispark.
Um, but you know, there's all sorts of issues with this. I'll show this in code actually in a bit. Um, I want to highlight this other paper um that kind of bridges the gap between these two things using a BERT based model. Um it works a lot better than LDA um which is meant to be out of the box. Um you know one big thing with LDA is it's kind of a clustering algorithm rather than a topic modeling algorithm. Um but you know there's still cases where this is not going to be quite as robust as we might expect.
Um and that's where LLM based approaches make a little bit more sense. Um ultimately you get greater flexibility and can iterate a lot faster as well. Right? If you see that there's something wrong with your topic modeling approach. Well, hey, um, why not add in, you know, some component to that prompt and, you know, specifically address that and get better performance and, you know, be able to hill climb over time. from those client meeting notes, but they want it to be pretty consistent, right?
Maybe it's about um future business relations, maybe it's about a current contract, etc. , right? Um we can have these different pieces of text. Imagine it's variable length um which means we need something that also works at scale. Um what we can do is using data bricks, we can generate topics um at a per text grain, right? So, you know, we might have this be independently generated for each meeting note summary. Um, and then, you know, this is helpful, but what we really want is to, you know, narrow the scope.
Each of these are generated independently of one another, which means they might be something totally irrelevant. Um, and there's not clear clusters, right? So, the next step is to do that clustering. Um this is super cool because we can actually combine traditional ML approaches um you know for doing clustering because fundamentally these texts are things that we can you know pass to an embedding model and then start to see in space where they all sit amongst each other.
Alternatively, you just pass it to an LLM, right? This is kind of the LLM versus traditional ML like step here, right? Instead, you can just pass it all to one LM and say, "Hey, summarize this into a couple of topics, right?" With those new couple of topics, right? We can then reclassify what we originally had from these initial topics to more consistent topics and, you know, ultimately get something that's going to be more reasonable.
Um, this is all helpful, but, uh, there's also just a paper that did this as well. Um, as it turns out, you can just do prompt engineering and get papers published at major computational linguistics conferences. Um, not knocking them by any means. This is really great and helpful research. Um, but the barrier to entry is super low. Um, and you know there's a lot of positive impact here because you know we effectively redid the algorithm that had been kind of a standard for something like 20 15 years.
Um, so you know, LMS can really change these things and generally speaking, this is one of these cases, and I'll demonstrate this later in the demo, where the Genai solution can be a lot more powerful and more robust than anything you might get otherwise. Let's talk about recommener systems. Um, recommener systems have also been along for around for a very long time. Um, data bricks partially founded as a result of Netflix's challenge for Rexus.
Um, so Rexus is, you know, an approach that has traditionally been done with collaborative filtering. Um, I don't want to talk too too much about it. Um, but feel free to just look at that nice little diagram on the right for a long while. Um, in short, it is vector-based similarity, right? Um, for anyone that you know is just getting into RAG, you'll be like, "Oh, that sounds familiar, right? Guess what? That's also vector-based similarity."
As it turns out, there's more in common with the traditional ML paradigms with the current modern genai approach than we might think. Um, in this case, you kind of identify users or products. And if you're recommending a product to someone, we might say, "Oh, this product has a similar representation of users that like it um to some other product you might have bought." And then we will say, "Hey, these two vectors have high cosign similarity or other distancebased metric.
Thus, let's recommend it." That's the short of it. Again, we're not going to get too too into it. Um, also amazing. PiSpark providing a really easy way for us to just get this out of the box. Um there's all sorts of fun hyperparameters here. Um it also is pretty compute intensive. Um just calling that out. But um in short, this has been done for ages, right? Collaborative filtering as an algorithm. That's a 20 almost 25 year old algorithm.
You can see what this looks like as part of a broader architecture. Um again like data bricks is great for this stuff because it works nicely at scale. Um but you know we also have this flavor of collaborative filtering where we start to talk about integration with vector stores and feature stores. Can also talk about LLM integration here as well. Um vector stores you know seem to have only come into existence in the last couple years but guess what people have been doing this cosign similarity problem um at scale for a very long time.
They probably built something that looks a lot like your modern day vector store. Um, and now like traditional search players, right? Like I think open search is a good example. They now have a vector search because guess what? This is the same exact problem as before just being solved or thought of in a new way with genai. Um, here we call it feature stores, but there's an even more kind of LLM oriented way to do this because arguably this doesn't involve any genai.
Um, maybe your vector embeddings are actually like text embeddings from uh like BGE models or something like that. Um but to combine this with LLM inference is pretty straightforward, right? Um in the stupidest way possible, right? This prompt kind of spells it out. A user bought these things. What are they going to buy next? Right? That is a prompt based solution. Um this is again dumbing down the problem significantly.
Um but fundamentally this is kind of how we see customers uh you know thinking about Rexus in this more genai based context. Maybe, you know, in terms of these items, we're also looping in some of the recommendations um from that traditional Rexus model and saying, uh, a user bought the following items um and you know, we think these three items are going to be popular with them. Which one of the three should we recommend?
Right? And we might have natural language descriptions of those products. This is again like oversimplification here but again hopefully you're seeing hey this is the same problem and we can maybe get I don't know like a 5% performance boost just by leveraging some genai paradigms with it. Um you can see there's some nice papers here too. Um Shashank the second author of uh that paper actually works at data bricks now.
Um but yeah as you can see here you know it's kind of getting back to that prompt based approach. you know, we can see okay, which tokens are we going to predict to have the highest likelihood, right? Um, this is how we can start to think about recommener systems as being something that is just based in large language models. As Andre Carpathy says, it's kind of this auto reggressive classification system. Um, that's really the power of LM is we can transform it to fit any number of these different tasks.
Let's talk about the last one. Uh, like I said, it can't talk about Genai without talking about agents. Um but you know to my point um I call it deep RL here as being 2014 but RL and the concept of agents have been around much much longer. Um so again like this is from 1993. People were thinking about agents then they were thinking about how to make these systems that can act semi-autonomously to solve specific problems in a more dynamic way.
Um but I had some fun like jumping down this rabbit hole. Not the first mention of agents. um you have to go back to 1973 um for this planner actor agent which uh plays a role on Q according to a script. Um I don't know that kind of sounds like saying hey I have a prompt and I'm feeding it to this quote unquote agent that is making decisions. I don't know what this actually looked like. It maybe didn't even involve like actual code um TBD.
But let's talk about traditional RL for those that might be unfamiliar. Um we're actually going to go back to this diagram a little bit later. um in traditional RL right your agent is just as important as your environment um and your agent takes actions in that environment um we'll walk through a like example of this that is going to do two things one it is going to elicit some reward um you know think of this as like a Pavlovian dog kind of thing right uh it presses one button and you know it gets a reward and it presses another maybe there's no reward and then it incentivizes that agent or you know in this case a dog to keep pressing the button that gives it a reward, right?
We can think of agents actually in a similar context. I think most of us think about them as these lane chain tool calling things. Um, but I think in the last like six months, we've kind of seen a convergence both of these agents that we think about in the genai world and agents in the RL context. And we'll kind of show on data bricks how, you know, this is being built out. So, um, just like some other fun things here.
I'm not going to spend too much time here. Um this is just more traditional RL notions of things. And when you start to think about your models in this way, um it can be a really powerful way to think about new ways in which we might optimize them, make them self-improve over time, um etc. Um in traditional RL, your thermostat is an agent. Temperature goes down, okay, it needs to then turn on the heat. Temperature goes up, it then needs to turn on the cooling, so on and so forth.
Um this is uh like also called like dynamic programming um or like linear programming is another kind of flavor of this. Let's talk about geni agents. Um there's a bunch of different ways to refer to geni agents. Um you could see all of the different questions that you might be asking yourselves. Um I am like the geni product specialist here at data bicks and even I you know kind of uh play fast and loose with these terms because you know customers have different expectations of what these things mean and you really need to align well on definitions.
Um, but you know, we'll talk about what things look like in more official data bricks terms here. Um, so kind of one that I think most of us are familiar with are conversational agents, right? You're going to have this conversation. Um, I realize like the colors here might be terrible. Um, so apologies I can't zoom in unfortunately. Um, but you kind of treat that agent as this uh collaborative iterative agent uh that is going to have this conversation and ideally by the end of that conversation resolve some task or issue that you might have, right?
Um it's kind of based around taking actions and responding back to you at this multi-turn setting. Um ideally there's also some memory so it actually remembers what you said um not just in the last uh prompt that you sent it but for all of the chat history, right? you think about chat GPT it's this um this is kind of why there is so much chat GPT hype right as part of this there's also tool calling um right so tools are going to enable your agent to do very specific tasks um and oftentimes you're specifying a lot of the constraints as well as a kind of workflow that any one tool might take right maybe that's an API call right um a lot of us have maybe heard of MCP MCP servers are meant to make it so that tools can communicate more effectively with LMS and vice versa.
Um, we see this as being like really integral to people building agents today. Um, but you can also think of tools going back to that traditional RL view of things as actions that your agent might take to get rewards later. Rewards probably from you as an end user or your customers, right? And then we have tool calling agents. Um, so there's a lot of different steps here. We're going to do reasoning. We're going to combine that with our different tool calls.
Um and then we're going to perhaps call additional tools as you know time goes on. This might iterate right ideally not indefinitely. Um but you know in a way that you know until the user is happy right until we see the feedback that we need to say hey this is my final answer or you know this is satisfying the user's request um that we're done right. And so there's always this kind of like fun looping functionality in this um until we get to in this case uh helping someone return some order um and giving them a shipping label.
Um we also see this called like a function calling agent um we see agents you know using MCP as part of this um as kind of a more modern iteration of this. So if you're again like what the heck like so much information here, think of an agent as an LM acting as if it had a brain, being able to take actions, right? Being able to reason, doing all of these things to ultimately have uh some final output here. Um this is again like the data bricks official terminology.
If you disagree with it, um you know, you're you're not wrong. Uh all these terms are maybe a little arbitrary. Um but you know, this is the easiest way to think about it, especially in the context of all that RL stuff. So, let's talk about kind of how we unite these two areas, right? Because I think for most of us here, this might be a totally new concept. Um, when we see agents today, um, I'm borrowing these slides partially like concepts from this really great blog from Anthropic.
Highly recommend checking it out to, you know, kind of dispel with this notion that like, wow, agents are so mysterious and complicated. How do I do them? Sometimes your agents are just pipelines. You're taking data, you're making some changes to it, you're spitting it back out to a user. Guess what? We've been building data pipelines for ages, right? Like that is the backbone of data bricks. Um, oftentimes there's a low degree of autonomy and there might be non-trivial engineering required.
If you're a data engineer, right? Like this is something that we're all kind of used to. And we actually say, hey, this is a good thing, right? I don't want there to be this non-determinism in my workflow. I don't want there to be hallucinations as to whether or not I match up data or, you know, send off data to some non-secure place, right? Um, alternatively, there's kind of this more iterative approach, which is that second diagram that you see on the bottom there.
Um, in cases where we see tight feedback loops, hopefully you're starting to see like the RL picture side of things, right? When we say that there's a tight feedback loop, that means we're taking the rewards that we might get in the case of like some of these idees like cursor. I'm saying, oh, this code works, right? People talk about verifiable rewards. That just means, hey, do I have a reward that I see as being clearly defined?
In the case of coding, this is obvious, right? Does my code run? Does my code actually output something or does it fail? Great. I'm going to go back. You know, that's like a negative reward. I'm going to go back, rewrite the code until it actually does work, right? I think for a lot of us, this is our lived experiences as people coding in 2025, right? We take our code, we vibe code it, we pass it, we try to see if it's right, we're like, what the heck? we go like tell chatgbt that it's you know terrible at coding until it actually gets something right right um but ultimately there's this kind of repeated Q&A process right in which we're able to iterate and get to something that is ultimately more powerful um than you know some initial baseline right without good prior about what we want as a good output so classic RL again is giving us a way to think about how we might optimize this right how we might take the agent feedback so agent feedback right that might me in my IDE saying, "Yeah, this code sucks.
This code is great." Right? Um or right, it could be another judge that is an LM or it could be a subject matter expert, right? Um if people here are familiar with review apps, right, that is an easy signal for us to take and then actually optimize our systems against. So just to you know kind of illustrate this at a higher level like the future of both you know not just data bricks um but I think for a lot of folks is to unite this vision of traditional ML or traditional reinforcement learning and genai right and RL is kind of the easiest clearest way for us to be doing this for agents you know there's still a lot of a lack of definitions here um because the field just kind of said oh who needs eval are you know second place I was just talking with a customer they're building all sorts of cool stuff in lane chain and I'm like well like what accuracy does it get in there you know it's oh I don't know like it doesn't hallucinate that much that's not helpful right we would think about this as a problem with a clearly defined KPI for traditional ML right we jump the gun on saying eval are important not data bricks right we have ML flow we've had ML flow forever um works great for agents too um but RL is going to present us a path towards getting even better agents or you know topic models or recommener systems that ultimately have more autonomy, more flexibility and are going to be more robust as we get more and more feedback from customers um or from whomever your end users are.
Um you can do this to some degree with a library called DSPI um really helpful and popular for building agents. Um but you know I think at the end of the day like all of us here are fundamentally doing some flavor of engineering right we still need to figure out how to maybe do prompt engineering as part of our agents or you know build out these other capabilities that uh you know are not as easy as automation. This is all to say like we still need us right we are essential and you know we are always going to need humans in the loop no matter what with these things.
Um, with that being said, that loop is something that we can make more efficient end to end on data bricks today. So, um, this is like kind of one of the last slides that I have as part of this presentation. Um, we normally present this in customer meetings, but I kind of messed around with it a little bit. Um, so you know, this hopefully it reminds some people of the RL diagram that I presented uh, right before this, right?
You're going to have this agent, right? We have all sorts of capabilities for you to experiment, to build, to you know combine maybe traditional ML models with these agents. There's going to be this really nice governance layer on top of all this because frankly we need it. Um and you know it's essential for people like us who have enterprise use cases, right? You're not going to production with a non-governed system.
But the system is something that we can start to think about improving, right? that we can monitor that we can use that signal from to then loop back around and improve this, right? And so ultimately what this actually starts to look like is what we had before, right? We have our agent, it takes some actions, it produces some outputs, our subject matter experts, our customers, you know, maybe myself as an IML engineer say, "Oh, this sucks.
Like I need to improve my prompts, right? I need to maybe do some automatic reoptimizations, right?" Um, and ultimately these two worlds are, you know, a lot closer than I think we have given credit for. And, you know, we should really be looking to RL as a way for us to think about how to improve these things over time and get to solutions that are going to, you know, solve our business problems that are hyper specific that don't have universal solutions.
Um, so yeah, uh, I wanted to end that here. Um, I'm going to get into a demo. Um, if you want to see more stuff about DSPI or more general like RLified Agentic workflows, things of that nature, I'm on Twitter X or whatever you want to call that. Um, but yeah, uh, I'll get into a demo. Um, and we should still have some time for questions at the end. Sweet. Okay, so let's talk about um, this demo here. So, pretty straightforward.
Um, this did not take me that long to actually code up. Um, we're comparing LDA versus this paper uh called topic GPT. I had that link to it. It's uh by famitall 2024. Um, and what we want to do here is we just want to compare LDA versus topic GPT. We'll see in this case, guess what? The traditional ML algorithm sucks. Um, maybe with a sufficient data engineering, we could get there, but it's a lot of work. Let's see what LDA looks like.
Um, you know, we're going to load in this data set. I think it's on like congressional bills or like house bills. Um you can see the information here. It talks about what this actually is about. And I think our ground truth topic is going to be uh the subject top term here, right? So this is about education apparently. And we actually have 21 different topics that we'll try to classify this into. For anyone who's done LDA before, you're probably already going like, "Oh god, like this is not going to go well, right?"
Um fortunately, the text is pretty like similar in terms of size. Um but what you can see here is LDA produces topics right this is a topic this is helpful maybe if you start to actually read this like I don't know um patient services health family like drug applicant like I don't know there's not a lot that actually differentiates these um okay bofuel that's that's pretty unique um but I don't think these words really have okay never mind they're somewhat like renewable and fuel um so Maybe that's a case where the topic actually is like being produced in a somewhat reliable way.
But also like I don't think about topics this way. Topic should be like one word, not just a bunch of keywords, right? That is how LDA works. That is why LDA might not be the best solution for you. Um let's keep walking through this though. Um in this case, I'm going to uh just pass this to actually get the topics that are predicted um by LDA on each of these. So you can see here um I'm actually like computing some features and I have a predicted topic and I could say ah yes clearly this is topic four which you know again if we want to go reference this back um it's this one act secretary requires second amendment state very descriptive it's not that descriptive um so let's uh keep going on here um LDA uh we're going to go ahead and get predicted topic keywords it's kind of just mapping those topic numbers to the actual words there which Again, like I said, not that informative.
Um, so then the last step that we'll do here, um, is I'll just format this nicely because then what we can do is just pass this to MLflow with a custom LLM judge. So in this case, I'm going to say the topic keywords must contain keywords relevant to the ground truth topic. Um, and what this will do is it will provide a means for us to then say, hey, is this an actually good model, right? By using LLM as a judge. You might be saying, "Wait, where's the judge?"
Um, it's just an MLFlow. So, for all of us here who are super familiar with traditional ML, right, showing you this should look pretty familiar. Um, this evaluator config is like something that's net new genai. Um, and also specifying this model type, but you know, you can also specify like model type equals linear regression or something like that, and that'll give you nice linear regression metrics, right? Um, what's nice about this though is within the data bricks notebook environment is we can get eval results just like this.
Um, the Wi-Fi was being terrible. So I won't actually click on this but it will open up an ML flow experiment. Um, this is not too great. Like we get 25% accuracy right because as it turns out our LDA based topics are not all that informative. So you know then the next question is well what do you do from there right? In pre-GNAI land, we would say, "Oh, we just need better feature engineering or, you know, maybe we need to try and do some stemming and lemonization and, you know, try all these fun old school NLP techniques.
They're not going to be very fun. Um, we're going to spend a lot of time stuck engineering this solution and not enough time actually solving our problems." So, that's where topic GPT comes in. Um, I kind of cheated here. I don't actually have the code for topic GPT in this notebook. I just took the outputs. That's fine. Um, but you can hopefully see that this is actually going to be helpful for us. Um, I'm just reading in the data set here.
Um, and you can start to see like, oh, you know, this is actually kind of a useful topic, right? We're saying that this is about social security. This one's about education, environment, health, so on and so forth. Native American affairs. Let's just vibe check this one. See if it's actually about that. Sorry. Just need to Oh, does this not It might not want to scroll because I'm Okay, there we go. Which one was Native American?
It's that one. Um, as it turns out, the subject term actually is Native American. And if we wanted to, we could, you know, click in and see uh like the actual text of it here. Um, and you know, get some sense that is actually right. Um, yeah, it's talking about some like tribes water rights, right? Awesome. Like clearly topic GPD is helpful there. But again, I feel like a lot of us would say in Genai land, oh, looks good.
Like let's let's ship to production, right? No, no, no, no, no, no. Like think of having an eval data set. It's traditional ML. We just are solving it in a different way, right? So, we need to do the same exact thing we did before where we take our outputs. We're gonna use LM as a judge here again. Um, this is effectively the same term or the same um like prompt that we used and we need to make sure that you know we have keywords associated with it.
This is the same exact code for this Genai system as what we had for the LDA based system. It's the same problem. we just have different outputs and then we want to compare them. ML flow like is totally agnostic to what those underlying models might look like. I see some people with agents and the agents aren't even agents. They don't call a model. They're just, you know, if else statements, cool. Like if you want to call that your model, like go for it, gen uh with MLFlow like we're totally agnostic to that.
Um I did cancel this output, but uh I have like one where it did actually run both of these. Um and you can see this is actually the topic GPT one. It does marginally better. Um, as it turns out, LM are also not the solution to all of our problems. I probably could have done a little bit more like prompt engineering here. Um, I only spent like a day or so building this out. Um, but you know, if we wanted to then go in and say like, hey, how do these compare to each other?
Um, this is in the MLFlow uh side on data bricks, we can actually go through any one of these uh and then see, you know, kind of the comparisons of uh what was generated in this case by our LDA model um and the Genai flavored model, right? Um, I'm not going to go through all of these, but uh, you know, the big bigger point here is, you know, we can kind of think of MLflow as being a neat way to unify the worlds of Genai and traditional ML and make it so that, you know, that transition is not something that is quite as scary as, you know, it might seem to be today, right?
Genai is just a new way of solving the same problems that we have always had. Maybe there's some new problems we can solve that we didn't have the ability to solve before. Um but I really want to you know hope everyone can take this away today and say hey with data bricks right whether we were doing traditional ML or genai we have a unified platform for doing both moving between the two and ultimately finding the solution that works best for our business specific problem.
So um I think with that I'm I'm like done done um you can see like there's uh like an improvement in performance but uh yeah happy to take any questions for the last six minutes or so. Cool. Um thanks everyone. Uh yeah I'll probably stick around for a little bit.
Learn more about the Databricks Data and AI platform.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.