Medical question and answer method based on knowledge graph and related equipment

CN115470327BActive Publication Date: 2026-08-28TIANJIN TAIFAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210964247.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-11
Publication Date
2026-08-28
Estimated Expiration
2042-08-11

AI Technical Summary

Technical Problem

由于医疗对话数据十分有限,标注对话内容的对话状态与对话策略需要专家干预,通常较为复杂且耗时耗力,因此,依赖于对话状态和对话策略的传统方法变得困难而不可行

Benefits of technology

[0015]从上面所述可以看出,本申请提供的基于知识图谱的医疗问答方法及相关设备,将经过预处理的医疗问题的描述通过编码器进行编码后与知识图谱表示相融合,得到的融合特征通过解码器解码后进行逐个元素输出,将每次的输出元素对应的解码器的隐藏状态作为查询向量作用于知识图谱表示中,以便解码器对下一个元素进行输出。通过本申请提供的医疗问答方法能够将医疗问题与知识图谱进行有效结合,深度理解所述医疗问题,生成蕴含实体与图谱推理的针对医疗问题的回复,有利于提高医疗诊断结果的准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115470327B_ABST
    Figure CN115470327B_ABST
Patent Text Reader

Abstract

The medical question answering method based on a knowledge graph and related equipment provided in the application can effectively combine a medical question with a knowledge graph, deeply understand the medical question, generate a reply to the medical question containing an entity and graph reasoning, and is beneficial to improving the accuracy of a medical diagnosis result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of knowledge graph technology, and in particular to a medical question-answering method and related equipment based on knowledge graph. Background Technology

[0002] Medical dialogue question answering can be viewed as a task-oriented dialogue system: the system acts as a doctor, engaging in dialogue with patients through multiple rounds of conversation, answering their questions, and ultimately completing the system's diagnostic task. Due to the limited availability of medical dialogue data, annotating dialogue states and strategies requires expert intervention, which is typically complex and time-consuming. Therefore, traditional methods relying on dialogue states and strategies become difficult and impractical. Furthermore, due to the scarcity of training data, end-to-end supervised learning methods based on sequence-to-sequence learning struggle to train high-performing models for medical dialogue question answering tasks. Summary of the Invention

[0003] In view of this, the purpose of this application is to propose a medical question-answering method and related equipment based on knowledge graphs.

[0004] To achieve the above objectives, the first aspect of this application provides a knowledge graph-based medical question-answering method, comprising:

[0005] In response to receiving a description of a medical problem input by the user, the description is preprocessed; The preprocessed description is input into the encoder to obtain a text representation of the description; Based on the text representation and the medical knowledge graph triples, the decoder outputs each element of the response sequence for the medical question one by one. For the output of each element, Based on the text representation, the medical knowledge graph triple, and the hidden state of the decoder corresponding to the element, a first knowledge graph representation associated with the text representation is obtained through a first multilayer perceptron network; The text representation and the first knowledge graph representation are input into a second multilayer perceptron network to obtain a fused feature representation; The fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation are input into the decoder, and the element is output, wherein... The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are all pre-trained.

[0006] Optionally, the preprocessing includes: The description is segmented using a word segmentation algorithm to obtain the word sequence corresponding to each sentence in the description; The entire sequence of words is sorted according to predetermined rules.

[0007] Optionally, based on the text representation, the medical knowledge graph triple, and the hidden state of the decoder corresponding to the element, a first knowledge graph representation associated with the text representation is obtained through a first multilayer perceptron network, including: Obtain medical knowledge graph triples; The triplet is input into the first multilayer perceptron network to obtain the triplet vector representation; A medical knowledge graph is constructed based on the triplet vector representation; The first knowledge graph representation is obtained by calculation based on the medical knowledge graph, the text representation, and the hidden state of the decoder corresponding to the element.

