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

By combining the pre-trained entity recognition model and large language model with exact matching method, fuzzy matching method and ontology semantic structure, the problems of insufficient data quality and reasoning ability in the construction of medical knowledge graphs are solved, and efficient and accurate entity alignment and relationship extraction are achieved.

CN120705330AActive Publication Date: 2025-09-26CHONGQING UNIV OF POSTS & TELECOMM

Patent Information

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

AI Technical Summary

Technical Problem

Existing medical knowledge graph construction methods have high requirements on data quality, poor reasoning ability and weak generalization ability, and it is difficult to deal with terminology ambiguity and fuzzy entity boundaries in medical texts.

Method used

Entity extraction is performed through a pre-trained entity recognition model, entity matching is performed by combining exact matching and fuzzy matching methods, relationships are extracted using a fine-tuned large language model, and entity alignment is performed by integrating the ontology semantic structure with entity relationship attributes to construct a complete medical knowledge graph.

Benefits of technology

It achieves efficient and accurate construction of medical knowledge graphs, improves data quality and reasoning capabilities, enhances the ability to process unstructured data, and ensures consistency in entity alignment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705330A_ABST
    Figure CN120705330A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a medical knowledge graph construction method and device, equipment and a storage medium, and is applied to the field of medical knowledge graph construction, and the method comprises the steps: obtaining a medical text, and carrying out the entity extraction of the medical text through a pre-trained entity recognition model; based on a precise matching method and a fuzzy matching method, the extracted entities are matched with entities in an existing knowledge base, an entity matching result is obtained, and the entity matching result comprises matched entity pair information; based on an entity matching result, using the fine-tuned large language model to extract a relationship between entities according to a preset cue word to obtain a plurality of knowledge maps; and aligning entities with the same meaning in different knowledge maps by using an entity alignment method fusing the ontology semantic structure and the entity relationship attribute to obtain a complete medical knowledge map. According to the method, accurate, efficient and automatic medical knowledge graph construction is realized, and high-quality knowledge support can be provided 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 method, apparatus, device and storage medium for constructing a medical knowledge graph. Background Art

[0002] The construction of medical knowledge graphs primarily relies on core technologies such as entity recognition, relationship extraction, and entity alignment. Traditional entity recognition methods rely on medical ontologies and rule matching, and can identify standardized terminology, but their generalization capabilities on unstructured text are weak. Deep learning methods have improved the automation level of medical entity recognition, but still face challenges such as terminology 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. Although deep learning methods can automatically identify relationships such as disease-symptom and drug-indication, they are highly dependent on labeled data and have difficulty capturing implicit causal relationships.

[0003] In recent years, large-scale language models have shown promise in understanding medical text, but hallucinations still plague the knowledge graph's reliability. Regarding entity alignment, due to the diverse representations of medical concepts, traditional string matching methods struggle to address semantic equivalence. While semantic matching methods based on large-scale language models can improve accuracy, they still fail to fully integrate the relational attributes and ontological structure of entities, limiting alignment consistency. Summary of the Invention

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

[0005] In a first aspect, the present application provides a method for constructing a medical knowledge graph, the method comprising:

[0006] Obtain medical text and extract entities from the medical text using a pre-trained entity recognition model;

[0007] Match the extracted entities with the entities in the existing knowledge base based on the exact matching method and the fuzzy matching method to obtain the entity matching results, wherein the entity matching results include the information of the matched entity pairs;

[0008] Based on the entity matching results, a fine-tuned large language model is used to extract the relationships between entities according to the preset prompt words to obtain multiple knowledge graphs;

[0009] 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.

[0010] Optionally, perform entity extraction on medical text using a pre-trained entity recognition model, including:

[0011] Input the medical text into the pre-trained character embedding model for analysis and processing to obtain the character embedding vector;

[0012] Generate a position embedding vector based on the relative position of each character in the medical text;

[0013] Extract the radical components of characters from a large-scale Chinese character structure dataset and randomly sample them from a uniform distribution to obtain radical embedding vectors;

[0014] Perform feature fusion on the radical embedding vector and the position embedding vector to obtain a fused feature vector;

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

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

[0017] 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 an output vector sequence.

[0018] The output vector sequence is feature enhanced through a preset attention visualization matrix to obtain a feature enhanced sequence;

[0019] The cross attention mechanism is used to fuse the feature enhancement sequence to obtain the fused feature vector.

[0020] Optionally, before extracting the relationship between entities using the fine-tuned large language model based on the entity matching results according to preset prompt words, the method further includes:

