Medical knowledge graph construction method and device, equipment and storage medium

By combining pre-trained models and large language models with precise matching, fuzzy matching, and entity alignment methods based on ontology semantic structures, the problems of insufficient data quality and reasoning ability in existing medical knowledge graph construction are solved, and efficient and accurate medical knowledge graph construction is achieved.

CN120705330BActive Publication Date: 2026-02-03CHONGQING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510814448.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2026-02-03
Estimated Expiration
2045-06-18

AI Technical Summary

Technical Problem

Existing methods for constructing medical knowledge graphs have high requirements for data quality, poor reasoning ability, and weak generalization ability, and also face challenges in entity recognition, relation extraction, and entity alignment.

Method used

A pre-trained entity recognition model is used for entity extraction, and a combination of exact matching and fuzzy matching is used for entity matching. A fine-tuned large language model is used to extract relationships, and entity alignment is performed by fusing ontology semantic structure and entity relationship attributes to construct a complete medical knowledge graph.

Benefits of technology

It enables the construction of high-quality, automated medical knowledge graphs, improves the accuracy of entity recognition and relation extraction, and enhances alignment consistency and data generalization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705330B_ABST
    Figure CN120705330B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a medical knowledge graph construction method, device and equipment and a storage medium, which are applied to the field of medical knowledge graph construction. The method obtains medical text, performs entity extraction on the medical text by using a pre-trained entity recognition model, matches the extracted entities with entities in an existing knowledge base based on an accurate matching method and a fuzzy matching method to obtain entity matching results, wherein the entity matching results contain information about matched entity pairs, uses a fine-tuned large language model to extract relationships between entities according to preset prompt words based on the entity matching results, and obtains multiple knowledge graphs. The method aligns entities with the same meaning in different knowledge graphs by using an entity alignment method that fuses an ontology semantic structure and entity relationship attributes, and obtains a complete medical knowledge graph. The method realizes accurate, efficient and automated medical knowledge graph construction, and can provide high-quality knowledge support for medical artificial intelligence.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of medical knowledge graph construction, and in particular to a medical knowledge graph construction method, device and equipment and a storage medium. BACKGROUND

[0002] The construction of a medical knowledge graph mainly relies on core technologies such as entity recognition, relationship extraction and entity alignment. Traditional entity recognition methods rely on medical ontology and rule matching, and can recognize standardized terms, but have weak generalization ability on unstructured text. Deep learning methods have improved the automation level of medical entity recognition, but still face challenges such as term ambiguity, low resource annotation and fuzzy entity boundaries. In terms of relationship extraction, rule-based methods have high interpretability, but are difficult to extend to large-scale unstructured data, while deep learning methods, although capable of automatically identifying disease-symptom, drug-indication and other relationships, are highly dependent on annotated data and difficult to capture implicit causal relationships.

[0003] In recent years, large language models have shown potential in medical text understanding, but still have hallucination problems that affect the reliability of the knowledge graph. In terms of entity alignment, traditional string matching methods are difficult to handle semantic equivalence problems due to the diversity of medical concept representations, while semantic matching methods based on large language models can improve accuracy, but still do not fully combine entity relationship attributes and ontology structures, resulting in limited alignment consistency. SUMMARY

[0004] The present application provides a medical knowledge graph construction method, device, equipment and storage medium to solve the problems of high data quality requirements, poor reasoning ability and weak generalization ability of existing medical knowledge graph construction methods.

[0005] In a first aspect, the present application provides a medical knowledge graph construction method, which comprises:

[0006] Obtaining medical text, and performing entity extraction on the medical text by using a pre-trained entity recognition model;

[0007] Matching the extracted entities with entities in an existing knowledge base based on an exact matching method and a fuzzy matching method to obtain entity matching results, wherein the entity matching results contain information about matched entity pairs;

[0008] Using a large language model after fine-tuning to extract relationships between entities according to preset prompt words based on the entity matching results, to obtain multiple knowledge graphs;

[0009] Using an entity alignment method that combines ontology semantic structure and entity relationship attributes to align entities with the same meaning in different knowledge graphs to obtain a complete medical knowledge graph.

[0010] Optionally, the medical text is subjected to entity extraction by a pre-trained entity recognition model, including:

[0011] The medical text is input into a pre-trained character embedding model for analysis and processing to obtain a character embedding vector;

[0012] A position embedding vector is generated according to the relative position of each character in the medical text;

[0013] A component of the character is extracted from a large-scale Chinese character structure data set, and a component embedding vector is randomly sampled from a uniform distribution;