[0008] Optionally, the fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation are input into the decoder, and the element is output, including: The selection probability is calculated based on the fused feature representation, the hidden state of the decoder, and the second knowledge graph representation; The candidate set corresponding to the element is determined based on the selection probability, and the candidate set includes a pre-constructed vocabulary and the medical knowledge graph; Based on the candidate set and its corresponding selection probability distribution, the entity probability distribution is determined by calculation; The entity with the highest probability in the entity probability distribution is selected as the element for output.

[0009] Optionally, the pre-training includes: Retrieve medical conversation history text; The medical dialogue history text is divided into a training sample set and a test sample set; The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are iteratively trained based on the training sample set and the loss function. The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder, which have been trained iteratively, are evaluated and calculated using the test sample set. The pre-training is stopped when the evaluation score calculated by the evaluation reaches a preset condition or the number of iterations reaches a preset value.

[0010] Optionally, the iterative training includes multiple rounds of training. The iterative training of the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder based on the training sample set and the loss function includes: For each round of training in iterative training, The preprocessing is performed on the training sample set; The preprocessed training sample set is input into the encoder to obtain the sample representation of each training sample in the training sample set; Based on the sample representation of the training samples and the medical knowledge graph triples, the decoder outputs each predicted element in the predicted response sequence of the training samples one by one. For the output of each predicted element Based on the sample representation of the training samples, the medical knowledge graph triples, and the hidden state of the decoder corresponding to the predicted element, a first predicted knowledge graph representation associated with the sample representation of the training samples is obtained through the first multilayer perceptron network. The sample representation of the training samples and the first predicted knowledge graph representation are input into the second multilayer perceptron network to obtain the predicted fusion feature representation; The predicted fusion feature representation and the second predicted knowledge graph representation calculated based on the first predicted knowledge graph representation are input into the decoder, and the predicted element is output. The loss value between the predicted element and its corresponding true element is calculated using a loss function. Minimize the loss value to obtain the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder.

[0011] Optionally, the encoder includes an embedded network and a multi-layer multi-head attention network; both the first multi-layer perceptron and the second multi-layer perceptron include an input layer, a hidden layer, and an output layer; the decoder is a Long Short-Term Memory (LSTM) network.

[0012] A second aspect of this application also provides a knowledge graph-based medical question-answering device, comprising: The preprocessing module is specifically configured to preprocess the description of a medical problem received from a user. The first encoding module is configured to input the preprocessed description into the encoder to obtain a text representation of the description; The output module is configured to output each element of the response sequence to the medical question sequentially through a decoder, based on the text representation and the medical knowledge graph triples. For the output of each element, The knowledge graph representation unit is configured to obtain a first knowledge graph representation associated with the text representation through a first multilayer perceptron network based on the text representation, the medical knowledge graph triple, and the hidden state of the decoder corresponding to the element. The fusion unit is configured to input the text representation and the first knowledge graph representation into a second multilayer perceptron network to obtain a fused feature representation; The decoding unit is configured to input the fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation into the decoder, and output the element, wherein, The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are all pre-trained.

[0013] A third aspect of this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.

[0014] A fourth aspect of this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the methods described above.

[0015] As described above, the knowledge graph-based medical question-answering method and related equipment provided in this application encode the preprocessed medical question description using an encoder and then fuse it with a knowledge graph representation. The resulting fused features are decoded by a decoder and output element by element. The hidden state of the decoder corresponding to each output element is used as a query vector in the knowledge graph representation so that the decoder can output the next element. The medical question-answering method provided in this application can effectively combine medical questions with knowledge graphs, deeply understand the medical questions, and generate responses to the medical questions that incorporate entity and graph reasoning, which is beneficial for improving the accuracy of medical diagnosis results. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating the knowledge graph-based medical question-answering method according to an embodiment of this application. Figure 2This is a flowchart illustrating the method for determining the first knowledge graph representation according to an embodiment of this application; Figure 3 This is a flowchart illustrating the calculation method for determining the output element according to an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a knowledge graph-based medical question-answering device according to an embodiment of this application; Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.

