Advanced RAG Overview — Thawing Your Frozen RAG Pipeline
Summary
- Frozen RAG limitations: Traditional single-embedding, single-index RAG systems hit accuracy ceilings in production—adaptive RAG unfreezes this by using multiple models and dynamic retrieval strategies.
- Experian's production AI models: This video shares real-world learnings from deploying four production generative AI models at Experian to improve accuracy and handle complex retrieval scenarios.
- Adaptive RAG techniques: Moving beyond frozen systems enables tailored outputs with higher accuracy through dynamic model selection and query-adaptive retrieval optimization.
Advanced RAG Overview — Thawing Your Frozen RAG Pipeline

Talk by James Lin, Head of AI/ML Innovation, Experian ; Jason Li, Senior Generative AI Engineer, Experian
The most common RAG systems rely on a frozen RAG system — one where there’s a single embedding model and single vector index. We’ve achieved a modicum of success with that, but when it comes to increasing accuracy for production systems there is only so much this approach solves. In this video we will explore how to move from the frozen systems to adaptive RAG systems which produce more tailored outputs with higher accuracy. Databricks services: Lakehouse, Unity Catalog, Mosaic, Sweeps, Vector Search, Agent Evaluation, Managed Evaluation, Inference Tables
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
What makes a RAG system 'frozen'?
A frozen RAG system uses a single, unchanging embedding model and vector index—this approach limits accuracy improvements and struggles with diverse query types or domain shifts.
How does adaptive RAG improve accuracy?
Adaptive RAG systems use multiple embedding models, dynamic reranking, and query-aware retrieval strategies to produce more tailored and accurate outputs for different types of questions.
what is generative ai
Generative AI refers to machine learning systems trained to generate new content such as text, code, or data insights based on patterns learned from training data. This video explores how generative AI powers advanced retrieval-augmented generation systems that provide more accurate and contextual responses to user queries. When properly grounded in high-quality data and optimized through adaptive techniques, generative AI can deliver reliable insights that organizations can trust for critical business decisions.
What is a RAG AI agent?
A RAG AI agent combines retrieval-augmented generation with autonomous reasoning to answer questions and complete tasks while maintaining accuracy and relevance. This video demonstrates how moving from frozen RAG systems to adaptive systems allows agents to retrieve more relevant information by dynamically adjusting embedding models and refining search strategies. By evaluating and improving retrieval quality at runtime, RAG agents can deliver more nuanced and contextually appropriate responses to complex business queries.
What is RAG in AI?
RAG in AI stands for Retrieval-Augmented Generation, a technique that combines document search with language generation to provide accurate, grounded answers. This video explains how traditional frozen RAG systems struggle with accuracy because they use a single embedding model and static vector index, which cannot adapt to changing data or diverse query types. Modern adaptive RAG systems overcome these limitations by continuously improving retrieval quality, adjusting embedding models, and optimizing context selection for better accuracy.
Full transcript
Hello, welcome. Uh, today we will be going through the advanced rag overview. Uh, and uh, we'll be talking about unfreezing a frozen rag pipeline. So, some of you might be wondering what that means and we'll get into it. Uh, I guess just in terms of some housekeeping, there is a forward-looking statement here. And then uh just as a way of introduction uh. I'm the head of AI ML innovation for Experian. Uh and speaking with me will be uh one of my uh generative AI engineers.
Um if you're not familiar with Experian um what we do is we uh do credit scores obviously. Um but our kind of motto is uh financial power to all. So we want to empower customers to take control of their financial future. Uh and in terms of generative AI, uh we have four models in production in North America today. So what we're hoping is that we'll be able to share some of those uh kind of learnings with you. Um but we we won't be talking about anything Asperian specific.
Uh we'll just be talking about kind of the technology here. So uh to kind of open up uh we were fortunate enough to get one of the early slots. So I'll lead off with a quote. Uh this is from one of my friends, who uh is the CEO of Creative Artist Agency. Um and he he's kind of very inspirational. He likes to say funny, quirky things. So this is kind of uh one of those things that he said. So um you might have heard about FOMO.
Obviously you guys all know that it's fear of missing out. Um but with generative AI, we have JMO. So JMO in this case means the joy of missing out. Uh, and what we're looking for here is, uh, essentially, uh, we're hoping that you take some of the things that we learned in the pain points and, uh, you're able to take it back and apply it, uh, to something that you can do yourself. And our our goal with this presentation is that, uh, you you have something that you can really apply when you walk out the door.
Uh, and, you know, feel free to talk to us afterwards. We're we're really open to collaboration on these things. So, uh, just to kind of set the stage before we get into everything, uh, you, this is just kind of the review in case you're not familiar, but you're probably all familiar with this slide, uh, for rag. Uh, you know, all the earliest hugging face examples have some form of it. So, in this case, uh, you have some documentation that you're creating embeddings out of. you stick those into a vector DB and then those embeddings are used by the generative AI model to give uh context to the model to answer but uh for our presentation we have to go maybe one level deeper so in this case we'll break everything out so the first step is embedding so as as we said before we have the documents uh and with the documents you have to break them up into chunks uh usually 512 bytes uh and with that there's an embedding model which is what's used to create the index uh which is stuck into a vector database.
Um I'm going to go through this kind of fast by the way. So um and then on the inference side uh when you get the prompt from the user uh you then also use the same embedding model to uh index the prompt and then that's what's used to do the lookup in the vector DB. Um and that uh is how it kind of actually performs. So if you look at the whole picture uh we stick in the embedding uh essentially it's one system or one pipeline uh but just kind of like an expanded view of that.
Um, so I think the next thing is we opened up saying there's this concept of frozen rag. Uh, and this was uh pioneered by I'm probably going to butcher the name because I don't I only read I don't care. Uh, but it's uh Dawi Kella who actually invented rag um and uh you know like kind of the first phase rag systems that we're all dealing with he says are frozen which is why we're not able to kind of achieve high results.
So uh what what exactly then do we mean when it's frozen? Um so maybe the first instantiation of that is well once you deploy to production you have uh you know essentially uh the vectors the data that you're putting in there everything there is stuck right like when when you're in production you can no longer change whatever you have in your vector store for that use case. Um, so when this so it's basically whatever you have is only as good as what you have when you did that deployment and you can't change this anymore.
But uh maybe if you start going into it you might think other things are frozen as well. So in this case um we can look at the embedding model itself. So uh you know like when we first started out there was maybe only one or two embedding models. Now there's probably a dozen or more that people use. um what what are the differences between the embedding models like can we change that or do you even want to like say tune an embedding model um but also the LLM itself I I think in the beginning we were all very focused on um you know just using one LLM for each rag system but uh you know in in more advanced use cases now we can even switch the LLM um and then I'll challenge you even further what if we can change what the user asks or what if we can change documentation like we started out saying hey once these vectors are stuck in your database you can't do anything but is that really the case can we actually change the documentation and can we change the prompts the user asking us so basically the whole system is frozen um and when you get a bad kind of rag result uh you know we we kind of have this model of saying hey like when you when you when you get this challenge you're basically how do I fix this?
Um, and usually a lot of times you're you're basically stuck saying, "Hey, there's a prompt and I get the wrong answer. So, why do I have the wrong answer?" Um, you have to break out kind of the whole rag system into the steps and within those steps, that's how you debug like if something is wrong. So retrieval uh meaning uh the when you're using your embedding algorithm are you finding the right or the best embedding to answer the question for that user.
So again this kind of goes back to the fact that maybe the embedding algorithm was frozen when you started out within the context. This is maybe like the data that we were talking about in the beginning. So the embeddings that you created in the vector DB are they accurate? Are they complete for the question? And maybe most importantly and overlooked is are they time relevant? Like did did kind of the answer change over time?
Did your policy change? Um and maybe sometimes it's hey did the embedding to answer this question actually even exist in the system because we found that it wasn't all the time. Um and then finally we go over generation that's obviously the model. So uh when you are generating the model did we have the correct uh answer? uh was it the correct length for that use case or for your product and did we talk about it in the right tone or style that uh we were expecting and maybe more so I hate to use the word hallucination here but it's a big topic obviously so uh you know are we are we willing to accept additional knowledge that the model is imparting based off its training data in addition to maybe the embedding knowledge that we're uh trying to stay on our own so uh I will switch to an enterprise context because maybe this is where we're coming from as Experian.
Um maybe some of you are more advanced than we are because we're not uh we are kind of stuck to enterprise. So I hope this this resonates with some of you at least. Um but we'll go back to kind of this first flow that we opened up with. So um you know I think if we fast or if we backtrack maybe two years ago uh when we were first looking at rag architectures uh we probably were in this world where openai is saying hey you know chat GPT or GPT30 at the time is the most advanced model in the world and uh you know everyone is going to build out their own like enterprise GPT which would be like one single model to rule them all type of thing right um So if we enter rag in this case it's it's just this simple view but you know maybe even 18 months ago uh I think we started to talk about this thing called agents or you we at least moved away from the idea that there's only one LLM uh or or model that is going to be accessing your rag or vector database.
Uh I think for a long time people are kind of stuck on this architecture in terms of like how we're deploying to production. Um, and this is probably kind of a key issue for enterprise systems, but uh what I would call this is a monolithic vector database. Um, and there are some pros to this from a uh enterprise perspective. So yeah, I mean the maintenance of it is very easy like everyone just kind of uh embeds their own vectors into it and we're we're good, you know, like it, you know, we we don't really have to uh manage too much.
Um and maybe more importantly um the access like if we have one single vector DB then uh you can reuse the things that other people had put in already and prepared for you and uh you know maybe you didn't have access to that data yourself but there are cons to this also so um what you find is if you have a single vector DV um you start getting repeats of the same embeddings like what what are kind of the embeddings that we're creating they're like PDFs or word docs or you know I guess a a popular example is finance bench where they're like 10k of different companies right so from year to year how similar are these 10k documents to each other like you know there's probably 80% overlap so how do you know that like the one that you have the embedding that you got is the right one for that year um and you're basically making that retrieval problem that we had like uh spun out on its own a much harder problem to solve.
So this kind of timesensitive aspect is uh what makes it really challenging in this perspective. So we propose maybe a more advanced enterprise architecture ragar. So so what does this mean? So I mean we we could still have maybe some sort of monolithic perspective here but instead of maybe being a vector DB uh what if it instead it was just a storage mechanism? In this case, it could be your data lake or delta lake, right?
Or lakehouse, however you want to call it. But from there, when you deploy uh each gen app that you're making, you you might want to kind of curate and do some data operations to uh do a bespoke vector DB for that particular application. In this case, um when you're kind of deploying, um this is probably more extensible. So, so we'll proceed with this model for the examples that we give to you. Um, and before we kind of get into everything and I'm wrapping up, so we we will get to the more interesting bits soon.
Um, some of the critics for what we're saying might ask, oh, but isn't rag dead, right? And I I think with based on how many of you are here, I would say maybe not because you're all very interested in this topic. But, um, for enterprises, uh, it won't be the case and I'll I'll explain why. So, um, what what are the things that kind of the critics might say, right? So the first is rag is unnecessary or eventually we'll become obsolete right like our our foundational models are constantly improving and at some point it'll know everything but if you say that for enterprise I think that's really scary right so we we'll talk about this later um the second thing that someone might say is okay well with these agentic systems now like why do we need rag we can just build an agent that's going to query the exact structured data that we need and based off of that structured data we'll be able to answer the question.
Um, and yeah, that's true, but that doesn't mean that you don't need rag. That's pretty much all I'll say there. Um, and then the final thing, and this is still rag, but um, kind of some one of the things that people say about rag is, hey, graph rag performs better than regular rag. So well first of all it's still rag but second of all I think if you see someone who has taken graph rag to production uh what they end up inevitably doing with the architecture that we had said previously is that uh the graph relationships usually are only three layers deep.
So you can actually do your data operations for your uh use case specific vector database and embed the vectors into that use case specific thing. So you get kind of get the benefits of both. Um and this is why enterprises will always use rag as we said. So um essentially the first thing is hey there's this uh domain specific data that you know that we we want and are very interested in um and uh kind of systemically if we create the architecture that I had gone through then uh it's actually easier to deploy and transfer expertise to like kind of this shift left concept right like once you've set up that architecture even though it might be a difficult problem uh you this is something that you can then transfer on uh very easily to like your teams.
Um and finally there's this kind of concept of the data mode which goes back to the first thing which is enterprises are very protective of their data and their expertise. So in that case uh we want to uh you know protect kind of the castle or the core business logic and the data in or the rag database in this case is kind of functions as this mode that will protect the enterprise at least how we think of it today. Um so what we're looking at here and kind of summing up here before I hand it off is that we consider rag to be the entire system and uh more so that the data is foundational to that system.
So we do take a very datacentric approach to this. Um and to kind of run through those examples I'll now hand it off to the much more interesting part of this presentation. So, uh, I'll be talking you guys through some of the pitfalls with a frozen rack system and how we can break them break the system down into individual components and see if we can start addressing some of the problems. Um so a lot of the complaints against rag is really just against frozen rag and we have here we identified some issues with frozen rack and kind of separated them into two categories and the first one being out of the box models.
So with these out of the box models um the first one is the large language model right that's the generative module of a rag system. So uh the in the case of rag hallucination takes on a different definition because anytime the model relies on spill to knowledge we'll refer that we refer that as hallucination because that's a big red flag in a rack system because you don't really know where the uh generation or the answer is coming from whether from like the context the model's given where it's reli where it's built-in knowledge right and that's kind of destroying the reliability of a rack system you're kind of just going back to the original foundation model only kind of Q&A system right so and that can be that faithfulness of the LM it can be uh addressed using u supervised fine tuning and we'll talk about in a little bit but for the embeddings embedding models uh it faces a it faces a different issue because you actually need the embedding models to know your data unlike you know the LM is more of a behavior fix right the faithfulness So because the embedding models actually need to map a query to the relevant chunks and the intricacies within your own data are not captured in the training of these general domain embedding models.
So again uh the uh fine-tuning is required even for these embedding models as well. And the last piece is these uh user queries are really messy in the real world. And they're not messy in the sense that they contain typos, but they're messy uh in the sense that they uh often contain multiple parts even in a single sentence question. And even worse, sometimes the users themselves don't even know what they want out of your system.
So uh you need to um that would take some sort of query decomposition or query rewriting. And moving on to the right hand side of the slide. Uh we believe data is really important. It's foundational to any welloiled rack system. That's why I put it in its own genre. And the first point is the source the source documentations even nowadays are still written with human readers in mind. And what that means is that tables and images are still uh prevalent in these documentations.
And these even frontier LMS are not as adept at reading these uh at least not as well as they are at reading text data. Um and sometimes the information in these source documentations um you they're written with the assumption that the employees within your organization or the co-workers know uh certain u things about your company right or your enterprise right so they're kind of just glared over uh in the sourcement documentation and the uh which is not as apparent to out of the box LM and the second point which is the most common case in our experience is that the true answer may not even exist in your documentation, right?
So, you kind of just need to add documents there uh on your own or uh because the second point gets tied into the third point is when uh the uh outdated information get passed into the LM which pollutes its context window, right? Because it's hard for a human to distinguish older data and newer data, let alone an LLM when it when that's all it sees, right? So that the order I just talked these issues in uh LLM embedding and data that is intentional because this is also the order in which we did evaluation or in which we do evaluation because only when you you can trust what the generative module is saying right it's saying faithful to the context that's when you can really isolate the retriever module and then once you fix once you fix the embedding model then you can some of these data gaps will be res be surfaced later on.
So that flow uh is very important to our evaluation as well. Uh so the ideal state of a domain adapted rack which is the opposite of a frozen rack uh is as follows and we um I kind of just listed the properties or the solutions under model data and strategy. And for model and data I kind of uh walk through some of them already. So for the model I'm just going to quickly go through it. It's so I listed the some of the papers in the brackets uh square brackets so you can and actual papers are listed at the end so you can kind of produce them uh over um you know at your own leisure. uh but for SFT uh for the LM what you need what you need to instill is the type of is the behavior you want right the faithfulness or the tone the length of the response and for the embedding model uh that's the part that you actually need to instill the new information into the mo into the embedding model which requires some sort of contrastive learning and I listed what we used in the um in the slide there and I'm going to go over uh glance over data because I already talked through uh in the last slide.
Uh so once you have uh well tuned models and uh all the holes in your data are pl are plugged well this is the strategy part is what we didn't really realize at the beginning when we started the project. So the strategy part is what we really realized that will get you through uh the finishing line in terms of customization to your own uh to your needs or your application. So we look at it through three lenses and the first one is when to retrieve.
So when someone uh says retrieval uh or rag they automatically assume retrieval is done at the very beginning uh which is uh which kind of an old view of rag because recent research has shown that when you do gener when you do retrieval throughout the generation it's actually uh better for the model especially when uh it's presented to the model when it needs it and I'll show an example of that later. uh or you can do you can think about what to retrieve.
So from this case I already talked about uh multiquery which is you know basically query decomposition right so you simplify a complex query into simpler ones or you can think about uh using multiple vector indices right so that if you have some sort of inherent structure within your data you can kind of enforce that onto your vector index as well so this is kind of similar to a graphql idea because the structure that's inherent in the multiple vector indices setup or you can the last piece is what to generate So a lot of people think rag uh rag just in terms of one shot right so the model sees the context once and then generates an answer right but you can also have some sort of a chain of thought right if you have if you don't have any latency requirements right so you can have the model reason over the context and then generate a more detailed or better answer in general and the last piece is kind of new is fshot and it's not in ter it's not the fshot prompting you often see in prompt engineering uh fshot in the case of rag is more of a reflection type of generation So you have the model uh a good example of that is self rag which you have the model like look over its past generation and then uh reflect on it and see if there's more required or how to fix its past generations and stuff like that. uh and I will show an example of this later that's more of an implicit refle reflection in the examples later.
And uh so this slide I basically took one of slides uh if you recall uh in terms of retrieval context and generation and I combined the solutions from the last slide and I just put them under this the problem each one actually solves. So in order to read it so for example retrieval if you have retrieval problems basically you can try ranking or fine-tuning the retriever uh the embedding model right or you can try some sort of query decomposition or rewriting just to lessen the load uh the workload on the um embedding model and I'm not going to go through the rest because the solutions already talked about but this is just a more of a practical view of the um of the information the same the same information uh From here I'll be walking you guys through some of the examples uh that we came up with.
So in this case the problem setup is we have 15 research papers on the topic of genai. Uh we have three categories with five papers each and this is our custom data set and the query that we designed is meant to replicate some of the issues that uh we that I already uh kind of walked through. So namely uh sometimes the users don't prompt the rack system correctly. Right? because this is a the if you look into the question this is a comparison uh question between dragon which is a rag paper and ORPO which is a reinforcement learning paper so this is a two-part question in a single sentence right so rag is in is notoriously bad at these this type of question and also another problem is that these uh since all 15 papers are on the topic of jai within these papers they they contain paragraphs or sentences that carry the same semantic meaning right so they have overlapping information and therefore overlapping embeddings.
So if you want to do precise retrieval uh meaning you want to you want to pull the exact paper that the question is asking for you need to do uh some more uh magic under the hood in terms of rag. So what we're going to do is we're going to uh start off with the most simple question the most simple setup the vanilla setup that mentioned uh and then also some housekeeping things. So for the generated module we're using uh 34 billion just so I could uh run it on my own computer and all for the vector indices they're all data bricks vector search uh and the embedding model is the GTE foundational API on uh data bricks um and uh just to illustrate the problem further.
So from the uh most vanilla model you can see I included the context the embedding model retrieved and the model response at the end. And just so uh you can have a clearer picture of what I'm talking about. So, so immediately that jumped out at me is the model is retrieving correctly one of the papers, right? It's pulling the paper dragon, right? But the glaring miss in the context is there's no uh oro, right? That's a problem because the model needs to see both papers in order to generate a u a good answer.
And the mark the question marked in red basically reflects that, right? because the LM in this case is surprisingly uh faithful because it's saying I don't really know about workbook because it's not being given to me. It didn't just say anything out of its own knowledge. So if you follow the flow that I mentioned at the beginning LLM embedding and then data LM in this case is pretty faithful. So we can just f focus on the retrieval piece.
So I think the issue right now is that uh the uh retriever model is uh not only facing a complex question but also has a different embedding overlapping embeddings right so let's see if we can sort of impose the structure we already know about the data which if you recall is the three categories right we have three categories of uh on jai rag reinforcement learning and vision right so if we can impose that structure onto the single vector index so what we did was to uh basically impose the categorization onto the uh vector index.
So right here we have three vector indices. We broke the single vector index into three. Uh and along with it we have the description with the vector index. So the LM can uh will know which one to pick given the description and the query. Um and so the uh the model output from this setup as you can see here. So each retriever is still doing uh the top three chunk uh retrieval. So that's that's why there's six uh chunks.
And so if you if I can direct your attention to the top line here. So the model selected RL research paper and rack research paper. Right? So the correct two domains that the question is asking about. So from the these two domains uh three questions or three documents are retrieved for each one, right? because you're kind of essentially forcing the retriever to select one from each category, right? So you're therefore solving the problem of just retrieving the dragon paper.
So now you can see the dragon paper is still selected but along with it we also have a reinforcement learning paper. However, in this case it's now retrieving the oro paper, right? It's this is retrieving an AI feedback paper and oh go back. So the model is still in the response is still you know summarizing what dragon does and it's also summarizing what the AF feedback does but it's at the end it's saying I'm still not provided the paper workflow.
So like I mentioned the next step uh also I we frame the progression in terms of crawl walk and run. I forgot to mention that. Um but that's the we're still in the crawl phase uh with the multi vector index setup. So the next phase is uh to walk so to speak right and how do we walk is by breaking down the complex question into a uh multiple or two simpler ones. And the way we did that is just to use uh pretty simple query decomposition and we included a few shot prompting uh just to show the model uh of how we want to do this kind of uh decomposition.
Um and the purpose of this again is to lessen the burden on both the vector uh index and the retriever. So after we did that uh we you can see uh the oro papers and the dragon papers are both correctly retrieved and therefore the model response is the best response so far. So now we're uh you know walking so to speak but we didn't just want to stop here. Uh so figuring out which moving parts uh to pick you know takes a lot of data science hours.
So we try to figure out a way to uh really reduce the load make it more user friendly and also the purpose of this talk is also to unfreeze uh all the components of the rack system. So we kind of really wanted to push the boundaries of what's possible. So what we did here next in terms of run the run phase is uh we try to unfreeze all the components of a rack system and by all the components I mean if you look at the heading uh it's when to retrieve what to retrieve and what to generate.
So these are the two the three strategic perspectives that we talked about and so we the purpose is to give the model control to decide all three just by its own right so you essentially you uh obulate all the data science hours uh that's required in picking them so the way we did that is we implement the implemented the paper dragon and it stands for dynamic rag based on the information needs of uh LMS s and the you can see the three main ideas from the paper list in the bullet points they will correspond really nicely to the three uh strategies.
So let's go through when to retrieve and the way we do the model decides when to retrieve is uh it only activates the retriever module when the LM generates an uncertain yet significant token. So how do we determine these two criteria? So that's why I attached the pseudo code on the right um on the right of the slide. So the way we determine the significance of a token is that we need to look under the hood of the LM and more specifically the attention matrix of the last transformer layer.
So the way I think about attention uh matrix is really just a way to tell uh how much a token is paying attention to other tokens or vice versa. Right? So if you look into the code a little bit, it's trying to extract the maximum the maximum impact of a token it has on the future context because it's looking down the column of the attention matrix. So that's how we determine uh the significance of a token. Again, it's by looking at how much impact it has on the future context or the future the future tokens.
And uh how do we determine uncertainty of a token? It's by looking at the entropy of the probability distribution. So if you recall an LLM basically generates a probab probability distribution over its entire vocab right and it just slice one token. So when it come every time you encounter a probab probability distribution you will encounter entropy right. So for example if you have a token that with a probability of one all else zero the entropy of the system is zero because there's no really uncertainty uh in the system it's deterministic right.
So that's how we calculate for each token the uncertainty of the distribution. Uh and the last chunk is where we really tie the two uh perspectives together. Uh if you look into the mean attention uh so for each token we'll multiply their attention or significance by their entropy right which is the uncertainty and also by a uh a real word binary indicator to indicate like whether a real this word is a real word or not and not not just a filler word right we don't we don't really care about like words such as and stuff like that and once we calculate this value if it exceeds a userdefined hallucination threshold will count this token as a hallucination.
Right? So as a user, you pretty much just need to define what the threshold is and you can do some testing that way. But this is how the model decides when uh a retriever is needed, right? Otherwise, it will just uh say stuff out of its own built-in knowledge. And the second point uh the model decides is what to retrieve. And the idea is pretty similar, right? Basically, it utilizes the attention matrix again, right?
Right? So every time it encounters an uncertain uh yet significant token, it will just look into the past context and select the most significant tokens and then pass them on to the retriever. Uh and the third piece is what to generate. So the way dragon works is that it will generate uh the output sentence by sentence, right? So uh and the sentence is either free of hallucination meaning it doesn't have any none of the tokens exceed the hallucination threshold or the sentence is supplied by a context uh or like the retriever is activated.
So in order to make uh this example more concrete I um we did uh we passed the same query into the uh dragon pipeline as well. And so you can see here the same question is passed in and if you just follow the print out so the model generates two sentences first right this is all done on its own knowledge this is no like no recruiter is activated right but the problem is we run into in the second sentence which starts by uh dragon which stands for dense retrieval.
So right there we know that's a hallucination right that's the model is making up a name for the prayer dragon because it's you know it's probably past its knowledge cutoff date right so uh again the model automatically detects the hallucination is uh you know in the second sentence which is marked in red the model automatically does that by doing the hallucination threshold right so and after that uh we look at the tokens that are significant to the word probably in this case that triggered the module trigger the retriever module is dense retrieval.
So we look at the tokens that are significant to those two words and then we send them to the retriever. So if you follow the print out question to retriever, those are the tokens that are actually sent to the retriever and again the model automatically detects uh uh determines that and uh so these those words are sent to the model and then I kind of redacted the context because uh you already saw what the context is and I kind of wanted to save space for uh for this example.
So what happens is that the model generates the new green text at the bottom on the left hand side which is replacing the original hallucinated uh text which is the second sentence. Right? So you have these two new sentences for this query and uh both are supposedly free of hallucinations uh based on your uh hallucination threshold. So from there we actually take those two cont two sentences and pass them into the model again and just have the model generate the answer all on its own.
And unfortunately the model uh there's a new there's a new hallucination detected in the third sentence the model generates right and the same process is repeated right so you just determine like which are the tokens that are significant to the model sorry to the uncertain yes significant token and just they're sent through the retriever and then a new sentence which is shown in the green is attached at the bottom. So this is an example this is a knowledge intensive example but you can easily imagine an example where some sort of reasoning by the LM is required based on the retrieved information right so when the model doesn't need like outside information and it only just needs to do the reasoning we just leave it be and not supply any uh additional knowledge but since this case is uh right this is a two-part problem that's why the retriever module is activated twice which is how it's supposed to work.
Um, again, but this mo this model is not for, you know, production ready at all. So, we're just trying to really push the boundaries of what's possible of unfreezing all the components of a rack system. And again, we're um open for collaboration uh with anyone who's interested in this line in this type of work. And uh with that, I just want to thank you so much for your time and uh Yeah, and I like I promised at the citations at the at the end here and uh these are the five papers five papers that we thought were very influential to our research and uh going to production as well.
So I think I'm done. Thank you so much for your time. Have a good rest of your day.
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.