Generative question and answer optimization method based on deep learning
By improving the deep learning algorithm and entity recognition model combined with the knowledge graph, the problem of inaccurate answers generated by the Q&A system is solved, and more efficient Q&A services are achieved.
Patent Information
- Application Number
- CN202510177683.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-07-04
AI Technical Summary
The existing question and answer system is not very accurate when generating answers, and the answers are unnatural, so optimization methods are urgently needed to improve performance.
The entity recognition model is deployed using an improved deep learning algorithm, combining knowledge graphs and generative answer optimization algorithms, and accurate answers are generated through entity recognition, similarity judgment and generative answer optimization.
It improves the accuracy and nature of the Q&A system and provides better Q&A services.
Smart Images

Figure CN120256556A_ABST
Abstract
Description
[0001] Technical Field
[0002] The present invention belongs to the technical field of data processing, and particularly relates to an optimization method for generative question answering based on deep learning. Background Art
[0003] An intelligent question answering system is a computer program based on artificial intelligence technology that can understand and answer user questions. It analyzes the questions input by users through methods such as natural language processing and machine learning, and retrieves relevant information in a vast knowledge base to generate accurate and natural answers. Intelligent question answering systems are widely used in fields such as customer service, education, and healthcare, significantly improving the efficiency and accuracy of information acquisition. With the development of technologies such as deep learning, intelligent question answering systems are constantly being optimized to achieve a more intelligent and user-friendly interaction experience. With the rapid development of artificial intelligence technology, natural language processing (NLP) has been widely applied in various fields. Among them, the question answering system, as an important branch of NLP, aims to enable machines to understand user questions and give corresponding answers. However, existing question answering systems often have problems such as low accuracy and unnatural answers when generating answers, and there is an urgent need for an effective optimization method to improve the performance of the question answering system. Summary of the Invention
[0004] The present invention provides an optimization method for generative question answering based on deep learning to solve the technical problem of low accuracy in generating answers in the prior art.
[0005] An optimization method for generative question answering based on deep learning includes:
[0006] Obtain the inquiry statement input by the user, and dispatch an entity recognition model deployed by an improved deep learning algorithm to recognize the inquiry statement, and obtain the first target entity corresponding to the inquiry statement;
[0007] Based on the first target entity corresponding to the inquiry statement, query candidate relationships in the knowledge graph to obtain the first candidate relationship, and obtain the similarity between the inquiry statement and the first candidate relationship, and determine the first target answer corresponding to the inquiry statement according to the similarity;
[0008] When the first target answer meets the preset answer constraint conditions, then use the first target answer as the answer corresponding to the inquiry statement and output it;
[0009] When the first target answer does not meet the preset answer constraint conditions, then based on the inquiry statement, use a generative answer optimization algorithm to generate a second target answer, and use the second target answer as the answer corresponding to the inquiry statement and output it.
[0010] Further, obtain the query statement input by the user, and dispatch the entity recognition model deployed by the improved deep learning algorithm to recognize the query statement, and obtain the first target entity corresponding to the query statement, including:
[0011] Obtain the query statement input by the user, use the jieba word segmentation tool to perform word segmentation processing on the query statement, and obtain the words corresponding to the query statement;
[0012] Dispatch the entity recognition model deployed by the improved deep learning algorithm to process the words corresponding to the query statement, and obtain the first target entity corresponding to the query statement.
[0013] Further, the entity recognition model is constructed using the BERT - BiLSTM - CRF model.
[0014] Further, the improved deep learning algorithm includes:
[0015] Initialize the hyperparameters of the entity recognition model, encode the hyperparameters into vectors to obtain encoded individuals, and repeat to obtain multiple different encoded individuals;
[0016] Obtain the loss function value corresponding to each encoded individual, and determine the optimal individual and the sub - optimal individual according to the loss function value; where the loss function value of the sub - optimal individual is only greater than the loss function value of the optimal individual;
[0017] According to the optimal individual and the sub - optimal individual, use a multi - dimensional guidance mechanism to guide and update each encoded individual to obtain the encoded individual after guidance update;
[0018] According to the optimal individual, use a spiral search mechanism to perform spiral update on the encoded individual after guidance update to obtain the encoded individual after spiral update;
[0019] Use a global mutation mechanism to perform global update on the encoded individual after spiral update to obtain the encoded individual after global update;
[0020] For the optimal individual, use an adaptive neighborhood search mechanism to perform neighborhood update on the optimal individual to obtain the optimal individual after neighborhood update;
[0021] Re - form the population with the encoded individual after global update and the optimal individual after neighborhood update;
[0022] Judge whether the hyperparameter update end condition is satisfied. If so, determine the final hyperparameters of the entity recognition model according to the re - formed population to obtain the entity recognition model deployed by the improved deep learning algorithm. Otherwise, return to the step of determining the optimal individual and the sub - optimal individual.
[0023] Further, determining whether the hyperparameter update end condition is satisfied includes: determining whether the number of training times reaches the maximum number of training times. If so, it is determined that the hyperparameter update end condition is satisfied; otherwise, it is determined that the hyperparameter update end condition is not satisfied.
[0024] Further, based on the reconstituted population, determining the final hyperparameters of the entity recognition model to obtain an entity recognition model deployed by an improved deep learning algorithm, including:
[0025] Based on the reconstituted population, re-obtaining the optimal individual, and taking the hyperparameters included in the optimal individual as the final hyperparameters of the entity recognition model, and deploying the entity recognition model according to the final hyperparameters of the entity recognition model to obtain an entity recognition model deployed by an improved deep learning algorithm.
[0026] Further, based on the first target entity corresponding to the query statement, querying candidate relationships in the knowledge graph to obtain the first candidate relationship, and obtaining the similarity between the query statement and the first candidate relationship, and determining the first target answer corresponding to the query statement according to the similarity, including:
[0027] Based on the first target entity corresponding to the query statement, querying the knowledge related to the first target entity in the knowledge graph to obtain multiple pieces of first target knowledge, and taking the relationships in all the first target knowledge as the first candidate relationship;
[0028] Obtaining the internal representation corresponding to the query statement, and obtaining the similarity between the internal representation and the first candidate relationship, and determining the first candidate relationship with the highest similarity as the second candidate relationship;
[0029] Taking the second target knowledge including the target knowledge and the second candidate relationship as the first target answer.
[0030] Further, the similarity is set to cosine similarity.
[0031] Further, the preset answer constraint condition is set as: the similarity between the relationship in the first target answer and the query statement is greater than the preset similarity threshold.
[0032] Further, based on the query statement, using a generative answer optimization algorithm to generate a second target answer, and taking the second target answer as the answer corresponding to the query statement, including:
[0033] Based on the first target entity corresponding to the query statement, obtaining all the entities within the neighborhood of the first target entity to obtain multiple second target entities;
[0034] Obtaining the importance of all the second target entities relative to the first target entity, and obtaining the second target entity with the greatest importance to obtain a third target entity;
[0035] Obtain all entities within the neighborhood of the third target entity to obtain a fourth target entity; wherein, the fourth target entity is different from the first target entity.
[0036] Obtain the importance of all fourth target entities relative to the third target entity, and obtain the fourth target entity with the greatest importance to obtain a fifth target entity.
[0037] Construct new knowledge using the relationships among the first target entity, the third target entity, and the fifth target entity in the interrogation statement and the fifth target entity, and use the obtained new knowledge as the second target answer, and use the second target answer as the response corresponding to the interrogation statement.
[0038] A generative Q&A optimization method based on deep learning provided by the present invention can more accurately analyze the entities in the interrogation statement by scheduling an entity recognition model deployed by an improved deep learning algorithm, so that the matching of the knowledge graph can be more accurate, effectively improving the Q&A accuracy. And when no corresponding answer can be matched, a generative answer optimization algorithm is used to generate and output a predicted answer, which can effectively improve the Q&A ability and provide better Q&A services for users. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings herein are incorporated into and constitute a part of this specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention.
[0040] Figure 1 It is a flowchart of a generative Q&A optimization method based on deep learning provided by an embodiment of the present invention.
[0041] Figure 2 It is a flowchart of an improved deep learning algorithm provided by an embodiment of the present invention.
[0042] Through the above accompanying drawings, specific embodiments of the present invention have been shown, and there will be more detailed descriptions hereinafter. These drawings and the textual descriptions are not intended to limit the scope of the inventive concept in any way, but to illustrate the concept of the present invention to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0043] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0044] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0045] As Figure 1 shown, an embodiment of the present invention provides a method for optimizing generative question answering based on deep learning, including:
[0046] S11. Obtain an inquiry statement input by a user, and dispatch an entity recognition model deployed by an improved deep learning algorithm to recognize the inquiry statement, and obtain a first target entity corresponding to the inquiry statement;
[0047] The inquiry statement input by the user generally includes an entity and a relationship, and the corresponding answer can be matched in the knowledge graph by analyzing this inquiry statement. It should be noted that the knowledge graph in the embodiments of the present invention is pre-constructed, and the present invention only uses it, and the existing technology can be used to construct it. For example, when the intelligent question answering is applied in the power field or the medical field, the professional knowledge in the power field or the medical field can be obtained by using web crawlers or by specifying data sources by staff, and a knowledge graph can be generated.
[0048] In the embodiments of the present invention, an entity recognition model deployed by an improved deep learning algorithm is introduced to recognize the inquiry statement, which can effectively improve the recognition efficiency of the inquiry statement, and combined with subsequent semantic matching, can effectively improve the answer quality.
[0049] S12. Based on the first target entity corresponding to the inquiry statement, query candidate relationships in the knowledge graph to obtain a first candidate relationship, and obtain the similarity between the inquiry statement and the first candidate relationship, and determine a first target answer corresponding to the inquiry statement according to the similarity;
[0050] After obtaining the first target entity in the inquiry statement, all knowledge related to the first target entity can be matched in the knowledge graph, and then the relationships included in these knowledges are the first candidate relationships, and then the similarity between the inquiry statement and the first candidate relationship can be obtained, so as to achieve semantic matching and finally determine the first target answer. However, it should be noted that the first target answer is mainly determined among all the knowledge containing the first target entity, and may not be the answer corresponding to the inquiry statement, so further judgment is required.
[0051] S13. When the first target answer meets the preset answer constraint conditions, use the first target answer as the answer corresponding to the inquiry statement and output it;
[0052] Generally, when there is knowledge corresponding to the query statement in the knowledge graph, the maximum similarity should be 1. However, there may be certain deviations in the description process (for example, when asking about someone's place of residence or residential address, there is a one-character deviation, but the meaning is the same). Therefore, a preset answer constraint condition can be set as a threshold. When the similarity corresponding to the first target answer is greater than this threshold, it can be considered reliable and output.
[0053] S14. When the first target answer does not meet the preset answer constraint condition, based on the query statement, a second target answer is generated using a generative answer optimization algorithm, and the second target answer is used as the answer corresponding to the query statement and output.
[0054] When the first target answer does not meet the preset answer constraint condition, it can be determined that there is no direct relationship in the knowledge graph. Therefore, a generative answer optimization algorithm can be used to generate a second target answer, thereby improving the intelligent answering ability. When the generative answer optimization algorithm cannot generate a second target answer (that is, when the generative answer optimization algorithm cannot be executed smoothly), a trusted user can be asked. The trusted user can be specified by the administrator.
[0055] The present invention provides a generative question-answering optimization method based on deep learning. By scheduling an entity recognition model deployed by an improved deep learning algorithm to recognize the query statement, the entities in the query statement can be analyzed more accurately, so that the matching of the knowledge graph can be more accurate, the question-answering accuracy can be effectively improved, and when no corresponding answer can be matched, a generative answer optimization algorithm is used to generate a predicted answer and output, which can effectively improve the question-answering ability and provide better question-answering services for users.
[0056] In an embodiment of the present invention, obtaining a query statement input by a user and scheduling an entity recognition model deployed by an improved deep learning algorithm to recognize the query statement, and obtaining a first target entity corresponding to the query statement includes:
[0057] Obtaining a query statement input by a user, using the jieba word segmentation tool to perform word segmentation processing on the query statement to obtain words corresponding to the query statement;
[0058] Scheduling an entity recognition model deployed by an improved deep learning algorithm to process the words corresponding to the query statement to obtain a first target entity corresponding to the query statement.
[0059] In an embodiment of the present invention, the entity recognition model is constructed using a BERT-BiLSTM-CRF model.
[0060] The BERT-BiLSTM-CRF model consists of three sub-models: BERT (pre-trained language representation model), BiLSTM (bidirectional long short-term memory network), and CRF (conditional random field). Among them, the BERT pre-trained model, as the text representation layer, extracts rich text features and maps each word in the text sequence to a high-dimensional vector space. The BILSTM model takes the vectors of the transformed text as input, further captures the semantic relationships between text sequences, and outputs the scoring probabilities of words corresponding to each label. The CRF model takes the output of the BILSTM model as input, and through the interdependence between labels, calculates the optimal annotation sequence, so as to finally achieve entity recognition.
[0061] The hyperparameters (such as connection weights) of the BERT-BiLSTM-CRF model often need to be optimized to enable the BERT-BiLSTM-CRF model to more accurately identify entities. In the existing technology, gradient descent and backpropagation are often used to train the hyperparameters, but the training effect is often not good. Therefore, the embodiments of the present invention use an improved deep learning algorithm to train the entity recognition model to improve the recognition accuracy of entities, thereby improving the answering efficiency and accuracy.
[0062] As Figure 2 shown, the improved deep learning algorithm includes:
[0063] S21. Initialize the hyperparameters of the entity recognition model, encode the hyperparameters into vectors to obtain encoded individuals, and repeatedly obtain multiple different encoded individuals;
[0064] S22. Obtain the loss function value corresponding to each encoded individual, and determine the optimal individual and the sub-optimal individual according to the loss function value; among them, the loss function value of the sub-optimal individual is only greater than the loss function value of the optimal individual;
[0065] S23. According to the optimal individual and the sub-optimal individual, use a multi-dimensional guidance mechanism to guide and update each encoded individual to obtain the encoded individual after guidance and update;
[0066] The multi-dimensional guidance mechanism includes:
[0067] Determine the linear control factor as: where A represents the linear control factor, F represents the constant factor and can be set to 2, t represents the current training times, and T represents the preset maximum training times;
[0068] According to the linear control factor, the operation of avoiding collision for the encoded individual is: where represents the m-th encoded individual in the t-th training process, m = 1, 2,..., M, and M represents the total number of encoded individuals;
[0069] According to the optimal individual, the sub-optimal individual, and the encoded individual after the collision avoidance operation, the encoded individual is guided and updated to obtain the encoded individual after the guided update as follows:
[0070]
[0071] where represents the m-th encoded individual after the guided update, Δ m1 represents the optimal region search amount, Δ m2 represents the sub-optimal position search amount, r1 represents the first random number between (0, 1), represents the optimal individual, r2 represents the second random number between (0, 1), represents the sub-optimal individual;
[0072] In the embodiment of the present invention, through the double guidance mechanism of the optimal individual and the sub-optimal individual, it is possible to effectively move forward in a better direction and not fall into the local optimum prematurely. While effectively maintaining the search speed of the algorithm, it improves the possibility of searching for the global optimal solution.
[0073] S24. According to the optimal individual, the encoded individual after the guided update is spirally updated by using a spiral search mechanism to obtain the encoded individual after the spiral update;
[0074] The spiral search mechanism includes:
[0075] Generate a random spiral control factor k between [0, 2π]; where π represents the circumference ratio;
[0076] According to the random spiral control factor k, generate the first spiral search factor as: ξ1 = kRue kv ; where ξ1 represents the first spiral search factor, u represents the first spiral flight trajectory constant, v represents the second spiral flight trajectory constant, and both u and v can be set to 1, e represents the natural constant, and R represents the radius of the spiral flight trajectory;
[0077] According to the random spiral control factor k and the radius R of the spiral flight trajectory, generate the second spiral search factor and the third spiral search factor as: ξ2 = Rcos(k) and ξ3 = Rsin(k); where ξ2 represents the second spiral search factor, ξ3 represents the third spiral search factor, cos represents the cosine function, and sin represents the sine function;
[0078] After arranging the encoded individuals after the guided update in ascending order according to the loss function, according to the first spiral search factor, the second spiral search factor, and the third spiral search factor, the encoded individuals after the guided update are spirally updated to obtain the encoded individuals after the spiral update as:
[0079]
[0080] Among them, represents the encoded individual after the nth guiding update in the tth training process, where n = 1, 2, …, M, and M represents the total number of encoded individuals. represents the encoded individual after the (n - 1)th guiding update. When n = 1, then is the encoded individual after a random guiding update. represents the encoded individual after the nth spiral update.
[0081] The spiral search mechanism provided by the embodiments of the present invention can form a chain with all encoded individuals and search according to different spiral radii, thereby forming a search network, which can effectively improve the problem that the algorithm jumps out of the local optimal solution, and mainly searches around the optimal position. As the algorithm progresses, the search accuracy will also gradually increase, which can solve the problems in the prior art to a certain extent while ensuring the search accuracy.
[0082] S25. Perform global update on the encoded individual after spiral update by using the global mutation mechanism to obtain the encoded individual after global update;
[0083] The global mutation mechanism includes:
[0084] For the encoded individual after spiral update, obtain the global mutant corresponding to the encoded individual as:
[0085]
[0086] Among them, represents the encoded individual after the ith spiral update in the tth training process, where i = 1, 2, …, M, and M represents the total number of encoded individuals. represents the global mutant corresponding to the ith encoded individual; X max represents the upper limit individual corresponding to the encoded individual, that is, the individual composed of the upper limits of each dimension of hyperparameters; X min represents the lower limit individual corresponding to the encoded individual, that is, the individual composed of the lower limits of each dimension of hyperparameters, and τ represents a random mutation factor between (0, 1);
[0087] Judge whether the loss function value of the global mutant decreases. If so, use the global mutant as the encoded individual after global update, otherwise enter the step of obtaining the acceptance probability of the inferior solution;
[0088] Obtain the acceptance probability of the inferior solution as: Among them, p represents the acceptance probability of the inferior solution;
[0089] Randomly generate a decision factor between (0, 1), and determine whether the decision factor is less than the inferior solution acceptance probability. If so, use the globally mutated individual as the encoded individual after global update; otherwise, directly use the encoded individual after the original spiral update as the encoded individual after global update.
[0090] The global mutation mechanism provided by the embodiments of the present invention can effectively jump out of the original area for search, providing the algorithm with strong global search ability. Moreover, the mutation ability is stronger in the middle and early stages of the algorithm and weaker in the later stage of the algorithm, which can ensure the convergence ability of the algorithm at the same time.
[0091] S26. For the optimal individual, use the adaptive neighborhood search mechanism to perform neighborhood update on the optimal individual to obtain the optimal individual after neighborhood update;
[0092] The adaptive neighborhood search mechanism includes:
[0093] Generate an adaptive step size adjustment factor as: where β represents the adaptive step size adjustment factor, and r3 represents the third random number between (0, 1);
[0094] According to the adaptive step size adjustment factor, determine the search value of the optimal individual in the h-th neighborhood search direction as:
[0095]
[0096] where represents the d-th dimension parameter of the optimal individual in the t-th training process, d = 1, 2,..., D, D represents the total dimension of the parameters, S represents the preset neighborhood search step size, h represents the neighborhood search direction, H represents the total number of neighborhood search directions, and h = 1, 2,..., H, represents the d-th dimension parameter of the search value corresponding to the optimal individual in the h-th neighborhood search direction;
[0097] Traverse all neighborhood search directions, determine the H search values corresponding to the optimal individual, and determine the search value with the smallest loss function value as the optimal individual after neighborhood update.
[0098] The adaptive neighborhood search mechanism provided by the embodiments of the present invention can search the neighborhood range of the optimal individual with an adaptive step size, effectively ensuring the search speed of the algorithm, while improving the search accuracy of the algorithm and further enhancing the performance of the algorithm.
[0099] S27. Reconstitute the population with the encoded individual after global update and the optimal individual after neighborhood update;
[0100] S28. Determine whether the hyperparameter update end condition is met. If so, determine the final hyperparameters of the entity recognition model based on the reconstituted population to obtain the entity recognition model deployed by the improved deep learning algorithm. Otherwise, return to the step of determining the optimal individual and the suboptimal individual.
[0101] In an embodiment of the present invention, determining whether the hyperparameter update termination condition is met includes: determining whether the number of training times reaches the maximum number of training times, if so, determining that the hyperparameter update termination condition is met, otherwise determining that the hyperparameter update termination condition is not met.
[0102] In an embodiment of the present invention, the final hyperparameters of the entity recognition model are determined according to the reorganized population, and the entity recognition model deployed by the improved deep learning algorithm is obtained, including:
[0103] According to the reconstituted population, the optimal individual is obtained again, and the hyperparameters contained in the optimal individual are used as the final hyperparameters of the entity recognition model. The entity recognition model is deployed according to the final hyperparameters of the entity recognition model to obtain the entity recognition model deployed by the improved deep learning algorithm.
[0104] In an embodiment of the present invention, based on the first target entity corresponding to the query statement, querying the candidate relationship in the knowledge graph to obtain the first candidate relationship, and obtaining the similarity between the query statement and the first candidate relationship, and determining the first target answer corresponding to the query statement according to the similarity, including:
[0105] Based on the first target entity corresponding to the query statement, search the knowledge graph for knowledge related to the first target entity to obtain a plurality of first target knowledge, and use the relations in all the first target knowledge as the first candidate relations;
[0106] Obtaining an internal representation corresponding to the query statement, and obtaining a similarity between the internal representation and the first candidate relationship, and determining the first candidate relationship with the highest similarity as the second candidate relationship;
[0107] In order to answer natural language questions, this embodiment converts the query sentence into an internal representation that can capture the semantics of the question. For example, when a natural language question "What is the capital of the United States?" is input, first, the central entity in the query sentence is found to be the United States through the entity recognition model; then, the category corresponding to the entity (i.e., country) is queried through the entity conceptualization mechanism; finally, the entity in the question is replaced with the category to which it belongs, so that the internal representation of the question "What is the capital of &country&" can be obtained. &country& represents a wildcard, and as long as the entity is a country, it can be matched, thereby achieving entity matching.
[0108] The second target knowledge including the target knowledge and the second candidate relationship is used as the first target answer.
[0109] In an embodiment of the present invention, the similarity is set as the cosine similarity. The cosine angle value between two vectors is calculated through the cosine similarity to obtain the semantic similarity between the two vectors. In the same vector space, the smaller the cosine angle value between two vectors, the closer the cosine distance between them. It should be noted that the cosine distance is mainly judged from the direction and is not affected by the vector length, which is the main reason for using the cosine distance to calculate the similarity.
[0110] In an embodiment of the present invention, the preset answer constraint condition is set as: the similarity between the relationship in the first target answer and the query statement is greater than a preset similarity threshold.
[0111] In an embodiment of the present invention, based on the query statement, a generative answer optimization algorithm is used to generate a second target answer, and the second target answer is used as the answer corresponding to the query statement, including:
[0112] Based on the first target entity corresponding to the query statement, all entities within the neighborhood of the first target entity are obtained to get a plurality of second target entities;
[0113] The importance of all second target entities relative to the first target entity is obtained, and the second target entity with the greatest importance is obtained to get a third target entity;
[0114] All entities within the neighborhood of the third target entity are obtained to get a fourth target entity; wherein, the fourth target entity is different from the first target entity;
[0115] The importance of all fourth target entities relative to the third target entity is obtained, and the fourth target entity with the greatest importance is obtained to get a fifth target entity;
[0116] New knowledge is constructed using the relationship between the first target entity, the third target entity, and the fifth target entity in the query statement and the fifth target entity, and the obtained new knowledge is used as the second target answer, and the second target answer is used as the answer corresponding to the query statement.
[0117] The importance of an entity can be determined through an importance calculation model or some existing importance calculation methods. The importance calculation model may include a fully connected neural network layer, multiple aggregation layers, an averaging layer, and a non-linear activation function layer. After calculating the initial score through the fully connected neural network layer, score aggregation is independently performed through multiple aggregation layers, then averaged through the averaging layer, and output through the non-linear activation function layer.
[0118] Those of ordinary skill in the art can understand that all or part of the steps in implementing the above facts and methods can be completed by instructing relevant hardware through a program. The program involved or the said program can be stored in a computer-readable storage medium. When the program is executed, it includes the following steps: At this time, the corresponding method steps are introduced. The storage medium can be ROM / RAM, magnetic disk, optical disk, etc.
[0119] The specific embodiments described above further elaborate on the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily think of other embodiments of the present invention. The present invention aims to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common general knowledge or conventional technical means in the technical field not disclosed in the present invention. It should be understood that the present invention is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present invention is only limited by the appended claims.
Claims
1. A generative question and answer optimization method based on deep learning, characterized in that Including: Obtain an inquiry statement input by a user, and dispatch an entity recognition model deployed by an improved deep learning algorithm to recognize the inquiry statement, and obtain a first target entity corresponding to the inquiry statement; Based on the first target entity corresponding to the inquiry statement, query for candidate relationships in a knowledge graph to obtain a first candidate relationship, and obtain the similarity between the inquiry statement and the first candidate relationship, and determine a first target answer corresponding to the inquiry statement according to the similarity; When the first target answer meets the preset answer constraint conditions, then use the first target answer as the answer corresponding to the inquiry statement and output it; When the first target answer does not meet the preset answer constraint conditions, then based on the inquiry statement, use a generative answer optimization algorithm to generate a second target answer, and use the second target answer as the answer corresponding to the inquiry statement and output it.
2. The generative Q&A optimization method based on deep learning according to claim 1, wherein Obtain an inquiry statement input by a user, and dispatch an entity recognition model deployed by an improved deep learning algorithm to recognize the inquiry statement, and obtain a first target entity corresponding to the inquiry statement, including: Obtain an inquiry statement input by a user, and use the jieba word segmentation tool to perform word segmentation processing on the inquiry statement to obtain words corresponding to the inquiry statement; Dispatch an entity recognition model deployed by an improved deep learning algorithm to process the words corresponding to the inquiry statement, and obtain a first target entity corresponding to the inquiry statement.
3. The generative Q&A optimization method based on deep learning according to claim 1 or 2, characterized in that The entity recognition model is constructed using a BERT-BiLSTM-CRF model.
4. The generative question-answering optimization method based on deep learning according to claim 3, characterized in that The improved deep learning algorithm includes: Initialize the hyperparameters of the entity recognition model, and encode the hyperparameters into vectors to obtain encoded individuals, and repeatedly obtain multiple different encoded individuals; Obtain the loss function value corresponding to each encoded individual, and determine the optimal individual and the sub-optimal individual according to the loss function value; wherein, the loss function value of the sub-optimal individual is only greater than the loss function value of the optimal individual; According to the optimal individual and the sub-optimal individual, use a multi-dimensional guidance mechanism to guide and update each encoded individual to obtain the encoded individual after guidance update; According to the optimal individual, use a spiral search mechanism to perform spiral update on the encoded individual after guidance update to obtain the encoded individual after spiral update; Use a global mutation mechanism to perform global update on the encoded individual after spiral update to obtain the encoded individual after global update; For the optimal individual, use an adaptive neighborhood search mechanism to perform neighborhood update on the optimal individual to obtain the optimal individual after neighborhood update; Reconstitute the population with the encoded individual after global update and the optimal individual after neighborhood update; Judge whether the hyperparameter update end condition is met. If so, determine the final hyperparameters of the entity recognition model according to the reconstituted population to obtain an entity recognition model deployed by an improved deep learning algorithm. Otherwise, return to the step of determining the optimal individual and the sub-optimal individual.
5. The generative question-answering optimization method based on deep learning according to claim 4, wherein Judging whether the hyperparameter update end condition is met includes: judging whether the number of training times reaches the maximum number of training times. If so, it is determined that the hyperparameter update end condition is met. Otherwise, it is determined that the hyperparameter update end condition is not met.
6. The generative Q&A optimization method based on deep learning according to claim 5, wherein, Based on the reconstituted population, determine the final hyperparameters of the entity recognition model, and obtain the entity recognition model deployed by the improved deep learning algorithm, including: Based on the reconstituted population, re-obtain the optimal individual, and use the hyperparameters included in the optimal individual as the final hyperparameters of the entity recognition model, and deploy the entity recognition model according to the final hyperparameters of the entity recognition model to obtain the entity recognition model deployed by the improved deep learning algorithm.
7. The generative Q&A optimization method based on deep learning according to claim 1, characterized in that Based on the first target entity corresponding to the query statement, query candidate relationships in the knowledge graph to obtain the first candidate relationship, and obtain the similarity between the query statement and the first candidate relationship, and determine the first target answer corresponding to the query statement, including: Based on the first target entity corresponding to the query statement, query the knowledge related to the first target entity in the knowledge graph to obtain multiple first target knowledge, and use the relationships in all the first target knowledge as the first candidate relationship; Obtain the internal representation corresponding to the query statement, and obtain the similarity between the internal representation and the first candidate relationship, and determine the first candidate relationship with the highest similarity as the second candidate relationship; Use the second target knowledge including the target knowledge and the second candidate relationship as the first target answer.
8. The generative Q&A optimization method based on deep learning according to claim 7, wherein The similarity is set to cosine similarity.
9. The generative Q&A optimization method based on deep learning according to claim 8, characterized in that, The preset answer constraint condition is set as: the similarity between the relationship in the first target answer and the query statement is greater than the preset similarity threshold.
10. The generative Q&A optimization method based on deep learning according to claim 1, characterized in that Based on the query statement, use the generative answer optimization algorithm to generate the second target answer, and use the second target answer as the answer corresponding to the query statement, including: Based on the first target entity corresponding to the query statement, obtain all the entities in the neighborhood of the first target entity to obtain multiple second target entities; Obtain the importance of all the second target entities relative to the first target entity, and obtain the second target entity with the greatest importance to obtain the third target entity; Obtain all the entities in the neighborhood of the third target entity to obtain the fourth target entity; where the fourth target entity is different from the first target entity; Obtain the importance of all the fourth target entities relative to the third target entity, and obtain the fourth target entity with the greatest importance to obtain the fifth target entity; Construct new knowledge using the relationship between the first target entity, the third target entity and the fifth target entity in the query statement and the fifth target entity, and use the obtained new knowledge as the second target answer, and use the second target answer as the answer corresponding to the query statement.