Question-answering method, system, device and storage medium based on question-answering model
By generating and screening inquiry texts to expand the text pool and combining them with medical data to train the question-answering model, the problems of insufficient instruction compliance and Chinese comprehension ability of the question-answering model were solved, and the quality and reliability of question-answering were improved.
Patent Information
- Application Number
- CN202411380161.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-09-30
AI Technical Summary
Existing question-answering models have deficiencies in their ability to follow instructions and understand Chinese, making it difficult to effectively meet user needs. In addition, the cost of acquiring datasets is high and the quality is difficult to guarantee.
By generating multiple inquiry texts related to the initial inquiry text and screening them based on preset text quality screening rules, the text pool is expanded, and training is combined with medical text files and self-questioning instructions to improve the professionalism and instruction-compliance ability of the question-answering model.
The question-answering model has strong Chinese comprehension capabilities and professionalism, which can effectively ensure the reliability and professionalism of question-answering and improve the quality of question-answering.
Smart Images

Figure CN119293176B_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] Currently, there are many large models available for question answering on the market, but they face various problems in practical application. For example, they have poor command-following capabilities and are unable to meet user needs according to preset instructions. Another example is that they lack professionalism in some aspects. In addition, most current question answering models have poor understanding of Chinese, and the Chinese datasets they use are mostly obtained from the Internet. This acquisition process is not only labor-intensive, material-intensive, and financially demanding, but also difficult to ensure quality, making it difficult to effectively improve the performance of question answering models.
[0003] To sum up, 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 inquiries;
[0008] Select K query texts from the text pool; K is a positive integer;
[0009] For each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text are generated by 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;
[0010] Based on preset text quality screening rules, each reply text generated by the question-answering model is screened, and the screened reply texts and their corresponding inquiry texts are placed in the text pool to expand the text pool;
[0011] Returning 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 query text selected from the text pool, after generating multiple query texts related to the query text through a preset question-answering model, the method further includes:
[0015] For each query text selected from the text pool, the overlap between each query text generated 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 query text selected from the text pool, after generating multiple query texts related to the query text through a preset question-answering model, the method further includes:
[0017] For each query text selected from the text pool, determining 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;
[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 the response texts generated by the question-answering model, the method further includes:
[0020] De-duplicate the response texts generated by the question-answering model.
[0021] On the other hand, each inquiry text in the initial text pool is an inquiry text for medical questions. 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 to the medical question based on the medical text file in accordance with the requirements of the self-question-and-answer instruction, and placing the generated medical question and 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 symptoms and the medical departments for the symptoms;
[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 third type of inquiry text includes medical record writing standards, and some third type of inquiry texts include sample medical record data;
[0028] 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 the response 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 question output by the obtained question-answering model;
[0036] If not, generating a search keyword based on the user question and searching for the search keyword through a network search engine to obtain search results;
[0037] The user question and the search results 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 inquiries;
[0040] A seed query text selection module selects K query texts from the text pool; K is a positive integer;
[0041] An expansion module is configured to generate, for each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text using 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 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 query texts into the text pool to expand the text pool; return to trigger the seed query text selection module until the current text pool meets the preset requirements;
[0043] A training module, configured to train 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 solution of this application 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 the multiple inquiry texts related to the inquiry text are respectively input into the question-answering model, and the various reply texts generated by the question-answering model can be obtained. In order to ensure quality, this application will screen the various reply texts generated by the question-answering model based on the preset text quality screening rules, and place the filtered reply texts and their corresponding inquiry texts into the text pool to expand the text pool. After that, it returns 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 solution can automatically expand the text pool and ensure the high quality of the text pool, so that after the question-answering model is trained based on this, 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 following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 any 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 embodiment of the present invention;
[0053] Figure 3 A schematic diagram of the search principle in a specific embodiment of the present invention;
[0054] Figure 4A schematic diagram of the structure of a question-answering system based on a question-answering model provided in one 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 in one embodiment of the present invention;
[0056] Figure 6 This is a schematic structural diagram of a computer-readable storage medium of the present invention. 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 based on this, the trained question-answering model has strong performance, that is, it has strong Chinese comprehension ability, professionalism, and strong instruction-following ability, thereby effectively ensuring the reliability and professionalism of the question-answering when question-answering based on the question-answering model of this application.
[0058] To help those skilled in the art better understand the present invention, the present invention is further described below in conjunction with the accompanying drawings and specific embodiments. It is apparent that the embodiments described are only a portion of the present invention, not all of the embodiments. All other embodiments derived by those skilled in the art based on the embodiments of the present invention without inventive effort are also within the scope of protection of the present invention.
[0059] Please refer to Figure 1 , Figure 1 This is a flowchart of an implementation 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] Basic data sets can be obtained from the Internet, books, etc., but it should be noted that compared with the quantity of text, the quality of text is more important for the training of question-answering models. Therefore, when obtaining basic data sets and obtaining the initial text pool, high-quality basic data sets should be obtained, and then the initial text pool should be obtained based on this.
[0062] The initial text pool consists of multiple query texts, each of which asks a question. For example, a query text might be "I've been feeling tired and low on energy lately. Could this be an early symptom of anemia?" For the sake of convenience, this query text will be referred to as query text A.
[0063] Based on the basic dataset, generating an initial text pool can be accomplished in a variety of ways. For example, the basic dataset can be fed into a question-answering model, which can then be instructed to extract multiple query texts. Furthermore, to ensure quality, staff can verify and delete queries from the initial text pool that contain grammatical errors, unclear meaning, or illogical problems. Of course, staff can also directly write or modify query texts into the text pool based on the basic dataset, allowing staff to directly define query texts.
[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 actual applications, in order to effectively expand the text pool and ensure 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 various reply texts generated by the question-answering model.
[0067] It should be noted that the specific type of the question-answering model of this 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 this 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 illustration using the medical question-and-answer field as an example.
[0069] It's also worth noting that while many traditional medical big-box models exist for question-and-answering, most are designed only for basic tasks like processing imaging reports and triage and guidance. They can't be integrated into the entire medical process to enable comprehensive consultations. Furthermore, they face various practical challenges. For example, while medical capabilities may be sufficient, their ability to follow instructions is poor, making it impossible to implement intelligent medical care according to pre-set instructions. Another example is a lack of medical expertise. Furthermore, most current medical big-box models have limited understanding of Chinese, and the Chinese medical datasets they use are mostly obtained online. This acquisition process is not only labor-intensive, material-intensive, and financially demanding, but also difficult to ensure quality, making it difficult to effectively improve the performance of question-and-answer models.
[0070] In this application, a large number of high-quality inquiry texts and their responses are generated, and the question-answering model is trained based on them. The trained question-answering model has strong performance, that is, it has strong Chinese comprehension ability, medical expertise, and strong instruction-following ability. Therefore, the question-answering model based on this application can effectively realize medical consultation.
[0071] For each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text will be generated by the question-answering model. For example, a certain inquiry text selected from the text pool is the inquiry text A mentioned above, "I have been feeling tired and in a bad mental state recently. Could this be an early symptom of anemia?" After inputting the inquiry text into the question-answering model and inputting a prompt such as "Please generate multiple inquiry texts related to this", the question-answering model will generate multiple inquiry texts related to the inquiry text. These generated inquiry texts may be related to anemia, fatigue, or related to inquiry text A in other aspects.
[0072] For example, if a preset question-answering model generates 20 query texts related to query text A, then query text A and the 20 query texts related to query text A can be input into the question-answering model to obtain the response texts generated by the question-answering model. In this example, the question-answering model will generate 21 corresponding response texts for these 21 query 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 to first generate multiple inquiry texts related to the inquiry text through the question-answering model, and then obtain each reply text through the question-answering model.
[0074] For example, after query text A is input into the question-answering model, the response 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 confirm the diagnosis." Then, query text A and the response text corresponding to 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 filtered reply text and its corresponding inquiry text are placed in the text pool to expand the text pool.
[0076] In this application, considering the varying quality of the response texts, to ensure the quality of the text pool, each response text generated by the question-answering model is screened based on preset text quality screening rules. Only response texts that pass the screening and their corresponding query texts are added to the text pool, thus expanding 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 a question-and-answer model is used to implement a medical consultation, it will be required to effectively filter out responses that are not professional or irrelevant to medical knowledge. For example, in a specific scenario, the quality of the response text can be evaluated based on multiple aspects to obtain an overall evaluation score. If the total evaluation score does not reach the score threshold, it can be determined that the response text does not meet the preset text quality screening rules.
[0078] When evaluating the quality of a response text, specific evaluation criteria can also be set based on actual needs. Still using the question-and-answer model used to implement medical consultations as an example, when setting evaluation criteria in text quality screening rules, one could, for example, search for the number of medical keywords in a response text. If this number is below a certain value, the response text will not receive a score for this evaluation criterion; otherwise, it will receive a score for this evaluation criterion. Another example could be determining whether the length of a response text meets a length requirement. If it does not, indicating that the response text is too short, the response text will not receive a score for this evaluation criterion; otherwise, it will receive a score for this evaluation criterion. Another example could be searching for the number of non-medical related words in a response text. If this number is above a certain value, the response text will not receive a score for this evaluation criterion; otherwise, it will receive a score for this evaluation criterion. The specific non-medical related words can be pre-set and adjusted based on actual needs.
[0079] Furthermore, in a specific embodiment of the present invention, after generating multiple query texts related to each query text selected from the text pool using a preset question-answering model in step S103, the following steps 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 exceeds a first threshold are discarded.
[0081] This implementation method takes into account that although the present application scheme filters the various reply texts generated by the question-answering model based on preset text quality screening rules, this usually filters out low-quality reply texts and does not deal with situations where the overlap between the inquiry texts is too high or the overlap between the reply texts is too high.
[0082] In this regard, in this implementation, still taking the inquiry text A as an example, after generating multiple inquiry texts related to the inquiry text A through the preset question-answering model, the generated inquiry texts may have a high degree of overlap with the inquiry text A. If the overlap between the two inquiry texts is very high, the reply texts of the question-answering model for the two will also be roughly similar. Roughly similar reply texts do not contribute much to the expansion of the text pool. Therefore, this implementation takes into account that in such a situation, the inquiry text can be directly discarded, and there is no need to generate a reply text. That is, the degree of overlap between each of the generated inquiry texts related to the inquiry text A and the inquiry text A will be determined. If the overlap between a certain inquiry text and the 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, it can be set to 0.7. The degree of 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 are many specific ways to measure the degree of overlap between two inquiry texts. For example, a simple way is to convert each inquiry text into a vector, and then determine the degree of overlap between the two vectors based on the cosine similarity between the vectors or other distance measurement methods, as the corresponding degree of overlap between the two inquiry texts.
[0084] Furthermore, in a specific embodiment of the present invention, after generating multiple query texts related to each query text selected from the text pool using a preset question-answering model in step S103, the following steps may also be included:
[0085] For each query text selected from the text pool, determine whether there is any 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 query texts related to the query text that cannot be processed by the question-answering model will be discarded.
[0087] This implementation also takes into account that some of the generated inquiry texts may not 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 discarded directly 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 "image, picture, and graphic" are involved, it means that the query text is likely 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 steps may be further 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 contain duplicate content. Therefore, it is possible to deduplicate the reply texts generated by the question-answering model. In addition, it is understandable 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 example, the principle of determining the overlap between two inquiry texts can be referred to above. After converting the reply text into a vector, the overlap between the two vectors can be 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 executing step S102 until the current text pool meets the preset requirements.
[0094] Typically, the pool is considered sufficient to train the question-answering model when the number of training instances in the pool reaches a certain value. Other requirements can be set, such as requiring a certain number of iterations.
[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. And when the text pool is expanded in subsequent rounds, when executing S102, after selecting a certain inquiry text, 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 corresponding reply texts. Of course, you can also 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 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: Receive user questions and input them into the trained question-answering model to obtain the response 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 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 can be an inquiry text for medical questions. Accordingly, it can 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 text pool is expanded using data generated by the question-answering model itself, i.e., it is achieved in a self-instruct manner. This implementation further considers that when implementing a medical consultation based on a question-answering model, the model's professionalism is particularly required. Therefore, it is also possible to inject unknown knowledge into the question-answering model, specifically through the use of self-QA (enhancing the machine's understanding of text by generating questions and answering them automatically).
[0104] Specifically, in this implementation, medical text files and self-questioning instructions need to be input into the question-answering model. To ensure professionalism, the source of the medical text files should be more professional medical data sources such as medical books, medical encyclopedias, medical assessment questions, and medication instructions.
[0105] After a medical text document and self-questioning instructions are input into the question-answering model, the model analyzes the document according to the instructions and generates a medical question. Based on this document, the model then generates a response to the question. Finally, the generated medical question and response are placed into the text pool as a training example.
[0106] For example, in one scenario, a training example was "What are the diagnostic examination methods for breast hyperplasia nodules? Breast hyperplasia nodules can be diagnosed through infrared thermography, 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. The subsequent "Breast hyperplasia nodules can be diagnosed through infrared thermography, 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.
[0107] This implementation method helps the question-answering model to have a deeper understanding of the content of medical text files. Since 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: judging 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 the convenience 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 Figure 2 Figure 1 is a schematic diagram illustrating the principle of expanding the text pool in a specific implementation. This implementation utilizes both self-instruction and self-QA methods to achieve this expansion. The question-answering model is specifically used to implement a medical consultation. Therefore, when generating the initial text pool, the base dataset is specifically a basic medical dataset. Furthermore, the text pool is expanded using self-QA, based on medical text files.
[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 first type of inquiry text includes the corresponding relationship between symptoms and the medical departments for these symptoms;
[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 third type of inquiry text includes medical record writing standards, and some third type of inquiry texts include sample medical record data;
[0114] 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 professional skills.
[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 the question-answering model, in order to ensure that the question-answering 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 seven types of inquiry texts, which will be conducive to training the inquiry of various aspects of the question-answering 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 problems.
[0119] The first type of inquiry text includes the correspondence between symptoms and the appropriate medical departments for those symptoms, which is used to ensure accurate registration during consultation. The second type of inquiry text includes the correspondence between diseases and their typical symptoms, which is used to quickly confirm the disease based on the patient's symptoms during the consultation. The third type of inquiry text includes medical record writing standards, and some third type of inquiry texts include sample medical record data, which is used to generate standardized medical records after the consultation. The fourth type of inquiry text includes the correspondence between diseases and typical examination items for those diseases, which is used to prescribe examination orders for undiagnosed diseases and rule out suspected diseases based on examination results. The fifth type of inquiry text includes the correspondence between diseases and typical prescriptions for those diseases, which is used to prescribe standardized prescriptions after a diagnosis is confirmed. The sixth type of inquiry text includes dialogue about the consultation process, which is used to improve dialogue capabilities during training and make the question-answering model more "humanized." The seventh type of inquiry text includes data on medical professional skills, for example, generated based on common medication instructions, common examination items, and basic medical knowledge.
[0120] In a specific embodiment of the present invention, a user question is received and input into a trained question-answering model, and the response 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 the initial response to the user's questions through the question-answering model;
[0122] Determining 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 the user's 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 a user's question, the Q&A model generates an initial response to the user's question and then determines whether the credibility of the initial response meets a preset credibility threshold. If so, the initial response is highly credible and can be directly used as the response to the user's question output by the Q&A model, which is 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. It should also be noted that there are multiple specific ways to determine the credibility of the initial reply. For example, the quality of the initial reply can be evaluated by referring to the text quality screening rules described above, and the resulting quality assessment score is used as its credibility. Of course, the 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 solution of this application 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 the multiple inquiry texts related to the inquiry text are respectively input into the question-answering model, and the various reply texts generated by the question-answering model can be obtained. In order to ensure quality, this application will screen the various reply texts generated by the question-answering model based on the preset text quality screening rules, and place the filtered reply texts and their corresponding inquiry texts into the text pool to expand the text pool. After that, it returns 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 solution can automatically expand the text pool and ensure the high quality of the text pool, so that after the question-answering model is trained based on this, 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, an 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 the structure of a question-answering system based on a question-answering model in the present invention, comprising:
[0133] The initial text pool construction module 401 is used to obtain an initial text pool based on the basic data set; wherein the initial text pool includes a plurality of inquiry texts for question inquiries;
[0134] The seed query text selection module 402 selects K query texts from the text pool; K is a positive integer;
[0135] Extension module 403 is configured to generate, for each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text using a preset question-answering model, and input the inquiry text and multiple inquiry texts related to the inquiry text into the question-answering model to obtain respective response texts generated by the question-answering model;
[0136] The text quality screening module 404 is used to screen the response texts generated by the question-answering model based on preset text quality screening rules, and place the filtered response texts and their corresponding query texts into the text pool to expand the text pool; and return to trigger the seed query 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-answering execution module 406 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.
[0139] In a specific embodiment 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 and the query text is determined, and query texts related to the query text whose overlap exceeds a first threshold are discarded.
[0141] In a specific embodiment 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 any 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 query texts related to the query 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 further 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 further 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 first type of inquiry text includes the corresponding relationship between symptoms and the medical departments for these symptoms;
[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 third type of inquiry text includes medical record writing standards, and some third type of inquiry texts include sample medical record data;
[0153] 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 embodiment of the present invention, the question-answer execution module 406 is specifically configured to:
[0158] Receive user questions and input them into the trained question-answering model, and obtain the initial response to the user's questions through the question-answering model;
[0159] Determining 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 the user's 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 configured 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 Figure 6 The computer-readable storage medium 60 stores a computer program 61. When executed by a processor, the computer program 61 implements the steps of the question-answering method of the question-answering model in any of the above-mentioned embodiments. The computer-readable storage medium 60 mentioned here includes RAM (Random Access Memory), internal memory, ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), registers, hard disks, removable disks, or any other form of storage medium known in the art.
[0169] It should also be noted that, in this document, relational terms such as first and second, etc., are used only 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 "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0170] Professionals may further appreciate 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 terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians 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. The description of the above embodiments is only used to help understand the technical solution and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles 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 inquiries; Select K query texts from the text pool; K is a positive integer; For each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text are generated by 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; Based on preset text quality screening rules, each reply text generated by the question-answering model is screened, and the screened reply texts and their corresponding inquiry texts are placed in the text pool to expand the text pool; Returning 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, and obtain the response content output by the question-answering model; For each query text selected from the text pool, after generating multiple query texts related to the query text through a preset question-answering model, the method further includes: For each query text selected from the text pool, determining the degree of overlap between each query text generated and the query text, and discarding query texts related to the query text whose overlap is greater than a first threshold; After 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, the method further includes: Deduplication of each reply text generated by the question-answering model; Each inquiry text in the initial text pool is an inquiry text for a medical question. 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 to the medical question based on the medical text file in accordance with the requirements of the self-question-and-answer instruction, and placing the generated medical question and 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.
2. The question-answering method based on the question-answering model according to claim 1, characterized in that: For each query text selected from the text pool, after generating multiple query texts related to the query text through a preset question-answering model, the method further includes: For each query text selected from the text pool, determining 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; If so, the inquiry texts related to the inquiry text that cannot be processed by the question-answering model will be discarded.
3. The question-answering method based on the question-answering model according to claim 1 or 2, 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 symptoms and the medical departments for the symptoms; The content of the second type of inquiry text includes the correspondence between the disease and the typical symptoms of the disease; The third type of inquiry text includes medical record writing standards, and some third type of inquiry texts include sample medical record data; 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.
4. The question-answering method based on the question-answering model according to claim 1 or 2, characterized in that: Receive user questions and input them into the trained question-answering model, and obtain the response 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 question output by the obtained question-answering model; If not, generating a search keyword based on the user question and searching for the search keyword through a network search engine to obtain search results; The user question and the search results are input into the trained question-answering model to obtain the reply content output by the question-answering model.
5. 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 inquiries; A seed query text selection module selects K query texts from the text pool; K is a positive integer; An expansion module is configured to generate, for each inquiry text selected from the text pool, multiple inquiry texts related to the inquiry text using 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 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 query texts into the text pool to expand the text pool; return to trigger the seed query text selection module until the current text pool meets the preset requirements; A training module, configured to train the question-answering model based on the text pool; A question-answering execution module, configured to receive user questions and input them into the trained question-answering model, and obtain the response content output by the question-answering model; It also includes a first inquiry text discarding module for: For each query text selected from the text pool, determining the degree of overlap between each query text generated and the query text, and discarding query texts related to the query text whose overlap exceeds a first threshold; Also includes a reply text deduplication module for: De-duplicate the response texts generated by the question-answering model; 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 further includes a knowledge injection module for: 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; Among them, the sources of medical text files include medical books, medical encyclopedia knowledge, and medical assessment test questions.
6. 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 4.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the question-answering method based on the question-answering model as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Question and answer pair generation method and system, electronic equipment and storage medium
CN117271736A
Text expansion method and device, storage medium and computer program product
CN118503715A