Knowledge base reasoning-based search engine intelligent question answering method, system and device
By tagging, traversing, and optimizing triples and multi-hop paths in the search engine knowledge base, the problem of ignoring structural and semantic information in multi-hop reasoning is solved, the question-answering ability of the multi-hop reasoning model is improved, and more efficient intelligent question-answering performance is achieved.
Patent Information
- Application Number
- CN202310324098.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2043-03-29
AI Technical Summary
Existing technologies neglect the structural information of knowledge base triples and the semantic information between different multi-hop paths during multi-hop inference, and fail to effectively optimize the multi-hop inference process.
By tagging triples in the search engine's knowledge base, traversing multi-hop valid and invalid paths, setting hyperparameters, mapping to vector space, calculating feature vectors of multi-hop paths, optimizing the model using binary cross-entropy function, and integrating the encoder model to distinguish between valid and invalid paths, the question-answering ability of the multi-hop inference model is improved.
It significantly improves the accuracy of multi-hop inference models, enhances the intelligent question-answering performance of search engine knowledge bases, and can more accurately identify valid and invalid paths, thereby improving question-answering accuracy.
Smart Images

Figure CN116431785B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent question answering of search engines, and particularly relates to a search engine intelligent question answering method, system and device based on knowledge base reasoning. BACKGROUND
[0002] Intelligent question answering for search engines, given a natural language question, the model can reason the corresponding entity from the existing knowledge base as the answer to the question. Specifically, for search engine-oriented questions, entity recognition and relationship extraction are performed, and the corresponding entities and relationships in the search engine knowledge base are linked to infer candidate answers and filter out target answers.
[0003] Among them, the multi-hop reasoning technology for knowledge base mainly has the following problems:
[0004] 1. The structure information of the knowledge base triple is ignored in the multi-hop reasoning process;
[0005] 2. The semantic information between different multi-hop paths is ignored in the multi-hop reasoning process;
[0006] 3. There is no work to model multi-hop paths and optimize the multi-hop reasoning process. SUMMARY
[0007] In order to overcome the defects and deficiencies of the prior art, the present application provides a search engine intelligent question answering method based on knowledge base reasoning. The present application traverses the multi-hop neighborhood of the search engine knowledge base triple, and then extracts the multi-hop effective path and the multi-hop invalid path in the neighborhood. Then, the multi-hop effective path and the multi-hop invalid path are modeled, and how to distinguish between effective paths and invalid paths is learned. The trained model is further integrated into the multi-hop reasoning model to improve the question answering capability of the multi-hop reasoning model on the search engine.
[0008] The second object of the present application is to provide a search engine intelligent question answering system based on knowledge base reasoning.
[0009] The third object of the present application is to provide a computing device.
[0010] In order to achieve the above objects, the present application adopts the following technical solutions:
[0011] A search engine intelligent question answering method based on knowledge base reasoning, comprising the following steps:
[0012] Labeling triples in the search engine knowledge base;
[0013] Based on the search engine knowledge base, traversing the multi-hop effective path and the multi-hop invalid path of a triple;
[0014] Setting the hyperparameter of the number of search engine multi-hop paths;
[0015] Setting label values corresponding to the multi-hop effective path and the multi-hop invalid path, adding a start relation to each multi-hop path, setting the multi-hop path according to each hop, mapping the entity and the relation of the multi-hop path to a vector space respectively to obtain an embedding vector;
[0016] Performing linear transformation on the embedding vector corresponding to the multi-hop path to obtain a feature vector of a multi-hop path action of the search engine knowledge base;
[0017] Calculating a score value of the multi-hop path in the search engine knowledge base according to the feature vector of the multi-hop path action;
[0018] Integrating the score value of each multi-hop path into a score vector, calculating a loss using a binary cross-entropy function, traversing the triples in the search engine knowledge base, and optimizing the embedding vectors of the entities and the relations in the triples in the search engine knowledge base through back propagation to obtain an encoder model;
[0019] The encoder model saves the embedding vectors of the entities and the relations in the search engine knowledge base and is applied to a search engine knowledge base question answering model decoder MultiHop of multi-hop reasoning;
[0020] Obtaining a question input by a user, obtaining source entities and question answering relations involved in the question through a named recognition tool and a relation extraction tool;
[0021] Inputting the source entities and the question answering relations into the search engine knowledge base question answering model decoder MultiHop to perform multi-hop reasoning and reasoning out an answer to the question.
[0022] As a preferred technical solution, the step of marking the triples in the search engine knowledge base comprises the following steps:
[0023] Marking the triples in the search engine knowledge base as head entities e s , relations r, and tail entities e o .
[0024] Mapping the entities and the relations in the search engine knowledge base to a vector space.
[0025] As a preferred technical solution, the step of setting the hyperparameter of the number of multi-hop paths of the search engine comprises the following steps:
[0026] Setting a proportion of random sampling of the multi-hop effective path and the multi-hop invalid path, and if a minimum value of the number of samples is less than a preset threshold, using a self-loop or an invalid path to make up, the self-loop path being: e s →r op →e s →r q →e o , e sdenotes a head entity, e o denotes a tail entity, r op denotes a relation in the search engine knowledge base without any operation, r q denotes a question-answer relation, and the invalid path is: e s → r d → e d → r d → e d , r d denotes a false relation in the search engine knowledge base, e d denotes a false entity in the search engine knowledge base.
[0027] As a preferred technical solution, the embedding vector corresponding to the multi-hop path is linearly transformed, and is specifically represented as:
[0028]
[0029] Wherein, : represents the splicing operation of the vector, W1 represents the learnable model parameter, denotes the feature vector of the 0th jump action (r0, e s ), denotes the feature vector of the first jump action (r1, e1), denotes the feature vector of the second jump action (r2, e o ), e s denotes a head entity, e o denotes a tail entity, e1 denotes a certain entity in the search engine knowledge base, r0 denotes a redundant starting relation, r1 denotes a certain relation adjacent to the head entity e s in the search engine knowledge base, and r2 denotes a certain relation in the search engine knowledge base.
[0030] As a preferred technical solution, the scoring value of the multi-hop path in the search engine knowledge base is calculated according to the feature vector of the multi-hop path action, and is specifically represented as:
[0031]
[0032] Wherein, ω represents a convolution kernel parameter, W2 represents a learnable model parameter, f(·) represents a nonlinear activation function ReLU(·), vec(·) represents a matrix flattening operation to a vector, σ(·) represents a Sigmoid(·) activation function, and c i denotes the scoring value of the ith multi-hop path s i .
[0033] As a preferred technical solution, the loss is calculated using a binary cross-entropy function, and is specifically represented as:
[0034]
[0035] where i represents the i-th multi-hop path, N represents the total number of the multi-hop valid paths and the multi-hop invalid paths, and l represents the label of the multi-hop valid path and the multi-hop invalid path.
[0036] As a preferred technical solution, the encoder model saves embedding vectors about search engine knowledge base entities and relations, and is integrated into a search engine knowledge base question answering model decoder MultiHop of multi-hop reasoning, and specifically includes:
[0037] agg e =σ(W3(e p +e i )+b);agg r =σ(W4(r p +r i )+b)
[0038] where W3 and W4 represent learnable parameters, e p represents an entity embedding vector in the encoder, e i represents a randomly initialized entity embedding vector, r p represents a relation embedding vector in the encoder, r i represents a randomly initialized relation embedding vector, b represents a bias, and σ(·) represents a ReLU(·) activation function, agg e and agg r respectively represent entity and relation embedding vectors obtained after the integration of the encoder.
[0039] As a preferred technical solution, the source entity and the question and answer relation are input into the search engine knowledge base question answering model decoder MultiHop for multi-hop reasoning, and the answer to the question is reasoned out, and the reasoning process of each jump action is represented as:
[0040]
[0041] where π θ represents a probability distribution of each jump action space, softmax(·) represents a normalized exponential function, A t represents an action space corresponding to each jump, represents a vector product, W5 and W6 represent learnable model parameters, ReLU(·) represents a nonlinear activation function, e t represents an embedding vector corresponding to a current entity on a reasoning path, LSTM(·) represents a long short-term memory network, h t-1 represents a hidden state of the long short-term memory network for memorizing historical reasoning paths, a t represents a feature vector of each action, : represents a concatenation operation of two vectors, and r q represents a question and answer relation rq embedding vectors of the triples.
[0042] Based on the action space probability distribution of the current hop, the action corresponding to the maximum probability value is taken as the inference result, denoted as (r m1 ,e m1 ), r m1 and e m1 represent the relationship and entity on the search inference path respectively.
[0043] The search engine infers the answer corresponding to the user input question based on the search path and the inference path.
[0044] In order to achieve the above-mentioned second purpose, the application adopts the following technical solutions:
[0045] A search engine intelligent question and answer system based on knowledge base inference, comprising: a triple marking module, a multi-hop path traversal module, a hyperparameter setting module, a multi-hop path mapping module, a feature vector calculation module, a score value calculation module, a back propagation optimization module, a feature information integration module, a question acquisition module, and a multi-hop inference module.
[0046] The triple marking module is used to mark triples in the search engine knowledge base.
[0047] The multi-hop path traversal module is used to traverse the multi-hop effective path and the multi-hop ineffective path of a triple based on the search engine knowledge base.
[0048] The hyperparameter setting module is used to set the hyperparameters of the number of multi-hop paths of the search engine.
[0049] The multi-hop path mapping module is used to set the label values corresponding to the multi-hop effective path and the multi-hop ineffective path, add a start relationship to each multi-hop path, set the multi-hop path according to each hop, map the entities and relationships of the multi-hop path to the vector space respectively, and obtain embedding vectors.
[0050] The feature vector calculation module is used to perform linear transformation on the embedding vectors corresponding to the multi-hop paths to obtain the feature vectors of the multi-hop path actions of the search engine knowledge base.
[0051] The score value calculation module is used to calculate the score values of the multi-hop paths in the search engine knowledge base according to the feature vectors of the multi-hop path actions.
[0052] The back propagation optimization module is used to integrate the score values of each multi-hop path into a score vector, calculate the loss using a binary cross-entropy function, traverse the triples in the search engine knowledge base, and back propagate and optimize the embedding vectors of the entities and relationships in the triples of the search engine knowledge base to obtain an encoder model.
[0053] The feature information integration module is used to integrate the embedding vectors of entities and relations in the search engine knowledge base stored in the encoder model into the MultiHop decoder of the multi-hop reasoning search engine knowledge base question answering model;
[0054] The question acquisition module is used to acquire questions input by users and obtain the source entities and question-answer relationships involved in the question through naming recognition tools and relationship extraction tools;
[0055] The multi-hop reasoning module is used to input the source entity and question-answer relationship into the MultiHop question-answering model decoder of the search engine knowledge base to perform multi-hop reasoning and deduce the answer to the question.
[0056] To achieve the third objective mentioned above, the present invention adopts the following technical solution:
[0057] A computing device includes a processor and a memory for storing processor-executable programs, wherein when the processor executes the programs stored in the memory, it implements the above-described intelligent question-answering method for a search engine based on knowledge base reasoning.
[0058] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0059] This invention models effective and invalid paths in multi-hop inference based on convolutional coding, which can effectively learn and memorize the structural features of triples in multi-hop inference, identify and distinguish the semantic features of different multi-hop paths, thereby significantly improving the accuracy of multi-hop inference models and enhancing the performance of intelligent question answering for search engine knowledge bases. Attached Figure Description
[0060] Figure 1 This is a flowchart illustrating the intelligent question-answering method for a search engine based on knowledge base reasoning, as described in this invention.
[0061] Figure 2 This is a schematic diagram of the multi-hop path modeling process of the search engine knowledge base of this invention. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0063] Example 1
[0064] like Figure 1 As shown in the figure, this embodiment provides a search engine intelligent question answering method based on knowledge base reasoning. The specific steps of its intelligent reasoning process are as follows:
[0065] Step one: mark the triples in the search engine knowledge base, first mark the triples in the search engine knowledge base as head entity e s , relation r, tail entity e o , at the same time, the set of all entities in the search engine knowledge base is denoted as E, the set of all relations in the search engine knowledge base is denoted as R, the set of triples in the search engine knowledge base is denoted as T, the entities and relations in the search engine knowledge base are mapped to the vector space, and e represents the embedding vector of entity e, and r represents the embedding vector of relation r, that is, the embedding vector is denoted in bold. For example, there is a triple ("Beijing" "is the capital" "China") in the search engine knowledge base, where "Beijing" represents an entity in the search engine knowledge base, denoted by e, the embedding vector corresponding to the "Beijing" entity is denoted by e, "is the capital" is a relation in the search engine knowledge base, denoted by r, and the embedding vector corresponding to the "is the capital" relation is denoted by r, e and r do not refer to a specific entity, which represents a certain entity in the search engine knowledge base.
[0066] Step two: traverse the multi-hop path of the triples in the search engine knowledge base. Based on the search engine knowledge base, traverse the multi-hop valid path and multi-hop invalid path of a certain triple, where the multi-hop valid path refers to a path starting from the head entity e s , which can reach the tail entity e o through multi-hop search in the search engine knowledge base, and the multi-hop invalid path refers to a path starting from the head entity e s , which cannot find the tail entity e o through multi-hop search in the search engine knowledge base. For example, the set of multi-hop valid paths is {(e s →r1→e1→r2→e o )}, r1 represents a certain relation adjacent to the head entity e s in the search engine knowledge base, e1 represents a certain entity in the search engine knowledge base, r2 represents a certain relation in the search engine knowledge base, and the tail entity e t is found through the path; the set of multi-hop invalid paths is: where r ′ represents a certain relation in the relation set R, and the error entity e2 is found through the path (e s →r1→e1→r2→e2), and the triple (e s , ′ ,2) composed of the head entity e ′ , the entity e2 and the relation r s does not exist in the search engine knowledge base.
[0067] Step three: Set the hyperparameters of the number of multi-hop reasoning paths of the search engine. Based on the search engine knowledge base triples, set the multi-hop effective path set and the multi-hop invalid path set obtained in step two as S u and S v respectively. In order to reduce the training burden of the model, set the ratio of random sampling of multi-hop effective paths and multi-hop invalid paths as 1:3, set the sampling number of multi-hop effective paths as 2, and set the sampling number of multi-hop invalid paths as 6. If the minimum value of the sampling number is less than the preset threshold, use self-loop or invalid path to make up. The self-loop path e s →r op →e s →r q →e o , r op indicates that there is no operation in the relationship of the search engine knowledge base, the invalid path e s →r d →e d →r d →e d , r d indicates a false relationship in the search engine knowledge base, and e d indicates a false entity in the search engine knowledge base.
[0068] Step four: As shown in Figure 2 , map the multi-hop reasoning paths of the search engine to the vector space. According to step
[0069] three, set the sampled multi-hop effective paths and multi-hop invalid paths as S′ u and S′ v respectively, |S′ u | = 2, |S′ v | = 6. Then set the label value of the effective path as 1 and the label value of the invalid path as 0, that is, the label value of the eight multi-hop paths corresponding to the search engine knowledge base triples is l = [1, 1, 0, 0, 0, 0, 0, 0]. Secondly, add a start relationship r0 to each multi-hop path, and set the multi-hop path according to each jump, such as p = ((r0, e s ), (r1, e1), (r2, e o )). Wherein r0 represents a redundant start relationship, (r1, e1) represents the first action on the multi-hop path, and the action refers to the further selection of the edge containing the entity and the relationship according to the current entity. Finally, map the entities and relationships of the multi-hop path to the vector space respectively to obtain the embedding vector, for example, p i = [r0, e s , r1, e1, r2, e o ], p iThe embedding vector represents the i-th valid or invalid multi-hop path. The above symbols are mapped to a vector space, such as the entity "apple". The mapped vector can be a 200-dimensional vector, and the value of each vector is a scalar floating-point number.
[0070] Step 5: Combining Figure 2 As shown, the multi-hop path feature information of the search engine knowledge base is calculated. Based on step four, eight multi-hop paths s will be obtained. i,i=1,2,...,8 and its corresponding embedding vector p i,i=1,2,...,8 Let i represent the i-th multi-hop path, and then for the multi-hop path s i The corresponding embedding vector p i The linear transformation is performed in the following form:
[0071]
[0072] Where “:” indicates vector concatenation, and W1 represents the learnable model parameters. This represents the 0th jump action (r0, e) s ) eigenvectors, Let (r1, e1) be the feature vector representing the first jump action. Indicates the second jump action (r2,e) o The feature vector of ) has the superscript i indicating the i-th multi-hop path and the subscripts x, y, z used to distinguish different actions on the multi-hop path. In this embodiment, x, y, z correspond to the 0th hop, the first hop, and the second hop actions, but multiple symbols can also be used to represent the multi-hop actions.
[0073] Step Six: Calculate the score of the multi-hop reasoning path in the search engine knowledge base. Step Five will yield the feature vector of the action of the i-th multi-hop path. Then, the score for this multi-hop path is calculated based on the action feature vector, as shown below:
[0074]
[0075] Where ω represents the convolution kernel parameters, W2 represents the learnable model parameters, f(·) represents the non-linear activation function ReLU(·), vec(·) represents the operation of flattening the matrix into a vector, σ(·) represents the Sigmoid(·) activation function, and c i Represents the i-th multi-hop path s i The score.
[0076] Step 7: Calculate and optimize the score for all multi-hop inference paths of the search engine. Based on Step 6, each multi-hop path s will be obtained. i,i=1,2...,8 The corresponding score value c i,i=1,2...,8, and then the scoring vector C = [c1, c2, c3, c4, c5, c6, c7, c8] corresponding to the multi-hop path is obtained. Finally, the model loss is calculated using the binary cross-entropy function as follows:
[0077]
[0078] where i is the cumulative index, representing each multi-hop path, N = |s' u |+|S′ v | represents the number of multi-hop valid paths and multi-hop invalid paths, and l = [1, 1, 0, 0, 0, 0, 0, 0] represents the labels of multi-hop valid paths and multi-hop invalid paths. Finally, the triples in the search engine knowledge base are traversed, and steps two to seven are sequentially performed on the triples in the knowledge base to backpropagate and optimize the embedding vectors of entities and relations in the triples in the search engine knowledge base, obtaining an encoder model.
[0079] Step eight: integrating the feature information of the multi-hop reasoning path in the search engine knowledge base into the multi-hop reasoning model. According to step seven, an encoder with the ability to distinguish between multi-hop valid paths and multi-hop invalid paths is obtained, and the embedding vectors of entities and relations about the search engine knowledge base in the encoder are applied to the multi-hop reasoning search engine knowledge base question answering model decoder MultiHop (open source model). The integration process is as follows:
[0080] agg e =σ(W3(e p +e i )+b);agg r =σ(W4(r p +r i )+b)
[0081] where W3 and W4 represent learnable parameters, e p represent the entity embedding vectors in the encoder, e i represent randomly initialized entity embedding vectors, r p represent the relation embedding vectors in the encoder, r i represent randomly initialized relation embedding vectors, b represents the bias, σ(·) represents the ReLU(·) activation function, agg e and agg r represent the entity and relation embedding vectors obtained after integrating the encoder, respectively.
[0082] Step nine: the multi-hop reasoning model MultiHop is applied to the search engine knowledge base. A user inputs a certain complex problem, and the source entities e mRelationship between questions and answers r q , will the source entity e m Relationship between questions and answers (r) q The input is fed into MultiHop, a multi-hop question-answering search model for search engines, for multi-hop inference. In this embodiment, the open-source module MultiHop is used as a decoder, and the inference process for each hop action is as follows:
[0083]
[0084] Where LSTM(·) represents Long Short-Term Memory network, ":" represents the concatenation operation of two vectors, and r q Representing a question-and-answer relationship r q The embedding vector, e t Represents the current entity e on the reasoning path. t The corresponding embedding vector,
[0085] a t =[r t-1 : t-1 ] represents the feature vector of each action. An action is a (relation-entity) tuple composed of entities and relations directly connected to the entity. During the first hop of inference, the action space corresponds to the edges and nodes directly connected to the source entity. h t-1 W5 and W6 represent the hidden states of the Long Short-Term Memory network used to remember historical reasoning paths. ReLU represents the vector product, ReLU(·) represents the nonlinear activation function, and A t This represents the action space corresponding to each jump, softmax(·) represents the normalized exponential function, and π θ This represents the probability distribution of each jump's action space.
[0086] Step 10: Infer the answer to the question based on the multi-hop inference model of the search engine knowledge base. Based on the action space probability distribution of the current hop, the action corresponding to the highest probability value is recorded as the inference result (r). m1 ,e m1 ), r m1 and e m1 Let these represent the relations and entities along the search reasoning path, respectively. Repeating step nine through the search engine process will yield the answer to the question. mT And the reasoning path, in the form of (r0,e m ,r m1 ,e m1 ,r m2 ,e m2 ,…,r mT ,e mT ), entity e mTTo search for an answer to the question for the user, the search engine infers an answer e to the question based on the search path mT T represents a multi-hop inference step.
[0087] To further illustrate the advantages of the intelligent question-answering method of the search engine based on the knowledge base proposed in this embodiment, the following example is given. There are triplets ("Zhang San", "born in", "Beijing"), ("Beijing", "is the capital", "China"), ("Zhang San", "wife", "Li Si"), and ("Li Si", "husband", "Zhang San") in the search engine knowledge base. According to steps one to eight, for the question "Zhang San is a citizen of which country?", the model can identify the multi-hop effective path "Zhang San" -> "born in" -> "Beijing" -> "capital" -> "China" for the triplet in the search engine knowledge base, and determine the multi-hop ineffective path "Zhang San" -> "wife" -> "Li Si" -> "husband" -> "Zhang San" for the triplet. Through steps one to seven, the model can learn two different path feature information, effectively identify the multi-hop effective path that contributes to multi-hop reasoning, and effectively identify the multi-hop ineffective path that does not contribute to multi-hop reasoning. The search engine multi-hop reasoning model integrates the ability to distinguish between the two path features, which can better distinguish between effective and ineffective paths in the search engine reasoning process, optimize path exploration in the multi-hop reasoning process of the search engine knowledge base, and help the search engine multi-hop reasoning model to better, faster and more accurately find answers to search questions.
[0088] Embodiment 2
[0089] The embodiment provides an intelligent question-answering system of a search engine based on knowledge base reasoning, comprising: a triplet marking module, a multi-hop path traversal module, a hyperparameter setting module, a multi-hop path mapping module, a feature vector calculation module, a score calculation module, a backpropagation optimization module, a feature information integration module, a question acquisition module, and a multi-hop reasoning module.
[0090] In this embodiment, the triplet marking module is used to mark triplets in the search engine knowledge base.
[0091] In this embodiment, the multi-hop path traversal module is used to traverse the multi-hop effective path and the multi-hop ineffective path of a certain triplet based on the search engine knowledge base.
[0092] In this embodiment, the hyperparameter setting module is used to set the hyperparameter of the number of multi-hop paths of the search engine.
[0093] In this embodiment, the multi-hop path mapping module is used to set the label value corresponding to the multi-hop effective path and the multi-hop ineffective path, add a start relationship to each multi-hop path, set the multi-hop path according to each hop, and map the entities and relationships of the multi-hop path to the vector space respectively to obtain the embedding vector.
[0094] In the embodiment, the feature vector calculation module is configured to perform linear transformation on the embedding vector corresponding to the multi-hop path to obtain the feature vector of the multi-hop path action of the search engine knowledge base.
[0095] In the embodiment, the score calculation module is configured to calculate the score of the multi-hop path in the search engine knowledge base according to the feature vector of the multi-hop path action.
[0096] In the embodiment, the back propagation optimization module is configured to integrate the score of each multi-hop path into a score vector, calculate the loss using a binary cross-entropy function, traverse the triples in the search engine knowledge base, and back propagate and optimize the embedding vectors of the entities and relations in the triples in the search engine knowledge base to obtain an encoder model.
[0097] In the embodiment, the feature information integration module is configured to integrate the embedding vectors of the entities and relations of the search engine knowledge base saved by the encoder model into a MultiHop search engine knowledge base question and answer model decoder of multi-hop reasoning.
[0098] In the embodiment, the question acquisition module is configured to acquire a question input by a user, and obtain source entities and question and answer relations involved in the question through a named recognition tool and a relation extraction tool.
[0099] In the embodiment, the multi-hop reasoning module is configured to input the source entities and the question and answer relations into the MultiHop search engine knowledge base question and answer model decoder to perform multi-hop reasoning, and infer the answer to the question.
[0100] Embodiment 3
[0101] The embodiment provides a computing device, which can be a desktop computer, a notebook computer, a smart phone, a PDA handheld terminal, a tablet computer, or other terminal devices with a display function. The computing device includes a processor and a memory. The memory stores one or more programs. When the processor executes the programs stored in the memory, the knowledge base reasoning-based search engine intelligent question and answer method of embodiment 1 is implemented.
[0102] The above embodiments are preferred embodiments of the present application, but the embodiments of the present application are not limited by the above embodiments. Any changes, modifications, substitutions, combinations, simplifications made without departing from the spirit and principles of the present application should be equivalent replacement methods, and are included in the protection scope of the present application.
Claims
1. A knowledge base reasoning-based search engine intelligent question answering method, characterized in that, Comprise the following steps: Marking triples in a search engine knowledge base; Based on the search engine knowledge base, traverse the multi-hop valid path and the multi-hop invalid path of a certain triple; Set the hyperparameters of the number of search engine multi-hop paths; Set the label values corresponding to the multi-hop valid path and the multi-hop invalid path, add a start relationship to each multi-hop path, set the multi-hop path according to each hop, map the entities and relationships of the multi-hop path to the vector space respectively, and obtain the embedding vector; Linearly transform the embedding vector corresponding to the multi-hop path to obtain the feature vector of the multi-hop path action of the search engine knowledge base; Calculate the scoring value of the multi-hop path in the search engine knowledge base according to the feature vector of the multi-hop path action; Integrate the scoring value of each multi-hop path into a scoring vector, calculate the loss using the binary cross-entropy function, traverse the triples in the search engine knowledge base, back-propagate and optimize the embedding vectors of entities and relationships in the triples in the search engine knowledge base, and obtain an encoder model; The encoder model saves the embedding vectors of entities and relationships in the search engine knowledge base and integrates them into the search engine knowledge base question and answer model decoder MultiHop for multi-hop reasoning; Obtain the user input question, obtain the source entity and question and answer relationship involved in the question through a named recognition tool and a relationship extraction tool; Input the source entity and question and answer relationship into the search engine knowledge base question and answer model decoder MultiHop for multi-hop reasoning to infer the answer to the question; The reasoning process of each hop action is represented as: ; in, This represents the probability distribution of each jump's action space. Represents the normalized exponential function, This represents the motion space corresponding to each jump. Represents the vector product. and Represents the learnable model parameters. Represents a non-linear activation function. This represents the embedding vector corresponding to the current entity on the inference path. Represents the Long Short-Term Memory network. This indicates that the hidden states of the Long Short-Term Memory (LSTM) network are used to remember historical reasoning paths. represents the feature vector for each action, and represents the concatenation operation between two vectors. Indicates a question-and-answer relationship The embedding vector; Based on the action space probability distribution of the current hop, the action corresponding to the maximum probability value is taken as the inference result, denoted as , and respectively represent the relationship and entity on the search inference path. The search engine infers the answer corresponding to the user input question based on the search path and the reasoning path. 2.The knowledge base reasoning based search engine intelligent question answering method according to claim 1, characterized in that, The specific steps for marking triples in the search engine knowledge base include: The knowledge base triples stored in the search engine are denoted as head entity , relation , tail entity , respectively. Map the entities and relationships in the search engine knowledge base to the vector space. 3.The knowledge base reasoning based search engine intelligent question answering method according to claim 1, characterized in that, The specific steps for setting the hyperparameters of the number of search engine multi-hop paths include: The proportion of random sampling of the multi-hop effective path and the multi-hop ineffective path is set, if the minimum value of the sampling number is less than a preset threshold, a self-loop or an ineffective path is used to make up, the self-loop path is: , represents a head entity, represents a tail entity, represents a relationship without any operation in a search engine knowledge base, represents a question and answer relationship, and the ineffective path is: , represents a false relationship in a search engine knowledge base, represents a false entity in a search engine knowledge base. 4.The knowledge base reasoning based search engine intelligent question answering method according to claim 1, characterized in that, The linear transformation of the embedding vector corresponding to the multi-hop path is specifically represented as: ; wherein, denotes a concatenation operation of vectors, denotes a learnable model parameter, denotes a 0-hop action feature vector, denotes a 1-hop action feature vector, denotes a 2-hop action feature vector, denotes a -hop path, denotes a head entity, denotes a tail entity, denotes a certain entity in the search engine knowledge base, denotes a redundant start relation, denotes a certain relation in the search engine knowledge base adjacent to the head entity , denotes a certain relation in the search engine knowledge base. 5.The knowledge base reasoning based search engine intelligent question answering method according to claim 4, characterized in that, The scoring value of the multi-hop path in the search engine knowledge base is calculated according to the feature vector of the multi-hop path action, which is specifically represented as: ; wherein, denotes a convolution kernel parameter, denotes a learnable model parameter, denotes a non-linear activation function , denotes a flattening operation of a matrix to a vector, denotes an activation function, denotes a score value of a th multi-hop path . 6.The knowledge base reasoning based search engine intelligent question answering method according to claim 5, characterized in that, The loss is calculated using the binary cross-entropy function, which is specifically represented as: ; wherein, represents the number of multi-hop paths, represents the number of multi-hop paths, represents the label of the multi-hop valid path and the multi-hop invalid path.
7. The knowledge base reasoning based search engine intelligent question answering method according to claim 1, characterized in that, The encoder model saves the embedding vectors of entities and relationships in the search engine knowledge base and integrates them into the search engine knowledge base question and answer model decoder MultiHop for multi-hop reasoning, which specifically includes: ; ; wherein, and denote learnable parameters, denote entity embedding vectors in the encoder, denote randomly initialized entity embedding vectors, denote relation embedding vectors in the encoder, denote randomly initialized relation embedding vectors, denote biases, denote activation functions, and denote the resulting entity and relation embedding vectors, respectively, after the integration encoder.
8. A knowledge base reasoning based search engine intelligent question answering system characterized in that, Comprise: Triple marking module, multi-hop path traversal module, hyperparameter setting module, multi-hop path mapping module, feature vector calculation module, scoring value calculation module, back-propagation optimization module, feature information integration module, question acquisition module, multi-hop reasoning module; The triple marking module is used to mark triples in a search engine knowledge base; The multi-hop path traversal module is used to traverse the multi-hop valid path and the multi-hop invalid path of a certain triple based on the search engine knowledge base; The hyperparameter setting module is used to set the hyperparameters of the number of search engine multi-hop paths; The multi-hop path mapping module is configured to set label values corresponding to the multi-hop valid path and the multi-hop invalid path, add a start relation to each multi-hop path, set the multi-hop path according to each hop, map the entity and the relation of the multi-hop path to a vector space respectively, and obtain an embedding vector; The feature vector calculation module is configured to perform linear transformation on the embedding vector corresponding to the multi-hop path, and obtain a feature vector of a multi-hop path action of the search engine knowledge base; The scoring value calculation module is configured to calculate a scoring value of the multi-hop path in the search engine knowledge base according to the feature vector of the multi-hop path action; The back propagation optimization module is configured to integrate the scoring value of each multi-hop path into a scoring vector, calculate a loss using a binary cross-entropy function, traverse a triple in the search engine knowledge base, and optimize the embedding vectors of the entity and the relation in the triple in the search engine knowledge base through back propagation, to obtain an encoder model; The feature information integration module is configured to save the embedding vectors of the entity and the relation of the search engine knowledge base in the encoder model to a multi-hop reasoning search engine knowledge base question and answer model decoder MultiHop; The question acquisition module is configured to acquire a question input by a user, and obtain a source entity and a question and answer relation involved in the question through a naming recognition tool and a relation extraction tool; The multi-hop reasoning module is configured to input the source entity and the question and answer relation into the multi-hop reasoning search engine knowledge base question and answer model decoder MultiHop to perform multi-hop reasoning, and reason out an answer to the question. The process of reasoning of each hop action is represented as: ; wherein, denotes a probability distribution over the action space for each hop, denotes a normalized exponential function, denotes the action space corresponding to each hop, denotes the vector product, and denotes the learnable model parameters, denotes a nonlinear activation function, denotes the embedding vector corresponding to the current entity on the inference path, denotes a long short-term memory network, denotes the hidden state of the long short-term memory network for memorizing the history inference path, denotes the feature vector of each action, denotes the concatenation operation of two vectors, denotes the embedding vector of the question-answer relation . Based on the action space probability distribution of the current hop, the action corresponding to the maximum probability value is taken as the inference result, denoted as , and respectively represent the relationship and entity on the search inference path. The search engine reasons out an answer corresponding to the question input by the user based on a search path and the reasoning path.
9. A computing device comprising a processor and a memory for storing processor-executable programs, characterized in that, The processor executes the program stored in the memory, and implements the search engine intelligent question and answer method based on knowledge base reasoning according to any one of claims 1-7.
Citation Information
Patent Citations
Intelligent question answering method for search engine knowledge base
CN113688217A
Evaluation method and device of multi-hop question and answer model and storage medium
CN114911900A