Diabetes consultation interaction method and device based on language big model
Through the diabetes consultation interaction method based on the language large model, using the entity recognition model and the medical knowledge graph, it solves the problem in the existing technology that the artificial intelligence question and answer equipment in medical places cannot accurately answer diabetes professional questions, and achieves more accurate and convenient medical information. Get.
Patent Information
- Application Number
- CN202411008065.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-26
AI Technical Summary
In the existing technology, artificial intelligence question and answer equipment in medical facilities cannot accurately combine medical terminology in the field of diabetes for consultation and interaction, resulting in scattered and redundant returned results, making it difficult to meet user needs.
Using a diabetes consultation interaction method based on a large language model, the medical sample sequence in the medical data set is obtained through the entity recognition model, a medical knowledge graph is generated, and a medical question and answer system is built so that users can accurately reply when entering questions. The method includes a coding layer, a prediction layer, a fusion layer and a conditional random field layer, and uses an iteratively expanded convolutional neural network for entity recognition and knowledge graph query.
It achieves accurate answers to medical professional questions, reduces the probability of identification errors or missed identifications, improves the accuracy of the medical question and answer system and the convenience for users to obtain medical knowledge.
Smart Images

Figure CN118538401B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a diabetes consultation interaction method and device based on a language large model. Background Art
[0002] As the informatization of the medical field continues to advance, more and more users are gaining and understanding relevant pathological knowledge and prevention methods through interaction with artificial intelligence question-answering devices in medical places. However, due to the current popular interaction methods, the returned results are scattered and redundant, which makes it difficult to meet user needs.
[0003] Taking diabetes as an example, as the number of people suffering from diabetes gradually increases, there will be many professional medical terms in the diabetes field during the consultation process. The existing artificial intelligence question-and-answer equipment in medical places cannot provide relatively accurate consultation and interactive answers in combination with the corresponding medical terminology scenarios. Summary of the invention
[0004] To solve the above problems, the purpose of the embodiments of the present invention is to provide a diabetes consultation interaction method and device based on a large language model.
[0005] In a first aspect, an embodiment of the present invention provides a diabetes consultation interaction method based on a language large model, which performs diabetes consultation through a language-based entity recognition model, including:
[0006] Obtain medical sample sequences in a medical dataset;
[0007] Determine the entities in the medical sample sequence according to the entity recognition model; the entity recognition model is used to first determine the probability information that each word vector in the input sequence belongs to the entity, and then perform entity recognition in combination with the probability information of the word vector;
[0008] Generate a medical knowledge graph based on the entity;
[0009] A medical question-and-answer system is constructed based on the medical knowledge graph; the medical question-and-answer system is used to feedback reply information corresponding to the medical question text when obtaining the medical question text input by the user.
[0010] In some optional implementations, the entity recognition model includes: a coding layer, a first prediction layer, a fusion layer, a second prediction layer, and a conditional random field layer;
[0011] The encoding layer is used to encode the input sequence and determine the word vector corresponding to each word in the input sequence;
[0012] The first prediction layer is used to perform entity probability prediction on the word vectors generated by the encoding layer to determine the probability information that each word vector belongs to an entity;
[0013] The fusion layer is used to fuse the word vector and the probability information of the word vector to generate a fusion vector corresponding to the word vector;
[0014] The second prediction layer is used to perform entity recognition on the fusion vectors generated by the fusion layer to determine the entity type score corresponding to each fusion vector;
[0015] The conditional random field layer is used to determine the entity label corresponding to the word vector according to the entity type score.
[0016] In some optional embodiments, the first prediction layer and the second prediction layer are both iterative dilated convolutional neural network layers.
[0017] In some optional implementations, the second prediction layer includes a first dilated convolutional layer, a second dilated convolutional layer, and a third dilated convolutional layer arranged in sequence;
[0018] The first dilated convolutional layer is used to As the expansion step length, The input vector is processed by dilation convolution to generate The first eigenvector; An input vector includes multiple fusion vectors corresponding to the input sequence;
[0019] The second dilated convolutional layer is used to As the expansion step size, The first eigenvector is processed by dilation convolution to generate The second eigenvector;
[0020] The third dilated convolutional layer is used to As the expansion step size, The second eigenvector is processed by dilation convolution to generate a third eigenvector; the third eigenvector is the input of the conditional random field layer; ;
[0021] No. The first eigenvector for: ;No. The second eigenvector for: ;No. The third eigenvector for: ;
[0022] in, is the first dilated convolutional layer convolution kernels, For the input vector; is the first dilated convolutional layer convolution kernels, For the The first eigenvector; is the first convolution kernels, For the The second eigenvector; Represents a convolution operation.
[0023] In some optional implementations, determining the entity in the medical sample sequence according to the entity recognition model includes:
[0024] Adding a start character before the first position of the medical sample sequence and adding an end character after the last position;
[0025] A pre-redundant sequence is added before the start character, and a post-redundant sequence is added after the end character to generate a target sequence of the entity recognition model; the pre-redundant sequence is a sequence of characters selected from the last character of the medical sample sequence and forward continuously from the medical sample sequence. The post-redundancy sequence is a sequence formed by selecting at least one word from the medical sample sequence in a row starting from the first word of the medical sample sequence;
[0026] The target sequence is input into the entity recognition model, and the entities in the medical sample sequence are determined according to the output result of the entity recognition model.
[0027] In some optional embodiments, inputting the target sequence into the entity recognition model, and determining the entity in the medical sample sequence according to the output result of the entity recognition model includes:
[0028] After determining the third feature vector output by the second prediction layer, the third feature vector corresponding to the end character is located using the conditional random field layer to determine the index position of the third feature vector corresponding to the end character. ;
[0029] Determine a label prediction result corresponding to each of the third eigenvectors using the conditional random field layer;
[0030] For The label prediction results are as follows: The label prediction results and label prediction results, comprehensively determine the first The entity corresponding to the word vector; .
[0031] In some optional implementations, the first half of the word vector corresponding to the start character is all zero, and the second half of the word vector corresponding to the end character is all zero;
[0032] Alternatively, the second half of the word vector corresponding to the start character is all zero, and the first half of the word vector corresponding to the end character is all zero.
[0033] In some optional embodiments, the method further comprises:
[0034] Obtaining a medical question text input by a user, and extracting keywords from the medical question text;
[0035] Performing entity matching on the keyword to determine entities matching the keyword;
[0036] The medical knowledge graph is queried according to entities matching the keywords, and reply information corresponding to the medical question text is generated according to the query results.
[0037] In a second aspect, an embodiment of the present invention further provides a diabetes consultation interactive device based on a language large model, which provides diabetes consultation through a language-based entity recognition model, including:
[0038] An acquisition module, used to acquire medical sample sequences in a medical data set;
[0039] An entity recognition module, used to determine entities in the medical sample sequence according to an entity recognition model; the entity recognition model is used to first determine the probability information that each word vector in the input sequence belongs to an entity, and then perform entity recognition in combination with the probability information of the word vector;
[0040] A knowledge graph module, used for generating a medical knowledge graph according to the entity;
[0041] The system construction module is used to construct a medical question and answer system based on the medical knowledge graph; the medical question and answer system is used to feedback reply information corresponding to the medical question text when obtaining the medical question text input by the user.
[0042] In a third aspect, an embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used for any one of the above-mentioned diabetes consultation interaction methods based on a large language model.
[0043] In a fourth aspect, an embodiment of the present invention further provides an electronic device, including:
[0044] at least one processor; and,
[0045] a memory communicatively connected to the at least one processor; wherein,
[0046] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the above-mentioned diabetes consultation interaction methods based on a large language model.
[0047] In the solution provided in the first aspect of the embodiment of the present invention, a medical question-and-answer system is constructed based on a medical knowledge graph, which can automatically answer medical professional questions asked by users; the entity recognition model first determines the probability information of the word vector input entity in the input sequence, and then performs entity recognition on the input sequence based on the probability information, which can more accurately extract the entities in the input sequence, and can also more effectively extract medical entities from unstructured data, reduce the probability of recognition errors or missed recognition, and be more focused, which can ensure the accuracy of building a medical question-and-answer system. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A flowchart of a diabetes consultation interaction method based on a language large model provided by an embodiment of the present invention is shown;
[0050] Figure 2 A schematic diagram showing a process of constructing a medical question-answering system provided by an embodiment of the present invention is shown;
[0051] Figure 3 A schematic diagram of the structure of an entity recognition model provided by an embodiment of the present invention is shown;
[0052] Figure 4 A schematic diagram of the structure of the second prediction layer provided by an embodiment of the present invention is shown;
[0053] Figure 5 Shows Figure 4 A schematic diagram of a deformation of the second prediction layer shown;
[0054] Figure 6A schematic diagram of the structure of a diabetes consultation interaction device based on a large language model provided by an embodiment of the present invention is shown;
[0055] Figure 7 A schematic diagram of the structure of an electronic device for executing a diabetes consultation interaction method based on a language large model provided by an embodiment of the present invention is shown.
[0056] Description of reference numerals:
[0057] 301, coding layer; 302, first prediction layer; 303, fusion layer; 304, second prediction layer; 305, conditional random field layer; 401, first dilated convolution layer; 402, second dilated convolution layer; 403, third dilated convolution layer; 601, acquisition module; 602, entity recognition module; 603, knowledge graph module; 604, system building module; 1100, electronic device; 1110, processor; 1120, communication interface; 1130, memory; 1140, bus. DETAILED DESCRIPTION
[0058] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0059] Compared with traditional retrieval methods, the Question Answering System (QA) can quickly and accurately identify user intentions and improve the convenience of users in acquiring medical knowledge.
[0060] In question-answering systems, knowledge graphs (KGs) are generally used as data sources. Triples in the form of "<head entity, relationship, tail entity>" are used to closely link scattered knowledge together to provide accurate knowledge retrieval for question-answering services. Knowledge graphs can be divided into general domain knowledge graphs and limited domain knowledge graphs. Most of the knowledge triples in general domain knowledge graphs are common sense in the real world and do not involve knowledge in professional fields. For example, general domain knowledge graphs include FreeBase, YAGO2, etc. Limited domain knowledge graphs are usually oriented to a certain vertical field, and the knowledge triples contained in them are mostly professional terms and professional knowledge, which can specifically involve the judicial field, financial field, and medical field, etc.
[0061] The knowledge in the medical field is highly specialized. For example, diabetes complications and treatment drugs contain many complex terms, which are prone to recognition errors. Especially when extracting diabetes knowledge from unstructured data, it is easy to make recognition errors or missed recognitions, resulting in inaccurate or even erroneous diabetes question-and-answer systems.
[0062] The diabetes consultation interaction method based on the language big model provided in the embodiment of the present invention uses the medical data set to generate the corresponding knowledge graph, and then constructs a medical question-and-answer system, which can answer the medical professional questions asked by users; and when identifying the entity, a label of whether it belongs to the entity is first generated, and then the entity type label is generated in combination with the label, which can improve the recognition accuracy of the medical entity.
[0063] The embodiment of the present invention provides a diabetes consultation interaction method based on a language large model, see Figure 1 As shown, including:
[0064] Step 101: Obtain a medical sample sequence in a medical data set.
[0065] In this embodiment, a medical data set containing various medical information is obtained in advance. For example, public diabetes data can be collected from the Internet, and public diabetes data sets such as DiaKG data sets can be used to collect diabetes data from multiple aspects, so that a medical data set related to diabetes can be constructed.
[0066] Among them, the medical data set contains a large amount of medical text. In order to facilitate subsequent processing, the medical text is processed into corresponding sequences, namely medical sample sequences. For example, if the medical text is "symptoms of diabetes", the corresponding medical sample sequence can be generated in units of words: sugar, urine, disease, of, symptoms, and conditions. It can be understood that the medical data set includes multiple medical sample sequences.
[0067] Step 102: Determine the entities in the medical sample sequence according to the entity recognition model. The entity recognition model is used to first determine the probability information that each word vector in the input sequence belongs to an entity, and then perform entity recognition in combination with the probability information of the word vector.
[0068] In this embodiment, an entity recognition model for identifying entities is pre-built. The input sequence input to the entity recognition model is also a sequence divided into units of words, and the entity recognition model can encode each word in the input sequence to generate a corresponding word vector.
[0069] The entity recognition model first determines whether each word vector in the input sequence is an entity. Based on this, the probability information of each word vector belonging to an entity can be determined. The probability information is specifically a probability value between 0 and 1. The larger the probability value, the more likely the word vector is an entity. Afterwards, when performing entity recognition on the word vector, the probability information of the word vector is combined to comprehensively determine the entity corresponding to the word vector.
[0070] For each medical sample sequence in the medical data set, a corresponding input sequence can be generated based on the medical sample sequence. For example, the medical sample sequence is used as an input sequence and input into an entity recognition model. Then, based on the entity recognition model, the entity corresponding to each word vector in the medical sample sequence can be determined, thereby extracting the entity in the medical sample sequence.
[0071] Among them, the entity recognition model can specifically determine the entity type of each entity. For example, the entity types of diabetes can be divided into: disease, department, symptom, check, check index value, medicine, food, etc. The entity recognition model can output the entity type of each entity, which is convenient for building a more accurate medical knowledge graph.
[0072] For example, for the medical sample sequence "sugar, urine, disease, of, symptoms, condition", after being processed by the entity recognition model, two entities can be extracted: "diabetes" and "symptoms". Among them, the entity type of "diabetes" is disease (Disease), and the entity type of "symptoms" is symptom (Symptom).
[0073] Step 103: Generate a medical knowledge graph based on the entity.
[0074] In this embodiment, after the entity in the medical sample sequence is extracted, the corresponding knowledge triples can be constructed based on the entity, and then the corresponding medical knowledge graph can be generated.
[0075] When constructing knowledge triples, it is also necessary to determine the relationship between entities. For example, the relationship extraction model can be used to extract the semantic association between entities in the medical sample sequence, so that a knowledge triple in the form of "<head entity, relationship, tail entity>" can be constructed. Each knowledge triple can be used as a piece of knowledge in the knowledge graph, thereby generating a medical knowledge graph that includes a large amount of medical knowledge.
[0076] The relationship extraction model may specifically be a Bi-GRU+ATT (Bidirectional Gated Recurrent Unit+ Attention) model, etc., which is not limited in this embodiment.
[0077] Step 104: Construct a medical question-answering system based on the medical knowledge graph. The medical question-answering system is used to feedback reply information corresponding to the medical question text when obtaining the medical question text input by the user.
[0078] In this embodiment, a corresponding question-and-answer system, namely a medical question-and-answer system, can be constructed based on the medical knowledge graph, and the medical question-and-answer system can respond to medical questions raised by users.
[0079] Figure 2 Figure 2 shows a schematic diagram of the process of building a medical question-answering system. Figure 2 As shown in the figure, by performing entity recognition and relationship extraction on the medical data set, knowledge triples can be constructed to generate a medical knowledge graph; and a medical question-answering system can be generated based on the medical knowledge graph. When the medical question text input by the user is obtained, the medical question-answering system can feedback the reply information corresponding to the medical question text.
[0080] Among them, a medical question-answering system can be built by combining large language models (LLM) and the medical knowledge graph. Specifically, LLM is used to understand semantic extraction entities, so that the medical knowledge graph can be retrieved and enhanced, and the professional medical knowledge graph can also enhance the LLM's generation results for medical questions.
[0081] The diabetes consultation interaction method based on the language big model provided by the embodiment of the present invention builds a medical question and answer system based on the medical knowledge graph, which can automatically answer medical professional questions asked by users; the entity recognition model first determines the probability information of the word vector input entity in the input sequence, and then performs entity recognition on the input sequence in combination with the probability information, which can more accurately extract the entities in the input sequence, and can also more effectively extract medical entities from unstructured data, reduce the probability of recognition errors or missed recognition, and ensure the accuracy of building the medical question and answer system.
[0082] In some optional implementations, the entity recognition model uses two prediction layers to determine the probability information belonging to the entity and the entity recognition, respectively. Figure 3 As shown, the entity recognition model includes: a coding layer 301, a first prediction layer 302, a fusion layer 303, a second prediction layer 304 and a conditional random field layer 305.
[0083] Among them, the encoding layer 301 is used to encode the input sequence and determine the word vector corresponding to each word in the input sequence. The first prediction layer 302 is used to perform entity probability prediction on the word vector generated by the encoding layer 301 to determine the probability information that each word vector belongs to the entity. The fusion layer 303 is used to fuse the word vector and the probability information of the word vector to generate a fusion vector corresponding to the word vector. The second prediction layer 304 is used to perform entity recognition on the fusion vector generated by the fusion layer 303 to determine the entity type score corresponding to each fusion vector. The conditional random field layer 305 is used to determine the entity label corresponding to the word vector according to the entity type score.
[0084] In the embodiment of the present invention, after the input sequence (for example, the medical sample sequence) is input into the entity recognition model, the encoding layer 301 of the entity recognition model encodes each word in the input sequence, so as to determine the word vector corresponding to each word in the input sequence. For example, the encoding process can be implemented based on the Word2Vec tool, or the encoding can be combined with the attention mechanism to more accurately represent the word vector. Figure 3 As shown, after the encoding layer 301 encodes the input sequence, multiple word vectors can be obtained. , Figure 3 Take four word vectors as an example, namely .
[0085] The first prediction layer 302 and the second prediction layer 304 are both used to implement prediction, the former is used to predict the probability that the word vector belongs to an entity, and the latter is used to predict a specific entity label, and different entity labels correspond to different entity types. For example, the first prediction layer 302 and the second prediction layer 304 can both be Bi-LSTM (Bidirectional Long Short Term Memory) networks.
[0086] like Figure 3 As shown, the first prediction layer 302 generates a word vector for the encoding layer 301 Perform entity probability prediction to determine the probability information of each word vector belonging to the entity ; The larger the value, the higher the possibility that the corresponding word vector belongs to the entity.
[0087] The fusion layer 303 can be used to transform the word vector and the word vector Corresponding probability information Fusion can generate the same word vector as the word vector The corresponding fusion vector It can be understood that the word vector With fusion vector is one-to-one. For example, the word vector and the corresponding probability information Splice and merge the two to get the fusion vector .
[0088] The fusion vector generated by the fusion layer 303 , is the input vector of the second prediction layer 304. The second prediction layer 304 can generate the fusion vector of the fusion layer 303. Perform entity recognition to determine each fusion vector The corresponding entity type score, that is, each word vector The corresponding entity type score, which can represent the word vector The probability of belonging to each entity type.
[0089] The conditional random field layer 305 can predict the corresponding label based on the CRF (Conditional Random Field) model. Specifically, the entity type score output by the second prediction layer 304 is used as the input of the conditional random field layer 305. The CRF model can be used to combine the entity type scores corresponding to each word vector to perform label prediction, thereby determining the entity label corresponding to the word vector. The entity labels of these word vectors can form an entity label sequence. The conditional random field layer 305 can optimize the entity label sequence to make the entire labeled sequence more reasonable.
[0090] In the embodiment of the present invention, the information input to the second prediction layer 304 includes the encoded word vector In addition, it also includes Corresponding probability information , so that the second prediction layer 304 can combine the probability information Entity prediction can more accurately identify entities in the input sequence and the corresponding entity types.
[0091] Among them, since the input of the second prediction layer 304 is a sequence, the first prediction layer 302 and the second prediction layer 304 can both use the Bi-LSTM network, and the Bi-LSTM network can better realize named entity recognition. However, since the entities in the fields of diabetes and the like are rare and complex, and some entities are long, the efficiency of using the Bi-LSTM network for prediction is low; and in addition, two prediction layers are provided in this embodiment, namely the first prediction layer 302 and the second prediction layer 304, which will further lead to low processing efficiency.
[0092] In order to improve the processing efficiency of the entity recognition model, in this embodiment, an iterative dilated convolutional neural network (IDCNN) is used to generate a prediction layer, that is, the first prediction layer 302 and the second prediction layer 304 are both iterative dilated convolutional neural network layers.
[0093] Compared with recurrent neural networks such as Bi-LSTM, IDCNN can accelerate GPU parallel processing, thereby reducing training time and improving recognition efficiency.
[0094] Optionally, the first prediction layer 302 may adopt an existing IDCNN structure, which is not described in detail in this embodiment. For the second prediction layer 304, in order to improve the accuracy of entity recognition of medical sample sequences, it is necessary to cover most medical sample sequences as much as possible, but since medical field texts are generally long, the receptive field of traditional IDCNN is difficult to meet the demand, especially for the word vectors at the beginning of the sequence, the receptive field range of traditional IDCNN is limited.
[0095] In this embodiment, the IDCNN is optimized and the optimized IDCNN is used as the second prediction layer 304 . Figure 4 FIG. 3 shows a schematic diagram of the structure of the second prediction layer 304; Figure 4 As shown, the second prediction layer 304 includes a first dilated convolution layer 401, a second dilated convolution layer 402, and a third dilated convolution layer 403 which are arranged in sequence. Figure 4 In the figure, the circular structure represents the input / output data of the corresponding dilated convolutional layer, and the line between the two rows of input / output data represents the processing method of the corresponding dilated convolutional layer.
[0096] Specifically, the first dilated convolutional layer 401 is used to As the expansion step length, The input vector is processed by dilation convolution to generate The first eigenvector; The second dilated convolutional layer 402 is used to As the expansion step length, The first eigenvector is processed by dilation convolution to generate The third dilated convolutional layer 403 is used to As the expansion step length, The second eigenvector is processed by dilation convolution to generate The third eigenvector is the input of the conditional random field layer 305. .
[0097] Among them, The first eigenvector for: ;No. The second eigenvector for: ;No. The third eigenvector for: .in, is the first dilated convolutional layer 401 convolution kernels, For the input vector; is the first convolution kernels, For the The first eigenvector; is the first convolution kernels, For the The second eigenvector; Represents a convolution operation.
[0098] In the embodiment of the present invention, the input sequence of the second prediction layer 304 may include vector, that is input vectors; each of which is a fusion vector output by the fusion layer 303. The first dilated convolution layer 401 input vector (i.e. fusion vectors) to perform dilated convolution processing, and the dilation step size is ; In general, the expansion step length is a smaller value.
[0099] Specifically, the first dilated convolution layer 401 is provided with a plurality of convolution kernels for performing dilated convolution processing. Convolution kernel The first dilated convolutional layer 401 is used to generate Output data, that is, The first eigenvector. Convolution kernel right The first Input vector , No. Input vector , No. Input vector Perform convolution processing to obtain the The first eigenvector .
[0100] For example, Figure 4 As shown, , so we can base it on the input vector , , Generate the first eigenvector The other first eigenvectors are similar to this and will not be described here. The first eigenvector. Figure 4 As shown, , so 18 first eigenvectors can be determined. Among them, for the latter eigenvectors, for example The first eigenvector corresponding to this, since there is no input vector , when performing convolution, non-existent vectors can be ignored.
[0101] Similarly, the second dilated convolution layer 402 is provided with a plurality of convolution kernels for performing dilated convolution processing. Convolution kernel The first Output data, that is, The second eigenvector Among them, the second dilated convolutional layer 402 adopts a larger dilation step size ,Right now ; and based on The corresponding second eigenvector can be calculated .
[0102] The third dilated convolution layer 403 is also provided with a plurality of convolution kernels for performing dilated convolution processing. For example, Convolution kernel The first Output data, that is, The third eigenvector Among them, the third dilated convolution layer 403 further adopts a larger dilation step size ,Right now ; and based on The corresponding third eigenvector can be calculated .
[0103] For example, Figure 4 As shown, , so it can be based on the first feature vector input to the second dilated convolutional layer 402 , , Generate the second eigenvector .based on The second dilated convolutional layer 402 can generate The second eigenvector; Figure 4 As shown, there are 16 second eigenvectors in total.
[0104] and, , so it can be based on the second feature vector input to the third dilated convolutional layer 403 , , Generate the third eigenvector . Similarly, based on The third dilated convolutional layer 403 can generate The third eigenvector; Figure 4 As shown, there are 13 third eigenvectors in total.
[0105] In this embodiment, these third feature vectors are used as inputs of the conditional random field layer 305. For example, the third feature vectors can be mapped based on a linear layer, so that the entity type score corresponding to each third feature vector can be determined and then input into the conditional random field layer 305.
[0106] In the embodiment of the present invention, the first dilated convolution layer 401, the second dilated convolution layer 402, and the third dilated convolution layer 403 perform dilated convolutions in the above manner, so that the feature vector of the first half of the third dilated convolution layer 403 (for example, the third feature vector , etc.) can also have a larger receptive field, thereby being able to cover longer input sequences and improve the accuracy of entity recognition.
[0107] Optionally, the above step 102 of “determining entities in the medical sample sequence according to the entity recognition model” specifically includes steps A1 to A3.
[0108] Step A1, adding a start character before the first position of the medical sample sequence, and adding an end character after the last position.
[0109] Step A2, add a pre-redundant sequence before the start character and a post-redundant sequence after the end character to generate a target sequence for the entity recognition model; the pre-redundant sequence is a sequence of characters starting from the last character of the medical sample sequence and selected from the medical sample sequence forward continuously. The post-redundant sequence is a sequence formed by starting from the first word of the medical sample sequence and continuously selecting at least one word from the medical sample sequence.
[0110] Step A3: input the target sequence into the entity recognition model, and determine the entities in the medical sample sequence according to the output results of the entity recognition model.
[0111] In the embodiment of the present invention, in order to enable the second prediction layer 304 to perform entity recognition based on the context of the input sequence, the medical sample sequence that needs to be recognized as an entity is redundantly expanded, and the expanded sequence is used as the input sequence of the entity recognition model.
[0112] Specifically, a start character and an end character are added to the front and back positions of the medical sample sequence, that is, a start character is added before the first position, and an end character is added after the last position. In addition, a corresponding redundant sequence is added before the start character and after the end character, and the redundant sequence is generated based on the medical sample sequence. Optionally, since the start character and the end character are only used to divide the medical sample sequence from the target sequence, the two characters have no practical meaning. In order to be able to distinguish the two characters and other meaningful words, the encoding layer 301 sets the two characters to zero when encoding the start character and the end character. Specifically, the first half of the word vector corresponding to the start character is all zero, and the second half of the word vector corresponding to the end character is all zero; or, the second half of the word vector corresponding to the start character is all zero, and the first half of the word vector corresponding to the end character is all zero.
[0113] The redundant sequence before the start character is called a pre-redundant sequence; since the three dilated convolutional layers of the second prediction layer 304 are arranged with a dilation step size , , After processing, the first third eigenvector of the third dilated convolutional layer 403 can be additionally introduced The information of the vector is removed, and the leading character is removed, so we can use a length of The sequence is used as the pre-redundant sequence. And, a corresponding number of words are selected from the medical sample sequence in reverse order (from the end to the beginning) to form a pre-redundant sequence.
[0114] The post-redundant sequence is similar to the pre-redundant sequence, except that the post-redundant sequence selects a certain number of words from the medical sample sequence in positive order (from the beginning to the end), and the length of the post-redundant sequence is not a fixed value. It is different from the sequence length that the entity recognition model can process (i.e. ) and the length of the medical sample sequence itself.
[0115] For ease of understanding, Figure 5 Shows the Figure 4 A modified structure of the second prediction layer 304 is provided to facilitate the description of the processing of the second prediction layer 304. It can be understood that Figure 4 and Figure 5 The second prediction layer 304 shown is essentially the same. Figure 5 The structure of the dotted line is only used to facilitate alignment and has no practical significance.
[0116] Among them, the medical sample sequence is: "symptoms of diabetes". As Figure 5 shown, the dilation strides of the three dilated convolutional layers are successively , , , so the length of the pre-redundant sequence , so the specific pre-redundant sequence is "symptoms of diabetes", corresponding to the word vectors of five characters in total. Under the Figure 5 shown structure, the length of the post-redundant sequence can be 6, so the complete medical sample sequence can be used as the post-redundant sequence, that is, the post-redundant sequence is "symptoms of diabetes". And, using "Start" to represent the start character and "End" to represent the end character, as Figure 5 shown, the specific target sequence generated is "symptoms of diabetes, Start, symptoms of diabetes, End, symptoms of diabetes", a total of 19 characters.
[0117] After inputting this target sequence into the entity recognition model and processing it through the encoding layer 301, the first prediction layer 302, and the fusion layer 303, 19 fusion vectors can be generated, that is, the fusion vectors . After being processed by the first dilated convolutional layer 401, the second dilated convolutional layer 402, and the third dilated convolutional layer 403, 13 third feature vectors can be generated. Based on these 13 third feature vectors , the conditional random field layer 305 can determine the entity label corresponding to each third feature vector.
[0118] As Figure 5 shown, the first third feature vector corresponds to the first character "sugar" of the medical sample sequence. Therefore, the entity labels output by the conditional random field layer 305 include the entity labels of the medical sample sequence and the post-redundant sequence. It can be understood that the receptive field of the first third feature vector also corresponds to , that is, the fusion vector can be comprehensively used to generate this first third feature vector , so as to more accurately determine the entity label of the first character in the medical sample sequence; similarly, the second, third, etc. earlier third feature vectors also have the same effect, which will not be elaborated here.
[0119] Optionally, the above step A3 "input the target sequence into the entity recognition model and determine the entities in the medical sample sequence according to the output result of the entity recognition model" may include steps A31 to A33.
[0120] Step A31, after determining the third feature vector output by the second prediction layer 304, use the conditional random field layer 305 to locate the third feature vector corresponding to the end character, and determine the index position of the third feature vector corresponding to the end character .
[0121] Step A32, using the conditional random field layer 305 to determine the label prediction result corresponding to each third eigenvector.
[0122] Step A33, for The label prediction results are The label prediction results and label prediction results, comprehensively determine the first The entity corresponding to the word vector; .
[0123] In this embodiment, the conditional random field layer 305 can locate the end character when performing label prediction. The other characters before the end character are all characters in the medical sample sequence. Therefore, the third feature vectors corresponding to these characters are used for label prediction to determine the entity label of each character in the medical sample sequence. Alternatively, the entity label of each character in the medical sample sequence can be comprehensively determined by combining the label prediction results of the post-redundant sequence.
[0124] by Figure 5 As shown in the example, the conditional random field layer 305 locates the third feature vector corresponding to the end character, and the third feature vector Corresponding to the end character End, the index position of the third eigenvector corresponding to the end character For Small arbitrary ( ), No. The label prediction result is the first label in the medical sample sequence. The label prediction result corresponding to the word vector. And The label prediction result is the first The label prediction results of the word vectors are the same word, so we combine the first The label prediction results and The label prediction results can comprehensively determine the first The entity corresponding to the word vector.
[0125] like Figure 5 As shown, if , the first third eigenvector and the 8th third eigenvector Both correspond to the first word in the medical sample sequence, namely "sugar", so the entity label of the first word in the medical sample sequence can be comprehensively determined by combining the two.
[0126] Among them, the BMEO labeling method can be used. Among them, the starting character of the entity is marked as "B", the middle character of the entity is "M", the end character of the entity is marked as "E", and the non-entity character is marked as "O". After the conditional random field layer 305 performs label detection on the medical sample sequence "sugar, urine, disease, of, symptoms, and conditions", its specific output result is "B-Disease, M-Disease, E-Disease, O, B-Symptom, E-Symptom"; among them, Disease indicates that the entity type is disease, and Symptom indicates that the entity type is symptom.
[0127] Optionally, after step 104 "constructing a medical question-and-answer system based on the medical knowledge graph", the method may specifically include steps B1 to B3.
[0128] Step B1: Obtain the medical question text input by the user and extract keywords from the medical question text.
[0129] Step B2: Perform entity matching on the keywords to determine entities that match the keywords.
[0130] Step B3: Query the medical knowledge graph based on entities matching the keywords, and generate response information corresponding to the medical question text based on the query results.
[0131] In this embodiment, when a user inputs a medical question text of concern to the medical question and answer system, the medical question and answer system can extract keywords in the medical question text and perform entity matching on these keywords, thereby determining entities that match the keywords.
[0132] The medical knowledge graph can be queried using these entities that match the keywords; for example, a corresponding query statement can be constructed, and the medical knowledge graph can be queried based on the query statement to extract the corresponding medical knowledge, and then reply information corresponding to the medical question text can be generated based on the medical knowledge, and the reply information can be displayed to the user for the user to view.
[0133] The diabetes consultation interaction method based on the language large model provided in the embodiment of the present invention, the second prediction layer 304 combines the word vector And probability information Entity prediction can more accurately identify entities and corresponding entity types in the input sequence. Using IDCNN to construct the prediction layer can improve processing efficiency; and the second prediction layer 304 can provide a larger receptive field for the feature vector of the first half, which can improve the entity recognition accuracy of the words in the first half of the sequence; adding redundant sequences before and after the medical sample sequence can make the third feature vector output by the second prediction layer 304 aligned with the medical sample sequence, which is convenient for determining the entity label of each word in the medical sample sequence.
[0134] The above introduces in detail the process of the diabetes consultation interaction method based on the language large model. The method can also be implemented through a corresponding device. The structure and function of the device are introduced in detail below.
[0135] Based on the same inventive concept, the embodiment of the present invention also provides a diabetes consultation interactive device based on a language large model, see Figure 6 As shown, the device comprises:
[0136] An acquisition module 601 is used to acquire a medical sample sequence in a medical data set;
[0137] An entity recognition module 602 is used to determine entities in the medical sample sequence according to an entity recognition model; the entity recognition model is used to first determine the probability information of each word vector in the input sequence belonging to an entity, and then perform entity recognition in combination with the probability information of the word vector;
[0138] A knowledge graph module 603, used to generate a medical knowledge graph according to the entity;
[0139] The system construction module 604 is used to construct a medical question and answer system based on the medical knowledge graph; the medical question and answer system is used to feedback reply information corresponding to the medical question text when obtaining the medical question text input by the user.
[0140] In some optional implementations, the entity recognition model includes: a coding layer, a first prediction layer, a fusion layer, a second prediction layer, and a conditional random field layer;
[0141] The encoding layer is used to encode the input sequence and determine the word vector corresponding to each word in the input sequence;
[0142] The first prediction layer is used to perform entity probability prediction on the word vectors generated by the encoding layer to determine the probability information that each word vector belongs to an entity;
[0143] The fusion layer is used to fuse the word vector and the probability information of the word vector to generate a fusion vector corresponding to the word vector;
[0144] The second prediction layer is used to perform entity recognition on the fusion vectors generated by the fusion layer to determine the entity type score corresponding to each fusion vector;
[0145] The conditional random field layer is used to determine the entity label corresponding to the word vector according to the entity type score.
[0146] In some optional embodiments, the first prediction layer and the second prediction layer are both iterative dilated convolutional neural network layers.
[0147] In some optional implementations, the second prediction layer includes a first dilated convolutional layer, a second dilated convolutional layer, and a third dilated convolutional layer arranged in sequence;
[0148] The first dilated convolutional layer is used to As the expansion step length, The input vector is processed by dilation convolution to generate The first eigenvector; An input vector includes multiple fusion vectors corresponding to the input sequence;
[0149] The second dilated convolutional layer is used to As the expansion step size, The first eigenvector is processed by dilation convolution to generate The second eigenvector;
[0150] The third dilated convolutional layer is used to As the expansion step size, The second eigenvector is processed by dilation convolution to generate a third eigenvector; the third eigenvector is the input of the conditional random field layer; ;
[0151] No. The first eigenvector for: ;No. The second eigenvector is : ;No. The third eigenvector for: ;
[0152] in, is the first dilated convolutional layer convolution kernels, For the input vector; is the first dilated convolutional layer convolution kernels, For the The first eigenvector; is the first convolution kernels, For the The second eigenvector; Represents a convolution operation.
[0153] In some optional implementations, the entity recognition module 602 determines the entity in the medical sample sequence according to the entity recognition model, including:
[0154] Adding a start character before the first position of the medical sample sequence and adding an end character after the last position;
[0155] A pre-redundant sequence is added before the start character, and a post-redundant sequence is added after the end character to generate a target sequence of the entity recognition model; the pre-redundant sequence is a sequence of characters selected from the last character of the medical sample sequence and forward continuously from the medical sample sequence. The post-redundancy sequence is a sequence formed by selecting at least one word from the medical sample sequence in a row starting from the first word of the medical sample sequence;
[0156] The target sequence is input into the entity recognition model, and the entities in the medical sample sequence are determined according to the output result of the entity recognition model.
[0157] In some optional implementations, the entity recognition module 602 inputs the target sequence into the entity recognition model, and determines the entity in the medical sample sequence according to the output result of the entity recognition model, including:
[0158] After determining the third feature vector output by the second prediction layer, the third feature vector corresponding to the end character is located using the conditional random field layer to determine the index position of the third feature vector corresponding to the end character. ;
[0159] Determine a label prediction result corresponding to each of the third eigenvectors using the conditional random field layer;
[0160] For The label prediction results are as follows: The label prediction results and label prediction results, comprehensively determine the first The entity corresponding to the word vector; .
[0161] In some optional implementations, the first half of the word vector corresponding to the start character is all zero, and the second half of the word vector corresponding to the end character is all zero;
[0162] Alternatively, the second half of the word vector corresponding to the start character is all zero, and the first half of the word vector corresponding to the end character is all zero.
[0163] In some optional embodiments, the device further includes a question-answering module, which is used to:
[0164] Obtaining a medical question text input by a user, and extracting keywords from the medical question text;
[0165] Performing entity matching on the keyword to determine entities matching the keyword;
[0166] The medical knowledge graph is queried according to entities matching the keywords, and reply information corresponding to the medical question text is generated according to the query results.
[0167] An embodiment of the present invention further provides a computer storage medium storing computer executable instructions, which includes a program for executing the above-mentioned diabetes consultation interaction method based on a large language model, and the computer executable instructions can execute the method in any of the above-mentioned method embodiments.
[0168] Among them, the computer storage medium can be any available medium or data storage device that can be accessed by the computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0169] Figure 7 The block diagram of the structure of an electronic device of another embodiment of the present invention is shown. The electronic device 1100 may be a host server with computing capability, a personal computer PC, or a portable computer or terminal, etc. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.
[0170] The electronic device 1100 includes at least one processor 1110 , a communication interface 1120 , a memory 1130 , and a bus 1140 . The processor 1110 , the communication interface 1120 , and the memory 1130 communicate with each other via the bus 1140 .
[0171] The communication interface 1120 is used to communicate with network elements, where the network elements include, for example, a virtual machine management center, shared storage, etc.
[0172] The processor 1110 is used to execute programs. The processor 1110 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0173] The memory 1130 is used for executable instructions. The memory 1130 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory. The memory 1130 may also be a memory array. The memory 1130 may also be divided into blocks, and the blocks may be combined into virtual volumes according to certain rules. The instructions stored in the memory 1130 can be executed by the processor 1110, so that the processor 1110 can execute the diabetes consultation interaction method based on the language large model in any of the above method embodiments.
[0174] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A diabetes consultation interaction method based on a large language model, It is characterized in that Diabetes consultation is performed through a language-based entity recognition model, including: Obtain medical sample sequences in a medical dataset; Determine the entities in the medical sample sequence according to the entity recognition model; the entity recognition model is used to first determine the probability information that each word vector in the input sequence belongs to the entity, and then perform entity recognition in combination with the probability information of the word vector; Generate a medical knowledge graph based on the entity; A medical question-and-answer system is constructed according to the medical knowledge graph; the medical question-and-answer system is used to feedback reply information corresponding to the medical question text when obtaining the medical question text input by the user; The entity recognition model includes: a coding layer, a first prediction layer, a fusion layer, a second prediction layer and a conditional random field layer; The encoding layer is used to encode the input sequence and determine the word vector corresponding to each word in the input sequence; The first prediction layer is used to perform entity probability prediction on the word vectors generated by the encoding layer to determine the probability information that each word vector belongs to an entity; The fusion layer is used to fuse the word vector and the probability information of the word vector to generate a fusion vector corresponding to the word vector; The second prediction layer is used to perform entity recognition on the fusion vectors generated by the fusion layer to determine the entity type score corresponding to each fusion vector; The conditional random field layer is used to determine the entity label corresponding to the word vector according to the entity type score.
2. The method according to claim 1, It is characterized in that The first prediction layer and the second prediction layer are both iterative dilated convolutional neural network layers.
3. The method according to claim 2, It is characterized in that The second prediction layer includes a first dilated convolutional layer, a second dilated convolutional layer, and a third dilated convolutional layer arranged in sequence; The first dilated convolutional layer is used to As the expansion step length, The input vector is processed by dilation convolution to generate The first eigenvector; An input vector includes multiple fusion vectors corresponding to the input sequence; The second dilated convolutional layer is used to As the expansion step size, The first eigenvector is processed by dilation convolution to generate The second eigenvector; The third dilated convolutional layer is used to As the expansion step size, The second eigenvector is processed by dilation convolution to generate a third eigenvector; the third eigenvector is the input of the conditional random field layer; ; No. The first eigenvector for: ;No. The second eigenvector for: ;No. The third eigenvector for: ; in, is the first dilated convolutional layer convolution kernels, For the input vector; is the first dilated convolutional layer convolution kernels, For the The first eigenvector; is the first convolution kernels, For the The second eigenvector; Represents a convolution operation.
4. The method according to claim 3, It is characterized in that The determining the entity in the medical sample sequence according to the entity recognition model comprises: Adding a start character before the first position of the medical sample sequence and adding an end character after the last position; A pre-redundant sequence is added before the start character, and a post-redundant sequence is added after the end character to generate a target sequence of the entity recognition model; the pre-redundant sequence is a sequence of characters selected from the last character of the medical sample sequence and forward continuously from the medical sample sequence. The post-redundancy sequence is a sequence formed by selecting at least one word from the medical sample sequence in a row starting from the first word of the medical sample sequence; The target sequence is input into the entity recognition model, and the entities in the medical sample sequence are determined according to the output result of the entity recognition model.
5. The method according to claim 4, It is characterized in that The step of inputting the target sequence into the entity recognition model and determining the entity in the medical sample sequence according to the output result of the entity recognition model includes: After determining the third feature vector output by the second prediction layer, the third feature vector corresponding to the end character is located using the conditional random field layer to determine the index position of the third feature vector corresponding to the end character. ; Determine a label prediction result corresponding to each of the third eigenvectors using the conditional random field layer; For The label prediction results are as follows: The label prediction results and label prediction results, comprehensively determine the first The entity corresponding to the word vector; .
6. The method according to claim 4, It is characterized in that The first half of the word vector corresponding to the start character is all zero, and the second half of the word vector corresponding to the end character is all zero; Alternatively, the second half of the word vector corresponding to the start character is all zero, and the first half of the word vector corresponding to the end character is all zero.
7. The method according to any one of claims 1 to 6, It is characterized in that Also includes: Obtaining a medical question text input by a user, and extracting keywords from the medical question text; Performing entity matching on the keyword to determine entities matching the keyword; The medical knowledge graph is queried according to entities matching the keywords, and reply information corresponding to the medical question text is generated according to the query results.
8. A diabetes consultation interactive device based on a language large model, It is characterized in that Diabetes consultation is performed through a language-based entity recognition model, including: An acquisition module, used to acquire medical sample sequences in a medical data set; An entity recognition module, used to determine entities in the medical sample sequence according to an entity recognition model; the entity recognition model is used to first determine the probability information that each word vector in the input sequence belongs to an entity, and then perform entity recognition in combination with the probability information of the word vector; A knowledge graph module, used for generating a medical knowledge graph according to the entity; A system construction module, used to construct a medical question-answering system according to the medical knowledge graph; the medical question-answering system is used to feedback reply information corresponding to the medical question text when obtaining the medical question text input by the user; The entity recognition model includes: a coding layer, a first prediction layer, a fusion layer, a second prediction layer and a conditional random field layer; The encoding layer is used to encode the input sequence and determine the word vector corresponding to each word in the input sequence; The first prediction layer is used to perform entity probability prediction on the word vectors generated by the encoding layer to determine the probability information that each word vector belongs to an entity; The fusion layer is used to fuse the word vector and the probability information of the word vector to generate a fusion vector corresponding to the word vector; The second prediction layer is used to perform entity recognition on the fusion vectors generated by the fusion layer to determine the entity type score corresponding to each fusion vector; The conditional random field layer is used to determine the entity label corresponding to the word vector according to the entity type score.
9. A computer storage medium, It is characterized in that The computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the diabetes consultation interaction method based on a language large model as described in any one of claims 1 to 7.