[0019] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0020] As described in the background section, task-oriented dialogue systems are human-computer natural language interaction systems designed to complete specific tasks. Building high-performance task-oriented dialogue systems has always been a hot research topic in academia and industry. Task-oriented dialogue systems can be divided into two main approaches: pipeline and end-to-end. Pipeline methods mainly consist of four parts: Natural Language Understanding (NLU), Dialogue State Tracking (DST), Dialogue Policy (DP), and Natural Language Generation (NLG). End-to-end methods directly use the dialogue context as input and output natural language responses. Their models are simple and easy to train and deploy, and have been widely researched and applied in recent years. With the continuous development of deep learning and pre-training, end-to-end dialogue systems based on pre-trained models have demonstrated advanced performance due to their superior natural language understanding and generation capabilities. Furthermore, unlike open-domain dialogue systems, task-oriented dialogue systems typically require the introduction of knowledge bases to generate responses that meet specific tasks. Therefore, combining pre-trained models trained in an unsupervised manner based on large-scale corpora with task-related knowledge representations is necessary to achieve better results in task-oriented dialogue systems.

[0021] In view of this, this application adopts an end-to-end encoder-decoder architecture, uses a pre-trained language model to encode medical dialogues, constructs a medical knowledge graph, and represents the entities in the dialogue and their relationships in the knowledge graph through graph embedding. The dialogue representation and the knowledge graph representation are fused and input into the decoder, which then outputs word-by-word responses to generate the system's response. The medical question-answering method provided in this application can effectively understand medical dialogues and implicitly perform graph reasoning based on the knowledge graph representations of the entities in the dialogue, thereby generating a system response with good performance.

[0022] The embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0023] This application provides a knowledge graph-based medical question-answering method, referencing... Figure 1 It includes the following steps: Step 101: In response to receiving a description of a medical problem input by the user, preprocess the description. The description of the medical problem includes the user's description of disease symptoms or related medical question consultation. Typically, the description of the medical problem is in text, which needs to be preprocessed into a form that can be recognized by a neural network model.

[0024] Step 102: Input the preprocessed description into the encoder to obtain the text representation of the description. The description is then input into the encoder for word embedding to obtain a word embedding vector sequence, which includes the sum of word embeddings, segment embeddings, and positional embeddings. This word embedding vector sequence is then propagated through the encoder to obtain the text representation of the description.

[0025] Step 103: Based on the text representation and the medical knowledge graph triples, output each element in the response sequence of the medical question one by one through the decoder. Associate the text representation with the knowledge graph, and output each element in the response sequence one by one through knowledge graph reasoning. Combine all the output elements to form the response to the medical question.

[0026] For the output of each element, Step 1031: Based on the text representation, the medical knowledge graph triples, and the hidden state of the decoder corresponding to the element, a first knowledge graph representation associated with the text representation is obtained through a first multilayer perceptron network. Each element corresponds to a hidden state of a decoder. After the decoder outputs an element, its hidden state is updated. The updated hidden state is then used as a query vector and applied to the first knowledge graph representation to update it, thus outputting the next element.

[0027] Step 1032: Input the text representation and the first knowledge graph representation into a second multilayer perceptron network to obtain a fused feature representation. The text representation and the first knowledge graph representation are fused through the second multilayer perceptron, that is, the text representation is associated with the knowledge graph. The second knowledge graph representation is calculated based on the first knowledge graph representation. Fusion Features Represented as

[0028] in, This is a second-level multilayer perceptron, where c represents the text representation. This represents the first knowledge graph representation.

[0029] Step 1033: Input the fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation into the decoder, and output the element, wherein, The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are all pre-trained. The fused features are input into the decoder to output the current element. Then, the updated hidden state of the decoder is applied to the first knowledge graph representation to generate new fused features. After that, the decoder outputs the next element of the current element, and so on, until all elements are output.

[0030] Based on steps 101 to 103 above, the medical problem is effectively combined with the knowledge graph, which enables a deep understanding of the medical problem and generates a response to the medical problem that contains entity and graph reasoning, which is conducive to improving the accuracy of medical diagnosis results.