[0021] Construct a labeled dataset in the medical field, which includes medical text, target entity pairs, and relationship labels between entities;

[0022] Determine an objective function for fine-tuning, which is used to measure the difference between the relation extraction results output by the large language model and the true annotations;

[0023] According to 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, and the fine-tuned large language model is obtained.

[0024] Optionally, based on the entity matching results, a fine-tuned large language model is used to extract relationships between entities using preset prompt words to obtain multiple knowledge graphs, including:

[0025] Input the entity matching results and the preset prompt words into the fine-tuned large language model;

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

[0027] The large language model extracts the relationship between entity pairs based on the analysis results and outputs the relationship extraction results in the format of the examples in the prompt word;

[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 relationship attributes is used to align entities with the same meaning in different knowledge graphs to obtain a complete medical knowledge graph, including:

[0030] Input multiple knowledge graphs into the relational graph convolutional network, process the input knowledge graphs through the relational graph convolutional network, and learn the feature representations of entities and relations in the knowledge graphs;

[0031] Based on the learned feature representation, multiple knowledge graphs are fused to obtain a 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] Perform attribute embedding and entity embedding operations on the second fused knowledge graph to obtain attribute embedding vectors and entity embedding vectors;

[0034] Construct an original similarity matrix based on the attribute embedding vector and the entity embedding vector, optimize the original similarity matrix, and determine the entity alignment result based on the optimized similarity matrix;

[0035] Construct a complete medical knowledge graph based on the entity alignment results.

[0036] In a second aspect, the present application provides a device for constructing a medical knowledge graph, the device comprising:

[0037] Acquisition module, used to acquire medical text;

[0038] Entity extraction module, used to extract entities from medical texts using a pre-trained entity recognition model;

[0039] An entity matching module is used to match the extracted entities with entities in the existing knowledge base based on an exact matching method and a fuzzy matching method to obtain an entity matching result, wherein the entity matching result includes information about matched entity pairs;

[0040] The relationship 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 to obtain 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 relationship attributes to obtain a complete medical knowledge graph.

[0042] In a third aspect, the present application provides a medical knowledge graph construction device, comprising:

[0043] Memory;

[0044] processor;

[0045] wherein the memory stores computer-executable instructions;

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

[0047] In a fourth aspect, the present application provides a computer storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the medical knowledge graph construction method as described in the first aspect and various possible implementation methods of the first aspect.

[0048] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the medical knowledge graph construction method as described in the first aspect and various possible implementation methods of the first aspect.

[0049] The present application provides a method, apparatus, device, and storage medium for constructing a medical knowledge graph. The method obtains medical text and extracts entities from the medical text using a pre-trained entity recognition model; matches the extracted entities with entities in an existing knowledge base based on exact matching and fuzzy matching methods to obtain entity matching results, wherein the entity matching results include information about matched entity pairs; based on the entity matching results, a fine-tuned large language model is used to extract relationships between entities according to preset prompt words to obtain multiple knowledge graphs; and 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. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0051] Figure 1A schematic diagram of the process of constructing a medical knowledge graph provided in an embodiment of the present application;

[0052] Figure 2 A schematic diagram of the structure of the entity recognition model provided in the embodiment of the present application;

[0053] Figure 3 A schematic diagram of the process of entity relationship extraction provided in an embodiment of the present application;

[0054] Figure 4 A schematic diagram of the structure of the entity alignment model provided in an embodiment of the present application;

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

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

[0057] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0058] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions in this application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0059] The terms "first," "second," "third," "fourth," and so forth (if any) in the description and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein.

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

[0061] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0062] Figure 1 This is a flow chart of a method for constructing a medical knowledge graph provided in an embodiment of the present 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 structure of the entity recognition model provided in an embodiment of the present application. The model uses radical embedding, position 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 the medical text into the pre-trained character embedding model for analysis and processing to obtain a character embedding vector.

[0066] Among them, medical text refers to text content containing relevant information in the medical field, such as medical records, medical research reports, medical papers, etc.

[0067] Specifically, medical text data is collected and preprocessed, such as through noise removal, word segmentation, and unified character encoding, to ensure the correct text format for input into the model. Furthermore, a suitable pretrained character embedding model, such as the Skip-gram model, is selected and the preprocessed medical text is fed into the pretrained character embedding model character by character. The model processes each character based on 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] It can be understood that for the input medical text sequence, a unique relative position index is assigned to each character, and according to the relative position index of the character, the corresponding row vector is extracted from the position embedding matrix as the position embedding vector of the character.