[0014] The component embedding vector and the position embedding vector are fused to obtain a fused feature vector;

[0015] A bidirectional long short-term memory network and a conditional random field model are used to decode the fused feature vector to obtain an entity label sequence.

[0016] Optionally, the component embedding vector and the position embedding vector are fused to obtain a fused feature vector, including:

[0017] The component embedding vector and the position embedding vector are spliced, and the spliced vector is input into a Transformer model for feature extraction to obtain an output vector sequence;

[0018] The output vector sequence is subjected to feature enhancement by a pre-set attention visualization matrix to obtain a feature enhanced sequence;

[0019] A cross-attention mechanism is used to fuse the feature enhanced sequence to obtain a fused feature vector.

[0020] Optionally, before extracting the relationship between entities based on the entity matching result using the large language model after fine-tuning according to the pre-set prompt word, the method further includes:

[0021] A medical field annotation data set is constructed, and the annotation data set includes medical text, target entity pairs, and relationship labels between entities;

[0022] A target function for fine-tuning is determined, and the target function is used to measure the difference between the relationship extraction result output by the large language model and the true annotation;

[0023] According to the annotation data set and the target function, the parameters of the pre-trained large language model are updated until the target function value is less than a pre-set value, and a large language model after fine-tuning is obtained.

[0024] Optionally, based on the entity matching result, the large language model after fine-tuning is used to extract the relationship between entities according to the pre-set prompt word to obtain a plurality of knowledge graphs, including:

[0025] The entity matching results and the preset prompts are input into the fine-tuned large language model;

[0026] The fine-tuned large language model performs semantic understanding and analysis on entity matching results based on the guiding information in the prompt words;

[0027] Based on the analysis results, the large language model extracts the relationships between entity pairs and outputs the relationship extraction results in the format of the example in the prompt words;

[0028] Based on the relationship extraction results, multiple knowledge graphs are constructed.

[0029] Optionally, an entity alignment method that integrates ontology semantic structure and entity relation attributes is used to align entities with the same meaning in different knowledge graphs, resulting in a complete medical knowledge graph, including:

[0030] Multiple knowledge graphs are input into a relational graph convolutional network, which processes the input knowledge graphs to learn the feature representations of entities and relations in the knowledge graphs.

[0031] Based on the learned feature representations, multiple knowledge graphs are fused to obtain the first fused knowledge graph;

[0032] The entity attention mechanism is used to perform weighted summation on the fused knowledge graph to obtain the second fused knowledge graph;

[0033] The second fused knowledge graph is subjected to attribute embedding and entity embedding operations to obtain attribute embedding vectors and entity embedding vectors.

[0034] The original similarity matrix is ​​constructed based on the attribute embedding vector and the entity embedding vector, and then optimized. The entity alignment result is determined based on the optimized similarity matrix.

[0035] A complete medical knowledge graph is constructed based on the entity alignment results.

[0036] Secondly, this application provides a medical knowledge graph construction device, the device comprising:

[0037] The acquisition module is used to acquire medical text.

[0038] The entity extraction module is used to extract entities from medical text using a pre-trained entity recognition model.

[0039] The entity matching module is used to match the extracted entities with entities in the existing knowledge base based on the exact matching method and the fuzzy matching method to obtain the entity matching result, which includes the information of the matched entity pairs.

[0040] The relation extraction module is used to extract the relationships between entities based on the entity matching results using a fine-tuned large language model and preset prompt words, thereby obtaining multiple knowledge graphs.

[0041] The entity alignment module is used to align entities with the same meaning in different knowledge graphs using an entity alignment method that integrates ontology semantic structure and entity relation attributes, thereby obtaining a complete medical knowledge graph.

[0042] Thirdly, this application provides a medical knowledge graph construction device, comprising:

[0043] Memory;

[0044] processor;

[0045] The memory stores computer-executed instructions;

[0046] The processor executes computer execution instructions stored in the memory to implement the medical knowledge graph construction method as described in the first aspect and various possible implementations of the first aspect above.

[0047] Fourthly, this application provides a computer storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the medical knowledge graph construction method as described in the first aspect and various possible implementations of the first aspect above.

[0048] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the medical knowledge graph construction method as described in the first aspect and various possible implementations of the first aspect.

[0049] This application provides a method, apparatus, device, and storage medium for constructing a medical knowledge graph. The method involves acquiring medical text and extracting entities from the text using a pre-trained entity recognition model. The extracted entities are then matched with entities in an existing knowledge base using both precise and fuzzy matching methods to obtain entity matching results, which include information about matched entity pairs. Based on these entity matching results, a fine-tuned large language model is used to extract relationships between entities according to preset prompts, resulting in multiple knowledge graphs. Finally, an entity alignment method that integrates ontology semantic structure and entity relationship attributes is used to align entities with the same meaning in different knowledge graphs, resulting in a complete medical knowledge graph. Attached Figure Description

