 Hello community! You know, do you know that Harvard has a problem? I mean, a beautiful problem. But since they just got here the Nobel Prize here in medicine, Gary Rufkin, professor of genetics at Harvard Medical School, there's a lot on the line for Harvard. And now they noticed here that LLMs have suffer from incorrect retrieval, missing key information, and misalignment with current scientific and medical knowledge. And Howard writes, you know, additionally, LLMs struggle to provide contextual relevant answer. And it goes on, and Howard writes, specifically, LLMs have difficulty combining scientific factual, this means structured and codified knowledge, with tacit, this means non-codified knowledge. And those LLM-powered question-and-answer models that we have available, the best model on this planet, those models lack such multi-source and grounded knowledge that is necessary for medical reasoning, because this requires an understanding of nuanced and specialized nature of the medical concepts. And you might say, this is a real problem for Harvard, yeah? And if we look here at the test, and Harvard published here some tests, we have here a basic medical test and an intermediate difficulty and a real expert level test. And you see, if we look here at LAMA 3B, we are here with the basic below 50%. Intermediate, we are below 40%. And the expert is below 30% with a LAMA 3 8B. GBT4 Turbo is a little bit better, but we are about at 50%. So, for a medical system, this is not acceptable. A 50% performance is horrible. So, what to do? Now, Howard stated here that LLMs face challenges in complex medical reasoning, because such reasoning would require here a simultaneous consideration of dependencies across multiple medical concepts, and I will show you those concepts in a minute, plus a precise local in-domain knowledge of semantically similar concepts that can carry different medical meanings. And we will have an example on this. So I know what you're gonna say. You say, okay, so prevailing strategy to address these challenges here is of course, like in the community today, we have some RAC, some Retrieval Augmented Generation. Yeah, you know, Harvard discovers that also those RAC methods can provide multi-source knowledge. They are really vulnerable to potential errors. And Harvard goes on and says, you know, all those data repositories and the knowledge bases those RAC models draw from, they contain incomplete and incorrect information, leading now here in Harvard Medical School inaccurate retrieval for their specific cases. And Harvard goes on, you know, further, many RAG-based methods simply lack a post-retrieval verification mechanism to validate that the retrieved information is factually correct and does not miss some key information, especially here in medicine. So you see, now you understand when I say Harvard has a problem. Harvard says, you know, to advance now these LL-empowered EI models here for knowledge-intensive medical question and answer. It is now essential to develop models that can consider complex associations between several medical concepts at the same time, and systematically integrate multi-source knowledge, and effectively verify and ground the retrieved information to really make sure that the context, the relevance, and the accuracy is there. Because we are working here in medicine. We cannot allow to have one single mistake in those LLMs. So Harvard develops a solution. And this here is the beautiful study. We have here Harvard University, University of Illinois, Imperial College London, and Pfizer. Hello, Pfizer. Harvard writes here, knowledge graph-based agent for complex, knowledge-intensive question-answering in medicine. And they developed a new methodology and they write we introduce a knowledge graph based agent designed to address the complexity of knowledge intensive medical queries so what we are going to look now is we have a medical large language model with all the shortcomings, particularly in the area of REC. And we will now have a detailed analysis, how we can integrate the knowledge of a knowledge graph and bring them together to have a much better performance in medical reasoning. You know, these medical LLMs, they have kind of a problem because they have a lot of non-codified knowledge, whereas at a knowledge graph, we're looking at come up with a solution. Sorry, I mean, Harvard has to come up with a solution to integrate multiple non-coherent knowledge graph and somehow make them work with a medical LLM. So as I've shown you on this test here, the expert test, the question again, is there an interaction between a Hitchock protein 70 family that acts here as a molecular chaperone and the gene or protein implicated here in a particular case is something there related to a mutation? And there's only one answer, but in the test you have normally multiple choice here for the medical students. So great. Now they look here also at multiple choice test, but what I will focus is, of course, the open-ended question, where we do not have multiple choice, because in medical research you don't already have, and please choose from four answers, because one answer is guaranteed to be the correct one. No, we go open-ended. So, the goal is here to identify the correct answer using here an LLM and a knowledge graph to come up with a better causal reasoning in medical questions. And they say here is now our new idea. So, we have here a question. Let's say we have four answers or maybe no answer at all and then we have four phases we generate something review something we revise something and then we can answer everything so it's a relative simple concept but you know there's some inherent beauty so let me focus here on the methodology because this is great. So at first we are at a generate level. This is designed here to prompt the LLM to follow different procedures and I will show you these procedures for generating relevant triplets. And you know triplets from graph theory. So we have here as I told you two kind of questions, the choice-aware questions and the non-choice-aware questions. And in both, we generate triplets. Goal is here, extract medical concepts in the question stem of a particular question, plus here also have a look at the content of each answer candidate. Now, the concept extraction. The LLM extracts now a medical concept from the input question, which is this one here, identifies now all key entities and relationships that are relevant to the question, and this is done by the LLM. So, from a query like, hey, what is the relationship between hypertension and heart disease? The LLM identifies now the medical concepts of hypertension, heart disease, plus, you know, a triplet here in a graph. We have a relation included in the middle, and this relation here is causes, or is associated with. So, the generation phase is simply to create a triplet. So based on the identified medical concept, and I will show you how we do this, the LLM generates triplets in the form of HRT, where H is the head entity, R is the relationship between those entities, and T is the tail entity. This is what we know from graph theory. So for instance, a generated triplet might be here, hypertension causes heart disease, H-R-T. So we do have a structured format. Now, for those different kind of questions, if you read this publication, it's a beautiful publication, they're also focusing here on multiple choice questions. I will leave out here the multiple choice because I will focus here on open-ended question where we do not have a solution given. But there's nothing. So we have to come up, I mean the AI has to come up, with a medical solution. Involves generating triplets directly from the question. Without, we have answers A, B, C, and D. Okay, so now that we have generated a triplet, and I will show you how we do this, let's have now look at the second phase. This is now the review phase, or the review action phase. Here, it aims to assess the correctness of the generative triplets by, and now we have the connection to the knowledge graph, by grounding here the correctness of the triplets in a medical knowledge graph. We do this to ensure that the relations in the entity produced by the LLMs are factually correct and consistent with medical knowledge. So you see, we have now two different systems, an LLM and a knowledge graph, and now it gets interesting. And there is now a specific way to map entities between those systems. And Harvard decided to go here with UMLS code, Unified Medical Language System code. Each entity in the generator triplets is mapped to the corresponding concept in the UMLS. This step ensures that the medical concepts identified by the LRM are linked to the correct standardized medical terms via the UMLS codes, which can then be matched with entries in the knowledge graph. If you've never seen a UMLS code, for example, some real simple diabetes mellitus, you have a concept, unique identifier, a simple code base, then you have two official names, then you have synonyms, and then you have different sources sources and then you have a lot of treatment options and whatever. So here we have codified knowledge, standardized medical terms. And what we do now is we just jump here from a medical LLM over with this complexity and the semantic knowledge to a knowledge graph. No, we have, if you want, a filter. And we say, hey, everything that is consistent and has a unified medical language system code from the official directory, this filters out that only the correct medical terms come over to the knowledge graph. And if the medical LLM hallucinates some, I don't know, technical terms, that is not within the code, that does not exist, well, then it is filtered out and not in the next step. Okay, now we are retrieving pre-trained knowledge graph embeddings. And you say, what? Yeah, it's beautiful. So for each matched entity and relation, the pre-trained embeddings from the knowledge graph are now retrieved. So these embeddings capture now the structural relationships between the medical entities in the knowledge graph. And you say, hey, wait a minute, I have a knowledge graph and you are talking about embeddings? Yeah, if you're not familiar with this, never mind, this is for an old methodology. This is from 2013. This is the first time it happened. We have a lot of embeddings functionalities. I would recommend you this particular paper. This is the original Trans-E paper for translating embeddings for modeling multirelational data from CNIS and Google 2013, about 2013. And they face here the problem of embedding the entities and the relationship of a multirelational data into low-dimensional vector spaces. So they have a graph and they want to find, if you want here, vector embeddings in low-dimensional mathematical spaces. Here I've given you here if you want to read the paper in detail. It is so old that unfortunately now it is only behind paywalls of this big corporation, but with this link you can read it free of charge and in this trans embedding they give you the translation based model and they say give them a training set of triplets hlt composed of two entities head and tail this is the set of the entities and a relationship now they call it l not r whatever this model learns vector embeddings of the entities and of the relationships by doing here a simple optimization problem. So you see, we have a method to find the embeddings in a mathematical vector space of a knowledge graph. So isn't this beautiful? So what we have, we have now officially from the large language model from chat GPT or whatever you use, here we have the LLM's internal embeddings. If you use GPT-4, you have to pay for those embeddings. And we have now from the knowledge graph also structured embeddings as given by a trans embedding. So we have now a free text information and a graph structure information, and we have brought them at the same level of an object of embeddings. And now we have the task of fine-tuning the LLM on a knowledge graph completion task, as Howard writes. So what is this? This is a key aspect of the methodology is now to fine-tune our LLM on the basic knowledge of the knowledge graph that is now added to the system, which involves then if we have a fine-tuned model to predict missing relations or entities now back in the knowledge graph. I will show you this in a minute. But just on a theoretical level, we have now LLM embeddings and we have knowledge graph embeddings, because the task is to somehow bring those together that one system can learn from the knowledge of the other system. So how we do this? There is something like an alignment phase, and you know, we have always had this problem in the classical phase. So the alignment between the LLM's token embeddings and the knowledge graph structural embeddings, this is now essential to combine here exactly also the unstructured knowledge of the LLM with the structured domain-specific medical knowledge found in a medical knowledge graph. So how we do this? Well, it is easy. We simply add a projection layer, for example, now we do this on the token embeddings, which will adjust their dimensionality and their structure to match here the format of the knowledge graph embeddings. So this means we have a mapping transformation, or it learns a mapping that brings the LLM token embeddings and the knowledge graph embeddings into the same geometric space. This is great, we can normalize it and then we can work with those embeddings, because now those embeddings are really compatible, coherent structure. And in this way the model can now combine the semantic meaning of the LLM embeddings with the grounded, proven structural relationships that are encoded in the knowledge graph. So now the LLM's, token embeddings and the structural embeddings, they are now harmonized. And once the token embeddings are transformed, we have the classical attention mechanism that you know, that you love. Whatever transformer used that has attention, self-attention, multi-head attention, it helps now the model to focus on important parts of the input, and in this case it helps align the LLM's token embeddings with the knowledge graph relational information, and it simply means it assigns more weight in the tensor structure to the important parts of the triplet, now learning thereby how the LLM's understanding of a hypertension should map onto the knowledge graph representation of the hypertension and the similarities for heart disease and related causes. So now we have, if you want, a new embedding created. That is, beautiful. We call this the aligned embeddings of both systems. So after the transformation layer and the additional attention layers and the execution, the final result is now a new set of embeddings for the triplet components, which we call now aligned embeddings. And these embeddings capture now both kinds of knowledge. We have the semantic meaning of the pure text is now understood by the LLM, and the relational structure information as encoded by the knowledge graph in the graph form from the graph-based training is also now available in those embeddings of those aligned components. Isn't that great? So therefore, we have now an improved reasoning. Because we do not have any more one system LLM and one decoupled system knowledge graph, but now we have combined the knowledge of both systems. The aligned embeddings are crucial for tasks like knowledge graph completion, where the LLM has to predict missing relations between the entities and the knowledge graph. By aligning the two types of embedding, the LLM can now reason about the knowledge graph with an improved accuracy and an improved understanding, so that its horse has all now the structural information of the medical knowledge graph. To ground the knowledge. Let me give you a practical example. So if we say here this knowledge graph completion task in which the model attempts to fill in the missing links in a portionally complete knowledge graph and this is a problem that we have almost every time. Especially in medicine you have never a complete medical knowledge graph. There are always some parts of information missing. So we always have more or less partially complete knowledge graph for a particular topic for a particular task. And now if we can now fill in the missing links and make this knowledge graph if you want more complete, this would be great. So let's do this. The LLM is now fine-tuned in order to predict here the missing relation between the entities that already exist in the knowledge graph, or to predict missing entities in a relationship if only one entity in the relation are known. So, simplest examples, hypertension associated with, and then we have not yet the end node for this in the relation. Or we have question mark causes heart disease. And now we can predict the missing entities of those two elements. So you see, we complete the knowledge graph another step, another level. Great. So here we have it. We have now, since we have two systems, we can do now, if we have an improved knowledge, we can have now two options. We can either update the knowledge graph. So if the purpose of the system is to continuously enhance the knowledge graph, then the new predicted relation and entities that we found with the combined knowledge can now be added back to the knowledge graph. We make the knowledge graph more complete. Let's call it knowledge graph plus. This results, see my last video, where I talked about dynamic evolving knowledge graph that are now more complete, more up to date, can have a higher complexity level to have a better augmentation, either in higher complexity structures, plus all this insight gained from the LLM reasoning are now incorporated back into the graph for the future use. So if you want, we have here absorbed all the knowledge of the medical LLM, and we put it now in a new knowledge graph that is much nicer, much more powerful. Or we have the option B, like here in the publication by Harvard, the inside staying with the LLM only. They say, for example, you say, hey, I just need a better LLM for argumentation, for causal reasoning. So my goal is to get a Medical LLM Plus. So the knowledge graph remains static and unchanged in this particular option, serving only as a source of structural knowledge that the LLM can draw from. And you bring in, I don't know, 20 different knowledge graphs from 20 different medical sub-disciplines. You get the idea. Your Medical LLM Plus will be a LLM plus, plus, plus. Great. So in this case, the LLMs learn from the knowledge graph using the fine-tuning process to better predict relationships and answer the question. But the new insights are not fed back into the knowledge graph. So whatever whatever you do, great. Now, there is of course an option C, not described here in the publication, that you could theoretically do both. You update your knowledge graph and you get a better medical LLM plus. But then we would have complexities that i would like to show you in a later video so now we are after we have done the review and we have done all this now there is also the revise phase or action phase and this happens if the triplets that were generated are found to be incomplete those triplets are found to be incorrect. So what we do? Theoretically, you just throw them away. But, Harvard tells us, hey, maybe there is some hidden information in there. So what we do? We keep those, but we get them a special treatment. And now, since we have this super LLM, the LLM Plus attempts now to adjust incorrect triplets by proposing here new relations or new entities in our triplet structure based on related medical concepts. So whatever was learned is new, also integrated in this new knowledge base. And then the LLM will call this triplet iteratively, where the LLM continues to propose and refine the triplets until the triplets are now validated again by the knowledge graph. So you see now, if you have a standard knowledge graph that is not dynamically evolving and increasing its complexity based on the reasoning structure of the LLM. Then sometimes the validation by the knowledge graph you will reach a plateau given by the complexity level that a knowledge graph can handle but might be necessary to validate here a very particular special triplet configuration that an LLM generates. So you have to make sure, in short, that the complexity level of both of your system, the LLM and the knowledge graph, are about the same. Or you must know, hey, my LLM has a complexity level of 6 out of 10, but my knowledge graph has 8 out of 10 you have to know what procedures to follow great and then of course the last phase here is the answer phase beautiful so everything is great we have now a lot of different answers and now the model simply and let's go here as in the publication with the medical llm plus now this model selects now the best answer based on the verified triplets from the review process and now from all this revision if we found some better review stages so the final answer is determined by considering the relationships and entities validated now by the knowledge graph and this ensures that the answer is not only plausible for the LLM but also factually grounded in the medical knowledge as presented in the knowledge graph in a medical knowledge graph so you see the beauty of this I hope so so for my green grasshoppers I try to have here five important points for you. This is the summary for a beginner. What we do, we have an integration of LLMs with domain-specific knowledge graphs. And you have a certain knowledge encoded in the language model, and you have a certain, maybe different knowledge encoded here in the knowledge graphs. And now you want to bring them together, a better system. Maybe different knowledge encoded here in the knowledge graphs. And now you want to bring them together, a better system. Five points. Combine the free-form reasoning capability of LLMs with the structured domain-specific knowledge from our medical knowledge graphs, resulting in a system that can reason more effectively about complex medical concepts. I told you that the use here of these UMLS codes as an intermediary between the LLM-generated concepts and the knowledge graph allows for a consistent and accurate mapping of medical terms. The fine-tuning of the LLM on a knowledge graph completion task enables the model to bridge you the gap between unstructured text and structured knowledge also leading to improved reasoning and as i told you the alignment phase of the token embeddings from the llm and the structural embeddings from the knowledge graph allow the model to leverage both the semantic and the structural knowledge improving also the accuracy of the reasoning. And especially beautiful, I think, is the error correction via the revision mechanism. Now, this is a try and error. Maybe there's nothing there, and LLM does not find, is not able to solve or decompose here this complex triplet. But maybe it is, and therefore we do have an error correction. So this iterative revision action ensures that the model can correct its mistakes by leveraging additional knowledge from the knowledge graph leading to a more robust and accurate answers so nice ideas beautiful ideas integrated here and i immediately have five other ideas how we can build on this and further improve this but the goal of this video is just to make you familiar with this study by Harvard and Pfizer. Harvard calls this methodology the KGA Reveon so knowledge graph A Reveon don't ask me for what it stands and it enhances here the medical questioning answering by leveraging the LLMs, grounded now with the knowledge of the knowledge graph to the novel mechanism we just went through. And they state, hey, unlike the standard RAG approaches, our new methodology doesn't directly retrieve information from the knowledge graph. And this is so important to understand this. This is not RAG. Instead, Harvard writes, it uses the LLM to propose a potential relationship between medical concepts extracted from the question represented as triplets. This is not as easy as you might think, and I would like to show you here an example. But you see, this is it in a nutshell here on this new methodology what is so beautiful that the llm is not constrained now to existing relationship in the knowledge graph it can propose a novel connection based on its language understanding and as i told you if you go here for a medical llm plus plus plus or whatever this here really just uses here the knowledge of the knowledge graph and then you can exchange the knowledge graph with a different subgraph or a different medical graph or a different or higher complexity knowledge graph so you see depending on what system you want to nurture on you have unbelievable options in front of you and the code is rather simple let me show you this now before i show you the code i want to show you the result ladies and gentlemen the results are now howard chose us here also the multi-choice so if you have a b c d and you have to cross A is the right answer. Reasoning. My goodness. So the number of medical concepts, the complexity of the concept is here on the x-axis up to six medical if you take the same Lama 3.8b and you apply this new methodology, you see that you go from, I don't know, 50% to about 70% plus. Nice. However, if you look at a Lama 3.1 and you do the same stuff, you see that the general curve shifts upward here. Suddenly, instead of 0.5, we are now at 0.7, but the increase now by this new methodology is not as significant as it was here on the LAMA 3B, and unfortunately they do not have the data, or publish the data, of LAMA 3.2. Interesting is, however, that if you see the more medical concepts we bring in into the question, the higher is the complexity, the more multidimensional medical concepts we have. You see here, this is nice. Unfortunately, it's just one data point. But you see, the more medical concepts we have, the better this new methodology is, and the less potent the classical LAMA system is. You see, the higher the number of concepts, it goes down, down, down, it goes down, down, down. Okay, but if you go now to open reasoning, let's have a look at this. Again, LAMA 3-8B here, the light blue. And here you see this new methodology is not as good. And look, even if we have here multiple number of medical concepts that we integrate in the answering of our medical question, there's only the same performance with and without this new methodology. And you might ask, is this based on this particular system or is this because the methodology is not working? And then it's interesting, they give you here the second one here. And they have now the LAMA 3.1, the 8b here. And you see the more comedical concepts we have further it goes down but here it separates and it has here kind of an equilibrium but it also breaks down here if wait a minute if we reach here a certain threshold so this tells me there is a high sensitivity to the underlying LLM. If we go with a LAMA 3.8B or LAMA 3.1.8B, and hopefully with a LAMA 3.2.8B, we would see significant differences if we apply this methodology. But unfortunately, the latest models are not available for us. And Harvard writes here, they used here a cluster of four NVIDIA. I think it was an H100 GPU configuration. So it was not that complex to do all of these calculations here in this demo. And I want to close this now here with the prompts. And a lot of questions are received here. How complex are those prompts? So have a look at the prompts and a lot of questions are received here how complex are those prompts so have a look at the prompts this is here the first prompt the very first step here to generate here our if you want medical triplet but before we generate this you remember i told you they want here if you want to fill here the search base with enough information so what they do they say give them here a for example multi-choice question extract all relevant medical entities contained within the question stem so this means identify and extract all medical entities such as disease proteins genes drug phenotypes anatom region, treatment, whatever relevant medical entities there are. And put all of this in a list with the key medical terminologies. So you see, you have now not only one particular term that you look for, that is in the question, but you look for the complete embodiment, for the complete surrounding, the topological cluster around your particular medical term. So this contextual embedding, if you would like to call it, this is done here in this particular prompt. Second prompt is really we generate now here our triplets. So the prompt for generating now the action phase, so we say given the following question stem and the medical terminologies that we just created, so this is here the list of all the surrounding, if you want, generate a set of related undirected triplets. Each triplet should consist of a head entity, a relation, and a tail entity. The relation should describe meaningful interactions or associations between the entities in a biomedical context. And now you can even say that you want to specify those relationships. And Howard tells us here, hey, the relationship should be one of the following. Protein, protein interaction, carrier, enzyme, target, transporter, counterindication, indication, off-level use, energetic, whatever. So you define your valid relationship. If you want, this is kind of another filter that you want to apply for your particular task. You know here the complete set of possible interactions. And then the task is, hey, just generate one to three triplets for each option focusing on the ones most relevant to answering the query. Only return the generated triplet in a structured JSON format with the key triplet and a list. Oh, you have here head entity, relationship and tail entity. Beautiful. So what we have, we have here the question, the user question, then the list of the medical terminologies that we just created in the step before. And now we get a response by the LLM. So the LLM generates here the kind of complexity triplet structure. And here also, the better your LLM, the more the the llm is able to think and reason and detect and create complex more complex triplets the more intelligent the system could be yeah if you want to see the prompt for the revise action i was interested in this and just simply say hey given the following triplet consisting of a head entity of a relation of a tail entity, please review and revise the triplet to ensure it is correct. Or ensure that the rise triplet is trying here to find a new triplet configuration, new terms, new relations that might be voted correct here by the knowledge from the knowledge graph. And this is the end. So therefore, yeah, I hope I have given you here an insight into a complete new methodology that harvard harvard medical school is utilizing here in this research publication it's brand new for me that's just three days old and i think it's beautiful and i thought about replacing here all my rack systems also with this new methodology because it is so much more powerful and if i don't need drag maybe that's maybe not a bad idea if i can substitute it with a more powerful methodology but you see more or less simple idea formulated in a coherent way four phases and they show you hey we have a much better performance of our systems for medical question and answering of course they are not there yet that it will be 100 correct but this is already the next step i hope you enjoyed this video i hope it was a little bit informative and it would be great to see you in my next video hey siri wie spät ist es denn
