Answer determination method, model training method, device and electronic equipment

By combining the PDCA cycle and the reading comprehension model, using question vectors to match knowledge vectors in the knowledge base, the problem of low information screening efficiency in project target management is solved, efficient and accurate answer determination is achieved, and project management efficiency is improved.

CN117290483BActive Publication Date: 2024-08-30CHENGDU MINGTU TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311301437.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-09
Publication Date
2024-08-30
Estimated Expiration
2043-10-09

AI Technical Summary

Technical Problem

In the process of project goal management, it is necessary to filter out the required information from a large amount of complicated project materials, which is time-consuming and labor-intensive and affects the advancement and development of the project.

Method used

The PDCA cycle is combined with the reading comprehension model. By obtaining the question vector and matching it with the knowledge vector in the knowledge base, the pre-trained reading comprehension model is used to determine the answer from the text to improve the efficiency of information screening.

Benefits of technology

It achieves efficient and accurate determination of answers from text based on questions entered by users, reduces information screening time, and improves the efficiency of project management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117290483B
    Figure CN117290483B
Patent Text Reader

Abstract

The present application provides an answer determination method, a model training method, a device and an electronic device, wherein the answer determination method comprises: obtaining a question; determining the relevant paragraphs corresponding to the question from a knowledge base; inputting the question and the relevant paragraphs into a reading comprehension model, and determining the answer to the question from the relevant paragraphs through the reading comprehension model; wherein the reading comprehension model is trained using sample questions, sample relevant paragraphs and the marking results corresponding to the sample relevant paragraphs as model training samples, and the marking results are determined by marking the sample relevant paragraphs according to the PDCA cycle, and the marking results include: planning labels, execution labels, inspection labels and processing labels. The answer determination method performs PDCA annotation on the text, thereby efficiently and accurately determining the answer from the text according to the question input by the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and specifically, to an answer determination method, a model training method, a device and an electronic device. Background Art

[0002] With the increasing growth of big data and the increasing complexity of project goal management, there is a large amount of information in the process of project goal management. When staff conduct project goal management, they need to read various long project materials and filter out the required information from the huge and complicated project materials, which is time-consuming and labor-intensive, and is not conducive to the advancement and development of the project. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide an answer determination method, a model training method, a device and an electronic device, which are used to efficiently and accurately determine the answer from the text based on the question input by the user.

[0004] In a first aspect, the present application provides an answer determination method, comprising: obtaining a question; determining the relevant paragraphs corresponding to the question from a knowledge base; inputting the question and the relevant paragraphs into a reading comprehension model, and determining the answer to the question from the relevant paragraphs through the reading comprehension model; wherein the reading comprehension model is trained using sample questions, sample relevant paragraphs and marked results corresponding to the sample relevant paragraphs as model training samples, and the marked results are determined by marking the sample relevant paragraphs according to the PDCA cycle, and the marked results include: planning labels, execution labels, inspection labels and processing labels.

[0005] In an embodiment of the present application, the reading comprehension model adopted is obtained by training with sample questions, sample-related paragraphs and marked results corresponding to the sample-related paragraphs as model training samples. The marked results are determined by marking the sample-related paragraphs according to the PDCA cycle. The PDCA cycle is combined with the reading comprehension model. The PDCA cycle can enable the reading comprehension model to better learn the relationship between sample questions, sample-related paragraphs and marked results, so that the reading comprehension model can more efficiently and accurately determine the answer from the text according to the question input by the user.

[0006] In an optional embodiment, determining the relevant paragraph corresponding to the question from the knowledge base includes: encoding the question to obtain a question vector; matching the question vector with the knowledge vector in the knowledge base to determine the knowledge vector; wherein the text paragraph corresponding to the knowledge vector is the relevant paragraph; accordingly, inputting the question and the relevant paragraph into a trained reading comprehension model, and determining the answer to the question from the relevant paragraph through the reading comprehension model includes: inputting the question vector and the knowledge vector into a trained reading comprehension model, and determining the answer to the question from the knowledge vector through the reading comprehension model.

[0007] In the embodiment of the present application, the question is usually a natural language text. Since the efficiency of matching natural language text is low, the question encoding in the form of natural language text is converted into a question vector through the above method to improve the efficiency of determining relevant paragraphs from the knowledge base. In addition, since the efficiency of the reading comprehension model in processing natural language text is low, using the question vector and the knowledge vector as the input of the reading comprehension model can effectively improve the processing efficiency of the reading comprehension model.

[0008] In an optional embodiment, before determining the relevant paragraphs corresponding to the question from the knowledge base, the method also includes: obtaining a data document; segmenting the data document to determine a plurality of paragraphs; encoding the plurality of paragraphs to obtain a plurality of knowledge vectors, and storing the plurality of knowledge vectors in the knowledge base.

[0009] In an embodiment of the present application, when a user needs to determine information from a data document, the data document is configured into the knowledge base in the above manner. When the user asks a question related to the data document, a knowledge vector with a higher similarity can be determined from the knowledge base, so that a subsequent reading comprehension model can generate a more accurate answer based on the knowledge vector with a higher similarity.

[0010] In an optional embodiment, the reading comprehension model is trained by the following steps:

[0011] Obtain a first sample-related paragraph for training the reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to a PDCA cycle; input the first sample-related paragraph and the first marking result into a question generation model, and generate a first sample question corresponding to the first sample-related paragraph through the question generation model; train a neural network model according to the first sample question, the first sample-related paragraph and the first marking result to obtain the reading comprehension model.