[0050] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0051] Figure 1A flowchart illustrating the medical knowledge graph construction method provided in this application embodiment;

[0052] Figure 2 This is a schematic diagram of the structure of the entity recognition model provided in the embodiments of this application;

[0053] Figure 3 A schematic diagram of the entity relationship extraction process provided in the embodiments of this application;

[0054] Figure 4 This is a schematic diagram of the structure of the entity alignment model provided in the embodiments of this application;

[0055] Figure 5 A schematic diagram of the structure of the medical knowledge graph construction device provided in the embodiments of this application;

[0056] Figure 6 A schematic diagram of the structure of the medical knowledge graph construction device provided in the embodiments of this application.

[0057] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation

[0058] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0059] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein.

[0060] In this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0061] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0062] Figure 1 This is a flowchart illustrating a method for constructing a medical knowledge graph, as provided in an embodiment of this application. Figure 1 As shown, the medical knowledge graph construction method provided in this embodiment includes:

[0063] S1: Obtain medical text and extract entities from the medical text using a pre-trained entity recognition model.

[0064] Figure 2 This is a schematic diagram of the entity recognition model provided in the embodiments of this application. The model utilizes radical embedding, positional embedding, character embedding, cross-attention mechanism, bidirectional long short-term memory network, and conditional random field model to achieve efficient recognition of named entities in Chinese clinical texts. Specifically, entity extraction from medical texts using a pre-trained entity recognition model includes the following steps:

[0065] S11: Input medical text into a pre-trained character embedding model for analysis and processing to obtain character embedding vectors.

[0066] Medical texts are textual content containing information related to the medical field, such as medical records, medical research reports, and medical papers.

[0067] Specifically, medical text data is collected and preprocessed, such as noise removal, word segmentation, and unified character encoding, to ensure the correct text formatting of the input model. Further, a suitable pre-trained character embedding model is selected, such as the Skip-gram model, and the pre-processed medical text is input character by character into the pre-trained character embedding model. The model processes each character according to its internal parameters and algorithms, outputting the corresponding character embedding vector.

[0068] S12: Generate a position embedding vector based on the relative position of each character in the medical text.

[0069] Understandably, for the input medical text sequence, each character is assigned a unique relative position index, and the corresponding row vector is extracted from the position embedding matrix based on the character's relative position index as the position embedding vector of that character.

[0070] S13: Extract radical components of characters from a large-scale Chinese character structure dataset and obtain radical embedding vectors by random sampling from a uniform distribution.

[0071] For example, to incorporate Chinese character structural information, radical components of characters were extracted from an online Xinhua dictionary. The radical embeddings were initialized from a uniform distribution U(-1,1) with a dimension of 64, as shown below:

[0072] E redical ~U(-1,1),dim=64

[0073] Where Eradical represents the radical embedding vector obtained by random sampling from the uniform distribution U(-1,1), and dim = 64 indicates that the dimension of the embedding vector is 64.

[0074] S14: Perform feature fusion between the radical embedding vector and the position embedding vector to obtain the fused feature vector.

[0075] Specifically, the radical embedding vector and the position embedding vector are fused to obtain a fused feature vector, including:

[0076] S141: Concatenate the radical embedding vector and the position embedding vector, and input the concatenated vector into the Transformer model for feature extraction to obtain the output vector sequence.

[0077] Understandably, to leverage the informational structural components of Chinese characters, more informative radical features are selected, and the Transformer model is used for feature extraction. Chinese characters are decomposed into their structural components, and radical embeddings are combined with positional embeddings. The combined embedding vector is then input into the Transformer model to capture the interaction between radicals and positions within Chinese characters.

[0078] By fusing radical and location information, the aim is to capture basic structural information and improve the model's performance in named entity recognition tasks.

[0079] S142: Enhance the output vector sequence with features using a preset attention visualization matrix to obtain an enhanced feature sequence.

[0080] Understandably, to mitigate the noise introduced by position embedding, an attention visualization matrix was designed to optimize the fusion vector. Let the vector sequence output from the radical Transform layer be represented as... Where n represents the sequence length, d represents the vector dimension, and the attention visualization matrix is ​​represented as follows: Each element m ij This represents the correlation between positions i and j. Calculate the denoised vector sequence. The formula is shown below:

[0081]

