Question and answer method, system and equipment based on question and answer model and storage medium
By building and expanding high-quality text pools and training Q&A models, the existing Q&A models are solved in the problem of insufficient instruction compliance and Chinese comprehension capabilities in the medical field, and high-quality Q&A support is achieved.
Patent Information
- Application Number
- CN202411380161.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-09-30
AI Technical Summary
The existing question and answer models have shortcomings in command compliance and Chinese comprehension ability, and it is difficult to ensure the quality of question and answer. Especially in the medical field, they cannot effectively integrate into full-process consultation and have weak Chinese comprehension ability.
By building an initial text pool based on the basic data set, generating and filtering high-quality query text and reply text, training the question and answer model, ensuring the high quality and expansion of the text pool, improving the model's instruction compliance ability and Chinese understanding ability, and Integrate medical data to enhance professionalism.
It has achieved high-quality training of the Q&A model, improved its command compliance and Chinese understanding ability in the medical field, ensured the reliability and professionalism of Q&A, and effectively supported users' medical consultations.
Smart Images

Figure CN119293176A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a question-answering method, system, device and storage medium based on a question-answering model. Background Art
[0002] At present, there are many large models that can be used for question answering on the market, but there are various problems in actual application. For example, the ability to follow instructions is poor and it is impossible to meet user needs according to the preset instructions. Another example is that they are not professional enough in some aspects. In addition, most of the current question answering models have poor understanding of Chinese, and the Chinese data sets used are mostly obtained from the Internet. The acquisition process not only consumes manpower, material and financial resources, but also makes it difficult to guarantee quality and effectively improve the performance of the question answering model.
[0003] In summary, how to effectively implement question and answer based on the question and answer model and ensure the quality of question and answer is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0004] The purpose of the present invention is to provide a question-answering method, system, device and storage medium based on a question-answering model, so as to effectively implement question-answering based on the question-answering model and ensure the quality of question-answering.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] In a first aspect, the present invention provides a question-answering method based on a question-answering model, comprising:
[0007] Based on the basic data set, an initial text pool is obtained; wherein the initial text pool includes a plurality of inquiry texts for question inquiry;
[0008] Select K query texts from the text pool; K is a positive integer;
[0009] For each of the inquiry texts selected from the text pool, a plurality of inquiry texts related to the inquiry text are generated by a preset question-answering model, and the inquiry text and a plurality of inquiry texts related to the inquiry text are respectively input into the question-answering model to obtain respective reply texts generated by the question-answering model;
[0010] Based on the preset text quality screening rules, each reply text generated by the question-answering model is screened, and the screened reply text and its corresponding inquiry text are placed in the text pool to expand the text pool;
[0011] Return to executing the operation of selecting K query texts from the text pool until the current text pool meets the preset requirements;
[0012] Training the question-answering model based on the text pool;
[0013] Receive user questions and input them into the trained question-answering model to obtain the reply content output by the question-answering model.
[0014] On the other hand, for each of the inquiry texts selected from the text pool, after a plurality of inquiry texts related to the inquiry text are generated by a preset question-answering model, the method further includes:
[0015] For each of the query texts selected from the text pool, the overlap between each of the generated query texts related to the query text and the query text is determined, and query texts related to the query text whose overlap is higher than a first threshold are discarded.
[0016] On the other hand, for each of the inquiry texts selected from the text pool, after a plurality of inquiry texts related to the inquiry text are generated by a preset question-answering model, the method further includes:
[0017] For each of the inquiry texts selected from the text pool, determining whether there is an inquiry text that cannot be processed by the question-answering model among the generated inquiry texts related to the inquiry text;
[0018] If so, the inquiry texts related to the inquiry text that cannot be processed by the question-answering model will be discarded.
[0019] On the other hand, after the inquiry text and multiple inquiry texts related to the inquiry text are respectively input into the question-answering model to obtain each reply text generated by the question-answering model, the method further includes:
[0020] De-duplicate each reply text generated by the question-answering model.
[0021] On the other hand, each inquiry text in the initial text pool is an inquiry text for inquiring about medical issues. The question-answering method based on the question-answering model also includes:
[0022] Inputting a medical text file and a self-question-and-answer instruction into the question-and-answer model, so that the question-and-answer model generates a medical question based on the medical text file and generates a reply text for the medical question based on the medical text file according to the requirements of the self-question-and-answer instruction, and placing the generated medical question and the reply text as a training instance into the text pool;
[0023] The sources of the medical text files include medical books, medical encyclopedia knowledge, and medical assessment test questions.
[0024] On the other hand, the basic data set is a basic medical data set, and the obtained initial text pool includes at least the first to seventh types of inquiry texts;
[0025] The content of the first type of inquiry text includes the corresponding relationship between the symptom and the department where the symptom is treated;
[0026] The content of the second type of inquiry text includes the correspondence between the disease and the typical symptoms of the disease;
[0027] The content of the third type of inquiry text includes medical record writing standards, and some of the third type of inquiry texts include sample medical record data;
[0028] The content of the fourth type of inquiry text includes the correspondence between the disease and the typical examination items of the disease;
[0029] The content of the fifth type of inquiry text includes the correspondence between the disease and the typical prescription for that disease;
[0030] The content of the sixth type of inquiry text includes the dialogue of the consultation process;
[0031] The content of the seventh type of inquiry text includes data on medical expertise.
[0032] On the other hand, receiving a user question and inputting it into the trained question-answering model, and obtaining a reply content output by the question-answering model, including:
[0033] Receive user questions and input them into the trained question-answering model, and obtain an initial response to the user questions through the question-answering model;
[0034] Determining whether the credibility of the initial response reaches a preset credibility threshold;
[0035] If yes, the initial reply is used as the reply content for the user's question output by the obtained question-answering model;
[0036] If not, generating a search keyword based on the user question and searching the search keyword through a network search engine to obtain search results;
[0037] The user question and the search result are input into the trained question-answering model to obtain the reply content output by the question-answering model.
[0038] In a second aspect, the present invention provides a question-answering system based on a question-answering model, comprising:
[0039] An initial text pool construction module is used to obtain an initial text pool based on a basic data set; wherein the initial text pool includes a plurality of inquiry texts for question inquiry;
[0040] A seed query text selection module selects K query texts from the text pool; K is a positive integer;
[0041] An extension module, for generating, for each of the inquiry texts selected from the text pool, multiple inquiry texts related to the inquiry text through a preset question-answering model, and inputting the inquiry text and multiple inquiry texts related to the inquiry text into the question-answering model respectively to obtain respective reply texts generated by the question-answering model;
[0042] A text quality screening module is used to screen the response texts generated by the question-answering model based on preset text quality screening rules, and place the screened response texts and their corresponding inquiry texts into the text pool to expand the text pool; return to trigger the seed inquiry text selection module until the current text pool meets the preset requirements;
[0043] A training module, used for training the question-answering model based on the text pool;
[0044] The question-answering execution module is used to receive user questions and input them into the trained question-answering model to obtain the reply content output by the question-answering model.
[0045] In a third aspect, the present invention provides a question-answering device based on a question-answering model, comprising:
[0046] Memory for storing computer programs;
[0047] A processor is used to execute the computer program to implement the steps of the question-answering method based on the question-answering model as described above.
[0048] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the question-answering method based on the question-answering model as described above.
[0049] Applying the technical solution provided by the embodiment of the present invention, considering that the current question-answering model has poor instruction-following ability and cannot implement question-answering according to the preset instruction requirements, this application will generate a large number of high-quality inquiry texts and their reply texts, and train the question-answering model based on this, which is conducive to improving the instruction-following ability of the question-answering model. Specifically, a basic data set can be obtained as the initial text pool; wherein the text pool includes multiple inquiry texts, and each inquiry text is an inquiry text for question inquiry. Since it is impossible to directly and conveniently obtain a large number of inquiry texts, the present application solution will be expanded based on the question-answering model, that is, K inquiry texts can be selected from the text pool, and for each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text are generated by the preset question-answering model. The inquiry text and multiple inquiry texts related to the inquiry text are respectively input into the question-answering model, and each reply text generated by the question-answering model can be obtained. In order to ensure quality, this application will screen each reply text generated by the question-answering model based on the preset text quality screening rules, and place the screened reply texts and their corresponding inquiry texts into the text pool to expand the text pool. Then return to execute the operation of selecting K inquiry texts from the text pool until the current text pool meets the preset requirements. It can be seen that the present application scheme can automatically expand the text pool and ensure the high quality of the text pool, so that after the question-answering model is trained accordingly, the trained question-answering model has strong performance, that is, it has strong Chinese comprehension ability, professionalism, and strong instruction-following ability, so that when the question-answering model based on this application is used for question-answering, the reliability and professionalism of the question-answering can be effectively guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] 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.
[0051] Figure 1 A flowchart of an implementation of a question-answering method based on a question-answering model provided by a specific embodiment of the present invention;
[0052] Figure 2 A schematic diagram of the principle of implementing the expansion of the text pool in a specific implementation mode of the present invention;
[0053] Figure 3 A schematic diagram of the principle of searching in a specific implementation mode of the present invention;
[0054] Figure 4A schematic diagram of the structure of a question-answering system based on a question-answering model provided by a specific embodiment of the present invention;
[0055] Figure 5 A schematic diagram of the structure of a question-answering device based on a question-answering model provided by a specific embodiment of the present invention;
[0056] Figure 6 The present invention is a schematic diagram of the structure of a computer-readable storage medium. DETAILED DESCRIPTION
[0057] The core of the present invention is to provide a question-answering method, system, device and storage medium based on a question-answering model, which can automatically expand the text pool and ensure the high quality of the text pool, so that after the question-answering model is trained, the trained question-answering model has strong performance, that is, it has strong Chinese comprehension ability, professionalism, and strong instruction-following ability, so that when question-answering based on the question-answering model of this application is conducted, the reliability and professionalism of the question-answering can be effectively guaranteed.
[0058] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0059] Please refer to Figure 1 , Figure 1 The following is a flowchart of a question-answering method based on a question-answering model provided in a specific embodiment of the present invention. The question-answering method based on a question-answering model may include the following steps:
[0060] Step S101: Based on the basic data set, an initial text pool is obtained, wherein the initial text pool includes a plurality of inquiry texts for question inquiry.
[0061] The basic data set can be obtained from the Internet, books, etc., but it should be noted that compared with the quantity of text, the quality of the text is more important for the training of the question-answering model. Therefore, when obtaining the basic data set and obtaining the initial text pool, a high-quality basic data set should be obtained, and then the initial text pool should be obtained based on it.
[0062] The initial text pool is composed of multiple inquiry texts, and each inquiry text is an inquiry text for question inquiry. For example, a certain inquiry text is "I often feel tired and in a bad mental state recently. Could this be an early symptom of anemia?" In addition, for the convenience of the following description, the inquiry text is referred to as inquiry text A.
[0063] When the initial text pool is obtained based on the basic data set, it can be achieved in a variety of ways, such as inputting the basic data set into the question-answering model and informing the question-answering model to extract multiple inquiry texts accordingly. In order to ensure quality, the staff can check and delete the inquiry texts with grammatical errors, unclear meanings, illogical problems, etc. in the initial text pool. Of course, the staff can also directly write inquiry texts into the text pool or modify the inquiry texts in the text pool based on the basic data set, that is, allow the staff to directly define the inquiry text.
[0064] Step S102: Select K query texts from the text pool; K is a positive integer.
[0065] When step S102 is triggered, one or more query texts need to be selected from the current text pool, and the text pool is expanded in this round based on them. In practical applications, in order to effectively expand the text pool and ensure the expansion efficiency, all query texts are usually selected from the current text pool, that is, K is usually set to the total number of query texts in the current text pool.
[0066] Step S103: For each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text are generated through a preset question-answering model, and the inquiry text and multiple inquiry texts related to the inquiry text are respectively input into the question-answering model to obtain respective reply texts generated by the question-answering model.
[0067] It should be noted that the specific type of the question-answering model of the present application can be set according to actual needs. For example, an open source model such as chatglm4 can be used as the question-answering model of the present application.
[0068] In addition, the specific question and answer field involved in the question and answer model of this application can be determined based on actual needs. The following is an explanation using the medical question and answer field as an example.
[0069] It should also be pointed out that although there are many medical big models that can be used for question answering in traditional solutions, most of them are only used to process basic tasks such as imaging reports, triage and consultation, and cannot be integrated into the entire medical process to realize consultation. In addition, there are various problems in actual application. For example, the medical capabilities are sufficient but the ability to follow instructions is poor, and it is impossible to realize intelligent medical care according to the preset instructions. Another example is that they are not professional enough in medicine. In addition, most of the current medical big models have poor understanding of Chinese, and the Chinese medical data sets used are mostly obtained from the Internet. The acquisition process not only consumes manpower, material and financial resources, but also makes it difficult to ensure quality and effectively improve the performance of the question answering model.
[0070] In the present application, a large number of high-quality inquiry texts and their reply texts are generated, and the question-answering model is trained accordingly. The trained question-answering model has strong performance, that is, it has strong Chinese comprehension ability, medical professionalism, and strong instruction-following ability. Therefore, the question-answering model based on the present application can effectively realize the consultation.
[0071] For each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text will be generated through the question-answering model. For example, a certain inquiry text selected from the text pool is the inquiry text A mentioned above, "I often feel tired and in a bad mental state recently. Could this be an early symptom of anemia?" After the inquiry text is input into the question-answering model, and a prompt such as "Please generate multiple inquiry texts related to this" is input, the question-answering model will generate multiple inquiry texts related to the inquiry text. The generated inquiry texts may be related to anemia, fatigue, or related to inquiry text A in other aspects.
[0072] For example, in one scenario, 20 inquiry texts related to inquiry text A are generated by a preset question-answering model. Then, the inquiry text A and the 20 inquiry texts related to the inquiry text A can be input into the question-answering model respectively, and the response texts generated by the question-answering model can be obtained. In this example, the question-answering model will generate 21 corresponding response texts for the 21 inquiry texts.
[0073] Here, the inquiry text A selected from the text pool is used as an example for explanation. For other inquiry texts selected from the text pool, the same as inquiry text A can be used. First, multiple inquiry texts related to the inquiry text are generated through the question-answering model, and then each reply text is obtained through the question-answering model.
[0074] For example, after the query text A is input into the question-answering model, the reply text generated by the question-answering model is specifically "Early symptoms of anemia may include fatigue, poor mental state, etc. These symptoms are not unique to anemia and may also be caused by other reasons. If the patient has these symptoms, it is recommended to undergo corresponding blood tests, such as hemoglobin, red blood cell count, etc., to clarify the diagnosis." Then, the query text A and the reply text corresponding to the query text A constitute a training instance. If it passes the subsequent screening, the training instance will be placed in the text pool.
[0075] Step S104: Based on the preset text quality screening rules, each reply text generated by the question-answering model is screened, and the screened reply text and its corresponding inquiry text are placed in the text pool to expand the text pool.
[0076] In this application, considering that the quality of the response texts obtained varies, in order to ensure the quality of the text pool, each response text generated by the question-answering model will be screened based on the preset text quality screening rules. Only the response texts that have passed the screening and their corresponding inquiry texts will be placed in the text pool to achieve the expansion of the text pool.
[0077] Of course, the specific content of the preset text quality screening rules can be set and adjusted according to actual needs. For example, if it is used to implement a question-and-answer model for medical consultation, it is required to effectively filter out the reply texts that are not professional enough or irrelevant to medical knowledge. For example, in a specific situation, the quality of the reply text can be evaluated in multiple aspects to obtain a total evaluation score. When the total evaluation score obtained does not reach the score threshold, it can be determined that the reply text does not meet the preset text quality screening rules.
[0078] When evaluating the quality of the reply text, specific evaluation items can also be set according to actual needs. Still taking the question-and-answer model used to implement the medical consultation as an example, when setting the evaluation items in the text quality screening rules, for example, the number of medical keywords in the reply text can be searched. If the number is lower than a certain value, the reply text will not get a score on this evaluation item, otherwise it can get a score for this evaluation item. For another example, it can be judged whether the length of the reply text meets the length requirement. If it does not meet the length requirement, it means that the reply text is too short, then the reply text will not get a score on this evaluation item, otherwise it can get a score for this evaluation item. For another example, the number of words that are not related to medical care in the reply text can be searched. If the number is higher than a certain value, the reply text will not get a score on this evaluation item, otherwise it can get a score for this evaluation item. Which words are not related to medical care can be pre-set and adjusted according to actual needs.
[0079] Further, in a specific embodiment of the present invention, after generating multiple inquiry texts related to each inquiry text selected from the text pool by using a preset question-answer model in step S103, the following may also be included:
[0080] For each query text selected from the text pool, the overlap between each query text generated related to the query text and the query text is determined, and query texts related to the query text whose overlap is higher than a first threshold are discarded.
[0081] This implementation method takes into account that although the present application scheme filters the various response texts generated by the question-and-answer model based on preset text quality screening rules, this usually filters out low-quality response texts, and does not deal with situations where the overlap between inquiry texts is too high, or where the overlap between response texts is too high.
[0082] In this regard, in this implementation, still taking inquiry text A as an example, after generating multiple inquiry texts related to inquiry text A through the preset question-and-answer model, the generated inquiry texts may have a high degree of overlap with inquiry text A. If the overlap between the two inquiry texts is very high, the reply texts of the question-and-answer model for the two will also be generally similar. Generally similar reply texts do not contribute much to the expansion of the text pool. Therefore, this implementation takes into account that for such a situation, the inquiry text can be directly discarded, and there is no need to generate a reply text. That is, the overlap between each of the generated inquiry texts related to inquiry text A and inquiry text A will be determined. If the overlap between a certain inquiry text and inquiry text A is higher than the first threshold, the inquiry text will be directly discarded.
[0083] The specific value of the first threshold can be set as needed, for example, set to 0.7. The overlap between two inquiry texts, that is, the degree of similarity between the two, the larger the value, the more similar the two are. In addition, there can be many specific ways to measure the overlap between two inquiry texts. For example, a simple way is to convert each inquiry text into a vector, and then determine the overlap between the two vectors based on the cosine similarity between the vectors or other distance measurement methods, as the overlap between the corresponding two inquiry texts.
[0084] Further, in a specific embodiment of the present invention, after generating multiple inquiry texts related to each inquiry text selected from the text pool by using a preset question-answer model in step S103, the following may also be included:
[0085] For each query text selected from the text pool, determine whether there is a query text that cannot be processed by the question-answering model among the generated query texts related to the query text;
[0086] If so, the inquiry texts related to the inquiry text that cannot be processed by the question-answering model will be discarded.
[0087] This implementation also takes into account that the generated inquiry text may not be able to be processed by the question-answering model. If a certain inquiry text cannot be processed by the question-answering model, the generated reply text is likely to be a low-quality text. Therefore, in this implementation, if it is determined that there is an inquiry text that cannot be processed by the question-answering model, it can be directly discarded without generating a reply text based on it.
[0088] In addition, there are many ways to determine whether a query text cannot be processed by the question-answering model. For example, keyword detection can be performed. When words such as "images, pictures, and graphics" are involved, it means that the query text is likely to be unable to be processed by the question-answering model and can be discarded.
[0089] In a specific embodiment of the present invention, after the inquiry text and multiple inquiry texts related to the inquiry text are respectively input into the question-answering model, and each reply text generated by the question-answering model is obtained, the following may also be included:
[0090] De-duplicate the response texts generated by the question-answering model.
[0091] This implementation method takes into account that the reply texts generated by the question-answering model may have duplicate content. Therefore, the reply texts generated by the question-answering model can be deduplicated. In addition, it can be understood that when deduplicating reply texts, only one reply text with a high degree of overlap is retained, and the rest can be deleted. When a reply text needs to be deleted, the reply text and the inquiry text corresponding to the reply text can be deleted together.
[0092] In addition, there are many specific implementation methods for determining the overlap between different reply texts. For example, the overlap between different reply texts can be determined by checking for duplicate text. For another example, the principle of determining the overlap between two inquiry texts can be referred to above. After the reply text is converted into a vector, the overlap between the two vectors is determined based on the cosine similarity or other distance measurement methods between the vectors as the overlap between the corresponding reply texts.
[0093] Return to execute the operation of step S102 until the current text pool meets the preset requirements.
[0094] Usually, it is set that when the number of training instances in the text pool reaches a certain value, it is determined that the current text pool meets the preset requirements and is sufficient to support the training of the question-answering model. Of course, other requirements can also be set in other occasions, such as requiring the iteration round to meet a certain round requirement.
[0095] In addition, it should be noted that, as described above, a training instance includes an inquiry text and its corresponding reply text. When the text pool is expanded for the first time, the expansion of the text pool is achieved based on the inquiry text in the text pool initially obtained. When the text pool is expanded in subsequent rounds, when executing S102, after a certain inquiry text is selected, the text pool may already have a reply text corresponding to the inquiry text. Then, when executing step S103, the inquiry text does not need to be input into the question-answering model. It is only necessary to input multiple inquiry texts related to the inquiry text into the question-answering model respectively to obtain the corresponding reply texts. Of course, it is also possible to choose to continue to input the inquiry text and multiple inquiry texts related to the inquiry text into the question-answering model respectively to obtain the various reply texts generated by the question-answering model, which does not affect the implementation of the present invention.
[0096] Step S105: training the question-answering model based on the text pool.
[0097] When the text pool meets the preset requirements, the question-answering model can be trained. In this application, the question-answering model is fine-tuned, that is, the question-answering model has completed preliminary training and has basic question-answering capabilities. Fine-tuning the question-answering model through the text type of this application can effectively improve the professionalism of the question-answering model and improve its question-answering capabilities.
[0098] Step S106: receiving user questions and inputting them into the trained question-answering model to obtain the reply content output by the question-answering model.
[0099] After the question-answering model is trained, it can answer user questions, that is, it can receive user questions and provide feedback to the user on the responses to the user's questions.
[0100] In a specific embodiment of the present invention, when the question-answering model is a question-answering model for medical consultation, each inquiry text in the initial text pool may be an inquiry text for medical inquiry. Accordingly, it may also include:
[0101] Inputting the medical text file and the self-question-answering instruction into the question-answering model, so that the question-answering model generates a medical question based on the medical text file according to the requirements of the self-question-answering instruction, and generates a reply text for the medical question based on the medical text file, and places the generated medical question and reply text as a training instance into the text pool;
[0102] Among them, the sources of medical text files include medical books, medical encyclopedia knowledge, and medical assessment test questions.
[0103] In the above solution, the data generated by the question-answering model itself is used to expand the text pool, that is, the expansion of the text pool is achieved in a self-instruct manner. This implementation method further takes into account that when implementing a medical consultation based on a question-answering model, the professionalism of the question-answering model is particularly required. Therefore, it is also possible to inject unknown knowledge into the question-answering model, specifically by using self-QA (enhancing the machine's understanding of the text by generating questions and answering them by themselves).
[0104] Specifically, in this implementation mode, medical text files and self-question and answer instructions need to be input into the question and answer model. In order to ensure professionalism, the source of the medical text files should be more professional medical data sources such as medical books, medical encyclopedia knowledge, medical assessment test questions, and medication instructions.
[0105] After the medical text file and the self-question-answering instructions are input into the question-answering model, the question-answering model will analyze the medical text file according to the requirements of the self-question-answering instructions and generate medical questions. Then, based on the medical text file, the model will generate a reply text for the medical question. Finally, the generated medical question and reply text are placed in the text pool as a training instance.
[0106] For example, in one scenario, a training example is "What are the diagnostic examination methods for breast hyperplasia nodules? Breast hyperplasia nodules can be diagnosed through infrared thermal imaging, multiple fine needle aspiration cytology, B-ultrasound, mammography, etc." In this training example, "What are the diagnostic examination methods for breast hyperplasia nodules?" is the medical question generated by the question-answering model based on the medical text file, and the subsequent "Breast hyperplasia nodules can be diagnosed through infrared thermal imaging, multiple fine needle aspiration cytology, B-ultrasound, mammography, etc." is the response text generated by the question-answering model based on the medical text file for this medical question.
[0107] This implementation method is conducive to the question-answering model to have a deeper understanding of the content of medical text files, and because medical text files are a professional source of medical data, it can effectively improve the professionalism of the question-answering model and inject previously unknown knowledge into the question-answering model.
[0108] Furthermore, in a specific embodiment of the present invention, it may also include: determining whether the training instance meets the text quality screening rules; if so, placing the training instance in the text pool; if not, discarding the training instance. This embodiment further takes into account that, according to the above description, after generating medical questions based on medical text files and generating reply texts for medical questions based on medical text files, the training instance can also be quality evaluated, and for ease of operation, the text quality screening rules in step S104 can be directly used. If a training instance meets the text quality screening rules, it will be placed in the text pool, otherwise it will be discarded. The quality of the text pool is effectively guaranteed.
[0109] See also Figure 2 , is a schematic diagram of the principle of implementing the expansion of the text pool in a specific implementation method, in which the expansion of the text pool is implemented by using both self-instruct and self-QA methods. And the question-answering model is specifically used to implement the question-answering model of the medical consultation, so when generating the initial text pool, the basic data set is specifically the basic medical data set. And based on the medical text file, the text pool is expanded in a self-QA manner.
[0110] In a specific embodiment of the present invention, the basic data set is a basic medical data set, and the obtained initial text pool includes at least the first to seventh types of inquiry texts;
[0111] The content of the first type of inquiry text includes the corresponding relationship between the symptoms and the departments for which the symptoms are treated;
[0112] The content of the second type of inquiry text includes the correspondence between the disease and the typical symptoms of the disease;
[0113] The content of the third type of inquiry text includes medical record writing standards, and some of the third type of inquiry texts include sample medical record data;
[0114] The content of the fourth type of inquiry text includes the correspondence between the disease and the typical examination items of the disease;
[0115] The content of the fifth type of inquiry text includes the correspondence between the disease and the typical prescription for that disease;
[0116] The content of the sixth type of inquiry text includes the dialogue of the consultation process;
[0117] The content of the seventh type of inquiry text includes data on medical expertise.
[0118] Most of the traditional large medical models are used to process basic tasks such as imaging reports, triage and guidance, and cannot be integrated into the entire medical process to realize medical consultation, and are only proficient in certain aspects. In a specific embodiment of the present invention, when implementing medical consultation based on a question-and-answer model, in order to ensure that the question-and-answer model can realize comprehensive medical consultation, the basic medical data set obtained will include comprehensive inquiry text types, that is, it will include the above-mentioned seven types of inquiry texts, which will be conducive to training the inquiry of various aspects of the question-and-answer model and improving its proficiency in various aspects of medical consultation. Since the basic medical data set is used, it can be understood that in the initial text pool obtained based on the basic medical data set, each inquiry text is an inquiry text for inquiring about medical issues.
[0119] The content of the first type of inquiry text includes the correspondence between symptoms and the treatment department of the symptoms, which is used to register correctly during the consultation. The content of the second type of inquiry text includes the correspondence between the disease and the typical symptoms of the disease, which is used to quickly confirm the disease through the patient's symptoms during the consultation. The content of the third type of inquiry text includes medical record writing specifications, and some third-type inquiry texts include sample medical record data, which is used to generate medical records in a standardized manner after the consultation. The content of the fourth type of inquiry text includes the correspondence between the disease and the typical examination items of the disease, which is used to issue an examination form for diseases that cannot be diagnosed, and exclude suspicious diseases through examination results. The content of the fifth type of inquiry text includes the correspondence between the disease and the typical prescription of the disease, which is used to prescribe a standardized prescription after diagnosis. The content of the sixth type of inquiry text includes a dialogue of the consultation process, which is used to improve the dialogue ability during the training process, making the question-answering model more "humanized". The content of the seventh type of inquiry text includes data on medical professional skills, such as generating the seventh type of inquiry text based on common drug instructions, common examination items, basic medical knowledge, etc.
[0120] In a specific embodiment of the present invention, a user question is received and input into a trained question-answering model, and a reply content output by the question-answering model is obtained, including:
[0121] Receive user questions and input them into the trained question-answering model, and obtain initial responses to user questions through the question-answering model;
[0122] Determine whether the credibility of the initial response reaches a preset credibility threshold;
[0123] If yes, the initial response is used as the response content to the user's question output by the obtained question-answering model;
[0124] If not, generating search keywords based on the user question and searching the search keywords through a network search engine to obtain search results;
[0125] Input user questions and search results into the trained question-answering model to obtain the response content output by the question-answering model.
[0126] This implementation method takes into account that, especially during medical consultations, in addition to the normal reasoning process in the intelligent question-and-answer process, an additional search link can be added so that, on the basis of having strong reasoning capabilities, information from authoritative websites can be integrated to ensure the reliability of the medical consultation.
[0127] Specifically, after receiving the user's question, the question-answering model will obtain an initial response to the user's question, and then determine whether the credibility of the initial response reaches a preset credibility threshold. If it reaches the credibility threshold, it means that the credibility of the initial response is very high, and the initial response can be directly used as the response content for the user's question output by the obtained question-answering model, and then fed back to the user.
[0128] On the contrary, if the credibility of the initial reply is not very high, in order to ensure reliability, in this implementation, search keywords can be generated based on the user question, and then the search keywords can be searched through the network search engine. The user question and search results are then used as input to the question-answering model. The reply content output by the question-answering model can be fed back to the user.
[0129] The design of this implementation method is conducive to further improving the professionalism of the question-answering model. Figure 3 , which is a schematic diagram of the search principle of this implementation method. In addition, it should be noted that when judging the credibility of the initial reply, there can be multiple specific judgment methods. For example, you can refer to the text quality screening rules described above, conduct a quality assessment on the initial reply, and use the obtained quality assessment score as its credibility. Of course, specific quality assessment items can also be set and adjusted according to actual needs.
[0130] Applying the technical solution provided by the embodiment of the present invention, considering that the current question-answering model has poor instruction-following ability and cannot implement question-answering according to the preset instruction requirements, this application will generate a large number of high-quality inquiry texts and their reply texts, and train the question-answering model based on this, which is conducive to improving the instruction-following ability of the question-answering model. Specifically, a basic data set can be obtained as the initial text pool; wherein the text pool includes multiple inquiry texts, and each inquiry text is an inquiry text for question inquiry. Since it is impossible to directly and conveniently obtain a large number of inquiry texts, the present application solution will be expanded based on the question-answering model, that is, K inquiry texts can be selected from the text pool, and for each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text are generated by the preset question-answering model. The inquiry text and multiple inquiry texts related to the inquiry text are respectively input into the question-answering model, and each reply text generated by the question-answering model can be obtained. In order to ensure quality, this application will screen each reply text generated by the question-answering model based on the preset text quality screening rules, and place the screened reply texts and their corresponding inquiry texts into the text pool to expand the text pool. Then return to execute the operation of selecting K inquiry texts from the text pool until the current text pool meets the preset requirements. It can be seen that the present application scheme can automatically expand the text pool and ensure the high quality of the text pool, so that after the question-answering model is trained accordingly, the trained question-answering model has strong performance, that is, it has strong Chinese comprehension ability, professionalism, and strong instruction-following ability, so that when the question-answering model based on this application is used for question-answering, the reliability and professionalism of the question-answering can be effectively guaranteed.
[0131] Corresponding to the above method embodiment, the embodiment of the present invention further provides a question-answering system based on a question-answering model, which can be referred to in correspondence with the above.
[0132] See also Figure 4 FIG. 1 is a schematic diagram of a question-answering system based on a question-answering model in the present invention, comprising:
[0133] An initial text pool construction module 401 is used to obtain an initial text pool based on a basic data set; wherein the initial text pool includes a plurality of inquiry texts for question inquiry;
[0134] The seed query text selection module 402 selects K query texts from the text pool; K is a positive integer;
[0135] The expansion module 403 is used to generate multiple inquiry texts related to each inquiry text selected from the text pool through a preset question-answering model, and input the inquiry text and multiple inquiry texts related to the inquiry text into the question-answering model respectively to obtain each reply text generated by the question-answering model;
[0136] The text quality screening module 404 is used to screen the reply texts generated by the question-answering model based on the preset text quality screening rules, and put the filtered reply texts and their corresponding inquiry texts into the text pool to expand the text pool; return to trigger the seed inquiry text selection module until the current text pool meets the preset requirements;
[0137] A training module 405 is used to train a question-answering model based on a text pool;
[0138] The question-and-answer execution module 406 is used to receive user questions and input them into the trained question-and-answer model to obtain the reply content output by the question-and-answer model.
[0139] In a specific implementation of the present invention, a first inquiry text discarding module is further included, which is used to:
[0140] For each query text selected from the text pool, the overlap between each query text generated related to the query text and the query text is determined, and query texts related to the query text whose overlap is higher than a first threshold are discarded.
[0141] In a specific implementation of the present invention, a second inquiry text discarding module is further included, which is used to:
[0142] For each query text selected from the text pool, determine whether there is a query text that cannot be processed by the question-answering model among the generated query texts related to the query text;
[0143] If so, the inquiry texts related to the inquiry text that cannot be processed by the question-answering model will be discarded.
[0144] In a specific embodiment of the present invention, a reply text deduplication module is also included, which is used to:
[0145] De-duplicate the response texts generated by the question-answering model.
[0146] In a specific embodiment of the present invention, each inquiry text in the initial text pool is an inquiry text for inquiring about a medical problem, and also includes a knowledge injection module for:
[0147] Inputting the medical text file and the self-question-answering instruction into the question-answering model, so that the question-answering model generates a medical question based on the medical text file according to the requirements of the self-question-answering instruction, and generates a reply text for the medical question based on the medical text file, and places the generated medical question and reply text as a training instance into the text pool;
[0148] Among them, the sources of medical text files include medical books, medical encyclopedia knowledge, and medical assessment test questions.
[0149] In a specific embodiment of the present invention, the basic data set is a basic medical data set, and the obtained initial text pool includes at least the first to seventh types of inquiry texts;
[0150] The content of the first type of inquiry text includes the corresponding relationship between the symptoms and the departments for which the symptoms are treated;
[0151] The content of the second type of inquiry text includes the correspondence between the disease and the typical symptoms of the disease;
[0152] The content of the third type of inquiry text includes medical record writing standards, and some of the third type of inquiry texts include sample medical record data;
[0153] The content of the fourth type of inquiry text includes the correspondence between the disease and the typical examination items of the disease;
[0154] The content of the fifth type of inquiry text includes the correspondence between the disease and the typical prescription for that disease;
[0155] The content of the sixth type of inquiry text includes the dialogue of the consultation process;
[0156] The content of the seventh type of inquiry text includes data on medical professional skills.
[0157] In a specific implementation of the present invention, the question-answer execution module 406 is specifically used to:
[0158] Receive user questions and input them into the trained question-answering model, and obtain initial responses to user questions through the question-answering model;
[0159] Determine whether the credibility of the initial response reaches a preset credibility threshold;
[0160] If yes, the initial response is used as the response content to the user's question output by the obtained question-answering model;
[0161] If not, generating search keywords based on the user question and searching the search keywords through a network search engine to obtain search results;
[0162] Input user questions and search results into the trained question-answering model to obtain the response content output by the question-answering model.
[0163] Corresponding to the above method and system embodiments, an embodiment of the present invention further provides a question-answering device of a question-answering model, a computer-readable storage medium, and a computer program product, which can be referred to in correspondence with the above.
[0164] See also Figure 5 As shown, the device may include:
[0165] Memory 501, used for storing computer programs;
[0166] The processor 502 is used to execute a computer program to implement the steps of the question-answering method of the question-answering model in any of the above embodiments.
[0167] The computer program product includes a computer program / instruction, which, when executed by a processor, implements the steps of the question-answering method of the question-answering model in any of the above embodiments.
[0168] See also Figure 6 The computer readable storage medium 60 stores a computer program 61, and when the computer program 61 is executed by the processor, the steps of the question-answering method of the question-answering model in any of the above-mentioned embodiments are implemented. The computer readable storage medium 60 mentioned here includes RAM (Random Access Memory), memory, ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), register, hard disk, removable disk, or any other form of storage medium known in the technical field.
[0169] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0170] Professionals may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention, and the description of the above embodiments is only used to help understand the technical solution and its core idea of the present invention. It should be pointed out that for ordinary technicians in the technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A question-answering method based on a question-answering model, characterized in that: include: Based on the basic data set, an initial text pool is obtained; wherein the initial text pool includes a plurality of inquiry texts for question inquiry; Select K query texts from the text pool; K is a positive integer; For each of the inquiry texts selected from the text pool, a plurality of inquiry texts related to the inquiry text are generated by a preset question-answering model, and the inquiry text and a plurality of inquiry texts related to the inquiry text are respectively input into the question-answering model to obtain respective reply texts generated by the question-answering model; Based on the preset text quality screening rules, each reply text generated by the question-answering model is screened, and the screened reply text and its corresponding inquiry text are placed in the text pool to expand the text pool; Return to executing the operation of selecting K query texts from the text pool until the current text pool meets the preset requirements; Training the question-answering model based on the text pool; Receive user questions and input them into the trained question-answering model to obtain the reply content output by the question-answering model.
2. The question-answering method based on the question-answering model according to claim 1, characterized in that: For each of the inquiry texts selected from the text pool, after a plurality of inquiry texts related to the inquiry text are generated by a preset question-answering model, the method further includes: For each of the query texts selected from the text pool, the overlap between each of the generated query texts related to the query text and the query text is determined, and query texts related to the query text whose overlap is higher than a first threshold are discarded.
3. The question-answering method based on the question-answering model according to claim 2, characterized in that: For each of the inquiry texts selected from the text pool, after a plurality of inquiry texts related to the inquiry text are generated by a preset question-answering model, the method further includes: For each of the inquiry texts selected from the text pool, determining whether there is an inquiry text that cannot be processed by the question-answering model among the generated inquiry texts related to the inquiry text; If so, the inquiry texts related to the inquiry text that cannot be processed by the question-answering model will be discarded.
4. The question-answering method based on the question-answering model according to claim 1, characterized in that: After the inquiry text and multiple inquiry texts related to the inquiry text are respectively input into the question-answering model to obtain each reply text generated by the question-answering model, the method further includes: De-duplicate each reply text generated by the question-answering model.
5. The question-answering method based on the question-answering model according to claim 1, characterized in that: Each inquiry text in the initial text pool is an inquiry text for inquiring about medical issues. The question-answering method based on the question-answering model also includes: Inputting a medical text file and a self-question-and-answer instruction into the question-and-answer model, so that the question-and-answer model generates a medical question based on the medical text file and generates a reply text for the medical question based on the medical text file according to the requirements of the self-question-and-answer instruction, and placing the generated medical question and the reply text as a training instance into the text pool; The sources of the medical text files include medical books, medical encyclopedia knowledge, and medical assessment test questions.
6. The question-answering method based on the question-answering model according to any one of claims 1 to 5, characterized in that: The basic data set is a basic medical data set, and the obtained initial text pool includes at least the first to seventh types of inquiry texts; The content of the first type of inquiry text includes the corresponding relationship between the symptoms and the departments for which the symptoms are treated; The content of the second type of inquiry text includes the correspondence between the disease and the typical symptoms of the disease; The content of the third type of inquiry text includes medical record writing standards, and some of the third type of inquiry texts include sample medical record data; The content of the fourth type of inquiry text includes the correspondence between the disease and the typical examination items of the disease; The content of the fifth type of inquiry text includes the correspondence between the disease and the typical prescription for that disease; The content of the sixth type of inquiry text includes the dialogue of the consultation process; The content of the seventh type of inquiry text includes data on medical expertise.
7. The question-answering method based on the question-answering model according to any one of claims 1 to 5, characterized in that: Receive user questions and input them into the trained question-answering model, and obtain the reply content output by the question-answering model, including: Receive user questions and input them into the trained question-answering model, and obtain an initial response to the user questions through the question-answering model; Determining whether the credibility of the initial response reaches a preset credibility threshold; If yes, the initial reply is used as the reply content for the user's question output by the obtained question-answering model; If not, generating a search keyword based on the user question and searching the search keyword through a network search engine to obtain search results; The user question and the search result are input into the trained question-answering model to obtain the reply content output by the question-answering model.
8. A question-answering system based on a question-answering model, characterized in that: include: An initial text pool construction module is used to obtain an initial text pool based on a basic data set; wherein the initial text pool includes a plurality of inquiry texts for question inquiry; A seed query text selection module selects K query texts from the text pool; K is a positive integer; An extension module, for generating, for each of the inquiry texts selected from the text pool, multiple inquiry texts related to the inquiry text through a preset question-answering model, and inputting the inquiry text and multiple inquiry texts related to the inquiry text into the question-answering model respectively to obtain respective reply texts generated by the question-answering model; A text quality screening module is used to screen the response texts generated by the question-answering model based on preset text quality screening rules, and place the screened response texts and their corresponding inquiry texts into the text pool to expand the text pool; return to trigger the seed inquiry text selection module until the current text pool meets the preset requirements; A training module, used for training the question-answering model based on the text pool; The question-answering execution module is used to receive user questions and input them into the trained question-answering model to obtain the reply content output by the question-answering model.
9. A question-answering device based on a question-answering model, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the question-answering method based on the question-answering model as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the question-answering method based on the question-answering model as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Artificial intelligence question and answer model generation method, question and answer method and device and storage medium
CN114896382A
Trusted question and answer method and system, electronic equipment and medium
CN117194623A
Question and answer method and device, equipment, medium and product
CN117216210A
Question and answer pair generation method and system, electronic equipment and storage medium
CN117271736A
Intelligent question and answer method and system for industry
CN117520524A