[0012] In the embodiment of the present application, since a large amount of training data is required to train the reading comprehension model, the first sample related paragraph and the first marked result can be directly extracted from the sample document. However, the first sample question usually needs to be manually determined based on the first sample related paragraph and the first marked result, which results in a large amount of manpower and material resources being consumed when preparing the training data required for training the reading comprehension model. Therefore, by training the question generation model, the question generation model directly outputs the first sample question based on the input first sample related paragraph and the first marked result, thereby improving the efficiency of obtaining training data for training the reading comprehension model.

[0013] In an optional embodiment, before obtaining the sample-related paragraphs for model training, the method further includes: obtaining a second sample-related paragraph for training a question generation model, a second labeling result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph; wherein the second labeling result is determined by labeling the second sample-related paragraph according to a PDCA cycle; and training a neural network model through the second sample-related paragraphs, the second labeling result, and the second sample question to obtain the question generation model.

[0014] In an optional embodiment, the reading comprehension model includes a residual connection layer, a normalization layer, a Gaussian error linear unit activation function, a single linear layer, a prediction layer and an output layer in sequence.

[0015] In the embodiment of the present application, the residual connection layer is set before the normalization layer, which can make the information better transmitted in the neural network and reduce the occurrence of gradient disappearance or explosion. The use of the Gaussian error linear unit activation function makes it easier to propagate gradients when training deep neural networks, helps to accelerate the convergence speed of the model, and improves the expressiveness and adaptability of the reading comprehension model.

[0016] In a second aspect, the present application provides a model training method, comprising: obtaining a first sample-related paragraph for training a reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to a PDCA cycle; inputting the first sample-related paragraph and the first marking result into a question generation model, and generating a first sample question corresponding to the first sample-related paragraph through the question generation model; training a neural network model according to the first sample question, the first sample-related paragraph and the first marking result to obtain the reading comprehension model; wherein the reading comprehension model is used to determine the answer to the question from the relevant paragraph based on the input question and relevant paragraph.

[0017] In an optional embodiment, before obtaining the sample-related paragraphs for model training, the method further includes: obtaining a second sample-related paragraph for training a question generation model, a second labeling result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph; wherein the second labeling result is determined by labeling the second sample-related paragraph according to the PDCA cycle; and training a neural network model according to the second sample-related paragraph, the second labeling result, and the second sample question to obtain the question generation model.

[0018] In an optional embodiment, the reading comprehension model includes a residual connection layer, a normalization layer, a Gaussian error linear unit activation function, a single linear layer, a prediction layer and an output layer in sequence.

[0019] In a third aspect, the present application provides an answer determination device, comprising: a question acquisition module, used to acquire questions; a related paragraph determination module, used to determine the related paragraphs corresponding to the question from a knowledge base; an answer determination module, used to input the question and the related paragraphs into a reading comprehension model, and determine the answer to the question from the related paragraphs through the reading comprehension model; wherein the reading comprehension model is trained using sample questions, sample related paragraphs and marked results corresponding to the sample related paragraphs as model training samples, and the marked results are determined by marking the sample related paragraphs according to the PDCA cycle, and the marked results include: planning labels, execution labels, inspection labels and processing labels.

[0020] In an optional embodiment, the relevant paragraph determination module is specifically used to encode the question to obtain a question vector; match the question vector with the knowledge vector in the knowledge base to determine the knowledge vector; wherein the text paragraph corresponding to the knowledge vector is the relevant paragraph; accordingly, the answer determination module is specifically used to input the question vector and the knowledge vector into a trained reading comprehension model, and determine the answer to the question from the knowledge vector through the reading comprehension model.

[0021] In an optional embodiment, the answer determination device also includes a knowledge base generation module, which is used to obtain a data document; segment the data document to determine a plurality of paragraphs; encode the plurality of paragraphs to obtain a plurality of knowledge vectors, and store the plurality of knowledge vectors in the knowledge base.

[0022] In an optional embodiment, the answer determination device also includes a sample acquisition module, which is used to obtain a first sample-related paragraph for training the reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to the PDCA cycle; a question generation module, which is used to input the first sample-related paragraph and the first marking result into a question generation model, and generate a first sample question corresponding to the first sample-related paragraph through the question generation model; and a training module, which is used to train a neural network model according to the first sample question, the first sample-related paragraph and the first marking result to obtain the reading comprehension model.

[0023] In an optional embodiment, the sample acquisition module is also used to obtain a second sample-related paragraph for training a question generation model, a second marking result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph; wherein the second marking result is determined by marking the second sample-related paragraph according to the PDCA cycle; the training module is also used to train a neural network model according to the second sample-related paragraph, the second marking result and the second sample question to obtain the question generation model.

[0024] In an optional embodiment, the reading comprehension model includes a residual connection layer, a normalization layer, a Gaussian error linear unit activation function, a single linear layer, a prediction layer and an output layer in sequence.

[0025] In a fourth aspect, the present application provides a model training device, comprising: a sample acquisition module, used to acquire a first sample-related paragraph for training a reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to a PDCA cycle; a question generation module, used to input the first sample-related paragraph and the first marking result into a question generation model, and generate a first sample question corresponding to the first sample-related paragraph through the question generation model; a training module, used to train a neural network model according to the first sample question, the first sample-related paragraph and the first marking result to obtain the reading comprehension model; wherein the reading comprehension model is used to determine the answer to the question from the relevant paragraph based on the input question and relevant paragraph.

