Question-answering dialogue data generation system and method for building a large oral medicine model
By using Transformer encoder and Qwen-based Q&A conversation data generation model, the problem of low construction efficiency of stomatology Q&A data sets and difficulty in obtaining oral dialogue data is solved, high-quality stomatology Q&A conversation data generation is achieved, and the large model is improved application capability.
Patent Information
- Application Number
- CN202410555789.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-07
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-05-07
AI Technical Summary
The prior art is inefficient in building stomatological question and answer data sets, and due to the privacy of doctor-patient dialogue data, it is difficult to obtain high-quality oral dialogue data, resulting in a weak oral dialogue capability of large models.
The Transformer encoder is used to extract and score medical knowledge triplets for oral medicine literature, and these triplets are input into the Qwen-based Q&A conversation data generation model to generate high-quality oral Q&A conversation data.
It improves the performance of oral medicine big models in oral medicine knowledge and dialogue ability, improves its application ability in practice, and reduces the cumbersome and cost of manual data extraction.
Smart Images

Figure CN118520082B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of question-answering models, and in particular to a system and method for generating question-answering dialogue data for building a large oral medicine model. Background Art
[0002] Stomatology is an important branch of medicine. Oral health is crucial to health and quality of life. Oral diseases such as caries and periodontal disease not only affect physiological functions, but are also related to systemic diseases and affect language, appearance, social interaction and quality of life. At present, the annual number of patients admitted to dental hospitals in my country is 51.24 million, while there are only 27,000 practicing doctors. The huge demand for medical treatment cannot match the limited medical resources, and dental guidance faces challenges.
[0003] In recent years, large language models represented by ChatGPT have made significant breakthroughs in tasks such as human-computer dialogue and image understanding, and are considered an important way to achieve general artificial intelligence. In the field of stomatology, there are many complex and specialized outpatient departments for stomatology (such as endodontics, periodontics, oral implants, and maxillofacial surgery). Most patients are unable to determine the specific department they should visit when registering (for example, toothache may require going to the endodontics department or the periodontics department), so patients often make the wrong appointments, which delays their treatment and wastes limited medical resources.
[0004] To address the above issues, dental clinics usually have multiple staff members in the reception hall to guide patients to register, but as the number of patients increases, the efficiency of this guidance becomes extremely low. Thanks to the powerful knowledge encoding and storage capabilities of the big model and its reasoning ability for complex tasks, it has the potential to achieve efficient patient guidance, avoid the waste of medical resources caused by registering in the wrong diagnosis department, and improve the efficiency of doctors' consultations. Therefore, the big model has broad application prospects in the field of stomatology.
[0005] In order to obtain the above capabilities, the large model first needs to be pre-trained on a large-scale unlabeled corpus dataset to obtain a basic understanding of scenarios such as grammar, facts, and causal reasoning. The quality of this corpus data directly determines the performance and effect of the large model of stomatology. In practice, this corpus data usually comes from a series of professional textbooks on stomatology, but due to the discrete distribution of oral knowledge in the textbooks and the presence of a large number of transition sentences, it is difficult for the model to learn specific oral knowledge points. Most existing methods manually condense the oral medical knowledge points in the paragraph, which is time-consuming, labor-intensive, and extremely inefficient. In addition, in order to enable the large model to have oral medical conversation thinking, it is necessary to use oral conversation data to fine-tune it. However, due to the privacy of doctor-patient conversation data, such data is often difficult to obtain, resulting in weak oral conversation capabilities of the large model and inability to be applied in practice. Summary of the invention
[0006] In view of the above-mentioned deficiencies in the prior art, the system and method for generating question-answering dialogue data for constructing a large oral medicine model provided by the present invention solve the problem of low efficiency of constructing oral medicine question-answering data sets in the prior art.
[0007] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:
[0008] In a first aspect, a method for generating question-answering dialogue data for constructing a large oral medicine model is provided, which comprises the steps of:
[0009] S1. Collect several articles related to stomatology, divide each article into several texts, and extract several candidate medical knowledge triples from each text;
[0010] S2. Use the trained Transformer encoder to score several candidate medical knowledge triples for each text, and select a preset number of medical knowledge triples with the highest scores for each text;
[0011] S3, input all the medical knowledge triples selected from the text into the oral dialogue and medical triples training based on Qwen The question-answering dialogue data generation model is used to obtain the oral question-answering dialogue data of each text.
[0012] Furthermore, the method of extracting several candidate medical knowledge triples for each text includes:
[0013] S11, using a word segmentation tool to extract the head entity and the tail entity in each text, and using the head entity and the tail entity of the same text to form an entity pair;
[0014] S12, input each text and its corresponding entity pair into the Transformer model to obtain the head entity feature, the tail entity feature and the overall text feature;
[0015] S13, concatenating the head entity feature, the tail entity feature and the overall text feature, and using a fully connected layer to extract multiple sets of candidate relationships of entity pairs to form an extraction sequence;
[0016] S14, use The layer calculates the correlation between the extracted sequence and its corresponding entity pair;
[0017] S15. Select several candidate relationships with the highest correlation in the extraction sequence, and form candidate medical knowledge triples with them and corresponding entity pairs.
[0018] Furthermore, the expressions for extracting head entity features, tail entity features, and overall text features by the Transformer model are:
[0019]
[0020]
[0021]
[0022] in, is the activation function; , and They are head entity feature, tail entity feature and overall text feature; i and j are the serial numbers of the first and last hidden feature vectors that constitute the head entity features; is the tth hidden state vector of the model; m and k are the serial numbers of the first and last hidden feature vectors that constitute the tail entity features; and are the weights of the Transformer model; and Both are biases of the Transformer model; and They are the weights and biases of the fully connected layer in the Transformer model respectively; is the initial hidden state of the text.
[0023] Furthermore, when the Transformer model extracts features of the head entity and the tail entity, it respectively includes searching for candidate relationships between the head entity and the tail entity, and searching for candidate relationships from the left and right sides of the head entity and / or the tail entity; after obtaining the extraction sequence, a bidirectional search is performed on the candidate relationships in the extraction sequence, and the double candidate relationships obtained by the bidirectional search are used to form the final extraction sequence.
[0024] Furthermore, the training method of the Transformer encoder includes:
[0025] S21, screening text A with a standard format in the oral medicine textbook, and classifying it according to oral sub-disciplines, and then extracting triple data of the classified text A;
[0026] S22, using text A and its triple data as fact data pairs, performing all possible combinations of each text A and the triple data of the remaining text A, each combination being a non-fact data pair;
[0027] S23. Use the data set consisting of all factual data pairs and non-factual data pairs to train the Transformer encoder.
[0028] Furthermore, when training the Transformer encoder, the loss function corresponding to the fact data pair is:
[0029]
[0030]
[0031]
[0032] in, and are the loss functions of text A and its triple data in the fact data pair respectively; To obtain the index operation; To take the logarithm operation; and Separate i The word embeddings corresponding to the text A and the triple data in the fact data pairs; N is the total number of fact data pairs; To calculate the cosine similarity; is the loss function value corresponding to the fact data pair.
[0033] Furthermore, the training method of the Qwen-based question-answering dialogue data generation model includes:
[0034] S31, collect the public doctor-patient dialogue data set, and select the oral dialogue as the data set D;
[0035] S32, using a k-means clustering algorithm to divide the oral conversations in the data set D into a number of clusters, and for each cluster, sorting the oral conversations according to the distance from the cluster center;
[0036] S33, using heuristic rules before each cluster selection oral dialogues and uses the BERT-based knowledge extraction model to extract oral medical triples;
[0037] S34. Use the medical triples and their corresponding oral dialogues as training data pairs. All training data pairs constitute a data set. ;
[0038] S35. Use of Dataset Based on Qwen Fine-tune the generative pre-trained large model to obtain Qwen A generation model for question-answering dialogue data.
[0039] Furthermore, based on Qwen The generative pre-trained large model is used for training, and its loss function is:
[0040]
[0041] in, For the dataset Middle n The probability of the true label of the training data pair; For the model to the dataset Middle n The predicted probability of training data pairs;
[0042] based on Qwen After the generative pre-trained large model is trained, the output of the generative model is generated by greedy decoding P :
[0043]
[0044] Among them, x is the input oral medicine triplet, argmax Returns the index corresponding to the maximum value in the tensor; is the output at time step o; For a given input sequence and all outputs before time step o Under these conditions, the output is generated The probability of
[0045] Judgment based on Qwen The expression for whether the performance of the generative pre-trained large model meets the requirements is:
[0046]
[0047]
[0048] in, To score; How many of the positive categories predicted by the model are actually positive categories; Recall How many of the actual positive categories are successfully predicted as positive categories by the model; is the preset threshold.
[0049] In a second aspect, a question-answering dialogue data generation system for constructing a large oral medicine model is provided, which includes:
[0050] The oral professional knowledge generation module is used to collect several articles related to oral medicine, divide each oral medicine article into several texts, and extract several candidate medical knowledge triples from each text;
[0051] The oral professional knowledge scoring module is used to score several candidate medical knowledge triples for each text using the trained Transformer encoder, and select a preset number of the highest-scoring medical knowledge triples for each text;
[0052] The oral dialogue data reconstruction component is used to input the medical knowledge triples selected from all texts into the Qwen-based question-and-answer dialogue data generation model trained with oral dialogues and medical triples to obtain the oral question-and-answer dialogue data for each text.
[0053] Compared with the prior art, the present invention has the following beneficial effects:
[0054] The Transformer of this solution can generate multiple candidate triplets containing medical dental knowledge from the input text. Based on the triplets, it can calculate the correlation between the text paragraph to be extracted and the given dental entity pair, thereby focusing large text paragraphs on the most relevant parts to dental medicine, so that the large model in the dental vertical field can better learn dental knowledge.
[0055] This program is based on Qwen The generative pre-trained large model adopts a few-sample learning method, which can make full use of limited oral dialogue data and convert a large amount of oral medicine text data into high-quality oral question-and-answer dialogue data, so that the large model in the vertical field of oral medicine can learn the oral professional question-and-answer dialogue model and improve its application ability in practice.
[0056] When constructing a large oral medicine model (an oral medicine question-and-answer model), all oral question-and-answer dialogue data obtained by this solution can be used to form a training set, and then these training sets are used to train the large oral medicine model (specifically, the question-and-answer model) to obtain a model with strong oral dialogue capabilities, so as to ensure that the obtained question-and-answer model can accurately answer users' questions.
[0057] Compared with the traditional method that relies on manual data extraction, this solution does not require manual assistance, completely gets rid of the tediousness and cost of manual data extraction and construction of question-and-answer dialogue data, making the data extraction process more convenient and efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 Flowchart of the method for generating question-answering dialogue data for building a large oral medicine model.
[0059] Figure 2 This is a block diagram of the question-answering dialogue data generation system used to build a large oral medicine model.
[0060] Figure 3 Block diagram of the module for generating dental expertise. DETAILED DESCRIPTION
[0061] The specific implementation modes of the present invention are described below so that those skilled in the art can understand the present invention. However, it should be clear that the present invention is not limited to the scope of the specific implementation modes. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations utilizing the concept of the present invention are protected.
[0062] refer to Figure 1 , Figure 1 A flow chart of a method for generating question-answering dialogue data for constructing a large oral medicine model is shown; Figure 1 As shown, the method S includes steps S1 to S3.
[0063] In step S1, several articles related to stomatology are collected, and each article of stomatology is divided into several texts, and several candidate medical knowledge triples are extracted from each text; the several articles related to stomatology include stomatology articles, medical guidance guides and textbooks.
[0064] In one embodiment of the present invention, the method for extracting a number of candidate medical knowledge triples for each text includes:
[0065] S11, using a word segmentation tool to extract the head entity and the tail entity in each text, and using the head entity and the tail entity of the same text to form an entity pair;
[0066] S12. Input each text and its corresponding entity pair into the Transformer model to obtain the head entity feature, tail entity feature and overall text feature:
[0067]
[0068]
[0069]
[0070] in, is the activation function; , and They are head entity feature, tail entity feature and overall text feature; i and j are the serial numbers of the first and last hidden feature vectors that constitute the head entity features; is the tth hidden state vector of the model; m and k are the serial numbers of the first and last hidden feature vectors that constitute the tail entity features; and are the weights of the Transformer model; and Both are biases of the Transformer model; and They are the weights and biases of the fully connected layer in the Transformer model respectively; is the initial hidden state of the text.
[0071] The Transformer model of this solution extracts multiple groups of sequences related to the entity pair from the input text as the relationship between the two entities, which is Finding the right relationship To form a knowledge triple ,in is the head entity, is the tail entity, is the relationship between two entities. For example, for the following input text: "Periodontal diseases usually include two main types: gingivitis and periodontitis. Gingivitis refers to the inflammation of the gum tissue, usually due to the accumulation of dental plaque and tartar. Periodontitis is a further development of gingivitis, involving the destruction of periodontal tissues, including the gums, alveolar bone and periodontal membrane." The entity pair extracted from this text is (periodontal disease, periodontitis), and the generated candidate knowledge triples may be (periodontal disease, including, periodontitis), (periodontal disease, causes, periodontitis), (periodontal disease, develops, periodontitis), and so on.
[0072] S13, concatenate the head entity feature, tail entity feature and overall text feature, and use the fully connected layer to extract multiple sets of candidate relationships of entity pairs to form an extraction sequence. This process is expressed by the following expression:
[0073]
[0074] in, is the extraction sequence; and Represent the weight and bias of the fully connected layer respectively; For splicing operation.
[0075] S14, use The layer calculates the correlation between the extracted sequence and its corresponding entity pair:
[0076]
[0077] in, express The operations performed by the layer; Represents the correlation between extracted sequences and entity pairs.
[0078] S15, select several candidate relations with the highest correlation in the extraction sequence, and form candidate medical knowledge triples with the corresponding entity pairs. This method can reduce the correlation calculation cost between the candidate concerns and the given entity pairs.
[0079] During implementation, this scheme preferably uses the Transformer model to extract head entity and tail entity features, including searching for candidate relationships between the head entity and the tail entity, and searching for candidate relationships from the left and right sides of the head entity and / or the tail entity; this method can generate more candidate knowledge triples.
[0080] To facilitate understanding of searching candidate relationships from the left and right sides of the head entity and / or the tail entity, an example is given below. For example: "Oral hygiene and gingivitis are closely related." If the search is performed according to the general pattern, only the head entity "oral hygiene" and the tail entity "gingivitis" can be searched. The "and" between the two cannot correctly reflect the relationship between the two. The triple generated at this time is (oral hygiene, and, gingivitis). After searching candidate relationships from the left and right sides of the head entity and / or the tail entity, "closely related" on the right side of the head entity and the tail entity can be searched as a candidate relationship. The candidate knowledge triple generated in this way is: (oral hygiene, closely related, gingivitis). Here, the head entity is "oral hygiene", the tail entity is "gingivitis", and the matching candidate relationship is "closely related". At this time, the candidate relationship is on the right side of the head entity position [S] and the tail entity position [E].
[0081] Considering that the order of appearance of the head entity and the tail entity in the input text is not necessarily consistent with the given entity pair, after obtaining the extraction sequence, this scheme performs a bidirectional search on the candidate relations in the extraction sequence, and uses the double candidate relations obtained by the bidirectional search to form the final extraction sequence. This allows each entity to be used as and , in order to generate knowledge triples that are more in line with medical common sense. For example, for the text "Gingivitis refers to inflammation of the gum tissue, usually caused by dental plaque." and a given entity pair (head entity: dental plaque, tail entity: gingivitis), if only one-way search is performed, the knowledge triple generated according to the order of appearance of the entities in the text is (gingivitis, caused by, dental plaque), which is inconsistent with the original meaning of the text. Bidirectional search allows a more flexible generation method, not limited to the order of appearance of the entities in the text, and takes the later-appearing dental plaque as the head entity and the first-appearing gingivitis as the tail entity, thereby generating the correct knowledge triple (dental plaque, caused by, gingivitis).
[0082] In step S2, the trained Transformer encoder is used to score several candidate medical knowledge triples for each text, and a preset number of medical knowledge triples with the highest scores are selected for each text; for each input text, this scheme preferably outputs the three knowledge triples with the highest scores as the high-quality oral medicine expertise extracted by the component, thereby completing the knowledge extraction of the oral text.
[0083] In one embodiment of the present invention, the training method of the Transformer encoder includes:
[0084] S21, screening text A with a standard format in oral medicine textbooks, and classifying it according to oral sub-disciplines (such as oral and maxillofacial surgery, oral medicine, orthognathic surgery), and then extracting triplet data of the classified text A;
[0085] For step S21, entity extraction is first performed to obtain the Subject (discipline) entity ( ) and the Object (target) body ( ), and then classify and predict the relationship between entities to obtain the relationship between entities ( ). Then we filter according to oral medical knowledge and finally get a large number of correct triples. , the triples obtained here are R Able to correctly represent the relationships between entities.
[0086] S22, using text A and its triple data as fact data pairs, each text A is combined with the triple data of the remaining text A in all possible combinations, each combination is a non-fact data pair; when including N text A, there will be A non-factual data pair.
[0087] S23. Use the dataset consisting of all factual data pairs and non-factual data pairs to train the Transformer encoder. When training the Transformer encoder, its training goal is to maximize the word embedding similarity between the input text A and the triple data from the factual data pairs (positive sample pairs), and minimize the word embedding similarity between the input text A and the triple data in the non-factual data pairs (negative sample pairs).
[0088] When training the Transformer encoder, the loss function corresponding to the fact data pair is:
[0089]
[0090]
[0091]
[0092] in, and are the loss functions of text A and its triple data in the fact data pair respectively; To obtain the index operation; To take the logarithm operation; and Separate i The word embeddings corresponding to the text A and the triple data in the fact data pair; N is the total number of fact data pairs; To calculate the cosine similarity; is the loss function value corresponding to the fact data pair.
[0093] In step S3, all medical knowledge triples selected from the text are input into a training set based on oral dialogue and medical triples. Qwen The question-answering dialogue data generation model is used to obtain the oral question-answering dialogue data of each text.
[0094] In one embodiment of the present invention, a training method for generating a model for question-answering dialogue data based on Qwen includes:
[0095] S31, collect the public doctor-patient dialogue data set, and select the oral dialogue as the data set D;
[0096] S32, using a k-means clustering algorithm to divide the oral conversations in the data set D into a number of clusters, and for each cluster, sorting the oral conversations according to the distance from the cluster center;
[0097] S33, using heuristic rules before each cluster selection Oral dialogues are generated, and the BERT-based knowledge extraction model is used to extract oral medical triples. For example, when oral dialogue data is input: "Patient: I have been having tooth pain recently, and there are black spots on my teeth. What could be going on? Doctor: Tooth pain may be caused by caries, and the black spots on the surface of the teeth are formed by bacterial erosion of the hard tissue on the surface of the teeth", the generated oral medical triplet is (tooth, pain, caries).
[0098] S34. Use the medical triples and their corresponding oral dialogues as training data pairs. All training data pairs constitute a data set. ;
[0099] S35. Use of Dataset Based on Qwen Fine-tune the generative pre-trained large model to obtain Qwen A generation model for question-answering dialogue data.
[0100] In this scheme, based on Qwen The generative pre-trained large model is trained in the training phase. The model continuously strives to minimize the cross entropy loss function of its output word origin to improve performance. Its loss function is:
[0101]
[0102] Among them, For the dataset Middle n The probability of the true label of the training data pair; For the model to the dataset Middle n The predicted probability of training data pairs;
[0103] based on Qwen After the generative pre-trained large model is trained, the output of the generative model is generated by greedy decoding P :
[0104]
[0105] in, is the input oral medicine triplet, argmax Returns the index corresponding to the maximum value in the tensor; is the output at time step o; For a given input sequence and all outputs before time step o Under these conditions, the output is generated The probability of
[0106] Judgment based on Qwen The expression for whether the performance of the generative pre-trained large model meets the requirements is:
[0107]
[0108]
[0109] in, To score; How many of the positive categories predicted by the model are actually positive categories; Recall How many of the actual positive categories are successfully predicted as positive categories by the model; is the preset threshold.
[0110] like Figure 2 As shown, the question-answering dialogue data generation system for building a large oral medicine model provided by this solution includes:
[0111] The oral professional knowledge generation module is used to collect several articles related to oral medicine, divide each oral medicine article into several texts, and extract several candidate medical knowledge triples from each text; the principle block diagram of the oral professional knowledge generation module can be referred to Figure 3 The workflow can refer to step S11 to step S15.
[0112] The oral professional knowledge scoring module is used to use the trained Transformer encoder to score several candidate medical knowledge triples for each text, and select a preset number of medical knowledge triples with the highest scores for each text.
[0113] The oral dialogue data reconstruction component is used to input the medical knowledge triples selected from all texts into the Qwen-based question-and-answer dialogue data generation model trained with oral dialogues and medical triples to obtain the oral question-and-answer dialogue data for each text.
[0114] Among them, the oral expertise generation module, the oral expertise scoring module and the oral dialogue data reconstruction component are connected in sequence.
[0115] In summary, this solution can accurately extract oral knowledge from massive oral teaching materials and construct high-quality oral question-and-answer dialogue data (oral doctor-patient dialogue data set) through the above-mentioned methods and technologies, thereby improving the performance of large models in the oral vertical field.
Claims
1. A method for generating question-answering dialogue data for constructing a large oral medicine model, characterized in that: Includes steps: S1. Collect several articles related to stomatology, divide each article into several texts, and extract several candidate medical knowledge triples from each text; S2. Use the trained Transformer encoder to score several candidate medical knowledge triples for each text, and select a preset number of medical knowledge triples with the highest scores for each text; S3, input all the medical knowledge triples selected from the text into the oral dialogue and medical triples training based on Qwen The question-answering dialogue data generation model is used to obtain the oral question-answering dialogue data of each text; Methods for extracting several candidate medical knowledge triples for each text include: S11, using a word segmentation tool to extract the head entity and the tail entity in each text, and using the head entity and the tail entity of the same text to form an entity pair; S12, input each text and its corresponding entity pair into the Transformer model to obtain the head entity feature, the tail entity feature and the overall text feature; S13, concatenating the head entity feature, the tail entity feature and the overall text feature, and using a fully connected layer to extract multiple sets of candidate relationships of entity pairs to form an extraction sequence; S14, use The layer calculates the correlation between the extracted sequence and its corresponding entity pair; S15, selecting several candidate relations with the highest correlation in the extraction sequence, and forming candidate medical knowledge triples with the corresponding entity pairs; The expressions for extracting head entity features, tail entity features, and overall text features by the Transformer model are: in, is the activation function; , and They are head entity feature, tail entity feature and overall text feature; i and j are the serial numbers of the first and last hidden feature vectors that constitute the head entity features; is the first t hidden state vector; m and k are the serial numbers of the first and last hidden feature vectors that constitute the tail entity features; and are the weights of the Transformer model; and Both are biases of the Transformer model; and They are the weights and biases of the fully connected layer in the Transformer model respectively; is the initial hidden state of the text.
2. The method for generating question-answer dialogue data according to claim 1, characterized in that: When the Transformer model extracts features of the head entity and the tail entity, it includes searching for candidate relations between the head entity and the tail entity, and searching for candidate relations from the left and right sides of the head entity and / or the tail entity, respectively; After obtaining the extraction sequence, a bidirectional search is performed on the candidate relations in the extraction sequence, and the double candidate relations obtained by the bidirectional search are used to form the final extraction sequence.
3. The method for generating question-answer dialogue data according to claim 1, characterized in that: The training method of the Transformer encoder includes: S21, screening text A with a standard format in the oral medicine textbook, and classifying it according to oral sub-disciplines, and then extracting triple data of the classified text A; S22, using text A and its triple data as fact data pairs, performing all possible combinations of each text A and the triple data of the remaining text A, each combination being a non-fact data pair; S23. Use the data set consisting of all factual data pairs and non-factual data pairs to train the Transformer encoder.
4. The method for generating question-answer dialogue data according to claim 1 or 3, characterized in that: When training the Transformer encoder, the loss function corresponding to the fact data pair is: in, and are the loss functions of text A and its triple data in the fact data pair respectively; To obtain the index operation; To take the logarithm operation; and Separate i The word embeddings corresponding to the text A and the triple data in the fact data pairs; N is the total number of fact data pairs; To calculate the cosine similarity; is the loss function value corresponding to the fact data pair.
5. The method for generating question-answer dialogue data according to claim 1, characterized in that: The training method of the Qwen-based question-answering dialogue data generation model includes: S31, collect the public doctor-patient dialogue data set, and select the oral dialogue as the data set D; S32, using a k-means clustering algorithm to divide the oral conversations in the data set D into a number of clusters, and for each cluster, sorting the oral conversations according to the distance from the cluster center; S33, using heuristic rules before each cluster selection oral dialogues and uses the BERT-based knowledge extraction model to extract oral medical triples; S34. Use the medical triples and their corresponding oral dialogues as training data pairs. All training data pairs constitute a data set. ; S35. Use of Dataset Based on Qwen Fine-tune the generative pre-trained large model to obtain Qwen A generation model for question-answering dialogue data.
6. The method for generating question-answer dialogue data according to claim 5, characterized in that: Based on Qwen The generative pre-trained large model is used for training, and its loss function is: in, For the dataset Middle n The probability of the true label of the training data pair; For the model to the dataset Middle n The predicted probability of training data pairs; based on Qwen After the generative pre-trained large model is trained, the output of the generative model is generated by greedy decoding P : in, is the input oral medicine triplet, argmax Returns the index corresponding to the maximum value in the tensor; is the output at time step o; For a given input sequence and all outputs before time step o Under these conditions, the output is generated probability; Judgment based on Qwen The expression for whether the performance of the generative pre-trained large model meets the requirements is: in, To score; How many of the positive categories predicted by the model are actually positive categories; Recall How many of the actual positive categories are successfully predicted as positive categories by the model; is the preset threshold.
7. A system for generating question-answering dialogue data for constructing a large oral medicine model according to any one of claims 1 to 6, characterized in that: include: The oral professional knowledge generation module is used to collect several articles related to oral medicine, divide each oral medicine article into several texts, and extract several candidate medical knowledge triples from each text; The oral professional knowledge scoring module is used to score several candidate medical knowledge triples for each text using the trained Transformer encoder, and select a preset number of the highest-scoring medical knowledge triples for each text; The oral dialogue data reconstruction component is used to input the medical knowledge triples selected from all texts into the Qwen-based question-and-answer dialogue data generation model trained with oral dialogues and medical triples to obtain the oral question-and-answer dialogue data for each text.
Citation Information
Patent Citations
Knowledge graph completion method and device, equipment and storage medium
CN112035672A
Medical question and answer method based on knowledge graph and related equipment
CN115470327A