[0031] In some embodiments, the preprocessing includes: The description is segmented using a word segmentation algorithm to obtain the word sequence corresponding to each sentence in the description; The entire sequence of words is sorted according to predetermined rules.

[0032] Specifically, the description is segmented using the jieba word segmentation algorithm to obtain the word sequence corresponding to each sentence in the description. Then, all word sequences are sorted according to the sentence order in the form of "[CLS]word sequence 1[SEP]word sequence 2[SEP]word sequence 3[SEP]" for input into the encoder.

[0033] In some embodiments, reference Figure 2 Based on the text representation, the medical knowledge graph triples, and the hidden state of the decoder corresponding to the element, a first knowledge graph representation associated with the text representation is obtained through a first multilayer perceptron network, including the following steps: Step 201: Obtain medical knowledge graph triples, which are obtained through web crawling.

[0034] Step 202: Input the triplet into the first multilayer perceptron network to obtain the triplet vector representation.

[0035] Specifically, each triple is represented as Through encoding by the first multilayer perceptron network, the triplet vector representation is obtained as follows: Where h, r, and t are the head entity, relation, and tail entity of the triple, respectively. For the first multilayer perceptron, the first multilayer perceptron pass The model uses embedded representations of triples. The first multilayer perceptron network consists of three layers: an input layer, a hidden layer, and an output layer, with each layer having a dimension of 768.

[0036] Step 203: Construct a medical knowledge graph based on the triple vector representation.

[0037] Specifically, constructing a medical knowledge graph ,in yes The subgraphs are i = {1, 2, ..., n}, where n represents the total number of subgraphs. Subgraph The total number of triples contained in each subgraph It represents the weighted sum of the eigenvectors of the triples it contains, calculated using the following formula:

[0038]

[0039]

[0040] Where j={1,2,…, }, m={1,2,…, }, These are the learnable parameter matrices for the head entity, relation, and tail entity, respectively. Let them be the head entity, relation, and tail entity of the j-th triple, respectively. This represents the concatenation of the feature vectors of the head entity and the tail entity.

[0041] Step 204: Based on the medical knowledge graph, the text representation, and the hidden state of the decoder corresponding to the element, the first knowledge graph representation is calculated.

[0042] Specifically, the first knowledge graph corresponding to the t-th element Represented as:

[0043]

[0044]

[0045] Where p = {1, 2, ..., n}, It is a learnable parameter matrix. This indicates selecting a subgraph when outputting the t-th element. The possibility, Let be the hidden state of the decoder corresponding to the t-th element, where t=1. , This represents the text representation, which is the hidden state of the decoder at the beginning of decoding.

[0046] In some embodiments, reference Figure 3 The process involves inputting the fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation into the decoder, and then outputting the element, including the following steps: Step 301: Calculate the selection probability based on the fused feature representation, the hidden state of the decoder, and the second knowledge graph representation.

[0047] Specifically, the second knowledge graph representation corresponding to the t-th element Specifically

[0048]

[0049]

[0050] in, It is a learnable parameter matrix. Indicates hidden state With the j-th triple in the subgraph similarity, Indicates in the subgraph Select triples The possibility.

[0051] The selection probability corresponding to the t-th element Specifically represented as

[0052] in, This represents the hidden state of the t-th element. Indicates fusion characteristics, This represents the second knowledge graph representation. It is a learnable parameter matrix.

[0053] Step 302: Determine the candidate set corresponding to the element based on the selection probability. The candidate set includes a pre-constructed vocabulary and the medical knowledge graph.

[0054] Specifically, Choose words from the vocabulary list. Entities are selected from the medical knowledge graph.

[0055] Step 303: Based on the candidate set and its corresponding selection probability distribution, determine the entity probability distribution by calculation.

[0056] Specifically, the entity probability distribution for

[0057]

[0058]

[0059] in, These represent words in the vocabulary and entities in the knowledge graph, respectively. These represent the selection probability distributions of words in the vocabulary and entities in the knowledge graph, respectively. This indicates the element to be output.

[0060] Step 304: Select the entity with the highest probability in the entity probability distribution as the element for output.