[0026] In an optional embodiment, the sample acquisition module is also used to obtain a second sample-related paragraph for training a question generation model, a second marking result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph; wherein the second marking result is determined by marking the second sample-related paragraph according to the PDCA cycle; the training module is also used to train a neural network model according to the second sample-related paragraph, the second marking result and the second sample question to obtain the question generation model.

[0027] In a fifth aspect, the present application provides an electronic device, comprising: a processor, a memory and a bus; the processor and the memory communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the above-mentioned answer determination method, or execute the above-mentioned model training method.

[0028] In a sixth aspect, the present application provides a storage medium having computer program instructions stored thereon. When the computer program instructions are read and run by a computer, the above-mentioned answer determination method or the above-mentioned model training method is executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0030] Figure 1 A flowchart of a method for determining an answer provided in an embodiment of the present application;

[0031] Figure 2 A structural diagram of a reading comprehension model provided in an embodiment of the present application;

[0032] Figure 3 A diagram of an implementation process of an answer determination method provided in an embodiment of the present application;

[0033] Figure 4 A structural block diagram of an answer determination device provided in an embodiment of the present application;

[0034] Figure 5 A structural block diagram of a model training device provided in an embodiment of the present application;

[0035] Figure 6 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0037] With the increasing growth of big data and the increasing complexity of project goal management, at each stage of project advancement, the project execution layer records the project advancement process and generates a large number of project-related documents. When the project management layer manages the project goals, it needs to read a large number of project-related documents and filter out the required information from the huge and complicated project documents to understand the current progress of the project. This process is time-consuming and labor-intensive, and is not conducive to the efficient advancement and development of the project.

[0038] Based on this, the embodiments of the present application provide an answer determination method, a model training method, a device and an electronic device to perform PDCA annotation on the text, so as to efficiently and accurately determine the answer from the text according to the question input by the user.

[0039] The following is an introduction to the answer determination method provided in this application.

[0040] See also Figure 1 , Figure 1 A flowchart of a method for determining an answer provided in an embodiment of the present application, the method for determining an answer may include the following steps:

[0041] S101: Get the question.

[0042] S102: Determine relevant paragraphs corresponding to the question from the knowledge base.

[0043] S103: Input the question and the relevant paragraphs into the reading comprehension model, and determine the answer to the question from the relevant paragraphs through the reading comprehension model.

[0044] In the embodiment of the present application, the question input by the user is first obtained, and the question is matched with the paragraphs in the knowledge base for similarity to determine the relevant paragraphs corresponding to the question. Then the question and the relevant paragraphs are input into a pre-trained reading comprehension model, and the reading comprehension model determines the answer to the question from the relevant paragraphs.

[0045] The reading comprehension model is trained using sample questions, sample related paragraphs, and the labeling results corresponding to the sample related paragraphs as model training samples. The labeling results are determined by labeling the sample related paragraphs according to the PDCA cycle. The labeling results include: planning labels, execution labels, inspection labels, and processing labels. The function of the reading comprehension model is to output the answer to the question based on the input question and the related paragraphs corresponding to the question.

[0046] To facilitate understanding of this solution, the training process of the reading comprehension model is first introduced before introducing S101.

[0047] As an optional implementation, the reading comprehension model provided in this application can be constructed by the following steps:

[0048] Step A1: Obtain a first sample-related paragraph for training a reading comprehension model and a first marking result corresponding to the first sample-related paragraph.

[0049] In the embodiment of the present application, the first sample related paragraph includes PDCA information.

[0050] There are many ways to obtain the first sample related paragraphs. In some embodiments, the first sample related paragraphs are directly obtained from an external server or other storage medium.

[0051] In an embodiment of the present application, the first sample related paragraphs are pre-stored in an external server or other storage medium, and when training the reading comprehension model, the first sample related paragraphs are directly obtained from the external server or other storage medium.

[0052] In other embodiments, a document containing PDCA information is selected as a sample document, and the sample document is preprocessed to obtain a first sample related paragraph. Since a sample document may contain multiple PDCA information and the number of input words of the reading training model is limited, the sample document is preprocessed to divide the sample document into multiple sample related paragraphs.

[0053] In this embodiment, there are multiple ways to pre-process the sample document to obtain multiple sample related paragraphs.

[0054] Optionally, the sample document is segmented using a text segmenter.

[0055] The text splitter can be: CharacterTextSplitter, LatexTextSplitter, MarkdownTextSplitter, etc. Among them, CharacterTextSplitter splits according to the specified delimiter (default "\n\n"); LatexTextSplitter splits text along Latex titles, headings, enumerations, etc.; MarkdownTextSplitter splits text along Markdown titles, code blocks or horizontal rules. This application does not specifically limit the type of text splitter.

[0056] Optionally, the sample document is segmented according to its natural paragraphs.

[0057] Usually, different PDCA information is in different paragraphs of the sample document, and the sample document is divided into a plurality of first sample related paragraphs in the form of natural paragraphs, so that each first sample related paragraph corresponds to one PDCA information.

[0058] It should be noted that the present application does not specifically limit the method of segmentation processing. The above-mentioned method of segmentation processing of sample documents is only an example provided in the embodiment of the present application. When performing segmentation processing, the embodiment of the present application can adopt any segmentation processing method that can divide the sample document into multiple first sample related paragraphs, and each first sample related paragraph corresponds to a PDCA information.

[0059] The first marking result is a label corresponding to the first sample related paragraph. The first marking result is determined by marking the first sample related paragraph according to the PDCA cycle. The first marking result includes a planning label, an execution label, a check label, and a processing label.

[0060] The meaning of the PDCA cycle is to divide quality management into four stages, namely Plan, Do, Check and Act. In the embodiment of the present application, the first sample related paragraphs are marked according to the PDCA cycle, and each first sample related paragraph corresponds to a first marking result.