[0082]

[0083] in, This represents the representation vector at position j. This process can be viewed as performing an attention-weighted average of the vectors at each position, thereby suppressing noise and enhancing effective information.

[0084] By utilizing the attention visualization matrix and computing the denoised vector sequence, the representation of radical features in the model is enhanced, and the impact of noise introduced by position embedding is mitigated.

[0085] S143: The cross-attention mechanism is used to fuse the features of the feature enhancement sequence to obtain the fused feature vector.

[0086] Understandably, a cross-attention mechanism is proposed to capture the dependencies between entities and character radicals in a sentence. By introducing this cross-attention mechanism, the aim is to enhance the model's understanding of clinical context and improve its ability to accurately identify entity boundaries. The cross-attention mechanism is designed as follows:

[0087]

[0088] Among them, Q C(R),i It is the query vector (Query) for the i-th character or radical, K C(R),i It is the key vector (Key) of the i-th character or radical, V C(R),i It is the value vector (Value) of the i-th character or radical, E C(R),i W is the context embedding representation of the i-th character or radical. C(R),Q and W C(R),V These are the linear transformation matrices of the query and the value, respectively, and I is the identity matrix used to maintain consistency in feature dimensions.

[0089] Furthermore, the attention score is calculated according to the following formula:

[0090] ATt C(R) (A R(C) V C(R) =Softmax(W) C(R) [A R(C) V C(R) ]+b C(R) V C(R)

[0091] Among them, Att C(R) It is a contextual representation of characters obtained by aggregating them from radicals, A R(C) It combines query information and contextual information from the characters, V C(R) The characteristic representation of radicals is used to construct the attention output, W C(R)It is used for projection learning of the spliced ​​input, b C(R) Together with the linear layer, the output is determined. Softmax transforms a set of arbitrary real values ​​into a probability distribution, where the sum of all values ​​is 1.

[0092] [A R(C) V C(R) ] = [Q C(R) +u C(R) ,u R(C) ]

[0093] Among them, Q C(R) It is a character query vector extracted from the character encoding layer. C(R) It is a character context feature vector that can be derived from a Transformer or a positional embedding, u R(C) It is the contextual feature vector of the radical.

[0094] A R(C)i,j =[Q C(R) +u C(R) ] T K R(C)j

[0095] Among them, A R(C)i,j Score the attention of character position i to radical position j, K R(C)j Let be the key vector of the j-th radical.

[0096] To minimize information loss, character and radical features are directly concatenated, and information fusion is performed on the concatenated character and radical feature feeds, satisfying the following formula:

[0097] Fusion(A C A R )=(A R ⊕A L W o +b

[0098] Fusion is the final fused feature representation, containing both character and radical information. C A is a character feature vector. R Let A be the feature vector of the radical. L For local context or intermediate features of a character, ⊕ indicates a concatenation operation, W o b are learnable parameters, W o is the weight, and b is the bias.

[0099] This fusion process enables the model to capture both character-level and radical-level information simultaneously, and further refines the fused representation by learning appropriate weights and biases.

[0100] S15: A bidirectional long short-term memory network and a conditional random field model are used to decode the fused feature vectors to obtain the entity label sequence.

[0101] Bidirectional Long Short-Term Memory (LSTM) networks process sequence data simultaneously through a bidirectional structure (forward and backward), capturing the contextual information before and after each time step. Conditional Random Fields (CRFs) are probabilistic graphical models for sequence labeling, capable of modeling dependencies between labels. Entity label sequences are sequences of entity categories labeled for each word or character in the input text.

[0102] Specifically, the fused feature vectors are input into a bidirectional long short-term memory (LSTM) network. The LSM network processes the sequence in both forward and backward directions, generating a context-dependent representation for each time step. The conditional random field (CRF) model models label dependencies based on the output of the LSM network, searches for the globally optimal label sequence, and uses this globally optimal label sequence as the final entity label sequence.

[0103] S2: Based on the exact matching method and the fuzzy matching method, the extracted entities are matched with the entities in the existing knowledge base to obtain the entity matching results.

[0104] The entity matching results include information about the matched entity pairs. Exact matching requires that the extracted entities be completely identical in text form to the entities in the knowledge base. Fuzzy matching is a flexible string matching method that allows for some differences in text form between the extracted entities and the entities in the knowledge base.

[0105] Specifically, the exact matching method involves: traversing the extracted entity list and, for each entity, searching the knowledge base for a matching string. If a match is found, it is considered a successful match; otherwise, it is considered a failed match. The fuzzy matching method involves: traversing the extracted entity list and, for each entity, calculating its similarity to all entities in the knowledge base. If the similarity exceeds a preset threshold, it is considered a successful match; otherwise, it is considered a failed match.

[0106] In an optional embodiment, the extracted entities are first matched using an exact matching method. For entities that fail to match exactly, a fuzzy matching method is then used to match them, and the final matching result is output.

[0107] By using both exact matching and fuzzy matching methods, the extracted entities are matched with entities in the existing knowledge base, which helps to ensure entity consistency and improve the accuracy of retrieval, data analysis, and relation extraction.

[0108] S3: Based on the entity matching results, the fine-tuned large language model extracts the relationships between entities according to the preset prompt words to obtain multiple knowledge graphs.

[0109] In an optional embodiment, before extracting relationships between entities based on the entity matching results using a fine-tuned large language model according to preset prompts to obtain multiple knowledge graphs, the method further includes:

[0110] Construct a medical domain labeled dataset, which includes medical text, target entity pairs, and relational labels between entities; determine the fine-tuning objective function, which measures the difference between the relation extraction results output by the large language model and the true annotations; based on the labeled dataset and the objective function, update the parameters of the pre-trained large language model until the objective function value is less than the preset value, thus obtaining the fine-tuned large language model.

[0111] For example, a large language model is fine-tuned to adapt to entity relation extraction tasks in the medical field. Let the model parameters be θ, and the training dataset be... Where x i Represents the input text, y i These are the corresponding relation labels. The training objective of the model is to minimize the loss function L, so that the model can accurately predict entity relations in the input text.

[0112]

[0113] Among them, f θ (x i ) indicates that the model is related to the input x i The predicted output L uses either cross-entropy loss or contrastive loss to measure the relationship between the predicted value and the true relation label y. i The error between them.

[0114] To optimize the model parameters, gradient descent is used to update the parameters θ. Based on the learning rate η, the parameter update formula is as follows:

[0115]

[0116] in, This represents the gradient of the loss function L with respect to the parameter θ. This optimization strategy can gradually reduce the value of the loss function, causing the model to converge to a better parameter configuration, thereby improving its generalization ability in medical text relation extraction tasks.

[0117] Figure 3 This is a schematic diagram illustrating the entity relationship extraction process provided in an embodiment of this application. Based on the entity matching results, a finely tuned large language model is used to extract relationships between entities according to preset prompts, resulting in multiple knowledge graphs, including:

[0118] The entity matching results and preset prompts are input into the fine-tuned large language model. The fine-tuned large language model performs semantic understanding and analysis on the entity matching results based on the guidance information in the prompts. Based on the analysis results, the large language model extracts the relationships between entity pairs and outputs the relationship extraction results in the format of the example in the prompts. Based on the relationship extraction results, multiple knowledge graphs are constructed.

[0119] Understandably, the process of constructing prompt words includes: analyzing the domain knowledge involved in the relation extraction task, common relation types, and the knowledge graph structure of the expected output; based on the analysis results, writing prompt word templates containing example entity pairs and their relation descriptions, with the examples used to show the expected output format and content to the fine-tuned large language model; and optimizing the prompt word templates to ensure that they can accurately guide the large language model to extract relations that meet the task requirements.

[0120] S4: Use an entity alignment method that integrates ontology semantic structure and entity relation attributes to align entities with the same meaning in different knowledge graphs to obtain a complete medical knowledge graph.

[0121] Figure 4 This is a schematic diagram of the entity alignment model provided in an embodiment of this application. Specifically, an entity alignment method that integrates ontology semantic structure and entity relationship attributes is used to align entities with the same meaning in different knowledge graphs to obtain a complete medical knowledge graph, including:

[0122] Multiple knowledge graphs are input into a relational graph convolutional network (RPN). The RPN processes the input knowledge graphs to learn feature representations of entities and relationships within the knowledge graphs. Based on the learned feature representations, the multiple knowledge graphs are fused to obtain a first fused knowledge graph. An entity attention mechanism is then used to perform a weighted summation on the fused knowledge graphs to obtain a second fused knowledge graph. Attribute embedding and entity embedding operations are performed on the second fused knowledge graph to obtain attribute embedding vectors and entity embedding vectors, respectively. An original similarity matrix is ​​constructed based on the attribute embedding vectors and entity embedding vectors, and the original similarity matrix is ​​optimized. The entity alignment result is determined based on the optimized similarity matrix. Finally, a complete medical knowledge graph is constructed based on the entity alignment result.

[0123] Understandably, the processing of relational graph convolutional networks follows the formula:

[0124]

[0125] in, Let be the embedding of entity e in the (l+1)th layer, σ(.) be the ReLU activation function, and N r (e) is the set of entities connected to entity e through relation r. Let e ​​be the attention weight or relevance coefficient between entity e and its neighboring entities. It is entity e ' Embedding at layer l It is the embedding of entity e at layer l. and These are trainable parameters, where d is the embedding dimension. Let l be the trainable transformation matrix for relation type r at layer l. Let be the transformation matrix for relation type r.

[0126] It is also understandable that attribute embeddings can further enrich the representation of entities. For example, attributes of diseases (such as age of onset, clinical symptoms, etc.) and attributes of drugs (such as drug type, mechanism of action, etc.) are crucial for understanding the characteristics of entities. A relational graph convolutional network is used to learn the attribute embeddings of medical entities. By setting different feature vectors for structure and attributes respectively, structural embeddings and attribute embeddings are learned independently. Let... The attribute embedding update method is as follows, representing the attribute at level l+1:

[0127]

[0128] in, This represents the attribute at level l. Let be the trainable weight matrix of the l-th layer in the relational graph convolutional network, d(l) be the dimension of the attribute features of the l-th layer, d(l+1) be the dimension of the attribute features of the (l+1)-th layer, and σ(.) be the ReLU activation function.

[0129] The entity embedding and attribute embedding are fused using a weighted concatenation method to obtain the joint embedding e of the entity. com , means as follows:

[0130] e com =concat(α.concat(β.h) e ,(1-α).P a ))

[0131] Among them, h e It is an optimized entity embedding, learned through a relational graph convolutional network, which includes information about the relationships between entities and their neighbors; P a Attribute embedding represents attribute information related to the entity; α is a weight parameter that balances the importance of entity embedding and attribute embedding, β is a weight parameter used to balance the importance of the synthesized entity embedding and attribute embedding, and concat represents the concatenation operation, which concatenates the two embedding vectors together along the feature dimension.

[0132] It's understandable that in graph convolutional networks, edge embeddings are used to capture relationship information between entities, and the edge embeddings are updated as follows:

[0133]

[0134] in, This represents the relationship between entities v and u at level l. The embedded representation of entity v The embedded representation of entity u This indicates that the joint embedding vectors of entities v and u are concatenated along the feature dimension; The learned weights are updated for edge embedding. This is the bias term. This process can not only learn the embedding of each edge, but also combine the structural information and relational features between entities, thereby capturing richer semantic relationships.

[0135] The loss function used to optimize semantic relations in a knowledge graph satisfies the following formula:

[0136]

[0137] Where h represents the head entity, r represents the relationship between the head and tail entities, t represents the tail entity, and E represents all combinations of head entities, relationships, and tail entities in the knowledge graph. For the embedding of the head entity at the l-th layer, Embed the relationship between the head entity and the tail entity at level l. Let ||.||2 be the embedding of the l-th layer of the tail entity, where ||.||2 represents the Euclidean distance.

[0138] By optimizing relation embeddings, entities and relations with similar semantics are brought as close as possible within the embedding space. Specifically, the loss function adjusts the relation embeddings... This minimizes the distance between the combined embedding of the head entity and relation and the embedding of the tail entity, thereby better capturing the semantic connection between entities and relations.

[0139] In an optional embodiment, embedding the ontology hierarchy into the model ensures more accurate representation of semantically similar entities within the same category. Specifically, each category is represented as an embedding vector, and semantic relationships between entities are constrained by subclass relationships. To transform the ontology hierarchy into embedding vectors, an embedding vector is first assigned to each category, and these category embedding vectors are learned using a graph neural network. In the embedding space, the parent class's embedding vector contains more general semantic information, while the subclass's embedding contains more fine-grained, specific semantic features. Specifically, the parent class c... h and subclass c h The constraints embedded in the model are shown below:

[0140]

[0141] Among them, c h For the parent class's embedding and c t For embedding of subclasses, H is the set of all parent-child class pairs. and b o These are learnable parameters. The linear transformation weights are used to deduce the child class embedding from the parent class, b o The bias vector represents the semantic offset of the class.

[0142] By optimizing ontology embedding, we can ensure that the relationship between entities and their categories is reasonably modeled, thereby improving the accuracy of entity alignment tasks.

[0143] Based on the loss functions of ontology embedding, knowledge graph embedding, conflict detection, alignment, and other embedding modules, a total loss function is constructed. This total loss function is used to optimize the final entity matching results, resulting in a more accurate medical knowledge graph. The total loss function is expressed as follows:

[0144]

[0145] in, Modeling loss for relationships between entity triples in a knowledge graph. The embedding loss is the hierarchy of ontology structures. The connection consistency loss between an entity and its category. The conflict detection loss is used to penalize potential logical / semantic conflicts in the graph. Let α be the entity alignment loss, and γ and η be adjustable hyperparameters that control the loss weights of different modules.

[0146] The medical knowledge graph construction method provided in this application involves acquiring medical text and extracting entities from it using a pre-trained entity recognition model. The extracted entities are then matched with entities in an existing knowledge base using both precise and fuzzy matching methods to obtain entity matching results, which include information about matched entity pairs. Based on these matching results, a fine-tuned large language model is used to extract relationships between entities according to preset prompts, resulting in multiple knowledge graphs. Finally, an entity alignment method that integrates ontology semantic structure and entity relationship attributes is used to align entities with the same meaning in different knowledge graphs, resulting in a complete medical knowledge graph. This method achieves accurate, efficient, and automated medical knowledge graph construction, providing high-quality knowledge support for medical artificial intelligence.

[0147] Figure 5This is a schematic diagram of the structure of the medical knowledge graph construction device provided in an embodiment of this application. Figure 5 As shown, the medical knowledge graph construction device 500 provided in this embodiment includes:

[0148] Module 501 is used to acquire medical text.

[0149] The entity extraction module 502 is used to extract entities from medical text using a pre-trained entity recognition model.

[0150] The entity matching module 503 is used to match the extracted entities with entities in the existing knowledge base based on the exact matching method and the fuzzy matching method to obtain the entity matching result, which includes the information of the matched entity pairs.

[0151] The relation extraction module 504 is used to extract the relationships between entities based on the entity matching results using a fine-tuned large language model and preset prompt words, thereby obtaining multiple knowledge graphs.

[0152] The entity alignment module 505 is used to align entities with the same meaning in different knowledge graphs using an entity alignment method that integrates ontology semantic structure and entity relation attributes, so as to obtain a complete medical knowledge graph.

[0153] The medical knowledge graph construction device provided in this embodiment can execute the medical knowledge graph construction method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0154] Figure 6 A schematic diagram of the structure of the medical knowledge graph construction device provided in this application embodiment. Figure 6 As shown in the embodiment of this application, the medical knowledge graph construction device 600 includes: a receiver 601, a transmitter 602, a processor 603, and a memory 604.