[0061] Specifically, when When, select The word corresponding to the maximum value in the list is output as the element; when When, select The entity corresponding to the maximum value in the list is output as the element.

[0062] In some embodiments, the pre-training includes: Retrieve medical conversation history text; The medical dialogue history text is divided into a training sample set and a test sample set; The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are iteratively trained based on the training sample set and the loss function. The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder, which have been trained iteratively, are evaluated and calculated using the test sample set. The pre-training is stopped when the evaluation score calculated by the evaluation reaches a preset condition or the number of iterations reaches a preset value.

[0063] Specifically, the medical dialogue history text is a medical dialogue dataset, such as MedDialog or MedDG. In this embodiment, the MedDG dataset is selected. The MedDG dataset covers 12 gastroenterology-related diseases. The training sample set contains 14,863 complete dialogues, each sentence of which is labeled with the speaker (patient or doctor). The doctor's last reply is used as the system response to be generated, and the remaining utterances form the dialogue history, resulting in a training sample. The test set contains 1,600 dialogue histories and provides the doctor's final reply. Each dialogue history and its corresponding reply serve as a test sample. Based on the training sample set and the loss function, the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder undergo multiple rounds of iterative training. After each round of training iterations, the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are evaluated using test samples from the test sample set. The evaluation method involves using the nltk library to calculate the BLEU score of each test sample and averaging it as the evaluation score. Pre-training stops when the evaluation score reaches a preset condition. In this embodiment, the preset condition is that if the evaluation score does not improve for eight consecutive rounds, pre-training stops, and the model with the highest evaluation score is selected as the final encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder. It is understood that the preset condition in this embodiment is only illustrative, and the specific preset condition can be adjusted according to actual circumstances. Furthermore, the pre-training cutoff condition can also be based on a predetermined number of iterations, for example, 100 iterations.

[0064] In some embodiments, the iterative training includes multiple rounds of training, wherein the iterative training of the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder based on the training sample set and the loss function includes: For each round of training in iterative training, The preprocessing is performed on the training sample set; The preprocessed training sample set is input into the encoder to obtain the sample representation of each training sample in the training sample set; Based on the sample representation of the training samples and the medical knowledge graph triples, the decoder outputs each predicted element in the predicted response sequence of the training samples one by one. For the output of each predicted element Based on the sample representation of the training samples, the medical knowledge graph triples, and the hidden state of the decoder corresponding to the predicted element, a first predicted knowledge graph representation associated with the sample representation of the training samples is obtained through the first multilayer perceptron network. The sample representation of the training samples and the first predicted knowledge graph representation are input into the second multilayer perceptron network to obtain the predicted fusion feature representation; The predicted fusion feature representation and the second predicted knowledge graph representation calculated based on the first predicted knowledge graph representation are input into the decoder, and the predicted element is output. The loss value between the predicted element and its corresponding true element is calculated using a loss function. Minimize the loss value to obtain the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder.

[0065] Specifically, the iterative training process is largely the same as the application process of the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder described above, and will not be repeated here. The loss value between the predicted element and its corresponding true element is calculated using a loss function, and the training parameters of the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are updated through backpropagation. The loss function... Specifically:

[0066] Where t represents the t-th element, These are the predicted elements output by the decoder. To output the probability of this predicted element, Ns represents the length of the response sequence output. , This indicates that the correct entity in the medical knowledge graph has been selected. This indicates that words from the actual responses were selected. When the loss function converges, the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder trained in this round are obtained.

[0067] In some embodiments, the encoder includes an embedded network and a multi-layer multi-head attention network; both the first multi-layer perceptron and the second multi-layer perceptron include an input layer, a hidden layer, and an output layer; the decoder is a long short-term memory network (LSTM).