[0061] Specifically, the content of the first sample related paragraph is analyzed, and when the first sample related paragraph corresponds to the Plan stage of the PDCA cycle, the first marking result corresponding to the first sample related paragraph is determined to be a planning label; when the first sample related paragraph corresponds to the Do stage of the PDCA cycle, the first marking result corresponding to the first sample related paragraph is determined to be an execution label; when the first sample related paragraph corresponds to the Check stage of the PDCA cycle, the first marking result corresponding to the first sample related paragraph is determined to be a check label; when the first sample related paragraph corresponds to the Act stage of the PDCA cycle, the first marking result corresponding to the first sample related paragraph is determined to be a processing label.

[0062] For example, the relevant paragraph of a first sample is: "The meeting requires that staff member A take the lead and Bureau B be responsible for taking the approach of enterprises paying for construction first, coordinating relevant departments to carry out site selection, project establishment, construction and other matters, and fully promoting the construction of a new slag yard in District C. Relevant departments such as D, E, and F should actively assist enterprises in handling relevant procedures and strive to complete and put the project into production as soon as possible." According to the PDCA cycle, "taking the approach of enterprises paying for construction first, coordinating relevant departments to carry out site selection, project establishment, construction and other matters, and fully promoting the construction of a new slag yard in District C." is the Do (execution) stage. Therefore, the first tag result corresponding to the relevant paragraph of the first sample is determined to be the execution tag.

[0063] There are multiple ways to obtain the first marking result corresponding to the first sample related paragraph.

[0064] In some embodiments, the first marking result corresponding to the first sample related paragraph is directly obtained from an external server or other storage medium.

[0065] In an embodiment of the present application, corresponding to the aforementioned direct acquisition of the first sample related paragraph from an external server or other storage medium, the external server or other storage medium pre-stores the first marking result corresponding to the first sample related paragraph, and the first marking result corresponding to the first sample related paragraph is directly acquired from the external server or other storage medium.

[0066] In some other embodiments, each first sample related paragraph is manually analyzed to determine the first marking result corresponding to the first sample related paragraph.

[0067] Furthermore, the first sample related paragraph and the first marking result corresponding to the first sample related paragraph can be saved in JSON format, and the data is divided into two columns: text and label; wherein the text column represents the first sample related paragraph, and the label column represents the first marking result.

[0068] For example, the data format of the first sample related paragraph and the first marking result is as follows:

[0069] {"text":"The meeting required that staff member A take the lead and Bureau B be responsible for coordinating relevant departments to carry out site selection, project establishment, construction and other matters in order to fully promote the construction of the new slag dump in Area C. Relevant departments such as D, E, and F should actively assist the enterprise in handling relevant procedures and strive to complete and put the project into production as soon as possible.","label":{"Do":{"The enterprise should advance the construction fee in advance, coordinate relevant departments to carry out site selection, project establishment, construction and other matters in order to fully promote the construction of the new slag dump in Area C."}}}

[0070] Among them, Do represents the execution label.

[0071] Step A2: input the first sample related paragraph and the first marking result into the question generation model, and generate a first sample question corresponding to the first sample related paragraph through the question generation model.

[0072] In the embodiment of the present application, the input of the question generation model is the first sample related paragraph and the first marked result, and the output is the first sample question. Each first sample related paragraph corresponds to a first sample question, and the answer to the first sample question is the content corresponding to the first marked result in the first sample related paragraph.

[0073] The following is an introduction to how to generate a model for a training problem.

[0074] As an optional implementation, before step A2, the answer determination method provided in the embodiment of the present application further includes:

[0075] Obtain a second sample-related paragraph, a second labeling result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph for training a question generation model; wherein the second labeling result is determined by labeling the second sample-related paragraph according to a PDCA cycle; train a neural network model according to the second sample-related paragraph, the second labeling result, and the second sample question to obtain a question generation model.

[0076] In the embodiment of the present application, the function of the question generation model is to output the first sample question according to the input first sample related paragraph and the first marking result. The training data of the training question generation model is a plurality of triple information. Each triple information includes: the second sample related paragraph, the second marking result and the second sample question, and the second sample related paragraph and the second marking result in the triple information are the training samples, and the second sample question is the training label.

[0077] It should be noted that the first sample-related paragraph and the second sample-related paragraph are paragraphs of the same type and are determined in the same manner, except that the first sample-related paragraph is used to train the reading comprehension model, and the second sample-related paragraph is used to train the question generation model. The first marked result and the second marked result are determined in the same manner, except that the first marked result is used to train the reading comprehension model, and the second marked result is used to train the question generation model. The first sample question is used to train the reading comprehension model, and the second sample question is used to train the question generation model. The first sample question is determined by the question generation model, and the second sample question can be a question determined in advance by analyzing the second sample-related paragraph and the second marked result. The answer to the second sample question is the content corresponding to the second marked result in the second sample-related paragraph.

[0078] As an optional implementation, the question generation model can be a pre-trained language model UNIMO-Text. The training data format for training the model is as follows:

[0079] {

[0080] "context":<context_text> ,

[0081] "answer":<answer_text> ,

[0082] "question":<question_text> ,

[0083] }

[0084] in<context_text> For the second sample related paragraph,<answer_text> is the second marking result,<question_text> This is the second sample problem.

[0085] For example, the training data for training the pre-trained language model UNIMO-Text is as follows:

[0086] {

[0087] "context":"The goal of the project is the regional gross value growth rate. The specific measures are to coordinate the implementation of the planning outline and special plans, benchmark the comprehensive performance evaluation of high-quality development and the evaluation index system of key tasks, adhere to the economic operation analysis and scheduling mechanism, and promote the implementation of goals and tasks.",

[0088] "answer": execution label, "coordinate the implementation of planning outlines and special plans, benchmark the comprehensive performance evaluation of high-quality development and the evaluation index system for the completion of key tasks, adhere to the economic operation analysis and scheduling mechanism, and promote the target task implementation system",

[0089] "question":"What are the specific measures to increase the growth rate of regional gross generation?"

[0090] }

[0091] Since training a reading comprehension model requires a large amount of training data, the first sample related paragraphs and the first marked results can be directly extracted from the sample document. However, the first sample question usually needs to be manually determined based on the first sample related paragraphs and the first marked results, which results in a large amount of manpower and material resources being consumed when preparing the training data required for training the reading comprehension model. Therefore, by training the question generation model, the question generation model directly outputs the first sample question based on the input first sample related paragraphs and the first marked results, thereby improving the efficiency of obtaining training data for training the reading comprehension model.

[0092] Furthermore, a low-parameter supervised training method is used to train the question generation model.

[0093] In an embodiment of the present application, when training the problem generation model, a low-parameter supervised training method is used for model training. Without changing the structure of the original model (problem generation model), a dimensionality reduction and dimensionality increase operation is added next to it to simulate the training of those parameters that can really affect the model effect, thereby achieving an effect almost the same as full parameters. During training, the original model parameters are frozen, and only the bypass model parameters are fine-tuned, thereby speeding up the efficiency of training the problem generation model and reducing training costs.

[0094] Step A3: Train the neural network model according to the first sample question, the first sample related paragraph and the first marking result to obtain a reading comprehension model.

[0095] In an embodiment of the present application, the first sample-related paragraph and the first marked result are input into a question generation model to obtain a first sample question corresponding to the first sample-related paragraph. Then, the first sample question, the first sample-related paragraph and the first marked result are used to train a neural network model to obtain a reading comprehension model.

[0096] The function of the reading comprehension model is to output the answer to the question based on the input question and the relevant paragraphs corresponding to the question. The training data for training the reading comprehension model is multiple triples of information. Each triple includes: the first sample related paragraph, the first marked result and the first sample question. The first sample related paragraph and the first sample question in the triple are training samples, and the first marked result is the training label.

[0097] For further information, see Figure 2 , Figure 2 This is a structural diagram of a reading comprehension model provided in an embodiment of the present application. Figure 2 As shown, the reading comprehension model includes a residual connection layer, a normalization layer, a Gaussian error linear unit activation function, a single linear layer, a prediction layer and an output layer in sequence.

[0098] In the embodiment of the present application, the reading comprehension model is a Transformer decoder, which is a combination of a multi-head attention mechanism and a feedforward neural network for generating an output sequence. The input sequence (the input question and the relevant paragraphs corresponding to the question) is first input into the residual connection layer (Residual Connection Layer), residual connection is performed, and then the normalization layer (Normalization Layer) is input. The normalization layer is used to perform normalization operations on the input of each layer to alleviate the problem of internal covariate shift during the training process and improve the stability and generalization ability of the model.

[0099] The input sequence is first input to the residual connection layer for residual connection and then to the normalization layer for normalization, which can better transmit information in the neural network and reduce the occurrence of gradient disappearance or explosion.

[0100] After the normalization layer processing, the Gaussian error linear unit activation function (GeLU Activation) is used to introduce nonlinear properties. The derivative of the GELU function is continuous, which makes it easier to propagate the gradient when training deep neural networks, so that the output of the GELU function falls within a wider range, which helps to accelerate the convergence of the model and improve the expressiveness and adaptability of the reading comprehension model.

[0101] After being processed by the Gaussian error linear unit activation function, the single linear layer is a linear change layer used to map the output vector to the predicted token. Compared with using a fully connected layer to predict the output token, using a single linear layer can simplify the structure of the neural network model.

[0102] The predicted token layer is used to generate the predicted value of the next token based on the input sequence.

[0103] The output layer is used to finally generate the output result. The form of the output result can be adjusted according to actual needs. The output result can be in the form of a token sequence, a sentence or other types of information. The embodiment of the present application does not limit the form of the output result.

[0104] Furthermore, the reading comprehension model provided in the embodiment of the present application may also include an embedding layer, which is arranged before the residual connection layer and is used to convert the input sequence into a vector.

[0105] In an embodiment of the present application, an embedding layer is set before the residual connection layer to convert the input token sequence into a continuous vector representation. It should be noted that the input token sequence is a question and a related paragraph. By setting an embedding layer and converting the input token sequence into a vector representation, the reading comprehension model can be helped to better capture the semantic relationship between token sequences, thereby improving the accuracy of the answer output by the reading comprehension model.

[0106] The above S101 to S103 will be described in detail below with reference to examples.

[0107] S101: Get the question.

[0108] The answer determination method provided in the embodiment of the present application can be applied to a knowledge injection model. The knowledge injection model provides an interactive interface. In actual application, when the user needs to know information, the user can enter questions in the interactive interface.

[0109] S102: Determine relevant paragraphs corresponding to the question from the knowledge base.