[0070] S13: Extract the 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, in order to incorporate the structural information of Chinese characters, the radical components of the characters are extracted from the online Xinhua Dictionary. The radical embedding is initialized from the uniform distribution U(-1,1) with a dimension of 64, as shown below:

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

[0073] Here, Eradical represents the radical embedding vector randomly sampled 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 on the radical embedding vector and the position embedding vector to obtain a 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 an output vector sequence.

[0077] As you can understand, to leverage the structural information components of Chinese characters, we select the more informative radical features and use the Transformer model for feature extraction. We decompose Chinese characters into their structural components and combine the radical embedding with the position embedding. This combined embedding vector is then fed into the Transformer model, capturing the interplay between radicals and positions within a character.

[0078] By fusing radical and position information, it aims to capture basic structural information and improve the performance of the model in named entity recognition tasks.

[0079] S142: Feature enhancement is performed on the output vector sequence using a preset attention visualization matrix to obtain a feature enhanced sequence.

[0080] It is understandable that in order to reduce the noise impact brought by the introduction of position embedding, an attention visualization matrix is ​​designed to optimize the fusion vector. Assume that the vector sequence output from the radical Transform layer is represented as Where n represents the sequence length, d represents the vector dimension, and the attention visualization matrix is ​​expressed as Each element m ij Represents the correlation between position i and position j. Calculate the denoised vector sequence The formula is as follows:

[0081]

[0082]

[0083] in, Represents the representation vector of the j-th position. This process can be regarded as 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: Use the cross attention mechanism to fuse the feature enhancement sequence to obtain the fused feature vector.

[0086] As you can understand, a cross-attention mechanism is proposed to capture the dependencies between entities and character radicals in a sentence. This cross-attention mechanism aims to strengthen 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 is the query vector (Query) of the i-th character or radical, K C(R),i is the key vector (Key) of the i-th character or radical, V C(R),i is the value vector (Value) of the i-th character or radical, E C(R),i is the contextual embedding representation of the i-th character or radical, W C(R),Q and W C(R),V are the linear transformation matrices of the query and value respectively, and I is the identity matrix used to keep the feature dimensions consistent.

[0089] Furthermore, the calculation of the attention score satisfies 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 the context representation of the character aggregated from the radical, A R(C) It is a combination of character query information and context information, V C(R) The feature representation of the radical is used to construct the attention output, W C(R)It is used to project the input of the splicing, b C(R) Together with the linear layer, Softmax determines the output. It converts a set of arbitrary real values ​​into a probability distribution, and 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) is the character query vector (Query) extracted from the character encoding layer, u C(R) is the character context feature vector which can come from Transformer or position embedding, u R(C) is the context 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 is the key vector of the j-th radical.

[0096] In order to minimize information loss, the character and radical features are directly connected, and the connected character and radical features are fed back for information fusion to satisfy the following formula:

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

[0098] Among them, Fusion is the final fusion feature representation, which contains both character and radical information. C is the character feature vector, A R is the radical eigenvector, A L is the local context or intermediate feature of the character, ⊕ represents the connection operation, and W o and 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 and further refine the fused representation by learning appropriate weights and biases.

[0100] S15: Use the bidirectional long short-term memory network and conditional random field model to decode the fused feature vector to obtain the entity label sequence.

[0101] The bidirectional long short-term memory network (LSTM) processes sequence data simultaneously through a bidirectional structure (forward and reverse), capturing the preceding and following contextual information at each time step. Conditional random fields (CRFs) are a probabilistic graphical model for sequence labeling that can model dependencies between labels. An entity label sequence is a sequence of entity categories labeled for each word or character in the input text.

[0102] Specifically, the fused feature vector is fed into a bidirectional long short-term memory network, which processes the sequence in both the forward and reverse directions, generating context-dependent representations for each time step. A conditional random field model models label dependencies based on the output of the bidirectional long short-term memory network, searching for the globally optimal label sequence, which is then used as the final entity label sequence.

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

[0104] Entity matching results contain information about matched entity pairs. Exact matching requires that the extracted entities and entities in the knowledge base are identical in text. Fuzzy matching is a flexible string matching method that allows for some textual differences between the extracted entities and 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 an identical string. If so, the match is considered successful; otherwise, the match is considered unsuccessful. The fuzzy matching method involves traversing the extracted entity list and, for each entity, calculating its similarity with all entities in the knowledge base. If the similarity exceeds a preset threshold, the match is considered successful; otherwise, the match is considered unsuccessful.

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