[0068] Specifically, the encoder's multi-head attention network has 12 layers. Each layer consists of a multi-head attention layer, a regularization layer, and a feedforward network layer. The hidden layer dimension is 768, and the number of attention heads is 12. The parameters are initialized using weights from the BERT-wwm Chinese pre-trained model loaded from the Transformers library. The first multilayer perceptron includes an input layer, a hidden layer, and an output layer, all with a dimension of 768. The second multilayer perceptron includes an input layer, a hidden layer, and an output layer, with dimensions of 1536, 768, and 768, respectively.

[0069] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the method described.

[0070] It should be noted that the above description describes some embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0071] This application also provides a medical question-answering device based on a knowledge graph.

[0072] refer to Figure 4 The knowledge graph-based medical question-answering device includes: The preprocessing module 401 is configured to preprocess the description of a medical problem input by the user in response to receiving such description. Encoding module 402 is configured to input the preprocessed description into an encoder to obtain a text representation of the description; Output module 403 is configured to output each element of the response sequence to the medical question sequentially through a decoder, based on the text representation and the medical knowledge graph triples. For the output of each element, The knowledge graph representation unit 4031 is configured to obtain a first knowledge graph representation associated with the text representation through a first multilayer perceptron network based on the text representation, the medical knowledge graph triple, and the hidden state of the decoder corresponding to the element. Fusion unit 4032 is configured to input the text representation and the first knowledge graph representation into a second multilayer perceptron network to obtain a fused feature representation; Decoding unit 4033 is configured to input the fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation into the decoder, and output the element, wherein, The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are all pre-trained.

[0073] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.

[0074] The apparatus described above is used to implement the corresponding knowledge graph-based medical question-answering method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0075] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the knowledge graph-based medical question-answering method described in any of the preceding embodiments.

[0076] Figure 5 This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.

[0077] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0078] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0079] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0080] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0081] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.

[0082] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.

[0083] The electronic devices described above are used to implement the corresponding knowledge graph-based medical question-answering methods in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0084] This application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the knowledge graph-based medical question-answering method as described in any of the above embodiments.

[0085] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0086] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the medical question-answering method based on knowledge graph as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0087] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application (including the claims) is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in the details for the sake of brevity.

[0088] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0089] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0090] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.

Claims

1. A medical question-answering method based on knowledge graphs, characterized in that, include: In response to receiving a description of a medical problem input by the user, the description is preprocessed; The preprocessed description is input into the encoder to obtain a text representation of the description; Based on the text representation and the medical knowledge graph triples, the decoder outputs each element of the response sequence for the medical question one by one. For the output of each element, Based on the text representation, the medical knowledge graph triple, and the hidden state of the decoder corresponding to the element, a first knowledge graph representation associated with the text representation is obtained through a first multilayer perceptron network; The text representation and the first knowledge graph representation are input into a second multilayer perceptron network to obtain a fused feature representation; The fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation are input into the decoder, and the element, the second knowledge graph representation corresponding to the t-th element, is output. Specifically: in, It is a learnable parameter matrix. Indicates hidden state With the j-th triple in the subgraph similarity, Indicates in the subgraph Select triples The possibility, This indicates selecting a subgraph when outputting the t-th element. The possibility, Subgraph The total number of triples contained therein; in, The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are all pre-trained; Based on the text representation, the medical knowledge graph triples, and the hidden state of the decoder corresponding to the element, a first knowledge graph representation associated with the text representation is obtained through a first multilayer perceptron network, including: Obtain medical knowledge graph triples; The triplet is input into the first multilayer perceptron network to obtain the triplet vector representation; A medical knowledge graph is constructed based on the triplet vector representation; The first knowledge graph representation is obtained by calculation based on the medical knowledge graph, the text representation, and the hidden state of the decoder corresponding to the element.

2. The method according to claim 1, characterized in that, The preprocessing includes: The description is segmented using a word segmentation algorithm to obtain the word sequence corresponding to each sentence in the description; The entire sequence of words is sorted according to predetermined rules.

3. The method according to claim 1, characterized in that, The fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation are input into the decoder, and the element is output, including: The selection probability is calculated based on the fused feature representation, the hidden state of the decoder, and the second knowledge graph representation; The candidate set corresponding to the element is determined based on the selection probability, and the candidate set includes a pre-constructed vocabulary and the medical knowledge graph; Based on the candidate set and its corresponding selection probability distribution, the entity probability distribution is determined by calculation; The entity with the highest probability in the entity probability distribution is selected as the element for output.