[0110] A knowledge base is configured in the knowledge injection model, and document knowledge is stored in the knowledge base. After obtaining the question input by the user, the document knowledge in the knowledge base is matched with the question by similarity. A similarity threshold is set. If the similarity between the document knowledge in the knowledge base and the question is greater than the threshold, the document knowledge with the highest similarity is selected as the relevant paragraph corresponding to the question; if the similarity between the document knowledge in the knowledge base and the question is less than the threshold, it means that the answer to the question cannot be determined based on the document knowledge stored in the knowledge base, and the subsequent steps will not be executed.

[0111] Furthermore, as an optional implementation, if the similarity between the document knowledge in the knowledge base and the question is less than a threshold, a pre-configured speech is output.

[0112] The pre-configured scripts are used to prompt users that the document knowledge in the current knowledge base cannot determine the answer to the question, and the user is required to provide document information related to the question in order to determine the answer to the question.

[0113] For example, the pre-configured words may be: "Based on the information you provided, we cannot provide an accurate answer to this question. Please provide more detailed information."

[0114] In some embodiments, various document knowledge is pre-configured in the knowledge base, and after obtaining the question, the document knowledge in the knowledge base is matched with the question in similarity.

[0115] In other embodiments, before S102, the answer determination method provided in the embodiments of the present application also includes: obtaining a data document; segmenting the data document to determine multiple paragraphs; encoding the multiple paragraphs to obtain multiple knowledge vectors, and storing the multiple knowledge vectors in the knowledge base.

[0116] In an embodiment of the present application, when a user needs to determine information from a document, the user can input the document into the knowledge injection model through an interactive interface. After the knowledge injection model obtains the document input by the user, it segments the document and determines a plurality of paragraphs. Each paragraph is encoded to obtain a plurality of knowledge vectors. In the above manner, the user configures the document into the knowledge base, and when the user asks a question related to the document, the user can determine a knowledge vector with a high similarity from the knowledge base, so that the subsequent reading comprehension model can generate a more accurate answer based on the knowledge vector with a high similarity.

[0117] It should be noted that the method of segmenting the data document is the same as the method of segmenting the sample document mentioned above, and in order to make the specification concise, it will not be repeated here.

[0118] S103: Input the question and the relevant paragraphs into the reading comprehension model, and determine the answer to the question from the relevant paragraphs through the reading comprehension model.

[0119] In an embodiment of the present application, after matching the question with the knowledge base to determine the relevant paragraphs, the question and the relevant paragraphs are input into a reading comprehension model. According to the above description of the reading comprehension model, the reading comprehension model outputs the answer to the question.

[0120] Further, as an optional implementation, S102 may include the following contents: encoding the question to obtain a question vector; matching the question vector with a knowledge vector in a knowledge base to determine the knowledge vector; wherein the text paragraph corresponding to the knowledge vector is the relevant paragraph.

[0121] Accordingly, S103 may include the following: inputting the question vector and the knowledge vector into a trained reading comprehension model, and determining the answer to the question from the knowledge vector through the reading comprehension model.

[0122] In the embodiment of the present application, the question is usually a natural language text, and the question is encoded and processed, and the question in the form of a natural language text is encoded into a question vector, and then the question vector is matched with the knowledge vector in the knowledge base to determine the knowledge vector. Since the efficiency of matching the natural language text is low, the question encoding in the form of a natural language text is converted into a question vector through the above method, thereby improving the efficiency of determining relevant paragraphs from the knowledge base.

[0123] In addition, since the reading comprehension model is inefficient in processing natural language text, using question vectors and knowledge vectors as inputs to the reading comprehension model can effectively improve the processing efficiency of the reading comprehension model.

[0124] In some embodiments, the question can be encoded by the Embeddings embedding model to obtain a question vector. The paragraphs in the knowledge base can also be encoded by the Embeddings embedding model to obtain a knowledge vector. The Embeddings embedding model converts the input text information into an array composed of one-dimensional floating point numbers to form a vector.

[0125] It is understandable that if the reading comprehension model does not have an embedding layer, after determining the question and the relevant paragraph, the above-mentioned Embeddings embedding model is used to convert the question and the relevant paragraph into a question vector and a knowledge vector respectively. If the reading comprehension model has an embedding layer, the question and the relevant paragraph can be directly input into the reading comprehension model, and the reading comprehension model converts the question and the relevant paragraph into a question vector and a knowledge vector respectively.

[0126] The following is an introduction to the answer determination method provided in the embodiment of the present application with reference to a specific example.

[0127] like Figure 3As shown, the document is input into the knowledge injection model, the document is segmented, and the multiple paragraphs after segmentation are encoded through the Embeddings embedding model to obtain the knowledge vector, which is stored in the knowledge base. The question input by the user is obtained, and the question is encoded through the Embeddings embedding model to obtain the question vector. The question vector is matched with the knowledge vector in the knowledge base, and when the similarity is less than the threshold, the pre-made speech is output. When the similarity is greater than the threshold, the knowledge vector with the highest similarity is determined. Then the question vector and the knowledge vector are input into the reading comprehension model, and the reading comprehension model outputs the answer.

[0128] The present application also provides an answer determination device. Figure 4 , Figure 4 This is a structural block diagram of an answer determination device provided in an embodiment of the present application. The answer determination device 400 may include:

[0129] The question acquisition module 401 is used to acquire questions;

[0130] A relevant paragraph determination module 402 is used to determine the relevant paragraphs corresponding to the question from the knowledge base;

[0131] An answer determination module 403 is used to input the question and the relevant paragraphs into a reading comprehension model, and determine the answer to the question from the relevant paragraphs through the reading comprehension model;

[0132] Among them, the reading comprehension model is trained by using sample questions, sample related paragraphs and the marking results corresponding to the sample related paragraphs as model training samples. The marking results are determined by marking the sample related paragraphs according to the PDCA cycle. The marking results include: planning labels, execution labels, inspection labels and processing labels.