[0155] Receiver 601 is used to receive instructions and data;

[0156] Transmitter 602 is used to send commands and data;

[0157] Memory 604 is used to store instructions executed by the computer;

[0158] The processor 603 is used to execute computer execution instructions stored in the memory 604 to implement the various steps of the medical knowledge graph construction method in the above embodiments. For details, please refer to the relevant descriptions in the foregoing embodiments of the medical knowledge graph construction method.

[0159] Alternatively, the memory 604 can be either standalone or integrated with the processor 603.

[0160] When the memory 604 is set up independently, the electronic device also includes a bus for connecting the memory 604 and the processor 603.

[0161] This application embodiment also provides a computer storage medium storing computer execution instructions. When the processor executes the computer execution instructions, it implements the medical knowledge graph construction method executed by the medical knowledge graph construction device described above.

[0162] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described medical knowledge graph construction method.

[0163] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0164] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0165] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for constructing a medical knowledge graph, characterized in that, The method includes: The medical text is obtained and input into a pre-trained character embedding model for analysis and processing to obtain character embedding vectors. Generate a position embedding vector based on the relative position of each character in the medical text; Extract radical components of characters from a large-scale Chinese character structure dataset and obtain radical embedding vectors by random sampling from a uniform distribution; The radical embedding vector and the position embedding vector are concatenated, and the concatenated vector is input into the Transformer model for feature extraction to obtain the output vector sequence. The output vector sequence is enhanced by using a pre-defined attention visualization matrix to obtain a feature-enhanced sequence. A cross-attention mechanism is used to fuse the features of the enhanced sequence to obtain a fused feature vector; A bidirectional long short-term memory network and a conditional random field model are used to decode the fused feature vectors to obtain the entity label sequence. The extracted entities are matched with entities in the existing knowledge base based on the exact matching method and the fuzzy matching method to obtain entity matching results, which include information on the matched entity pairs. Based on the entity matching results, the fine-tuned large language model extracts the relationships between entities according to the preset prompt words to obtain multiple knowledge graphs. The fine-tuned large language model is obtained by updating the parameters of the pre-trained large language model according to the labeled dataset and the objective function. Multiple knowledge graphs are input into a relational graph convolutional network, which processes the input knowledge graphs to learn the feature representations of entities and relations in the knowledge graphs. Based on the learned feature representations, multiple knowledge graphs are fused to obtain the first fused knowledge graph; The entity attention mechanism is used to perform weighted summation on the fused knowledge graph to obtain the second fused knowledge graph; The second fused knowledge graph is subjected to attribute embedding and entity embedding operations to obtain attribute embedding vectors and entity embedding vectors. The original similarity matrix is ​​constructed based on the attribute embedding vector and the entity embedding vector, and then optimized. The entity alignment result is determined based on the optimized similarity matrix. A complete medical knowledge graph is constructed based on the entity alignment results.