[0107] The extracted entities are matched with entities in the existing knowledge base through two matching methods: exact matching and fuzzy matching, which helps to ensure the consistency of entities and improve the accuracy of retrieval, data analysis and relationship extraction.

[0108] S3: Based on the entity matching results, a fine-tuned large language model is used to extract 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 using a fine-tuned large language model based on entity matching results and obtaining multiple knowledge graphs according to preset prompt words, the method further includes:

[0110] Construct a labeled dataset in the medical field, which includes medical text, target entity pairs, and relationship labels between entities; determine the objective function for fine-tuning, which is used to measure the difference between the relationship 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, thereby obtaining a fine-tuned large language model.

[0111] For example, based on a large language model, we fine-tune it to adapt to the entity relationship extraction task in the medical field. Let the model parameter be θ and the training dataset be where x i Represents input text, y i is the corresponding relationship label. The training goal of the model is to minimize the loss function L so that the model can accurately predict the entity relationship in the input text:

[0112]

[0113] Among them, f θ (x i ) represents the model's response to input x i The predicted output of L uses cross-entropy loss (Cross-EntropyLoss) or contrast loss (ContrastiveLoss) to measure the difference between the predicted value and the true relationship label y i The error between .

[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, represents the gradient of the loss function L with respect to the parameter θ. This optimization strategy can gradually reduce the loss function value, allowing the model to converge to a more optimal parameter configuration, thereby improving its generalization ability in the task of medical text relationship extraction.

[0117] Figure 3 A flow chart of entity relationship extraction provided in an embodiment of this application. Based on the entity matching results, a fine-tuned large language model is used to extract the relationships between entities according to preset prompt words, resulting in multiple knowledge graphs, including:

[0118] The entity matching results and the preset prompt words 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 prompt words; the large language model extracts the relationship between entity pairs based on the analysis results, and outputs the relationship extraction results in the format of the examples in the prompt words; based on the relationship extraction results, multiple knowledge graphs are constructed.

[0119] It can be understood that the process of constructing prompt words includes: analyzing the domain knowledge, common relationship types and expected output knowledge graph structure involved in the relationship extraction task; based on the analysis results, writing a prompt word template containing example entity pairs and their relationship descriptions. The examples are used to show the expected output format and content to the fine-tuned large language model; optimizing the prompt word template to ensure that it can accurately guide the large language model to extract relationships that meet the task requirements.

[0120] S4: Use the entity alignment method that integrates the 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.

[0121] Figure 4 This is a schematic diagram of the structure of the entity alignment model provided in the embodiments of this application. Specifically, an entity alignment method that integrates the semantic structure of the ontology and the 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, and the input knowledge graphs are processed by the relational graph convolutional network to learn the feature representations of entities and relationships in the knowledge graphs; based on the learned feature representations, multiple knowledge graphs are fused to obtain a first fused knowledge graph; an entity attention mechanism is used to perform 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 respectively to obtain an attribute embedding vector and an entity embedding vector; an original similarity matrix is ​​constructed based on the attribute embedding vector and the entity embedding vector, and the original similarity matrix is ​​optimized, and the entity alignment result is determined based on the optimized similarity matrix; a complete medical knowledge graph is constructed based on the entity alignment result.

[0123] It can be understood that the processing process of the relational graph convolutional network satisfies the following formula:

[0124]

[0125] in, is the embedding of entity e in the l+1 layer, σ(.) is the ReLU activation function, N r (e) is the set of entities connected to entity e through relationship r, is the attention weight or correlation coefficient between entity e and its neighbor entity, It is entity e ' In the embedding at layer l, is the embedding of entity e at layer l, and is a trainable parameter, d is the embedding dimension, is the trainable transformation matrix of the lth layer for relation type r, is the transformation matrix for relationship type r.

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

[0127]

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

[0129] The entity embedding and attribute embedding are fused by weighted splicing to obtain the joint embedding of the entity e com , which is expressed as follows:

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

[0131] Among them, h e It is the optimized entity embedding, which is learned through the relational graph convolutional network and contains the relationship information between the entity and its adjacent entities; a is attribute embedding, which represents the attribute information related to the entity; α is the weight parameter for balancing the importance of optimizing entity embedding and attribute embedding, β is the weight parameter for balancing the importance of the synthesis of entity embedding and attribute embedding, and concat represents the splicing operation, which is to splice the two embedding vectors together along the feature dimension.

[0132] It is also understandable that in the relational graph convolutional network, edge embedding is used to capture the relationship information between entities. The update method of edge embedding is as follows:

[0133]

[0134] in, Represents the relationship between entities v and u at level l, represents the embedding representation of entity v, represents the embedding representation of entity u, It means concatenating the joint embedding vectors of entities v and u according to the feature dimension; The learned weights for edge embedding updates, This process not only learns the embedding of each edge, but also combines the structural information and relational features between entities to capture richer semantic relationships.

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

[0136]

[0137] Among them, h is the head entity, r is the relationship between the head entity and the tail entity, t is the tail entity, and E represents all the head entities, relationships, and tail entity combinations in the knowledge graph. is the embedding of the first level of the head entity, is the relationship embedding between the head entity and the tail entity at the lth level, is the embedding of the tail entity at level l, and ||.||2 represents the Euclidean distance.

[0138] By optimizing the relationship embedding, entities and relationships with similar semantics can be as close as possible in the embedding space. Specifically, the loss function is adjusted by The distance between the combined embedding of the head entity and the relation and the embedding of the tail entity is minimized, thereby better capturing the semantic connection between entities and relations.

[0139] In an optional embodiment, by embedding the hierarchical structure of the ontology into the model, it is possible to ensure that semantically similar entities in the same category are represented more accurately. Specifically, each category is represented as an embedding vector, and the semantic connection between entities is constrained by the subclass relationship. In order to convert the ontology hierarchy into an embedding vector, an embedding vector is first assigned to each category, and the category embedding vector is learned through a graph neural network. In the embedding space, the embedding vector of the parent class will contain more general semantic information, while the embedding of the subclass will contain more fine-grained, specific semantic features. Specifically, the parent class c h and subclass c h The constraints embedded in the model are as follows:

[0140]

[0141] Among them, c h Embedding and c for the parent class t is the embedding of the subclass, H is the set of all parent-subclass pairs, and b o are learnable parameters, is the linear transformation weight used to derive the subclass embedding from the parent class, b o The bias vector represents the class semantic offset.

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

[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. The total loss function is used to optimize the final entity matching results and obtain a more accurate medical knowledge graph. The total loss function is expressed as follows:

[0144]

[0145] in, Modeling loss for the relationship between entity triplets in the knowledge graph, is the ontology structure level embedding loss, is the connection consistency loss between the entity and its category, The conflict detection loss is used to penalize potential logical / semantic conflicts in the graph. is the entity alignment loss, α, γ, and η are adjustable hyperparameters that control the loss weights of different modules.

[0146] The medical knowledge graph construction method provided in the embodiment of the present application obtains medical text and extracts entities from the medical text through a pre-trained entity recognition model; matches the extracted entities with entities in the existing knowledge base based on the exact matching method and the fuzzy matching method to obtain entity matching results, wherein the entity matching results contain information about matched entity pairs; based on the entity matching results, a fine-tuned large language model is used to extract the relationship between entities according to preset prompt words to obtain multiple knowledge graphs; an entity alignment method that integrates the ontology semantic structure and the entity relationship attributes is used to align entities with the same meaning in different knowledge graphs to obtain a complete medical knowledge graph. This method realizes accurate, efficient, and automated medical knowledge graph construction and can provide 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 the embodiment of this application. Figure 5 As shown, the medical knowledge graph construction device 500 provided in this embodiment includes:

[0148] An acquisition module 501 is used to acquire medical text;

[0149] An entity extraction module 502 is used to extract entities from medical texts using a pre-trained entity recognition model;

[0150] An entity matching module 503 is used to match the extracted entities with entities in the existing knowledge base based on an exact matching method and a fuzzy matching method to obtain an entity matching result, wherein the entity matching result includes information about matched entity pairs;

[0151] The relationship extraction module 504 is used to extract the relationships between entities based on the entity matching results using the fine-tuned large language model and preset prompt words to obtain 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 the ontology semantic structure and entity relationship attributes 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 effects are similar, and will not be described in detail in this embodiment.

[0154] Figure 6 This is a schematic diagram of the structure of the medical knowledge graph construction device provided in the embodiment of this application. Figure 6 As shown, the medical knowledge graph construction device provided in an embodiment of the present 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, for receiving instructions and data;

[0156] Transmitter 602, used to send instructions and data;

[0157] Memory 604, for storing computer-executable instructions;

[0158] The processor 603 is configured to execute the computer-executable instructions stored in the memory 604 to implement the various steps of the medical knowledge graph construction method in the above embodiment. For details, please refer to the relevant description in the above embodiment of the medical knowledge graph construction method.

[0159] Optionally, the memory 604 may be independent or integrated with the processor 603 .

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

[0161] An embodiment of the present application also provides a computer storage medium, which stores computer execution instructions. When a processor executes the computer execution instructions, it implements the medical knowledge graph construction method performed by the above-mentioned medical knowledge graph construction device.

[0162] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned medical knowledge graph construction method when executed by a processor.

[0163] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the 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 by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium 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 technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0164] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

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

Claims

1. A method for constructing a medical knowledge graph, characterized in that: The method comprises: Obtain medical text and extract entities from the medical text using a pre-trained entity recognition model; Match the extracted entities with the entities in the existing knowledge base based on the exact matching method and the fuzzy matching method to obtain the entity matching results, wherein the entity matching results include the information of the matched entity pairs; Based on the entity matching results, a fine-tuned large language model is used to extract the relationships between entities according to the preset prompt words to obtain multiple knowledge graphs; 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.

2. The method according to claim 1, characterized in that Entity extraction from medical text using pre-trained entity recognition models, including: Input the medical text into the pre-trained character embedding model for analysis and processing to obtain the character embedding vector; Generate a position embedding vector based on the relative position of each character in the medical text; Extract the radical components of characters from a large-scale Chinese character structure dataset and randomly sample them from a uniform distribution to obtain radical embedding vectors; Perform feature fusion on the radical embedding vector and the position embedding vector to obtain a fused feature vector; The bidirectional long short-term memory network and conditional random field model are used to decode the fused feature vector to obtain the entity label sequence.

3. The method according to claim 2, characterized in that The radical embedding vector and the position embedding vector are fused to obtain a fused feature vector, including: 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 an output vector sequence. The output vector sequence is feature enhanced through a preset attention visualization matrix to obtain a feature enhanced sequence; The cross attention mechanism is used to fuse the feature enhancement sequence to obtain the fused feature vector.

4. The method according to claim 1, wherein Before extracting the relationship between entities using the fine-tuned large language model based on the entity matching results according to preset prompt words, the method further includes: Construct a labeled dataset in the medical field, which includes medical text, target entity pairs, and relationship labels between entities; Determine an objective function for fine-tuning, which is used to measure the difference between the relation extraction results output by the large language model and the true annotations; According to 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, and the fine-tuned large language model is obtained.

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

6. The method according to claim 1, wherein We use an entity alignment method that integrates ontology semantic structure and entity relationship attributes to align entities with the same meaning in different knowledge graphs, and obtain a complete medical knowledge graph, including: Input multiple knowledge graphs into the relational graph convolutional network, process the input knowledge graphs through the relational graph convolutional network, and learn the feature representations of entities and relations in the knowledge graphs; Based on the learned feature representation, multiple knowledge graphs are fused to obtain a 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; Perform attribute embedding and entity embedding operations on the second fused knowledge graph to obtain attribute embedding vectors and entity embedding vectors; Construct an original similarity matrix based on the attribute embedding vector and the entity embedding vector, optimize the original similarity matrix, and determine the entity alignment result based on the optimized similarity matrix; Construct a complete medical knowledge graph based on the entity alignment results.

7. A medical knowledge graph construction device, characterized in that: The device comprises: Acquisition module, used to acquire medical text; The entity extraction module is used to extract entities from medical texts using a pre-trained entity recognition model; An entity matching module is used to match the extracted entities with entities in the existing knowledge base based on an exact matching method and a fuzzy matching method to obtain an entity matching result, wherein the entity matching result includes information about matched entity pairs; The relationship 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 to obtain multiple knowledge graphs; 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 relationship attributes to obtain a complete medical knowledge graph.

8. A medical knowledge graph construction device, characterized in that: The device comprises: Memory; processor; wherein the memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the medical knowledge graph construction method according to any one of claims 1 to 6.

9. 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 according to any one of claims 1 to 6.

10. 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 to 6.

Citation Information

Patent Citations

  • Activity text model training method, text generation method, device and equipment

    CN117332271A

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

    CN118569263A

  • Medical knowledge graph-oriented entity alignment method and related device

    CN119025682A

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

    CN119129722A

Cited By

  • Merging method of multi-source heterogeneous entities

    CN121031767A

  • Epilepsy medical knowledge map construction method and system based on rhodic acid C

    CN121835852A

  • Medical knowledge graph construction method and system based on artificial intelligence cross-dimension alignment

    CN122311392A