[0133] In an optional implementation, the relevant paragraph determination module 402 is specifically used to encode the question to obtain a question vector; match the question vector with a knowledge vector in the knowledge base to determine a knowledge vector; wherein the text paragraph corresponding to the knowledge vector is the relevant paragraph;

[0134] Correspondingly, the answer determination module 403 is specifically configured to input the question vector and the knowledge vector into a trained reading comprehension model, and determine the answer to the question from the knowledge vector through the reading comprehension model.

[0135] In an optional embodiment, the answer determination device also includes a knowledge base generation module 404, which is used to obtain a data document; segment the data document to determine a plurality of paragraphs; encode the plurality of paragraphs to obtain a plurality of knowledge vectors, and store the plurality of knowledge vectors in the knowledge base.

[0136] In an optional embodiment, the answer determination device further includes a sample acquisition module 405, which is used to obtain a first sample related paragraph for training the reading comprehension model and a first marking result corresponding to the first sample related paragraph; wherein the first marking result is determined by marking the first sample related paragraph according to the PDCA cycle;

[0137] A question generation module 406, configured to input the first sample-related paragraph and the first marked result into a question generation model, and generate a first sample question corresponding to the first sample-related paragraph through the question generation model;

[0138] The training module 407 is used to train the neural network model according to the first sample question, the first sample related paragraphs and the first marking result to obtain the reading comprehension model.

[0139] In an optional implementation, the sample acquisition module 405 is further used to acquire a second sample-related paragraph for training a question generation model, a second labeling result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph; wherein the second labeling result is determined by labeling the second sample-related paragraph according to a PDCA cycle;

[0140] The training module 407 is further used to train the neural network model according to the second sample related paragraphs, the second marking results and the second sample questions to obtain the question generation model.

[0141] In an optional embodiment, the reading comprehension model includes a residual connection layer, a normalization layer, a Gaussian error linear unit activation function, a single linear layer, a prediction layer and an output layer in sequence.

[0142] See also Figure 5 , an embodiment of the present application also provides a model training device. Figure 5 A structural block diagram of a model training device provided in an embodiment of the present application, the model training device 500 may include:

[0143] A sample acquisition module 501 is used to acquire a first sample-related paragraph for training a reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to a PDCA cycle;

[0144] A question generation module 502, configured to input the first sample-related paragraph and the first marked result into a question generation model, and generate a first sample question corresponding to the first sample-related paragraph through the question generation model;

[0145] The training module 503 is used to train the neural network model according to the first sample question, the first sample related paragraph and the first marking result to obtain the reading comprehension model; wherein the reading comprehension model is used to determine the answer to the question from the related paragraph according to the input question and related paragraph.

[0146] In an optional implementation, the sample acquisition module 501 is further used to acquire a second sample-related paragraph for training a question generation model, a second labeling result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph; wherein the second labeling result is determined by labeling the second sample-related paragraph according to a PDCA cycle;

[0147] The training module 503 is further used to train the neural network model according to the second sample related paragraphs, the second marking results and the second sample questions to obtain the question generation model.

[0148] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device 600 of an embodiment of the present application, and the electronic device 600 includes: at least one processor 601, at least one communication interface 602, at least one memory 603 and at least one bus 604. Among them, the bus 604 is used to realize the direct connection and communication of these components, the communication interface 602 is used to communicate signaling or data with other node devices, and the memory 603 stores machine-readable instructions executable by the processor 601. When the electronic device 600 is running, the processor 601 communicates with the memory 603 through the bus 604, and the machine-readable instructions are executed when the processor 601 calls the answer determination method and the model training method in the above-mentioned embodiment.

[0149] The processor 601 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. It can implement or execute various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0150] The memory 603 may include but is not limited to random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable read-only memory (EEPROM), etc.

[0151] Understandably, Figure 6 The structure shown is for illustration only. The electronic device 600 may also include Figure 6 More or fewer components as shown, or with Figure 6 Different configurations are shown. Figure 6 Each component shown in can be implemented by hardware, software or a combination thereof. In the embodiment of the present application, the electronic device 600 can be, but not limited to, a physical device such as a desktop computer, a laptop computer, a smart phone, a smart wearable device, a vehicle-mounted device, etc., and can also be a virtual device such as a virtual machine. In addition, the electronic device 600 is not necessarily a single device, but can also be a combination of multiple devices, such as a server cluster, etc.

[0152] In addition, an embodiment of the present application also provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a computer, the computer executes the answer determination method and model training method in the above embodiments.

[0153] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0154] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0156] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM) random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0157] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0158] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for determining an answer, characterized in that: include: Get the question; Determine relevant paragraphs corresponding to the question from the knowledge base; Inputting the question and the relevant paragraph into a reading comprehension model, and determining the answer to the question from the relevant paragraph by the reading comprehension model; The reading comprehension model is trained by using sample questions, sample related paragraphs and the marking results corresponding to the sample related paragraphs as model training samples, and the marking results are determined by marking the sample related paragraphs according to the PDCA cycle, and the marking results include: planning labels, execution labels, inspection labels and processing labels; The reading comprehension model is trained by the following steps: Acquire a first sample-related paragraph for training the reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to a PDCA cycle; Inputting the first sample-related paragraph and the first marked result into a question generation model, and generating a first sample question corresponding to the first sample-related paragraph through the question generation model; Training a neural network model according to the first sample question, the first sample related paragraphs and the first marking result to obtain the reading comprehension model; Before inputting the first sample-related paragraph and the first marked result into the question generation model, the method further includes: Obtaining a second sample related paragraph for training a question generation model, a second marking result corresponding to the second sample related paragraph, and a second sample question corresponding to the second sample related paragraph; wherein the second marking result is determined by marking the second sample related paragraph according to a PDCA cycle; The neural network model is trained according to the second sample related paragraphs, the second marking results and the second sample questions to obtain the question generation model.