2. The method according to claim 1, characterized in that, Before extracting relationships between entities using a fine-tuned large language model based on preset prompts according to the entity matching results, the method further includes: Construct a labeled dataset for the medical field, which includes medical text, target entity pairs, and relational labels between entities; Determine the objective function for fine-tuning, which measures the difference between the relation extraction results output by the large language model and the true annotations; Based on the labeled dataset and the objective function, the parameters of the pre-trained large language model are updated until the objective function value is less than the preset value, thus obtaining the fine-tuned large language model.

3. The method according to claim 1, characterized in that, Based on the entity matching results, a fine-tuned large language model is used to extract relationships between entities according to preset prompts, resulting in multiple knowledge graphs, including: The entity matching results and the preset prompts are input into the fine-tuned large language model; The fine-tuned large language model performs semantic understanding and analysis on entity matching results based on the guiding information in the prompt words; Based on the analysis results, the large language model extracts the relationships between entity pairs and outputs the relationship extraction results in the format of the example in the prompt words; Based on the relationship extraction results, multiple knowledge graphs are constructed.

4. A medical knowledge graph construction device, characterized in that, The device includes: The acquisition module is used to acquire medical text. The entity extraction module is used to analyze and process medical text input into a pre-trained character embedding model to obtain character embedding vectors; Generate a position embedding vector based on the relative position of each character in the medical text; Extract radical components of characters from a large-scale Chinese character structure dataset and obtain radical embedding vectors by random sampling from a uniform distribution; The radical embedding vector and the position embedding vector are concatenated, and the concatenated vector is input into the Transformer model for feature extraction to obtain the output vector sequence. The output vector sequence is enhanced by using a pre-defined attention visualization matrix to obtain a feature-enhanced sequence. A cross-attention mechanism is used to fuse the features of the enhanced sequence to obtain a fused feature vector; A bidirectional long short-term memory network and a conditional random field model are used to decode the fused feature vectors to obtain the entity label sequence. The entity matching module is used to match the extracted entities with entities in the existing knowledge base based on the exact matching method and the fuzzy matching method to obtain the entity matching result, which includes the information of the matched entity pairs. The relation extraction module is used to extract the relationships between entities based on the entity matching results using a fine-tuned large language model and preset prompt words, thereby obtaining multiple knowledge graphs. The fine-tuned large language model is obtained by updating the parameters of a pre-trained large language model based on the labeled dataset and the objective function. The entity alignment module is used to input multiple knowledge graphs into a relational graph convolutional network, which processes the input knowledge graphs and learns the feature representations of entities and relations in the knowledge graphs. Based on the learned feature representations, multiple knowledge graphs are fused to obtain the first fused knowledge graph; The entity attention mechanism is used to perform weighted summation on the fused knowledge graph to obtain the second fused knowledge graph; The second fused knowledge graph is subjected to attribute embedding and entity embedding operations to obtain attribute embedding vectors and entity embedding vectors. The original similarity matrix is ​​constructed based on the attribute embedding vector and the entity embedding vector, and then optimized. The entity alignment result is determined based on the optimized similarity matrix. A complete medical knowledge graph is constructed based on the entity alignment results.

5. A medical knowledge graph construction device, characterized in that, The device includes: Memory; processor; The memory stores computer-executed instructions; The processor executes the computer execution instructions stored in the memory to implement the medical knowledge graph construction method as described in any one of claims 1-3.

6. A computer storage medium, characterized in that, The computer storage medium stores computer execution instructions, which, when executed by a processor, are used to implement the medical knowledge graph construction method as described in any one of claims 1-3.

7. A computer program product, characterized in that, It includes a computer program, which, when executed by a processor, is used to implement the medical knowledge graph construction method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Medical knowledge relation extraction method and system based on large language model fine tuning and retrieval enhancement generation

    CN118569263A

  • Method for constructing knowledge graph based on large language model and vector library

    CN119129722A