Harvard Presents NEW Knowledge-Graph AGENT (MedAI)
Harvard Unveils New Knowledge Graph Agent for improved AI in Medicine. Called KGARevion, it combines the knowledge from knowledge graphs with the knowledge of LLMs.

Since RAG suffers from inaccurate and incomplete retrieval problems in medicine, Harvard et al present a new and improved methodology to significantly increase the reasoning performance of medical AI systems. Special focus on complex medical human interactions. 

New insights and new methods to combine the non-codified knowledge of LLMs with the structural codified knowledge of medical knowledge graphs. 

Detailed explanation of the new methods in this AI research pre-print (also for beginners in AI).

All rights w/ authors:
KNOWLEDGE GRAPH BASED AGENT FOR COMPLEX,
KNOWLEDGE-INTENSIVE QA IN MEDICINE
https://arxiv.org/pdf/2410.04660

00:00 Harvard has a problem w/ LLMs and RAG
04:20 Harvard Univ develops a new solution 
07:24 The Generate Phase (medical triplets)
09:50 Review Phase of KGARevion
12:30 Multiple embeddings from LLM and Graphs
15:40 Alignment of all embeddings in common math space
20:48 Dynamic update of the Knowledge graph
21:52 Update LLM with grounded graph knowledge
23:15 Revise phase to correct incomplete triplets 
25:20 Answer phase brings it all together
26:07 Summary
29:52 Performance analysis 
33:39 All prompts for KGARevion in detail 

#airesearch 
#aiagents 
#harvarduniversity