2. The answer determination method according to claim 1, characterized in that: Determining the relevant paragraphs corresponding to the question from the knowledge base includes: Encoding the problem to obtain a problem vector; Matching the question vector with the knowledge vector in the knowledge base to determine the knowledge vector; wherein the text paragraph corresponding to the knowledge vector is the relevant paragraph; Accordingly, the step of inputting the question and the relevant paragraphs into a trained reading comprehension model, and determining the answer to the question from the relevant paragraphs by means of the reading comprehension model, comprises: The question vector and the knowledge vector are input into a trained reading comprehension model, and the answer to the question is determined from the knowledge vector by the reading comprehension model.

3. The answer determination method according to claim 1, characterized in that: Before determining the relevant paragraphs corresponding to the question from the knowledge base, the method further includes: Get data documents; Segmenting the document to determine multiple paragraphs; The multiple paragraphs are encoded to obtain multiple knowledge vectors, and the multiple knowledge vectors are stored in the knowledge base.

4. The answer determination method according to claim 1, characterized in that: The reading comprehension model includes a residual connection layer, a normalization layer, a Gaussian error linear unit activation function, a single linear layer, a prediction layer and an output layer in sequence.

5. A model training method, characterized in that: include: Acquire a first sample-related paragraph for training a reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to a PDCA cycle; Inputting the first sample-related paragraph and the first marked result into a question generation model, and generating a first sample question corresponding to the first sample-related paragraph through the question generation model; The neural network model is trained according to the first sample question, the first sample related paragraph and the first marking result to obtain the reading comprehension model; wherein the reading comprehension model is used to determine the answer to the question from the related paragraph according to the input question and the related paragraph; Before obtaining the sample-related paragraphs for model training, the method further includes: Obtaining a second sample related paragraph for training a question generation model, a second marking result corresponding to the second sample related paragraph, and a second sample question corresponding to the second sample related paragraph; wherein the second marking result is determined by marking the second sample related paragraph according to a PDCA cycle; The neural network model is trained according to the second sample related paragraphs, the second marking results and the second sample questions to obtain the question generation model.

6. An answer determination device, characterized in that: include: A question acquisition module is used to acquire questions; A relevant paragraph determination module, used to determine the relevant paragraphs corresponding to the question from the knowledge base; An answer determination module, used for inputting the question and the relevant paragraphs into a reading comprehension model, and determining the answer to the question from the relevant paragraphs through the reading comprehension model; The reading comprehension model is trained by using sample questions, sample related paragraphs and the marking results corresponding to the sample related paragraphs as model training samples, and the marking results are determined by marking the sample related paragraphs according to the PDCA cycle, and the marking results include: planning labels, execution labels, inspection labels and processing labels; A sample acquisition module, used to acquire a first sample-related paragraph for training the reading comprehension model and a first marking result corresponding to the first sample-related paragraph; wherein the first marking result is determined by marking the first sample-related paragraph according to a PDCA cycle; a question generation module, configured to input the first sample-related paragraph and the first marked result into a question generation model, and generate a first sample question corresponding to the first sample-related paragraph through the question generation model; A training module, used for training a neural network model according to the first sample question, the first sample related paragraph and the first marking result to obtain the reading comprehension model; The sample acquisition module is also used to obtain a second sample-related paragraph, a second marking result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph for training a question generation model; wherein the second marking result is determined by marking the second sample-related paragraph according to the PDCA cycle; the training module is also used to train a neural network model according to the second sample-related paragraph, the second marking result, and the second sample question to obtain the question generation model.

7. A model training device, characterized in that: include: A sample acquisition module, used to acquire a first sample related paragraph for training a reading comprehension model; A marking module, used for marking the first sample related paragraphs according to the PDCA cycle to determine a first marking result; a question generation module, configured to input the first sample-related paragraph and the first marked result into a question generation model, and generate a first sample question corresponding to the first sample-related paragraph through the question generation model; A training module, used for training a neural network model according to the first sample question, the first sample related paragraph and the first marking result to obtain the reading comprehension model; wherein the reading comprehension model is used for determining the answer to the question from the related paragraph according to the input question and related paragraph; The sample acquisition module is also used to obtain a second sample-related paragraph, a second marking result corresponding to the second sample-related paragraph, and a second sample question corresponding to the second sample-related paragraph for training a question generation model; wherein the second marking result is determined by marking the second sample-related paragraph according to the PDCA cycle; the training module is also used to train a neural network model according to the second sample-related paragraph, the second marking result, and the second sample question to obtain the question generation model.

8. An electronic device, characterized in that: include: processor, memory, and bus; The processor and the memory communicate with each other via the bus; The memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the method according to any one of claims 1 to 4, or executes the method according to claim 5.

9. A storage medium, characterized in that: The storage medium stores computer program instructions, and when the computer program instructions are read and executed by a computer, the method according to any one of claims 1 to 4 or the method according to claim 5 is executed.

Citation Information

Patent Citations

  • Power equipment portrait label system construction method based on a big data technology

    CN109857831A

  • Method for establishing reading understanding model, reading understanding method and corresponding device

    CN113204611A