4. The method according to claim 1, characterized in that, The pre-training includes: Retrieve medical conversation history text; The medical dialogue history text is divided into a training sample set and a test sample set; The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are iteratively trained based on the training sample set and the loss function. The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder, which have been trained iteratively, are evaluated and calculated using the test sample set. The pre-training is stopped when the evaluation score calculated by the evaluation reaches a preset condition or the number of iterations reaches a preset value.

5. The method according to claim 4, characterized in that, The iterative training includes multiple rounds of training. The iterative training of the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder based on the training sample set and the loss function includes: For each round of training in iterative training, The preprocessing is performed on the training sample set; The preprocessed training sample set is input into the encoder to obtain the sample representation of each training sample in the training sample set; Based on the sample representation of the training samples and the medical knowledge graph triples, the decoder outputs each predicted element in the predicted response sequence of the training samples one by one. For the output of each predicted element Based on the sample representation of the training samples, the medical knowledge graph triples, and the hidden state of the decoder corresponding to the predicted element, a first predicted knowledge graph representation associated with the sample representation of the training samples is obtained through the first multilayer perceptron network. The sample representation of the training samples and the first predicted knowledge graph representation are input into the second multilayer perceptron network to obtain the predicted fusion feature representation; The predicted fusion feature representation and the second predicted knowledge graph representation calculated based on the first predicted knowledge graph representation are input into the decoder, and the predicted element is output. The loss value between the predicted element and its corresponding true element is calculated using a loss function. Minimize the loss value to obtain the encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder.

6. The method according to claim 1, characterized in that, The encoder includes an embedded network and a multi-layer multi-head attention network; both the first multi-layer perceptron and the second multi-layer perceptron include an input layer, a hidden layer, and an output layer; the decoder is a Long Short-Term Memory (LSTM) network.

7. A medical question-answering device based on a knowledge graph, characterized in that, include: The preprocessing module is specifically configured to preprocess the description of a medical problem received from a user. The first encoding module is configured to input the preprocessed description into the encoder to obtain a text representation of the description; The output module is configured to output each element of the response sequence to the medical question sequentially through a decoder, based on the text representation and the medical knowledge graph triples. For the output of each element, The knowledge graph representation unit is configured to obtain a first knowledge graph representation associated with the text representation through a first multilayer perceptron network based on the text representation, the medical knowledge graph triple, and the hidden state of the decoder corresponding to the element. The fusion unit is configured to input the text representation and the first knowledge graph representation into a second multilayer perceptron network to obtain a fused feature representation; The decoding unit is configured to input the fused feature representation and the second knowledge graph representation calculated based on the first knowledge graph representation into the decoder, and output the second knowledge graph representation corresponding to the t-th element. Specifically: in, It is a learnable parameter matrix. Indicates hidden state With the j-th triple in the subgraph similarity, Indicates in the subgraph Select triples The possibility, This indicates selecting a subgraph when outputting the t-th element. The possibility, Subgraph The total number of triples contained therein; among which, The encoder, the first multilayer perceptron network, the second multilayer perceptron network, and the decoder are all pre-trained; Based on the text representation, the medical knowledge graph triples, and the hidden state of the decoder corresponding to the element, a first knowledge graph representation associated with the text representation is obtained through a first multilayer perceptron network, including: Obtain medical knowledge graph triples; The triplet is input into the first multilayer perceptron network to obtain the triplet vector representation; A medical knowledge graph is constructed based on the triplet vector representation; The first knowledge graph representation is obtained by calculation based on the medical knowledge graph, the text representation, and the hidden state of the decoder corresponding to the element.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Medical automatic question-answering system construction method based on knowledge graph

    CN112071429A

  • Medical consultation dialogue generation method based on multi-task and knowledge guidance

    CN112164476A