Model training method, answer determination method, electronic equipment and storage medium
By jointly training the initial knowledge graph embedding model and the initial problem embedding model, the problem of low answer accuracy caused by the semantic gap between the knowledge graph and the problem is solved, and higher question-and-anscene accuracy and multi-scene adaptability are achieved.
Patent Information
- Application Number
- CN202411883259.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, the semantic gap between the knowledge graph and the natural language text of the problem leads to the low accuracy of the answers obtained by querying the problem in the knowledge graph, which cannot meet the query needs of many different scenarios.
By jointly training the constructed initial knowledge graph embedding model and initial problem embedding model, the target knowledge graph embedding model and the target problem embedding model are obtained, which reduces the semantic gap between the knowledge graph and the problem, and trains the inference model based on the trained target knowledge graph embedding model.
It effectively improves the accuracy of using knowledge graphs for question-and-answer answers, and meets the query needs of many different scenarios.
Smart Images

Figure CN119807371A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of question-answering technology, and in particular to a model training method, an answer determination method, an electronic device, and a storage medium. Background Art
[0002] With the rapid development of information technology, cyberspace has become an indispensable part of corporate and even personal life. However, at the same time, network security threats are becoming increasingly serious, and attack methods are constantly being updated. Traditional security protection measures are facing huge challenges. In order to effectively respond to these challenges, more intelligent and efficient methods are needed to analyze and process massive amounts of security data. Knowledge graphs can effectively organize and associate various types of security events, vulnerabilities, attack patterns and other information to provide support for automated analysis. By constructing a knowledge graph containing multi-dimensional information such as asset status, network traffic, known threat intelligence, etc., the system's ability to understand and predict the current security situation can be enhanced. Knowledge graph question-answering technology allows security analysts to quickly obtain the required security-related information through natural language queries, thereby speeding up the decision-making process.
[0003] In the prior art, questions are usually directly brought into the constructed knowledge graph to determine the corresponding answers, ignoring the semantic gap between the knowledge graph and the natural language text of the question, resulting in low accuracy of the answers obtained by querying the question in the knowledge graph, which cannot meet the query requirements of various different scenarios. Summary of the invention
[0004] In view of this, the purpose of the embodiments of the present application is to provide a model training method, an answer determination method, an electronic device and a storage medium to improve the problem of low accuracy of answers obtained when querying questions in knowledge graphs in the prior art.
[0005] In order to solve the above problems, in a first aspect, an embodiment of the present application provides a model training method, the method comprising:
[0006] The constructed initial knowledge graph embedding model and the initial question embedding model are jointly trained to obtain a target knowledge graph embedding model and a target question embedding model; wherein the target knowledge graph embedding model outputs a node vector of each node of the knowledge graph; and the target question embedding model outputs a context vector of each sample question data;
[0007] Determine a query intent vector based on the sample question data;
[0008] The initial reasoning model is trained according to the query intention vector and the target knowledge graph embedding model to obtain a target reasoning model.
[0009] In the above implementation process, in order to keep the knowledge graph and the embedding space of the question semantically aligned, the corresponding initial knowledge graph embedding model and the initial question embedding model can be constructed respectively, and the two can be jointly trained to obtain the corresponding target knowledge graph embedding model and the target question embedding model, so as to reduce the semantic gap between the knowledge graph and the natural language text of the question through the output of the vector space. In addition, the corresponding query intent vector can be determined based on the sample question data, so as to train the initial reasoning model based on the query intent vector and the target knowledge graph embedding model as training data to obtain the target reasoning model for reasoning about the answer path. The initial knowledge graph embedding model and the initial question embedding model can be jointly trained to align the semantic space of the knowledge graph and the question, and the reasoning model can be trained based on the trained target knowledge graph embedding model, which effectively improves the accuracy of question and answer using the knowledge graph and meets the query requirements of various different scenarios.
[0010] Optionally, the jointly training the constructed initial knowledge graph embedding model and the initial question embedding model to obtain the target knowledge graph embedding model and the target question embedding model includes:
[0011] Determine a correlation coefficient between each initial node vector and the corresponding initial context vector;
[0012] Calculating a first loss function according to the plurality of correlation coefficients;
[0013] Based on the first loss function, the initial knowledge graph embedding model and the initial question embedding model are jointly optimized to obtain the target knowledge graph embedding model and the target question embedding model.
[0014] In the above implementation process, since the initial knowledge graph embedding model and the initial question embedding model both output vector data in the vector space, therefore, when performing joint training, considering that the context of the question and the entities appearing in the question are highly correlated, the correlation coefficient between each initial node vector and the corresponding initial context vector can be determined to measure the correlation between the two. The corresponding first loss function is calculated according to the correlation coefficient, so as to perform multiple iterations of joint optimization on the relevant parameters of the initial knowledge graph embedding model and the initial question embedding model according to the first loss function, and obtain the target knowledge graph embedding model and the target question embedding model. The idea of maximizing the correlation coefficient can be used to jointly iteratively optimize the two embedding models according to the correlation between the context and the node entity, and the embedding representation of the joint knowledge graph and the context of the question is aligned to align the semantic space of the knowledge graph and the context of the question text, effectively improving the correspondence between the target knowledge graph embedding model and the target question embedding model, thereby improving the accuracy of question answering using the knowledge graph.
[0015] Optionally, determining the query intention vector based on the sample question data includes:
[0016] Obtain the context vector corresponding to the sample question data output by the target question embedding model;
[0017] Analyze the sample question data through a topic model to obtain a topic vector;
[0018] Extracting entity information from the sample question data, and performing vectorization processing on the entity information to obtain an entity vector;
[0019] The context vector, the topic vector and the entity vector are integrated to obtain the query intent vector.
[0020] In the above implementation process, considering that the sample question data contains multiple types of information, and considering the consistency of data in the vector space during reasoning, the query intention vector corresponding to each question can be determined. The query intention may include the context vector output after processing the sample question data based on the target question embedding model, the topic vector obtained after analyzing the sample question data based on the topic model, and the entity vector obtained after vectorizing the entity information in the sample data, so as to integrate the context vector, the topic vector and the entity vector to obtain the query intention vector for question and answer query in the input reasoning model. The sample question data can be comprehensively analyzed and processed, and the corresponding multiple vector data can be determined from multiple aspects such as context, topic, entity, etc., so as to integrate multiple different types of vector data to obtain the corresponding query intention vector, which effectively improves the consistency of the data type between the input data and the embedding model in the vector space during question and answer, thereby reducing the semantic gap between the knowledge graph and the natural language text of the question, and improving the accuracy of question and answer using the knowledge graph.
[0021] Optionally, training an initial reasoning model according to the query intent vector and the target knowledge graph embedding model to obtain a target reasoning model includes:
[0022] By using the initial reasoning model, mapping processing is performed on a plurality of node vectors in the target knowledge graph embedding model according to the entity vector in the query intent vector to determine a starting node;
[0023] Determine the correlation between all neighbor nodes of the starting node and the query intention vector through the initial reasoning model;
[0024] Determine a second loss function based on the multiple correlations and sample labels; wherein the sample label is a relationship label between the sample question data and the corresponding sample answer path;
[0025] Based on the second loss function, the initial reasoning model is optimized and trained to obtain the target reasoning model.
[0026] In the above implementation process, the initial reasoning model is a reasoning model that can determine the answer path in the knowledge graph according to the query intent vector. When training the initial reasoning model, the constructed initial reasoning model can be used to map multiple node vectors in the target knowledge graph embedding model according to the entity vector in the query intent vector, determine the node entity corresponding to the entity vector as the starting node, and determine the correlation between the node vectors of all neighboring nodes of the starting node and the query intent vector, thereby determining the corresponding second loss function based on the correlation and the sample labels between the sample question data and the corresponding sample answer path, and optimizing the initial reasoning model based on the second loss function to obtain the target reasoning model. The ability to train the initial reasoning model according to the actual situation of the sample effectively improves the correlation between the answer path obtained by the target reasoning model for answer path reasoning and the query intent vector, thereby improving the accuracy of question and answer using the knowledge graph.
[0027] Optionally, the initial knowledge graph embedding model is constructed in a manner including:
[0028] Build a knowledge graph based on the collected triple data;
[0029] The knowledge graph is mapped through a deep learning model to obtain the initial knowledge graph embedding model.
[0030] In the above implementation process, the corresponding triple data under different query scenarios can be collected to construct the corresponding knowledge graph, and the knowledge graph is mapped through the deep learning model to map the entities and relationships of the knowledge graph to the low-dimensional vector space to obtain the corresponding initial graph embedding model. By constructing the initial graph embedding model, the structural information in the knowledge graph is retained while facilitating calculations, effectively improving the efficiency of question-answering using the practical knowledge graph.
[0031] Optionally, mapping the knowledge graph through a deep learning model to obtain the initial knowledge graph embedding model includes:
[0032] Determine whether to sample the neighbor nodes of each node in the knowledge graph according to the community attribute or popularity of the neighbor nodes to obtain a sampling set;
[0033] The deep learning model is used to perform aggregation processing based on the sampling set to obtain the initial knowledge graph embedding model.
[0034] In the above implementation process, since each layer of the deep learning model needs to aggregate the information of neighbor nodes to learn the vector representation of the node, considering the high computational complexity of the model under large-scale data, in order to reduce the computational cost, it can be determined whether to sample the neighbor node according to the community attribute or popularity of each neighbor node of each node in the knowledge graph, so as to aggregate the sampling collection obtained by screening and sampling through the deep learning model to obtain the corresponding initial knowledge graph embedding model. It is possible to determine the correlation between the neighbor node and the current node from the community attribute or popularity, so as to select the neighbor nodes with higher correlation for sampling and aggregation processing, which effectively reduces the computational cost and complexity required for sampling and processing the neighbor nodes, and reduces the construction cost of the initial knowledge graph embedding model.
[0035] Optionally, the initial question embedding model is constructed in a manner including:
[0036] Extracting question text of the sample question data;
[0037] The context of the question text is analyzed through a neural network model to obtain the initial question embedding model.
[0038] In the above implementation process, in order to vectorize the context of the question, the question text of the sample question data can be extracted, and the context of the question text can be analyzed and processed through the neural network model to obtain the initial question embedding model that converts the context of the question text into a low-dimensional vector space representation. The initial question embedding model can effectively capture the semantic information of the question to understand and process natural language questions, convert high-dimensional natural language questions into low-dimensional embedding space, and retain the semantic features and key information of the original question to facilitate subsequent question-answering processing.
[0039] In a second aspect, an embodiment of the present application further provides a method for determining an answer, the method comprising:
[0040] Through the target question embedding model, the target question information input by the user is analyzed and processed to obtain the target context vector;
[0041] Determining a target intent query vector corresponding to the target question information according to the target context vector;
[0042] According to the target reasoning model, a target node path is determined based on the target query vector in the target knowledge graph embedding model;
[0043] Performing language conversion processing on the target node path to obtain answer information corresponding to the target question information;
[0044] Among them, the target question embedding model, the target knowledge graph embedding model and the target reasoning model are trained based on any one of the above-mentioned model training methods.
[0045] In the above implementation process, in the corresponding question-and-answer scenario, in order to determine the answer information required by the user, the target question information input by the user can be analyzed and processed first through the target question embedding model to convert the context of the target question information into a target context vector in a low-dimensional vector space, and according to the target context vector, the target question information is further analyzed to determine the overall target intent query vector, and the target query vector is input into the target reasoning model for processing to determine the corresponding target node path in the target knowledge graph embedding model, and, in order to facilitate user understanding, the target node path can also be processed by language conversion to obtain the answer information of the natural language text corresponding to the target question information. The trained target question embedding model, target knowledge graph embedding model and target reasoning model can be used to perform vectorization processing, analysis and answer reasoning on the questions raised by the user, effectively improving the accuracy of the answer information obtained by using the knowledge graph for question and answer, and meeting the query requirements of various different scenarios.
[0046] In a third aspect, an embodiment of the present application further provides a model training device, the device comprising: a combination module, a determination module and a training module;
[0047] The joint module is used to jointly train the constructed initial knowledge graph embedding model and the initial question embedding model to obtain a target knowledge graph embedding model and a target question embedding model; wherein the target knowledge graph embedding model outputs a node vector of each node of the knowledge graph; and the target question embedding model outputs a context vector of each sample question data;
[0048] The determination module is used to determine the query intention vector based on the sample question data;
[0049] The training module is used to train the initial reasoning model according to the query intention vector and the target knowledge graph embedding model to obtain the target reasoning model.
[0050] In the above implementation process, the corresponding initial knowledge graph embedding model and the initial question embedding model are respectively constructed through the joint module, and the two are jointly trained to obtain the corresponding target knowledge graph embedding model and the target question embedding model. The corresponding query intention vector is determined based on the sample question data through the determination module, and the initial reasoning model is trained based on the query intention vector and the target knowledge graph embedding model as training data through the training module to obtain the target reasoning model for reasoning about the answer path.
[0051] In a fourth aspect, an embodiment of the present application further provides an answer determination device, the device comprising: an analysis module, a reasoning module and a conversion module;
[0052] The analysis module is used to analyze and process the target question information input by the user through the target question embedding model to obtain a target context vector; and determine the target intent query vector corresponding to the target question information according to the target context vector;
[0053] The reasoning module is used to determine the target node path based on the target query vector in the target knowledge graph embedding model according to the target reasoning model;
[0054] The conversion module is used to perform language conversion processing on the target node path to obtain answer information corresponding to the target question information;
[0055] Among them, the target question embedding model, the target knowledge graph embedding model and the target reasoning model are trained based on any one of the above-mentioned model training methods.
[0056] In the above implementation process, the target question information input by the user is analyzed and processed by the analysis module using the target question embedding model to convert the context of the target question information into a target context vector in a low-dimensional vector space, and based on the target context vector, the target question information is further analyzed to determine the overall target intent query vector, and the target query vector is input into the target reasoning model for processing through the reasoning module to determine the corresponding target node path in the target knowledge graph embedding model, and, in order to facilitate user understanding, the target node path can also be processed by the conversion module to perform language conversion processing to obtain the answer information of the natural language text corresponding to the target question information.
[0057] In a fifth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores program instructions, and when the processor reads and runs the program instructions, it executes the steps in any implementation of the above-mentioned model training method and / or answer determination method.
[0058] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions. When the computer program instructions are read and executed by a processor, the steps in any implementation of the above-mentioned model training method and / or answer determination method are executed.
[0059] In the seventh aspect, an embodiment of the present application also provides a computer program product, which includes a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of any one of the methods described in the model training method and / or the answer determination method are implemented.
[0060] In summary, the embodiments of the present application provide a model training method, an answer determination method, an electronic device and a storage medium, which can jointly train the initial knowledge graph embedding model and the initial question embedding model to align the semantic space of the knowledge graph and the question, and train the reasoning model based on the trained target knowledge graph embedding model, thereby effectively improving the accuracy of question and answering using the knowledge graph and meeting the query requirements of a variety of different scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] 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.
[0062] Figure 1 A block diagram of an electronic device provided in an embodiment of the present application;
[0063] Figure 2 A flowchart of a model training method provided in an embodiment of the present application;
[0064] Figure 3 A detailed flowchart of step S210 provided in an embodiment of the present application;
[0065] Figure 4 A detailed flow chart of step S220 provided in an embodiment of the present application;
[0066] Figure 5 A detailed flowchart of step S230 provided in an embodiment of the present application;
[0067] Figure 6 A flowchart of another model training method provided in an embodiment of the present application;
[0068] Figure 7 A detailed flow chart of step S320 provided in an embodiment of the present application;
[0069] Figure 8 A flowchart of another model training method provided in an embodiment of the present application;
[0070] Fig. 9A flowchart of a method for determining an answer provided in an embodiment of the present application;
[0071] Fig.10 A schematic diagram of the structure of a model training device provided in an embodiment of the present application;
[0072] Fig.11 A schematic diagram of the structure of an answer determination device provided in an embodiment of the present application.
[0073] Icons: 100-electronic device; 111-memory; 112-storage controller; 113-processor; 114-peripheral interface; 115-input and output unit; 116-display unit; 500-model training device; 510-joint module; 520-determination module; 530-training module; 600-answer determination device; 610-analysis module; 620-reasoning module; 630-conversion module. DETAILED DESCRIPTION
[0074] The technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments of the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the embodiments of the present application.
[0075] In the prior art, questions are usually directly brought into the constructed knowledge graph to determine the corresponding answers. For example, keywords in the question are directly extracted and brought into the knowledge graph to select corresponding nodes, etc., which ignores the semantic gap between the knowledge graph and the natural language text of the question, resulting in low accuracy of the answers obtained when querying questions in the knowledge graph, and cannot meet the query requirements of various different scenarios.
[0076] In order to solve the above problems, the embodiments of the present application provide a model training method and an answer determination method, which are applied to electronic devices. The electronic devices may be servers, personal computers (PCs), tablet computers, smart phones, personal digital assistants (PDAs), and other electronic devices with logical computing functions, which can effectively improve the accuracy of answers obtained by querying questions in knowledge graphs.
[0077] Optionally, see Figure 1 , Figure 1The block diagram of an electronic device provided in an embodiment of the present application. The electronic device 100 may include a memory 111, a storage controller 112, a processor 113, a peripheral interface 114, an input and output unit 115, and a display unit 116. A person skilled in the art may understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the electronic device 100. For example, the electronic device 100 may further include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0078] The memory 111, storage controller 112, processor 113, peripheral interface 114, input / output unit 115 and display unit 116 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines. The processor 113 is used to execute the executable module stored in the memory.
[0079] The memory 111 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory 111 is used to store programs, and the processor 113 executes the program after receiving the execution instruction. The method executed by the electronic device 100 defined by the process disclosed in any embodiment of the present application can be applied to the processor 113, or implemented by the processor 113.
[0080] The processor 113 may be an integrated circuit chip with signal processing capability. The processor 113 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may 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. The methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or any conventional processor.
[0081] The peripheral interface 114 couples various input / output devices to the processor 113 and the memory 111. In some embodiments, the peripheral interface 114, the processor 113 and the memory controller 112 can be implemented in a single chip. In other embodiments, they can be implemented by separate chips.
[0082] The input / output unit 115 is used to provide input data to the user. The input / output unit 115 may be, but is not limited to, a mouse and a keyboard.
[0083] The above-mentioned display unit 116 provides an interactive interface (such as a user operation interface) between the electronic device 100 and the user or is used to display image data for the user's reference. In this embodiment, the display unit can be a liquid crystal display or a touch display. If it is a touch display, it can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations generated simultaneously from one or more positions on the touch display, and the sensed touch operations are handed over to the processor for calculation and processing. In an embodiment of the present application, the display unit 116 can display a variety of data such as confirmed answer information.
[0084] The electronic device in this embodiment can be used to execute each step in each model training method and answer determination method provided in the embodiment of this application. The implementation process of the model training method and the answer determination method is described in detail below through several embodiments.
[0085] See also Figure 2 , Figure 2 A flow chart of a model training method provided in an embodiment of the present application, the method may include steps S210-S230.
[0086] Step S210, jointly train the constructed initial knowledge graph embedding model and the initial question embedding model to obtain the target knowledge graph embedding model and the target question embedding model.
[0087] Among them, in order to keep the knowledge graph and the embedding space of the question semantically aligned, the corresponding initial knowledge graph embedding model and the initial question embedding model can be constructed respectively, and the two can be jointly trained to obtain the corresponding target knowledge graph embedding model and target question embedding model, so as to reduce the semantic gap between the knowledge graph and the natural language text of the question through the output of the vector space.
[0088] It should be noted that the initial knowledge graph embedding model and the trained target knowledge graph embedding model are models that embed entities and relations in the knowledge graph into a continuous vector space, which can retain the structural information in the knowledge graph while facilitating calculation. The initial question embedding model and the trained target question embedding model are representation models that convert questions or queries into a low-dimensional vector space, which can convert high-dimensional natural language questions into a low-dimensional embedding space while retaining the semantic features and key information of the original question.
[0089] It should be noted that the target knowledge graph embedding model can output the node vector of each node of the knowledge graph, and the target question embedding model can analyze each sample question data to output the context vector of each sample question data.
[0090] Step S220, determining a query intent vector based on the sample question data.
[0091] Among them, since there are multiple and different types of sample question data during training, considering the diversity of content in each sample question data, in order to better determine the user's query intention, the sample question data can be analyzed to obtain the corresponding query intention vector in the low-dimensional vector space.
[0092] Step S230, training the initial reasoning model according to the query intent vector and the target knowledge graph embedding model to obtain the target reasoning model.
[0093] Among them, the initial reasoning model can be trained based on the query intention vector and the target knowledge graph embedding model as training data to obtain a target reasoning model for reasoning about the answer path.
[0094] It should be noted that the target knowledge graph embedding model can be the data source for the inference model when performing inference, the query intention vector can be the input parameter for the inference model when performing inference, and the output parameter of the inference model can be the relevant path in the knowledge graph, which may include one or more entity nodes and corresponding node vectors.
[0095] It should be noted that both the initial reasoning model and the trained target reasoning model are based on the knowledge graph reasoning technology, which is a model that infers unknown information based on known facts and relationships. Knowledge reasoning can include deduction, induction, abduction, and analogy. The initial reasoning model and the target reasoning model can be models built based on multiple types of reasoning algorithms. For example, using the TransE series of algorithms: entities and relationships are represented as vectors, and the relationship h→t is represented by h+r≈t. Among them, h represents the head entity, r represents the relationship, and t represents the tail entity. Alternatively, using the path ranking algorithm (PRA), a reasoning algorithm that uses the relationship path as a feature, is usually used for link prediction tasks in knowledge graphs. It predicts a certain specific relationship that may exist between entities by discovering a set of relationship paths connecting two entities. Alternatively, using the NTN (Neural Tensor Networks) model: for a given two entities (which are vector representations of entities), find out whether there is a certain relationship and give a possibility score. The downstream tasks that can be connected include relationship prediction and knowledge base completion.
[0096] exist Figure 2 In the illustrated embodiment, the initial knowledge graph embedding model and the initial question embedding model can be jointly trained to align the semantic spaces of the knowledge graph and the question, and the reasoning model can be trained based on the trained target knowledge graph embedding model, thereby effectively improving the accuracy of question and answering using the knowledge graph and meeting the query requirements of a variety of different scenarios.
[0097] Optionally, see Figure 3 , Figure 3 A detailed flowchart of step S210 is provided for an embodiment of the present application. Step S210 may include steps S211-S213.
[0098] Step S211, determining the correlation coefficient between each initial node vector and the corresponding initial context vector.
[0099] Among them, since the output of the initial knowledge graph embedding model and the initial question embedding model are both vector data in the vector space, during joint training, considering that the context of the question and the entities appearing in the question are highly correlated, the correlation coefficient between each initial node vector and the corresponding initial context vector can be determined to measure the correlation between the two.
[0100] Optionally, the correlation coefficient may be a Pearson correlation coefficient, which is also called the Pearson product-moment correlation coefficient or PPMCC (Pearson product-moment correlation coefficient). It is a statistic used to measure the strength of the linear relationship between two variables, and is a value between -1 and 1, used to indicate the degree of linear correlation between the two variables. Among them, 1 indicates a perfect positive correlation, -1 indicates a perfect negative correlation, and 0 indicates no linear relationship.
[0101] Step S212, calculating a first loss function according to multiple correlation coefficients.
[0102] Step S213, based on the first loss function, jointly optimize the parameters of the initial knowledge graph embedding model and the initial question embedding model to obtain the target knowledge graph embedding model and the target question embedding model.
[0103] Among them, taking into account multiple correlation coefficients corresponding to multiple sample question data, the corresponding first loss function can be calculated according to the multiple correlation coefficients, so as to perform multiple iterative joint optimizations on the relevant parameters of the initial knowledge graph embedding model and the initial question embedding model according to the first loss function to obtain the target knowledge graph embedding model and the target question embedding model.
[0104] Optionally, the idea of maximizing the Pearson correlation coefficient can be used to measure the correlation between the initial node vector and the initial context vector. The larger the absolute value of the Pearson correlation coefficient, the greater the correlation between the two. The goal of jointly training the model using the first loss function is to jointly learn the initial knowledge graph embedding model and the initial question embedding model so that the initial context vector q t and the initial node vector contained in the sample problem data The absolute value of the Pearson correlation coefficient is large, while the initial context vector q t and the initial node vector not included in the sample problem data The absolute value of the Pearson correlation coefficient is small. The first loss function L1 is as follows:
[0105]
[0106] Where N is the number of sample pairs for training; y i is the label of the sample pair, that is, the relationship label between the sample question data and the corresponding sample answer path, such as correct or wrong, etc., y i =1 represents the correct positive sample pair, y i= 0 represents an incorrect negative sample pair; m is a hyperparameter, indicating the minimum distance between negative sample pairs; is the initial context vector q t and the initial node vector The absolute value of the Pearson correlation coefficient.
[0107] Optionally, various types of parameters such as dimensions, matrices, learning rates, optimization algorithms, negative sampling ratios, regularization terms, etc. in the initial knowledge graph embedding model and the initial problem embedding model can be jointly optimized according to the loss value calculated by the first loss function.
[0108] It should be noted that the initial knowledge graph embedding model and the initial question embedding model can be subjected to multiple rounds of iterative training. If the effect is still poor after multiple rounds of iterative training, multiple rounds of iterative training can be continued until the model converges, that is, the final target knowledge graph embedding model and target question embedding model have better effects and higher correlation.
[0109] exist Figure 3 In the illustrated embodiment, the idea of maximizing the correlation coefficient can be utilized to jointly iteratively optimize the two embedding models according to the correlation between the context and the node entity, and the embedding representation of the context of the knowledge graph and the question is combined to align the semantic space of the knowledge graph and the context of the question text, thereby effectively improving the correspondence between the target knowledge graph embedding model and the target question embedding model, thereby improving the accuracy of question and answering using the knowledge graph.
[0110] Optionally, see Figure 4 , Figure 4 A detailed flow chart of step S220 is provided for an embodiment of the present application. Step S220 may include steps S221-S224.
[0111] Step S221, obtaining the context vector corresponding to the sample question data output by the target question embedding model.
[0112] Considering that the sample question data contains multiple types of information and the consistency of the data in the vector space during reasoning, the query intent vector corresponding to each question can be determined. The query intent can include the context vector output after processing the sample question data based on the target question embedding model, i.e., q t .
[0113] Step S222: Analyze the sample question data through the topic model to obtain the topic vector.
[0114] Among them, the topic vector obtained by analyzing the sample question data using the topic model can also be used.
[0115] Optionally, the Biterm topic model can be used to learn the topic of the sample question data to obtain the text-topic probability distribution, which is the topic vector of the user question, denoted by T t .
[0116] Step S223, extracting entity information from the sample question data, and performing vectorization processing on the entity information to obtain an entity vector.
[0117] Among them, we can also use algorithms such as Spacy to extract all entities contained in the sample question data. After all entities are represented as vectors using algorithms such as word2vec, the average vector of all entity vectors is the entity vector of the user question, denoted as E t .
[0118] Step S224, integrating the context vector, topic vector and entity vector to obtain a query intent vector.
[0119] Among them, the query intention vector for question-answering query in the input reasoning model can be obtained by integrating the context vector, topic vector and entity vector.
[0120] Optionally, the context vector q of the sample question data can be t , the topic vector T of the user's question t , the entity vector E of the user's question t Jointly construct the user's query intention vector I t , I t =[q t ; T t ; E t ].
[0121] exist Figure 4 In the illustrated embodiment, it is possible to comprehensively analyze and process sample question data, determine corresponding multiple vector data from multiple aspects such as context, subject, entity, etc., and integrate multiple different types of vector data to obtain corresponding query intent vectors, effectively improving the consistency of data types in the vector space between input data and embedded models during question and answering, thereby reducing the semantic gap between the knowledge graph and the natural language text of the question, and improving the accuracy of question and answering using the knowledge graph.
[0122] Optionally, see Figure 5 , Figure 5 A detailed flowchart of step S230 is provided for an embodiment of the present application. Step S230 may include steps S231-S234.
[0123] Step S231, through the initial reasoning model, according to the entity vector in the query intention vector, mapping processing is performed in multiple node vectors in the target knowledge graph embedding model to determine the starting node.
[0124] Among them, when training the initial reasoning model, the constructed initial reasoning model can be used to map the entity vector in the query intention vector to multiple node vectors in the target knowledge graph embedding model, and determine the node entity corresponding to the entity vector as the starting node.
[0125] Optionally, the entity vector E in the query intent vector can be t Map it with the entity in the knowledge graph, and record the mapped entity v as the starting node s of the path.
[0126] Step S232, determining the correlation between all neighbor nodes of the starting node and the query intent vector through the initial reasoning model.
[0127] Among them, the correlation between the node vectors of all neighboring nodes of the starting node and the query intention vector can be determined.
[0128] Optionally, the correlation between the one-hop path formed by all neighbor nodes of the starting node s and the query intent vector can be calculated. If the one-hop path formed by the starting node s and the neighbor node n has the largest correlation and is greater than a threshold, it is added to the answer path, and n is set as the starting node. The above process is repeated until the maximum correlation of the last neighbor node is less than the correlation threshold. The calculation method of correlation J may include:
[0129] J=σ(hWI t )
[0130] h=[e s ;e n ]
[0131] Among them, σ is the sigmoid function, W is the learnable weight parameter, and e s and e n are the vectors of the starting node s and the neighbor node n respectively.
[0132] Step S233: determining a second loss function based on multiple correlations and sample labels.
[0133] Among them, the sample label is the relationship label between the sample question data and the corresponding sample answer path. The corresponding second loss function can be determined based on the correlation and the sample label between the sample question data and the corresponding sample answer path.
[0134] Optionally, the model loss can be calculated using binary cross entropy loss, and the second loss function L2 of the model loss is as follows:
[0135] L2=-∑ n∈N(s) J log J + (1-J) log (1-J);
[0136] Step S234: Based on the second loss function, the initial reasoning model is optimized and trained to obtain a target reasoning model.
[0137] Among them, the initial reasoning model can be optimized and trained based on the second loss function until the model converges to obtain the target reasoning model.
[0138] Optionally, when optimizing the initial inference model, the weight parameter W in the correlation calculation method may be iteratively optimized according to the actual situation of the second loss function.
[0139] It should be noted that the purpose of optimization training is to make the correlation between the sample question data and the sample answer path in the positive sample with the correct sample label higher, and to make the correlation between the sample question data and the sample answer path in the negative sample pair with the wrong sample label lower.
[0140] exist Figure 5 In the illustrated embodiment, the initial reasoning model can be trained according to the actual situation of the sample, effectively improving the correlation between the answer path obtained by the target reasoning model through answer path reasoning and the query intention vector, thereby improving the accuracy of question and answering using the knowledge graph.
[0141] Optionally, see Figure 6 , Figure 6 A flowchart of another model training method provided in an embodiment of the present application, the method may further include steps S310-S320.
[0142] Step S310, constructing a knowledge graph based on the collected triple data.
[0143] Among them, the corresponding triple data in different query scenarios can be collected to construct the corresponding knowledge graph.
[0144] Optionally, different query scenarios may include e-commerce customer service question-and-answer scenarios, legal consultation question-and-answer scenarios, poetry and ancient prose question-and-answer scenarios, or comprehensive information question-and-answer scenarios. For example, in the e-commerce customer service question-and-answer scenario, a network security knowledge graph may be constructed. Information such as attackers, malware, vulnerabilities, and assets may be organized into a triple format to construct a network security knowledge graph.
[0145] Optionally, the knowledge graph can describe the concepts, entities, events and the relationships between them in the objective world, and perform semantic modeling on them. The knowledge graph is a graph-based data structure consisting of nodes and edges. Each node represents an "entity" and each edge represents a "relationship" between entities. In the knowledge graph, each node (event, data, information in the real world) is no longer isolated, but linked together through specific relationships (edges) to form a structured knowledge representation.
[0146] Step S320, mapping the knowledge graph through a deep learning model to obtain an initial knowledge graph embedding model.
[0147] Among them, the knowledge graph can be mapped through a deep learning model to map the entities and relationships of the knowledge graph to a low-dimensional vector space to obtain the corresponding initial graph embedding model.
[0148] For example, the knowledge graph can be mapped using a deep learning model such as GCN (Graph Convolutional Network). The knowledge graph can also be mapped using other models that do not require processing in conjunction with neighboring nodes to obtain a corresponding initial knowledge graph embedding model.
[0149] exist Figure 6 In the illustrated embodiment, by constructing an initial graph embedding model, the structural information in the knowledge graph is retained while facilitating calculations, thereby effectively improving the efficiency of question and answering using the practical knowledge graph.
[0150] Optionally, see Figure 7 , Figure 7 A detailed flow chart of step S320 is provided for an embodiment of the present application. Step S320 may include steps S321-S322.
[0151] Step S321, determine whether to sample the neighbor nodes according to the community attributes or popularity of each neighbor node of each node in the knowledge graph to obtain a sampling set.
[0152] Among them, since each layer of the deep learning model needs to aggregate the information of neighbor nodes to learn the vector representation of the node, considering the high computational complexity of the model under large-scale data, in order to reduce the computational cost, it is possible to determine whether to sample the neighbor node based on the community attributes or popularity of each neighbor node of each node in the knowledge graph to obtain the corresponding sampling set.
[0153] Optionally, when calculating the neighborhood information of node v∈V, not all neighbor nodes are used, but some neighbor nodes are sampled from the neighbor nodes of v∈V. The sampling rules may include: the hierarchical Leiden algorithm may be used to perform community detection on the knowledge graph, and the knowledge graph is divided into different communities. The nodes in the same community have a highly close connection and can provide each other with richer information. Determine whether the neighbor node and the target node belong to the same community. If the neighbor node and the target node v∈V belong to the same community, add it to the neighbor node set N(v) (i.e., the sampling set). The pagerank algorithm can also be used to measure the popularity of the neighbor node. The higher the popularity of the node, the more important the node is in the knowledge graph and the more information it contains. Compare the popularity of the neighbor node with the preset popularity threshold. If the popularity of the neighbor node is determined to be greater than the popularity threshold, add it to the neighbor node set N(v) (i.e., the sampling set).
[0154] Step S322: Through the deep learning model, aggregation processing is performed according to the sampling set to obtain the initial knowledge graph embedding model.
[0155] Among them, the deep learning model can be used to aggregate the sampling collection obtained by screening and sampling to obtain the corresponding initial knowledge graph embedding model.
[0156] Optionally, in the (l+1)th layer of the GCN model, the vector representation of each node v∈V in the knowledge graph can be learned by aggregating the information of the sampled set N(v) of the node v∈V The formula is as follows:
[0157]
[0158] Where σ is the sigmoid function, N r (v) is the relationship between node v∈V in the sampling set N(v), r∈R is the set of neighbor nodes, is the normalization factor, and are the learnable weight matrices respectively.
[0159] exist Figure 7 In the illustrated embodiment, the correlation between the neighbor nodes and the current node can be determined from community attributes or popularity, thereby selecting neighbor nodes with higher correlation for sampling and aggregation processing, effectively reducing the computational cost and complexity required for sampling and processing neighbor nodes, and reducing the cost of building the initial knowledge graph embedding model.
[0160] Optionally, see Figure 8 , Figure 8A flowchart of another model training method provided in an embodiment of the present application, the method may further include steps S330-S340.
[0161] Step S330, extracting the question text of the sample question data.
[0162] In order to vectorize the context of the question, the question text of the sample question data can be extracted.
[0163] Optionally, you can first remove punctuation marks, special characters, and unnecessary spaces in the sample question data. For Chinese questions, you can use word segmentation tools (such as jieba, NLTK, etc.) to split the questions into words or phrases. For English questions, word segmentation can usually be achieved through spaces or punctuation marks. Through natural language processing, bag-of-words models and other algorithms, extract keywords from the content, and then obtain the corresponding question text through semantic understanding, information extraction and other methods.
[0164] Step S340, analyzing the context of the question text through a neural network model to obtain an initial question embedding model.
[0165] Among them, the context of the question text can be analyzed and processed through a neural network model to obtain an initial question embedding model that converts the context of the question text into a representation of a low-dimensional vector space.
[0166] Optionally, a GRU model can be used to represent the context of the question text as a vector. The context vector q of the question text x at the tth time step is t for:
[0167] q t =GRU(q t-1 ,x t );
[0168] Among them, x t It is the vector representation of the question text x obtained by the BERT model.
[0169] exist Figure 8 In the illustrated embodiment, the initial question embedding model can effectively capture the semantic information of the question to understand and process natural language questions, convert high-dimensional natural language questions into a low-dimensional embedding space, and retain the semantic features and key information of the original question to facilitate subsequent question-answering processing.
[0170] See also Fig. 9 , Fig. 9 A flowchart of an answer determination method provided in an embodiment of the present application, the method may include steps S410-S440.
[0171] Step S410: Analyze and process the target question information input by the user through the target question embedding model to obtain a target context vector.
[0172] Step S420, determining a target intent query vector corresponding to the target question information according to the target context vector.
[0173] Among them, in the corresponding question-and-answer scenario, in order to determine the answer information required by the user, the target question information input by the user can be analyzed and processed through the target question embedding model to convert the context of the target question information into a target context vector in a low-dimensional vector space, and based on the target context vector, continue to analyze the target question information to determine the overall target intent query vector.
[0174] Step S430, according to the target reasoning model, determine the target node path based on the target query vector in the target knowledge graph embedding model.
[0175] Among them, the target query vector can be input into the target reasoning model for processing to determine the corresponding target node path in the target knowledge graph embedding model.
[0176] Step S440: perform language conversion processing on the target node path to obtain answer information corresponding to the target question information.
[0177] In order to facilitate user understanding, the target node path may also be subjected to language conversion processing to obtain answer information of the natural language text corresponding to the target question information.
[0178] For example, various types of generative language models, such as GPT and other models, can be used to input the answer path into the generative language model, convert the target node path into natural language text to obtain the corresponding answer information, and return it to the user as a question answer.
[0179] It should be noted that the target question embedding model, the target knowledge graph embedding model and the target reasoning model are trained based on any of the above-mentioned model training methods.
[0180] exist Fig. 9 In the illustrated embodiment, the trained target question embedding model, target knowledge graph embedding model and target reasoning model can be used to perform various processing such as vectorization, analysis and answer reasoning on questions raised by users, thereby effectively improving the accuracy of the answer information obtained by using the knowledge graph for question and answering, and meeting the query requirements of various different scenarios.
[0181] See also Fig.10 , Fig.10A schematic diagram of the structure of a model training device provided in an embodiment of the present application, the model training device 500 may include: a combining module 510, a determining module 520 and a training module 530;
[0182] The joint module 510 is used to jointly train the constructed initial knowledge graph embedding model and the initial question embedding model to obtain a target knowledge graph embedding model and a target question embedding model; wherein the target knowledge graph embedding model outputs a node vector of each node of the knowledge graph; and the target question embedding model outputs a context vector of each sample question data;
[0183] The determination module 520 is used to determine the query intention vector based on the sample question data;
[0184] The training module 530 is used to train the initial reasoning model according to the query intent vector and the target knowledge graph embedding model to obtain the target reasoning model.
[0185] In an optional embodiment, the joint module 510 is specifically used to: determine the correlation coefficient between each initial node vector and the corresponding initial context vector; calculate a first loss function based on multiple correlation coefficients; and based on the first loss function, perform joint parameter optimization on the initial knowledge graph embedding model and the initial question embedding model to obtain a target knowledge graph embedding model and a target problem embedding model.
[0186] In an optional embodiment, the determination module 520 is specifically used to: obtain the context vector corresponding to the sample question data output by the target question embedding model; analyze the sample question data through the topic model to obtain the topic vector; extract the entity information in the sample question data, and vectorize the entity information to obtain the entity vector; integrate the context vector, topic vector and entity vector to obtain the query intention vector.
[0187] In an optional embodiment, the training module 530 is specifically used to: determine the starting node through the initial reasoning model, according to the entity vector in the query intent vector, perform mapping processing in multiple node vectors in the target knowledge graph embedding model; determine the correlation between all neighbor nodes of the starting node and the query intent vector through the initial reasoning model; determine the second loss function based on multiple correlations and sample labels; wherein the sample label is the relationship label between the sample question data and the corresponding sample answer path; based on the second loss function, optimize the initial reasoning model and obtain the target reasoning model.
[0188] In an optional embodiment, the model training device 500 may also include: a construction module for constructing a knowledge graph based on the collected triple data; mapping the knowledge graph through a deep learning model to obtain an initial knowledge graph embedding model.
[0189] In an optional embodiment, the construction module is specifically used to: determine whether to sample neighbor nodes according to the community attributes or popularity of each neighbor node of each node in the knowledge graph to obtain a sampling set; and perform aggregation processing based on the sampling set through a deep learning model to obtain an initial knowledge graph embedding model.
[0190] In an optional implementation, the construction module is also used to: extract the question text of the sample question data; analyze the context of the question text through a neural network model to obtain an initial question embedding model.
[0191] Since the principle of solving the problem by the model training device 500 in the embodiment of the present application is similar to that of the embodiment of the aforementioned model training method, the implementation of the model training device 500 in this embodiment can refer to the description in the embodiment of the aforementioned model training method, and the repeated parts will not be repeated.
[0192] See also Fig.11 , Fig.11 A schematic diagram of the structure of an answer determination device provided in an embodiment of the present application, the answer determination device 600 may include: an analysis module 610, a reasoning module 620 and a conversion module 630;
[0193] The analysis module 610 is used to analyze and process the target question information input by the user through the target question embedding model to obtain a target context vector; and determine the target intent query vector corresponding to the target question information according to the target context vector;
[0194] The reasoning module 620 is used to determine the target node path based on the target query vector in the target knowledge graph embedding model according to the target reasoning model;
[0195] The conversion module 630 is used to perform language conversion processing on the target node path to obtain answer information corresponding to the target question information;
[0196] Among them, the target question embedding model, the target knowledge graph embedding model and the target reasoning model are trained based on any one of the above-mentioned model training methods.
[0197] Since the principle of solving the problem by the answer determination device 600 in the embodiment of the present application is similar to that of the embodiment of the aforementioned answer determination method, the implementation of the answer determination device 600 in this embodiment can refer to the description in the embodiment of the aforementioned answer determination method, and the repeated parts will not be repeated.
[0198] An embodiment of the present application also provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the steps of any one of the model training methods and / or answer determination methods provided in this embodiment are executed.
[0199] An embodiment of the present application also provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of any one of the model training methods and / or answer determination methods provided in this embodiment are implemented.
[0200] In several embodiments provided in the present application, it should be understood that the disclosed device can also be implemented in other ways. The device embodiments described above are merely schematic, for example, the block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices according to the multiple embodiments of the present application. In this regard, each box in the block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram, and the combination of the block diagrams, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0201] In addition, 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.
[0202] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for 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 methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0203] 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 changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0204] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
[0205] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
Claims
1. A model training method, characterized in that: The method comprises: The constructed initial knowledge graph embedding model and the initial question embedding model are jointly trained to obtain a target knowledge graph embedding model and a target question embedding model; wherein the target knowledge graph embedding model outputs a node vector of each node of the knowledge graph; and the target question embedding model outputs a context vector of each sample question data; Determine a query intent vector based on the sample question data; The initial reasoning model is trained according to the query intention vector and the target knowledge graph embedding model to obtain a target reasoning model.
2. The method according to claim 1, characterized in that: The constructed initial knowledge graph embedding model and the initial question embedding model are jointly trained to obtain a target knowledge graph embedding model and a target question embedding model, including: Determine a correlation coefficient between each initial node vector and the corresponding initial context vector; Calculating a first loss function according to the plurality of correlation coefficients; Based on the first loss function, the initial knowledge graph embedding model and the initial question embedding model are jointly optimized to obtain the target knowledge graph embedding model and the target question embedding model.
3. The method according to claim 1, characterized in that The determining the query intention vector based on the sample question data includes: Obtain the context vector corresponding to the sample question data output by the target question embedding model; Analyze the sample question data through a topic model to obtain a topic vector; Extracting entity information from the sample question data, and performing vectorization processing on the entity information to obtain an entity vector; The context vector, the topic vector and the entity vector are integrated to obtain the query intent vector.
4. The method according to claim 1, characterized in that The initial reasoning model is trained according to the query intent vector and the target knowledge graph embedding model to obtain a target reasoning model, including: By using the initial reasoning model, mapping processing is performed on a plurality of node vectors in the target knowledge graph embedding model according to the entity vector in the query intent vector to determine a starting node; Determine the correlation between all neighbor nodes of the starting node and the query intention vector through the initial reasoning model; Determine a second loss function based on the multiple correlations and sample labels; wherein the sample label is a relationship label between the sample question data and the corresponding sample answer path; Based on the second loss function, the initial reasoning model is optimized and trained to obtain the target reasoning model.
5. The method according to any one of claims 1 to 4, characterized in that in, The construction method of the initial knowledge graph embedding model includes: Build a knowledge graph based on the collected triple data; The knowledge graph is mapped through a deep learning model to obtain the initial knowledge graph embedding model.
6. The method according to claim 5, characterized in that The mapping process of the knowledge graph by the deep learning model to obtain the initial knowledge graph embedding model includes: Determine whether to sample the neighbor nodes of each node in the knowledge graph according to the community attribute or popularity of the neighbor nodes to obtain a sampling set; The deep learning model is used to perform aggregation processing based on the sampling set to obtain the initial knowledge graph embedding model.
7. The method according to any one of claims 1 to 4, characterized in that in, The initial question embedding model is constructed in the following manner: Extracting question text of the sample question data; The context of the question text is analyzed through a neural network model to obtain the initial question embedding model.
8. A method for determining an answer, characterized in that: The method comprises: Through the target question embedding model, the target question information input by the user is analyzed and processed to obtain the target context vector; Determining a target intent query vector corresponding to the target question information according to the target context vector; According to the target reasoning model, a target node path is determined based on the target query vector in the target knowledge graph embedding model; Performing language conversion processing on the target node path to obtain answer information corresponding to the target question information; Wherein, the target question embedding model, the target knowledge graph embedding model and the target reasoning model are trained based on the method described in any one of claims 1-7.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores program instructions, and when the processor runs the program instructions, the steps in the method according to any one of claims 1 to 8 are executed.
10. A computer-readable storage medium, characterized in that: The readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the steps of the method according to any one of claims 1 to 8 are executed.
11. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps in the method according to any one of claims 1 to 8 are implemented.