Safety education and training question-answering optimization method and system based on demand feedback
Through the combination of knowledge distillation network and user interaction data, a multi-dimensional user portrait and semantic correlation map is built, which solves the problem of single content of traditional security education and training, realizes personalized and intelligent security knowledge services, and improves training results and knowledge. The coverage of the library.
Patent Information
- Application Number
- CN202411274289.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-09-12
AI Technical Summary
Traditional safety education and training has single content and insufficient interactivity, making it difficult to accurately understand the complex needs of employees. The existing intelligent question and answer system knowledge base is organized in a single form, and the lack of multi-dimensional and multi-grained semantic correlations have led to limited training results.
Using the security education and training Q&A optimization method based on demand feedback, the structured knowledge is transferred to the semantic coding space through the knowledge distillation network, and a semantic correlation map is constructed, and a heterogeneous interaction map is constructed based on the user Q&A interaction log to generate multi-dimensional user portraits and learn personality A comprehensive question-and-answer strategy, dynamically generate personalized question recommendations and answer combinations, and use heterogeneous graph neural network for rapid retrieval and answer evaluation.
It has improved the intelligence and personalization of safety education and training, provided accurate and high-quality safety knowledge services, enhanced employees' safety awareness and skills, improved training results, adapted to changes in user needs, and continuously optimized the knowledge base.
Smart Images

Figure CN118797018B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial safety technology, and in particular to a method and system for optimizing safety education and training questions and answers based on demand feedback. Background Art
[0002] With the continuous advancement of industrialization, safety education and training are particularly important. Traditional safety education and training mainly adopts classroom lectures, case analysis and other methods. There are problems such as single training content, insufficient interactivity, and lack of pertinence. It is difficult to fully mobilize employees' enthusiasm for learning, and the training effect is limited.
[0003] At present, existing technologies mainly provide personalized safety knowledge services for employees by building a safety production knowledge base and developing an intelligent question-and-answer system. However, the knowledge organization form of the knowledge base is single and lacks multi-dimensional and multi-granular semantic associations, making it difficult to accurately understand the complex needs of employees.
[0004] Therefore, a solution is urgently needed to solve the problems existing in the prior art. Summary of the invention
[0005] The embodiments of the present invention provide a method and system for optimizing safety education and training questions and answers based on demand feedback, which can at least solve some of the problems existing in the prior art.
[0006] A first aspect of an embodiment of the present invention provides a method for optimizing security education and training questions and answers based on demand feedback, including:
[0007] A safety education and training question and answer corpus and a safety production domain knowledge base are obtained, and structured knowledge in the safety production domain knowledge base is transferred to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and a pre-set safety education and training question and answer matching model is trained by contrastive learning based on the semantic enhancement encoder, and the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus is calculated based on the safety education and training question and answer matching model, and a semantic association graph is constructed based on the semantic similarity;
[0008] Obtain user question-and-answer interaction logs, build a heterogeneous interaction graph based on the user question-and-answer interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism in combination with the graph representation learning algorithm, generate node embedding and combine with the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-and-answer behaviors through causal inference theory, learn personalized question-and-answer strategy functions through counterfactual methods and evaluate the effect of the current question-and-answer strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results;
[0009] Based on the semantic association graph and the multi-dimensional user portrait, for the target question generated according to the personalized question recommendation list, the embedding vectors are aggregated through a heterogeneous graph neural network, and a personalized semantic association subgraph is dynamically generated and quickly retrieved to obtain a candidate answer set. Multi-angle feature extraction is performed on each answer in the candidate answer set, and a comprehensive answer quality evaluation index is generated and solved through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtain feedback data, and update the safety production field knowledge base based on the feedback data.
[0010] In an optional embodiment,
[0011] A safety education and training question and answer corpus and a safety production domain knowledge base are obtained, and structured knowledge in the safety production domain knowledge base is transferred to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and a pre-set safety education and training question and answer matching model is trained by contrastive learning based on the semantic enhancement encoder, and the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus is calculated based on the safety education and training question and answer matching model, and a semantic association graph is constructed based on the semantic similarity, including:
[0012] Acquire a safety education and training question-answer corpus and a safety production domain knowledge base, represent the safety education and training question-answer corpus as question-answer pairs, and represent the safety production domain knowledge base as triples;
[0013] Mapping the question-answer pair into a semantic vector based on a corpus encoder in a pre-constructed knowledge distillation network, mapping the triple into a knowledge vector through a knowledge encoder in a knowledge distillation model, distinguishing the semantic vector from the knowledge vector through a discriminator in the knowledge distillation network, reconstructing the semantic vector into a question-answer pair through a corpus encoder, training the knowledge distillation network based on a corpus reconstruction loss corresponding to the corpus encoder and a knowledge distribution matching loss generated after reconstruction, cascading the corpus encoder and the knowledge encoder in the trained knowledge distillation network, and fusing them to obtain the semantic enhancement encoder;
[0014] A contrastive learning framework is set based on the semantic enhancement encoder, and a security education training question-answer matching model is pre-set by constructing positive and negative example contrast training, wherein the positive examples are composed of semantically related question-answer pairs, and the negative examples are composed of semantically unrelated question-answer pairs, and the hyperparameters in the security education training question-answer matching model are corrected by minimizing the positive example contrast loss and the negative example contrast loss to obtain a trained security education training question-answer matching model;
[0015] Based on the safety education and training question-answer matching model, the semantic similarity between different question-answer pairs in the safety education and training question-answer corpus is calculated. Based on the semantic similarity, an initial semantic association graph is constructed with the question-answer pairs as nodes, wherein the weight of the edge between nodes in the initial semantic association graph is the semantic similarity. Node importance sampling and edge weight pruning are performed on the constructed initial semantic association graph to obtain the semantic association graph.
[0016] In an optional embodiment,
[0017] The probability of sampling the node importance of the constructed initial semantic association graph is as follows:
[0018] ;
[0019] in, p i Representation Node v i The sampling probability of η represents the balance factor, I i Representation Node v i The fundamental importance of α Represents the attenuation factor ,K is the maximum number of hops, indicating the neighborhood range considered, Representation Node v i No. k Hop neighborhood, I j Representation Node vj The fundamental importance of Representation Node v j No. k Hop neighborhood, c i Representation Node v i The compactness center, c j Representation Node v j The compactness center, V Represents the set of all nodes in the initial semantic association graph, where nodes v i ,node v j and nodes v l All in the node set V middle, I l Representation Node vl The fundamental importance of l Representation Node v l The index of .
[0020] In an optional embodiment,
[0021] Obtain user question-and-answer interaction logs, build a heterogeneous interaction graph based on the user question-and-answer interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism, combine the graph representation learning algorithm to generate node embedding and combine the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-and-answer behaviors through causal inference theory, learn personalized question-and-answer strategy functions through counterfactual methods and evaluate the effect of the current question-and-answer strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results, including:
[0022] Obtaining historical user question-and-answer interaction logs of users on the question-and-answer platform, and constructing a heterogeneous interaction graph based on the historical user question-and-answer interaction logs, wherein the heterogeneous interaction graph includes a variety of different nodes and edges, and the edges represent the interaction relationship between the nodes;
[0023] A plurality of semantically related meta-paths are set in the heterogeneous interaction graph, and the meta-paths are traversed. For each meta-path, all sub-graphs under each meta-path are determined. Based on the sub-graphs, the directly connected node features corresponding to each node in the meta-path are aggregated to generate a meta-path feature representation. On different meta-paths, weights are assigned to the meta-path representations corresponding to different nodes through an attention mechanism, and the node representations of different meta-paths are weighted summed according to the assigned weights to obtain a comprehensive semantic representation. Based on the comprehensive semantic representation, a corresponding node embedding is generated for each node.
[0024] Based on the node embedding, through a multi-task learning algorithm, the embedding of the user node is used as the initial feature representation of the current user, and the comprehensive user features corresponding to the current user are constructed in combination with the user attribute features and the behavior statistical features. Based on the comprehensive user features, multiple user understanding tasks are designed, and based on the task loss functions corresponding to the user understanding tasks, user feature representations of multiple dimensions are constructed to comprehensively obtain the multi-dimensional user portrait;
[0025] Based on the multi-dimensional user portrait, a causal relationship between the user feature representation and the user question-answering behavior is established through a causal inference algorithm, the user feature representation is used as an action, and the user question-answering behavior is used as a result, and the difference in question-answering behavior under different user features is evaluated through a causal graph, and the causal relationship graph is constructed based on the difference in question-answering behavior;
[0026] Based on the causal relationship graph, a personalized question-answering strategy function is constructed through a counterfactual method with user features as input and question-answering strategy as output. Based on the personalized question-answering strategy function, the causal effects of different question-answering strategies are evaluated through a counterfactual inference algorithm. Based on the effect evaluation results, the optimal question-answering strategy corresponding to the optimal causal effect is determined, and the personalized question recommendation list is generated based on the optimal question-answering strategy.
[0027] In an optional embodiment,
[0028] The causal effects of different question-answering strategies are evaluated through the counterfactual inference algorithm as shown in the following formula:
[0029] ;
[0030] in, ATE represents the effect evaluation results, n represents the number of samples, Y m Indicates user m The actual observation results, T m Indicates user m The processing status, e ( X m ) for users m The propensity score is given by X m The probability that the user accepts the treatment under the condition, H ( T =1) indicates the probability of actually receiving treatment in the sample, H ( T =0) indicates the probability that the sample actually did not receive treatment. Indicates that the covariate X m The probability that the user accepts the treatment under the condition, Indicates that the covariate X m The probability that the user will not accept the treatment under certain conditions.
[0031] In an optional embodiment,
[0032] Based on the semantic association graph and the multi-dimensional user portrait, for the target question generated according to the personalized question recommendation list, aggregating embedding vectors through a heterogeneous graph neural network, dynamically generating a personalized semantic association subgraph and performing rapid retrieval, obtaining a candidate answer set, performing multi-angle feature extraction on each answer in the candidate answer set, generating a comprehensive answer quality evaluation index, and solving it through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtaining feedback data and updating the safety production field knowledge base according to the feedback data, including:
[0033] Initialize the heterogeneous graph neural network, convert the semantic association graph into a heterogeneous graph data structure and define nodes, collect and generate training data on the heterogeneous graph data structure through a meta-path-based random walk algorithm, train the heterogeneous graph neural network through the training data, embed the multi-dimensional user portrait into the heterogeneous graph neural network, map the user features to the graph semantic space through an additional user representation learning layer, determine the semantic encoding function, and obtain an optimized heterogeneous graph neural network;
[0034] For each target question in the personalized question recommendation list, determine neighbor nodes and semantic similarities between the neighbor nodes and the multi-dimensional user portrait according to the nodes corresponding to each question through the optimized heterogeneous graph neural network, and generate the personalized semantic association subgraph;
[0035] On the personalized semantic association subgraph, with the target question as the center, candidate answer nodes related to the question semantics are retrieved through a graph-based fast approximate nearest neighbor search algorithm to generate the candidate answer set. For each answer in the candidate answer set, semantic relevance, structural relevance, user relevance and knowledge quality are extracted respectively through a feature extraction algorithm, and multi-angle features are combined to obtain a comprehensive answer quality evaluation index based on the multi-angle features. A comprehensive answer quality evaluation vector is generated by normalizing and weighted combining the multi-angle features.
[0036] The comprehensive answer quality evaluation vector corresponding to each candidate answer is used as the objective function value of the multi-objective optimization algorithm, the answer combination is used as the optimization variable, the search space of the answer combination is constructed, and the initial population is randomly generated. Each individual in the initial population represents an answer combination, and the comprehensive answer quality evaluation vector is the fitness value of the current individual;
[0037] The initial population is non-dominatedly sorted, and the individuals are divided into different frontier surfaces according to the dominance relationship of each individual, and the crowding degree of each individual is calculated. The individuals are screened based on a preset crowding degree threshold. If the crowding degree is greater than the crowding degree threshold, the current individual is removed, otherwise the current individual is retained, and crossover and mutation operations are performed on the retained individuals to generate offspring individuals, and the offspring individuals are merged with the retained individuals to obtain candidate second-generation individuals, and the second-generation individuals are non-dominatedly sorted and crowding degree is calculated. The second-generation individuals are screened again based on the crowding degree, and the retained individuals are combined to obtain second-generation individuals. Iterations are repeated until a preset maximum number of iterations is reached, and an answer combination with an optimal comprehensive answer quality evaluation vector is selected as the optimal answer combination and returned to the user, and explicit feedback data and implicit feedback data of the user for the optimal answer combination are collected to update the safety production field knowledge base.
[0038] In an optional embodiment,
[0039] The non-dominated sorting of the initial population is shown in the following formula:
[0040] ;
[0041] in, F ( S ) represents the non-dominated sorting vector, θ represents the similarity threshold, f( S ) indicates a combination of answers S The mass vector of NU represents the total number of individuals, sin ( c a , c j ) represents an individual c a and individuals c j The similarity between a∈S Indicates the answer combination S Each element in a Perform a union operation, β represents the constraint violation weight, g ( S ) indicates a combination of answers S The degree of constraint violation.
[0042] A second aspect of an embodiment of the present invention provides a security education and training question-answering optimization system based on demand feedback, including:
[0043] The first unit is used to obtain a safety education and training question and answer corpus and a safety production domain knowledge base, and to transfer structured knowledge in the safety production domain knowledge base to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and to train a pre-set safety education and training question and answer matching model through contrastive learning based on the semantic enhancement encoder, and to calculate the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus based on the safety education and training question and answer matching model, and to construct a semantic association map based on the semantic similarity;
[0044] The second unit is used to obtain user question-answering interaction logs, build a heterogeneous interaction graph based on the user question-answering interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism in combination with the graph representation learning algorithm, generate node embedding and combine with the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-answering behavior through causal inference theory, learn personalized question-answering strategy functions through counterfactual methods and evaluate the effect of the current question-answering strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results;
[0045] The third unit is used to aggregate embedding vectors through a heterogeneous graph neural network based on the semantic association graph and the multi-dimensional user portrait, dynamically generate personalized semantic association subgraphs and perform fast retrieval to obtain a candidate answer set for the target question generated according to the personalized question recommendation list, perform multi-angle feature extraction on each answer in the candidate answer set, generate a comprehensive answer quality evaluation index and solve it through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtain feedback data and update the safety production field knowledge base according to the feedback data.
[0046] According to a third aspect of the embodiments of the present invention,
[0047] An electronic device is provided, comprising:
[0048] processor;
[0049] a memory for storing processor-executable instructions;
[0050] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0051] A fourth aspect of the embodiments of the present invention is:
[0052] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0053] In the present invention, the knowledge in the structured knowledge base is transferred to the semantic encoding space of the question-answer corpus through the knowledge distillation network, so as to realize the semantic enhanced representation of knowledge, lay a foundation for the subsequent question-answer matching and semantic association mining, construct a semantic association graph through semantic similarity, characterize the complex semantic association between questions and answers, and provide rich semantic information for personalized question-answering. The causal relationship between user characteristics and question-answering behavior is established by using the causal inference theory. Through counterfactual learning of personalized question-answering strategy function, a personalized question recommendation list can be adaptively generated according to user portraits, and accurate demand understanding and question recommendation can be realized. The personalized semantic association subgraph focuses on the semantic information highly related to the user portrait, which improves the pertinence and personalization of the candidate answers. The continuous expansion and optimization of the knowledge base helps to improve the knowledge coverage and question-answering quality of the system. At the same time, the question-answering strategy is dynamically adjusted according to user feedback, so that the system can adapt to changes in user needs. In summary, this embodiment significantly improves the intelligence and personalization level of safety education and training questions and answers, and provides employees with more accurate, high-quality and personalized safety knowledge services, which is of great significance for improving the effect of enterprise safety education and training, promoting employee safety awareness and skills improvement, and ensuring enterprise safety production. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A flowchart of a method for optimizing the question-and-answer session of a safety education and training program based on demand feedback according to an embodiment of the present invention;
[0055] Figure 2 This is a structural diagram of a security education and training question-and-answer optimization system based on demand feedback according to an embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0058] Figure 1 FIG. 1 is a flow chart of a method for optimizing the question-answering of safety education and training based on demand feedback according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0059] S1. Obtain a safety education and training question and answer corpus and a safety production domain knowledge base, and transfer the structured knowledge in the safety production domain knowledge base to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and based on the semantic enhancement encoder, train a pre-set safety education and training question and answer matching model through comparative learning, calculate the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus based on the safety education and training question and answer matching model, and construct a semantic association map based on the semantic similarity;
[0060] The safety education and training question and answer corpus is a collection of question and answer data specifically used for safety education and training. The structured knowledge is organized and systematized information, usually presented in a specific data structure or form, such as a database, a knowledge graph, a table, etc. The semantic encoding space refers to a space that converts text or speech data into digital representations through natural language processing technology. The semantic enhancement encoder is an improved encoder that aims to enhance the encoding effect of text or data through additional semantic information (such as contextual information, external knowledge). The contrastive learning is an unsupervised learning method that learns useful features of data by maximizing the similarity between positive sample pairs (similar samples) and minimizing the similarity between negative sample pairs (dissimilar samples). The safety education and training question and answer matching model is used to match questions and answers in safety education and training to ensure the relevance between questions and answers. The question-answer pair refers to a pair of text data containing a question and a corresponding answer, which is widely used in training question-answering systems and performing information retrieval. The semantic similarity measures the semantic similarity between two text fragments.
[0061] In an optional embodiment,
[0062] A safety education and training question and answer corpus and a safety production domain knowledge base are obtained, and structured knowledge in the safety production domain knowledge base is transferred to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and a pre-set safety education and training question and answer matching model is trained by contrastive learning based on the semantic enhancement encoder, and the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus is calculated based on the safety education and training question and answer matching model, and a semantic association graph is constructed based on the semantic similarity, including:
[0063] Acquire a safety education and training question-answer corpus and a safety production domain knowledge base, represent the safety education and training question-answer corpus as question-answer pairs, and represent the safety production domain knowledge base as triples;
[0064] Mapping the question-answer pair into a semantic vector based on a corpus encoder in a pre-constructed knowledge distillation network, mapping the triple into a knowledge vector through a knowledge encoder in a knowledge distillation model, distinguishing the semantic vector from the knowledge vector through a discriminator in the knowledge distillation network, reconstructing the semantic vector into a question-answer pair through a corpus encoder, training the knowledge distillation network based on a corpus reconstruction loss corresponding to the corpus encoder and a knowledge distribution matching loss generated after reconstruction, cascading the corpus encoder and the knowledge encoder in the trained knowledge distillation network, and fusing them to obtain the semantic enhancement encoder;
[0065] A contrastive learning framework is set based on the semantic enhancement encoder, and a security education training question-answer matching model is pre-set by constructing positive and negative example contrast training, wherein the positive examples are composed of semantically related question-answer pairs, and the negative examples are composed of semantically unrelated question-answer pairs, and the hyperparameters in the security education training question-answer matching model are corrected by minimizing the positive example contrast loss and the negative example contrast loss to obtain a trained security education training question-answer matching model;
[0066] Based on the safety education and training question-answer matching model, the semantic similarity between different question-answer pairs in the safety education and training question-answer corpus is calculated. Based on the semantic similarity, an initial semantic association graph is constructed with the question-answer pairs as nodes, wherein the weight of the edge between nodes in the initial semantic association graph is the semantic similarity. Node importance sampling and edge weight pruning are performed on the constructed initial semantic association graph to obtain the semantic association graph.
[0067] The triplet is a basic structure used to represent knowledge. The question-answer pair refers to a pair of questions and answers in a question-answering system. The discriminator is a part of the generative adversarial network, used to determine whether a data sample is real or generated by a generator. The corpus encoder is a tool for converting natural language text into a vector representation that can be processed by a machine learning model, and is typically used for text classification, information retrieval, and other natural language processing tasks. The corpus reconstruction loss refers to the loss of reconstructing input data during model training. The reconstruction loss is a loss function that measures the similarity between the model and the original data when generating data. The knowledge distribution matching loss is a loss function used to measure the difference between the knowledge distribution generated by the model and the true knowledge distribution. Edge weight pruning refers to simplifying the model structure by reducing the weight of the edges in a graph neural network or graph model.
[0068] Obtain the safety education and training question-answer corpus and represent it in the form of question-answer pairs. Obtain the safety production domain knowledge base and represent it in the form of triples. Use the corpus encoder in the pre-built knowledge distillation network to map the question-answer pairs into semantic vectors. Use the knowledge encoder in the knowledge distillation network to map the triples into knowledge vectors. Use the discriminator in the knowledge distillation network to distinguish semantic vectors from knowledge vectors. Use the corpus encoder to reconstruct the semantic vectors into question-answer pairs. Calculate the corpus reconstruction loss. Calculate the knowledge distribution matching loss generated after reconstruction. Based on the corpus reconstruction loss and the knowledge distribution matching loss, train the knowledge distillation network. Cascade the corpus encoder and the knowledge encoder in the trained knowledge distillation network to obtain a semantic enhancement encoder. For example, the question is: "How should a safety helmet be worn correctly?" The answer is: The safety helmet should be worn on the top of the head with the visor facing forward and the chin strap fastened. Represent the knowledge in the safety production domain knowledge base as a triple pattern, such as: head protection-including-safety helmet, safety helmet-color-yellow;
[0069] Based on the semantic enhancement encoder, a contrastive learning framework is set to construct positive and negative examples, where the positive example indicates that there are semantically related question-answer pairs, such as (question 1, answer 1), and the negative example indicates that there are no semantically related question-answer pairs, such as (question 1, answer 2). The preset security education training question-answer matching model is used to perform contrastive training on the positive and negative examples. By minimizing the positive example contrast loss and the negative example contrast loss, the hyperparameters of the matching model are corrected to obtain the trained security education training question-answer matching model. Exemplarily, SimCSE is used as the matching model, and the SimCSE model is trained by minimizing the cosine similarity between the encoding vectors of the positive question-answer pairs and the cosine similarity between the encoding vectors of the negative question-answer pairs.
[0070] The trained safety education and training question-answer matching model is used to calculate the semantic similarity between different question-answer pairs in the safety education and training question-answer corpus. The question-answer pairs are used as nodes and the semantic similarity is used as the edge weight to construct an initial semantic association graph. The initial semantic association graph is sampled for node importance. According to the edge weight, the edges with smaller weights are pruned and the edges with larger weights are retained to obtain the final semantic association graph. For example, the semantic similarity of (question 1, answer 1) and (question 2, answer 2) is calculated to be 0.85. The edge weights of nodes (question 1, answer 1) and (question 2, answer 2) are 0.85. According to indicators such as node degree and betweenness, the nodes are sampled for importance. According to the edge weight, the edges with smaller weights are pruned and the edges with larger weights are retained. The edge weight threshold can be set and the edge weight can be compared with the edge weight threshold to determine whether to prune. The pruned semantic association graph contains question-answer pair nodes with higher semantic relevance and high-weight edges connecting these nodes.
[0071] In this embodiment, the information in the safety education and training question and answer corpus and the safety production field knowledge base is compressed into semantic vectors and knowledge vectors through the knowledge distillation network, realizing information fusion and enhanced representation at the semantic level, which is helpful to capture the semantic associations between question and answer pairs and knowledge triples and improve the performance of subsequent tasks. By minimizing the positive example comparison loss and the negative example comparison loss, the model learns the ability to distinguish between semantically related and unrelated question and answer pairs, thereby improving the accuracy and robustness of question and answer matching. Through node importance sampling and edge weight pruning, redundant and noisy information is removed, and nodes and edges with high semantic relevance are retained, thereby improving the quality and interpretability of the semantic association graph. Relevant answers are quickly retrieved through the nodes and edges in the graph, and the graph structure is used for knowledge reasoning to discover implicit semantic relationships and provide more comprehensive and accurate answers. In summary, this embodiment realizes the intelligence of the safety education and training question and answer system, improves the question and answer matching performance and the quality of the semantic association graph, and provides strong support for intelligent question and answer and knowledge reasoning.
[0072] In an optional embodiment,
[0073] The probability of sampling the node importance of the constructed initial semantic association graph is as follows:
[0074] ;
[0075] in, p i Representation Node v i The sampling probability of η represents the balance factor, I i Representation Node v i The fundamental importance of α Represents the attenuation factor ,K is the maximum number of hops, indicating the neighborhood range considered, Representation Node v i No. k Hop neighborhood, I j Representation Node vj The fundamental importance of Representation Node v j No. k Hop neighborhood, c i Representation Node v i The compactness center, c j Representation Nodev j The compactness center, V Represents the set of all nodes in the initial semantic association graph, where nodes v i ,node v j and nodes v l All in the node set V middle, I l Representation Node v l The fundamental importance of l Representation Node v l The index of .
[0076] In this embodiment, when calculating the importance of a node, the importance of the node's multi-hop neighborhood is taken into account. The importance information is propagated to the current node through the weighted average of the importance of the neighboring nodes to avoid over-smoothing and information loss. By introducing closeness centrality, the central nodes in the graph can be sampled first to improve the sampling quality and efficiency. By dynamically calculating the denominator, the sampling weights of different nodes can be adaptively adjusted to adapt to changes in the graph structure. By adjusting the balance factor, attenuation factor and maximum number of hops, the sampling process can be flexibly controlled to adapt to different application requirements and computing resource limitations. In summary, this embodiment achieves high-quality and efficient node sampling, removes redundancy and noise, provides high-quality semantic association information for downstream tasks such as intelligent question answering and knowledge reasoning, and improves task performance and user experience.
[0077] S2. Obtain user question-and-answer interaction logs, build a heterogeneous interaction graph based on the user question-and-answer interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism in combination with the graph representation learning algorithm, generate node embedding and combine with the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-and-answer behaviors through causal inference theory, learn personalized question-and-answer strategy functions through counterfactual methods and evaluate the effect of the current question-and-answer strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results;
[0078] The user question-and-answer interaction log is log data that records the interaction between the user and the question-and-answer system, including questions raised by the user and answers provided by the system. The heterogeneous interaction graph refers to a graph that contains multiple types of nodes and edges in graph data. The meta-path is a path of node types and edge types defined in a heterogeneous graph, which is used to capture different types of relationships. The graph representation learning algorithm is used to map the nodes in the graph or the entire graph to a low-dimensional vector space so that the structural information of the graph can be retained. The multi-task learning algorithm is a machine learning method that improves the generalization ability of the model by learning multiple related tasks at the same time. The granularity refers to the level of detail or sophistication of the data. The user features are data that describe user attributes and behaviors, including Including demographic information, interests and hobbies, historical behavior, etc. The multi-dimensional user portrait refers to a comprehensive description of the user constructed by comprehensively considering multiple aspects of the user's characteristics. The causal inference theory studies how to infer causal relationships from data, that is, how to determine whether the occurrence of one event will lead to the occurrence of another event. The causal relationship diagram is a graphical representation used to describe the causal relationship between variables. The counterfactual method is used to estimate how the results will change if an event does not occur. The personalized question and answer strategy function refers to adjusting the question and answer strategy in the question and answer system according to the user's personalized characteristics and needs to improve user satisfaction and answer accuracy. The effect evaluation refers to quantifying and evaluating the impact of a certain intervention or measure.
[0079] In an optional embodiment,
[0080] Obtain user question-and-answer interaction logs, build a heterogeneous interaction graph based on the user question-and-answer interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism, combine the graph representation learning algorithm to generate node embedding and combine the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-and-answer behaviors through causal inference theory, learn personalized question-and-answer strategy functions through counterfactual methods and evaluate the effect of the current question-and-answer strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results, including:
[0081] Obtaining historical user question-and-answer interaction logs of users on the question-and-answer platform, and constructing a heterogeneous interaction graph based on the historical user question-and-answer interaction logs, wherein the heterogeneous interaction graph includes a variety of different nodes and edges, and the edges represent the interaction relationship between the nodes;
[0082] A plurality of semantically related meta-paths are set in the heterogeneous interaction graph, and the meta-paths are traversed. For each meta-path, all sub-graphs under each meta-path are determined. Based on the sub-graphs, the directly connected node features corresponding to each node in the meta-path are aggregated to generate a meta-path feature representation. On different meta-paths, weights are assigned to the meta-path representations corresponding to different nodes through an attention mechanism, and the node representations of different meta-paths are weighted summed according to the assigned weights to obtain a comprehensive semantic representation. Based on the comprehensive semantic representation, a corresponding node embedding is generated for each node.
[0083] Based on the node embedding, through a multi-task learning algorithm, the embedding of the user node is used as the initial feature representation of the current user, and the comprehensive user features corresponding to the current user are constructed in combination with the user attribute features and the behavior statistical features. Based on the comprehensive user features, multiple user understanding tasks are designed, and based on the task loss functions corresponding to the user understanding tasks, user feature representations of multiple dimensions are constructed to comprehensively obtain the multi-dimensional user portrait;
[0084] Based on the multi-dimensional user portrait, a causal relationship between the user feature representation and the user question-answering behavior is established through a causal inference algorithm, the user feature representation is used as an action, and the user question-answering behavior is used as a result, and the difference in question-answering behavior under different user features is evaluated through a causal graph, and the causal relationship graph is constructed based on the difference in question-answering behavior;
[0085] Based on the causal relationship graph, a personalized question-answering strategy function is constructed through a counterfactual method with user features as input and question-answering strategy as output. Based on the personalized question-answering strategy function, the causal effects of different question-answering strategies are evaluated through a counterfactual inference algorithm. Based on the effect evaluation results, the optimal question-answering strategy corresponding to the optimal causal effect is determined, and the personalized question recommendation list is generated based on the optimal question-answering strategy.
[0086] The subgraph is a partial graph extracted from a large graph, including some nodes and edges. The meta-path feature representation is to extract the features of nodes in the graph using the defined meta-path (path of node type and edge type). The user understanding task involves analyzing the user's needs, intentions or behavior patterns in order to better meet user needs. The task loss function is used to measure the performance of the model on a specific task. The optimal question-answering strategy refers to selecting the best answering strategy in the question-answering system based on the user's questions and background information to improve accuracy and user satisfaction. The personalized question recommendation list is a recommended question list generated based on the user's interests, historical behaviors and preferences.
[0087] Obtain the historical user question-and-answer interaction logs of users on the question-and-answer platform, and construct a heterogeneous interaction graph based on the historical user question-and-answer interaction logs. The node types include user nodes, question nodes, answer nodes, topic nodes, etc., and the edge types include question edges, answer edges, follow edges, like edges, etc. For example, user A asks question Q1, and user B answers question Q1, then two edges (user A, question, question Q1) and (user B, answer, question Q1) are generated;
[0088] A plurality of semantically related meta-paths are set in the heterogeneous interaction graph, each meta-path is traversed, and all sub-graphs under each meta-path are determined. Based on the sub-graphs, the node features directly connected to each node in the meta-path are aggregated to generate a meta-path feature representation. On different meta-paths, weights are assigned to the meta-path representations of different nodes through the attention mechanism, and the weighted sum is used to obtain a comprehensive semantic representation. Based on the comprehensive semantic representation, a corresponding node embedding is generated for each node. Exemplarily, meta-paths such as user-question-question-answer-user and user-attention-topic-attention-user are set in the heterogeneous interaction graph. For the meta-path user-question-question-answer-user, the sub-graph may be (user A, question, question Q1, answer, user B). For user A, the features of the question nodes directly connected to it under the meta-path user-question-question-answer-user are aggregated.
[0089] The embedding of the user node is used as the initial feature representation of the current user. The comprehensive user features of the current user are constructed by combining the user attribute features (such as gender, age) and behavioral statistical features (such as the number of questions asked and the number of answers). Based on the comprehensive user features, multiple user understanding tasks are designed, such as user-focused topic prediction and user question and answer quality prediction. Based on the task loss function corresponding to the user understanding task, multi-dimensional user feature representations are constructed. The multi-dimensional user feature representations are integrated to obtain a multi-dimensional user portrait.
[0090] Based on multi-dimensional user portraits, a causal relationship between user feature representation and user question-and-answer behavior is established through a causal inference algorithm. The user feature representation is taken as an action and the user question-and-answer behavior is taken as a result. The difference in question-and-answer behavior under different user features is evaluated through a causal graph. A causal relationship graph is constructed based on the difference in question-and-answer behavior. Based on the causal relationship graph, a personalized question-and-answer strategy function is constructed with user features as input and question-and-answer strategy as output. The causal effects of different question-and-answer strategies are evaluated through a counterfactual inference algorithm. Based on the effect evaluation results, the optimal question-and-answer strategy corresponding to the optimal causal effect is determined. Based on the optimal question-and-answer strategy, a personalized question recommendation list is generated. For example, for user A, a question list that is consistent with his interests and of moderate difficulty is recommended based on the distribution of topics he follows and his historical question-and-answer behavior.
[0091] In this embodiment, by constructing a heterogeneous interaction graph, multiple types of nodes such as users, questions, answers, topics, and multiple types of interaction relationships such as asking questions, answering, following, and liking are integrated, providing rich semantic information for subsequent feature learning and recommendation. By setting multiple semantically related meta-paths and aggregating node features on the meta-paths, the semantic correlation between users and question-and-answer content is mined, and user interest preferences at different semantic levels can be captured, providing a more comprehensive and accurate user representation. The multi-dimensional user portrait comprehensively considers the user's attribute characteristics, behavioral characteristics, and semantic characteristics, and can deeply characterize the user's interest preferences and behavior patterns. The causal relationship graph can The influence and contribution of different user characteristics on question-answering behavior are revealed, which provides a theoretical basis and decision-making basis for the generation of personalized question-answering strategies. The personalized question-answering strategy function can adaptively generate a list of question recommendations that meet the user's interest preferences based on the user's characteristic representation, thereby improving the accuracy and satisfaction of the recommendations. In summary, this embodiment realizes personalized question recommendation, can comprehensively mine the semantic correlation between users and question-answering content, construct a multi-dimensional user portrait, and optimize the personalized question-answering strategy through causal inference, thereby improving the accuracy, diversity and interpretability of recommendations, providing users with a more intelligent and efficient question-answering service, and improving the user's question-answering experience and satisfaction.
[0092] In an optional embodiment,
[0093] The causal effects of different question-answering strategies are evaluated through the counterfactual inference algorithm as shown in the following formula:
[0094] ;
[0095] in, ATE represents the effect evaluation results, n represents the number of samples, Y m Indicates user m The actual observation results, T m Indicates user m The processing status, e ( X m ) for users m The propensity score is given by X m The probability that the user accepts the treatment under the condition, H ( T =1) indicates the probability of actually receiving treatment in the sample, H ( T =0) indicates the probability that the sample actually did not receive treatment. Indicates that the covariate X mThe probability that the user accepts the treatment under the condition, Indicates that the covariate X m The probability that the user will not accept the treatment under certain conditions.
[0096] In this embodiment, counterfactual inference can be used to estimate the potential results of accepting different question-answering strategies (treatments) under the same user characteristic conditions, which can reveal the true effect of the question-answering strategy and eliminate the influence of other confounding factors. Propensity score matching can balance the user characteristic distribution between the treatment group and the control group and reduce the influence of selection bias. By averaging the counterfactual results of all users, an estimate of the overall effect of the question-answering strategy can be obtained, which is helpful to compare the overall effects of different question-answering strategies. Counterfactual inference and propensity score matching can effectively reduce the influence of selection bias and confounding factors, provide unbiased causal effect estimation, ensure the reliability and accuracy of the effect evaluation results, and provide a credible basis for the optimization of question-answering strategies. In summary, this embodiment realizes accurate and unbiased causal effect estimation, provides reliable evaluation indicators and decision-making basis for the optimization of personalized question-answering strategies, fully considers the influence of user characteristics, can estimate personalized strategy effects, and improves the quality of question-answering recommendations and user satisfaction.
[0097] S3. Based on the semantic association graph and the multi-dimensional user portrait, for the target question generated according to the personalized question recommendation list, embedding vectors are aggregated through a heterogeneous graph neural network, personalized semantic association subgraphs are dynamically generated and quickly retrieved to obtain a candidate answer set, multi-angle feature extraction is performed on each answer in the candidate answer set, a comprehensive answer quality evaluation index is generated and solved through a non-dominated sorting genetic algorithm, the optimal answer combination is obtained and returned to the user, feedback data is obtained and the safety production field knowledge base is updated according to the feedback data.
[0098] The heterogeneous graph neural network is a graph neural network for processing heterogeneous graphs, the personalized semantic association subgraph is a specific subgraph extracted from the heterogeneous graph, and is personalized according to the user's interests and behaviors. The multi-angle feature extraction refers to extracting data features from different perspectives or methods to fully understand and analyze the data. The comprehensive answer quality evaluation indicator is used to comprehensively evaluate the quality of answers generated by the question-answering system. The non-dominated sorting genetic algorithm is a genetic algorithm for solving multi-objective optimization problems.
[0099] In an optional embodiment,
[0100] Based on the semantic association graph and the multi-dimensional user portrait, for the target question generated according to the personalized question recommendation list, aggregating embedding vectors through a heterogeneous graph neural network, dynamically generating a personalized semantic association subgraph and performing rapid retrieval, obtaining a candidate answer set, performing multi-angle feature extraction on each answer in the candidate answer set, generating a comprehensive answer quality evaluation index, and solving it through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtaining feedback data and updating the safety production field knowledge base according to the feedback data, including:
[0101] Initialize the heterogeneous graph neural network, convert the semantic association graph into a heterogeneous graph data structure and define nodes, collect and generate training data on the heterogeneous graph data structure through a meta-path-based random walk algorithm, train the heterogeneous graph neural network through the training data, embed the multi-dimensional user portrait into the heterogeneous graph neural network, map the user features to the graph semantic space through an additional user representation learning layer, determine the semantic encoding function, and obtain an optimized heterogeneous graph neural network;
[0102] For each target question in the personalized question recommendation list, determine neighbor nodes and semantic similarities between the neighbor nodes and the multi-dimensional user portrait according to the nodes corresponding to each question through the optimized heterogeneous graph neural network, and generate the personalized semantic association subgraph;
[0103] On the personalized semantic association subgraph, with the target question as the center, candidate answer nodes related to the question semantics are retrieved through a graph-based fast approximate nearest neighbor search algorithm to generate the candidate answer set. For each answer in the candidate answer set, semantic relevance, structural relevance, user relevance and knowledge quality are extracted respectively through a feature extraction algorithm, and multi-angle features are combined to obtain a comprehensive answer quality evaluation index based on the multi-angle features. A comprehensive answer quality evaluation vector is generated by normalizing and weighted combining the multi-angle features.
[0104] The comprehensive answer quality evaluation vector corresponding to each candidate answer is used as the objective function value of the multi-objective optimization algorithm, the answer combination is used as the optimization variable, the search space of the answer combination is constructed, and the initial population is randomly generated. Each individual in the initial population represents an answer combination, and the comprehensive answer quality evaluation vector is the fitness value of the current individual;
[0105] The initial population is non-dominatedly sorted, and the individuals are divided into different frontier surfaces according to the dominance relationship of each individual, and the crowding degree of each individual is calculated. The individuals are screened based on a preset crowding degree threshold. If the crowding degree is greater than the crowding degree threshold, the current individual is removed, otherwise the current individual is retained, and crossover and mutation operations are performed on the retained individuals to generate offspring individuals, and the offspring individuals are merged with the retained individuals to obtain candidate second-generation individuals, and the second-generation individuals are non-dominatedly sorted and crowding degree is calculated. The second-generation individuals are screened again based on the crowding degree, and the retained individuals are combined to obtain second-generation individuals. Iterations are repeated until a preset maximum number of iterations is reached, and an answer combination with an optimal comprehensive answer quality evaluation vector is selected as the optimal answer combination and returned to the user, and explicit feedback data and implicit feedback data of the user for the optimal answer combination are collected to update the safety production field knowledge base.
[0106] The meta-path-based random walk algorithm is a method for embedding nodes in a heterogeneous graph. By defining a specific meta-path (i.e., a sequence of node and edge types), the algorithm performs a random walk to generate a feature representation of the node. The user representation learning layer refers to the part used in the model to learn the user feature representation. The user's embedding vector is generated by mapping the user's historical behavior, preferences and other features into a low-dimensional vector space. The graph semantic space refers to the semantic representation space of nodes and edges in the knowledge graph. The semantic encoding function is a function that converts data (such as text, nodes, and relationships) into a semantic vector. The graph-based fast approximate nearest neighbor search algorithm is an effective method for finding approximate nearest neighbors in a high-dimensional data space. By constructing a graph structure, data points are mapped into the graph, and the connectivity of the graph is used to quickly find approximate neighboring points. The search space refers to the set of all possible solutions in the optimization problem, including all potential solutions or configurations. The algorithm searches in this space to find the best or approximately the best solution. The explicit feedback data refers to the feedback explicitly provided by the user, such as ratings, comments, etc. The implicit feedback data refers to the feedback indirectly inferred from the user's behavior, such as clicks, browsing time, purchase records, etc.
[0107] Convert the semantic association graph into a heterogeneous graph data structure, define node types such as user nodes, question nodes, answer nodes, etc., collect and generate training data on the heterogeneous graph through a meta-path-based random walk algorithm, use the training data to train the heterogeneous graph neural network, embed the multi-dimensional user portrait into the heterogeneous graph neural network, map the user features to the graph semantic space through an additional user representation learning layer, determine the semantic encoding function, and obtain the optimized heterogeneous graph neural network;
[0108] For each target question in the personalized question recommendation list, the neighbor nodes of its corresponding node are determined through the optimized heterogeneous graph neural network, and the semantic similarity between the neighbor nodes and the multi-dimensional user portrait is calculated to generate a personalized semantic association subgraph, which includes the target question node, related neighbor nodes and semantic similarity information. On the personalized semantic association subgraph, with the target question as the center, the candidate answer nodes related to the question semantics are retrieved through the graph-based fast approximate nearest search algorithm to generate a candidate answer set, which includes the answer nodes related to the target question semantics.
[0109] For each answer in the candidate answer set, the following multi-angle features are extracted through the feature extraction algorithm: semantic relevance, structural relevance, user relevance and knowledge quality. The multi-angle features are combined to determine the comprehensive answer quality evaluation index. The comprehensive answer quality evaluation vector is generated through normalization operation and weighted combination of multi-angle features. The comprehensive answer quality evaluation vector of each candidate answer is used as the objective function value of the multi-objective optimization algorithm. The answer combination is used as the optimization variable to construct the search space of the answer combination. The initial population is randomly generated, and each individual represents an answer combination. The comprehensive answer quality evaluation vector is the fitness value of the individual. The initial population is non-dominated and sorted. It is divided into different frontiers according to the dominance relationship of the individuals. The crowding degree of each individual is calculated based on the preset crowding degree threshold. Screening is performed to remove individuals whose crowding is greater than a threshold, crossover and mutation operations are performed on the retained individuals to generate offspring individuals, the offspring individuals are merged with the retained individuals to obtain candidate second-generation individuals, non-dominated sorting and crowding calculation are performed on the second-generation individuals, and the second-generation individuals are screened again based on the crowding to obtain second-generation individuals, and the sorting and iteration are repeated until the preset maximum number of iterations is reached. The answer combination with the best comprehensive answer quality evaluation vector is selected as the best answer combination and returned to the user, and explicit feedback data from users on the best answer combination, such as user ratings and comments, is collected. Implicit feedback data from users on the best answer combination, such as user clicks and browsing time, is collected. The knowledge base in the field of safe production is updated using the collected feedback data to optimize the content quality and structural association of the knowledge base.
[0110] For example, suppose Xiao Wang, a safety manager of a petrochemical enterprise, asks a question on the question-and-answer platform: "How to prevent fire accidents in the tank area?" Based on Xiao Wang's multi-dimensional user profile (such as occupation, professional background, historical questions, etc.), the system generates a personalized semantic association subgraph through a heterogeneous graph neural network, and retrieves a candidate answer set related to the question semantics, including: regularly conducting safety inspections and hidden danger inspections in the tank area, strengthening anti-static and lightning protection measures in the tank area, and formulating a complete fire emergency plan for the tank area. The system extracts multi-angle features for each candidate answer and calculates the comprehensive answer quality evaluation vector. The optimal answer combination is searched through a multi-objective optimization algorithm, and the optimal combination containing 3 answers is obtained, which are: 1. Regularly conduct safety inspections and hidden danger inspections in the tank area to promptly discover and eliminate accident hazards, 2. Strengthen anti-static and lightning protection measures in the tank area, such as installing electrostatic grounding devices and lightning rods, etc. 3. Formulate a complete fire emergency plan for the tank area, clarify the emergency disposal process and measures, and conduct emergency drills regularly. The system returns the optimal answer combination to Xiao Wang, who rates and comments on the answer combination. At the same time, the system collects implicit feedback data that Xiao Wang has browsed the answer content in detail. Based on the collected user feedback, the system updates and optimizes the content and associations of relevant knowledge points in the petrochemical production safety knowledge base, enhancing the professionalism and practicality of the knowledge base in fire prevention in tank areas.
[0111] In this embodiment, by converting the semantic association graph into a heterogeneous graph data structure and using a heterogeneous graph neural network for representation learning, unified modeling of multiple types of nodes and complex relationships such as users, questions, and answers is achieved. It can effectively integrate heterogeneous information and mine the semantic associations between nodes, providing a rich semantic basis for personalized recommendations. The personalized semantic association subgraph further captures the correlation between the target question and the user portrait in the local semantic space, providing more accurate personalized question understanding and recommendations. By extracting answer features from multiple angles such as semantic relevance, structural relevance, user relevance, and knowledge quality, and combining them into a comprehensive answer quality evaluation vector, a comprehensive quality consideration of the candidate answers is achieved. By collecting users' responses to recommendations The explicit and implicit feedback data of the answers are used to update the knowledge base in the field of safe production, realizing closed-loop optimization of the interaction between the knowledge base and users, which is helpful to timely incorporate new knowledge and new cases, expand the knowledge coverage, and dynamically adjust the content quality and association structure of knowledge nodes according to user feedback, so that the knowledge base can continue to evolve and adapt to the ever-changing user needs. In summary, this embodiment realizes personalized recommendation and answer of safe production questions, can accurately match user characteristics and question semantics, provide high-quality and explainable optimal answer combination, and improve knowledge service capabilities through continuous knowledge base optimization, providing safety management personnel with intelligent and efficient knowledge acquisition channels, promoting the improvement of enterprise safety management level, and has broad application prospects.
[0112] In an optional embodiment,
[0113] The non-dominated sorting of the initial population is shown in the following formula:
[0114] ;
[0115] in, F ( S ) represents the non-dominated sorting vector, θ represents the similarity threshold, f( S ) indicates a combination of answers S The mass vector of NU represents the total number of individuals, sin ( c a , c j ) represents an individual c a and individuals c j The similarity between a∈S Indicates the answer combination S Each element in a Perform a union operation, β represents the constraint violation weight, g ( S ) indicates a combination of answers S The degree of constraint violation.
[0116] In this embodiment, by weighting the combination quality and diversity, the quality and diversity of the answers can be balanced during the optimization process to avoid converging to a combination of answers with higher quality but severe homogeneity. By reasonably setting the threshold, the diversity level of the answer combination can be controlled according to actual needs. The dynamic measurement method can reflect the diversity changes of the answer combination in real time, provide more accurate diversity feedback for the optimization process, and incorporate the constraint violation degree into the non-dominated sorting to ensure that the generated answer combination meets the quality and diversity requirements while also meeting the constraints of the problem. In summary, this embodiment realizes the evaluation and selection of answer combinations under multi-objective optimization, improves the convergence speed and optimization efficiency of the population, generates a Pareto optimal solution set, and provides high-quality candidate solutions for the next step of evolutionary optimization.
[0117] Figure 2 FIG. 1 is a schematic diagram of a security education and training question-answering optimization system based on demand feedback according to an embodiment of the present invention. Figure 2 As shown, the system comprises:
[0118] The first unit is used to obtain a safety education and training question and answer corpus and a safety production domain knowledge base, and to transfer structured knowledge in the safety production domain knowledge base to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and to train a pre-set safety education and training question and answer matching model through contrastive learning based on the semantic enhancement encoder, and to calculate the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus based on the safety education and training question and answer matching model, and to construct a semantic association map based on the semantic similarity;
[0119] The second unit is used to obtain user question-answering interaction logs, build a heterogeneous interaction graph based on the user question-answering interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism in combination with the graph representation learning algorithm, generate node embedding and combine with the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-answering behavior through causal inference theory, learn personalized question-answering strategy functions through counterfactual methods and evaluate the effect of the current question-answering strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results;
[0120] The third unit is used to aggregate embedding vectors through a heterogeneous graph neural network based on the semantic association graph and the multi-dimensional user portrait, dynamically generate personalized semantic association subgraphs and perform fast retrieval to obtain a candidate answer set for the target question generated according to the personalized question recommendation list, perform multi-angle feature extraction on each answer in the candidate answer set, generate a comprehensive answer quality evaluation index and solve it through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtain feedback data and update the safety production field knowledge base according to the feedback data.
[0121] According to a third aspect of the embodiments of the present invention,
[0122] An electronic device is provided, comprising:
[0123] processor;
[0124] a memory for storing processor-executable instructions;
[0125] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.
[0126] A fourth aspect of the embodiments of the present invention is:
[0127] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.
[0128] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.
[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A safety education and training question-answering optimization method based on demand feedback, characterized in that: include: A safety education and training question and answer corpus and a safety production domain knowledge base are obtained, and structured knowledge in the safety production domain knowledge base is transferred to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and a pre-set safety education and training question and answer matching model is trained by contrastive learning based on the semantic enhancement encoder, and the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus is calculated based on the safety education and training question and answer matching model, and a semantic association graph is constructed based on the semantic similarity; Obtain user question-and-answer interaction logs, build a heterogeneous interaction graph based on the user question-and-answer interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism in combination with the graph representation learning algorithm, generate node embedding and combine with the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-and-answer behaviors through causal inference theory, learn personalized question-and-answer strategy functions through counterfactual methods and evaluate the effect of the current question-and-answer strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results; Based on the semantic association graph and the multi-dimensional user portrait, for the target question generated according to the personalized question recommendation list, the embedding vectors are aggregated through a heterogeneous graph neural network, and a personalized semantic association subgraph is dynamically generated and quickly retrieved to obtain a candidate answer set. Multi-angle feature extraction is performed on each answer in the candidate answer set, and a comprehensive answer quality evaluation index is generated and solved through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtain feedback data, and update the safety production field knowledge base based on the feedback data.
2. The method according to claim 1, characterized in that A safety education and training question and answer corpus and a safety production domain knowledge base are obtained, and structured knowledge in the safety production domain knowledge base is transferred to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and a pre-set safety education and training question and answer matching model is trained by contrastive learning based on the semantic enhancement encoder, and the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus is calculated based on the safety education and training question and answer matching model, and a semantic association graph is constructed based on the semantic similarity, including: Acquire a safety education and training question-answer corpus and a safety production domain knowledge base, represent the safety education and training question-answer corpus as question-answer pairs, and represent the safety production domain knowledge base as triples; Mapping the question-answer pair into a semantic vector based on a corpus encoder in a pre-constructed knowledge distillation network, mapping the triple into a knowledge vector through a knowledge encoder in a knowledge distillation model, distinguishing the semantic vector from the knowledge vector through a discriminator in the knowledge distillation network, reconstructing the semantic vector into a question-answer pair through a corpus encoder, training the knowledge distillation network based on a corpus reconstruction loss corresponding to the corpus encoder and a knowledge distribution matching loss generated after reconstruction, cascading the corpus encoder and the knowledge encoder in the trained knowledge distillation network, and fusing them to obtain the semantic enhancement encoder; A contrastive learning framework is set based on the semantic enhancement encoder, and a security education training question-answer matching model is pre-set by constructing positive and negative example contrast training, wherein the positive examples are composed of semantically related question-answer pairs, and the negative examples are composed of semantically unrelated question-answer pairs, and the hyperparameters in the security education training question-answer matching model are corrected by minimizing the positive example contrast loss and the negative example contrast loss to obtain a trained security education training question-answer matching model; Based on the safety education and training question-answer matching model, the semantic similarity between different question-answer pairs in the safety education and training question-answer corpus is calculated. Based on the semantic similarity, an initial semantic association graph is constructed with the question-answer pairs as nodes, wherein the weight of the edge between nodes in the initial semantic association graph is the semantic similarity. Node importance sampling and edge weight pruning are performed on the constructed initial semantic association graph to obtain the semantic association graph.
3. The method according to claim 2, characterized in that The probability of sampling the node importance of the constructed initial semantic association graph is as follows: ; in, p i Representation Node v i The sampling probability of η represents the balance factor, I i Representation Node v i The fundamental importance of α Represents the attenuation factor ,K is the maximum number of hops, indicating the neighborhood range considered, Representation Node v i No. k Hop neighborhood, I j Representation Node vj The fundamental importance of Representation Node v j No. k Hop neighborhood, c i Representation Node v i The compactness center, c j Representation Node v j The compactness center, V Represents the set of all nodes in the initial semantic association graph, where nodes v i ,node v j and nodes v l All in the node set V middle, I l Representation Node v l The fundamental importance of l Representation Node v l The index of .
4. The method according to claim 1, characterized in that: Obtain user question-and-answer interaction logs, build a heterogeneous interaction graph based on the user question-and-answer interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism, combine the graph representation learning algorithm to generate node embedding and combine the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-and-answer behaviors through causal inference theory, learn personalized question-and-answer strategy functions through counterfactual methods and evaluate the effect of the current question-and-answer strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results, including: Obtaining historical user question-and-answer interaction logs of users on the question-and-answer platform, and constructing a heterogeneous interaction graph based on the historical user question-and-answer interaction logs, wherein the heterogeneous interaction graph includes a variety of different nodes and edges, and the edges represent the interaction relationship between the nodes; A plurality of semantically related meta-paths are set in the heterogeneous interaction graph, and the meta-paths are traversed. For each meta-path, all sub-graphs under each meta-path are determined. Based on the sub-graphs, the directly connected node features corresponding to each node in the meta-path are aggregated to generate a meta-path feature representation. On different meta-paths, weights are assigned to the meta-path representations corresponding to different nodes through an attention mechanism, and the node representations of different meta-paths are weighted summed according to the assigned weights to obtain a comprehensive semantic representation. Based on the comprehensive semantic representation, a corresponding node embedding is generated for each node. Based on the node embedding, through a multi-task learning algorithm, the embedding of the user node is used as the initial feature representation of the current user, and the comprehensive user features corresponding to the current user are constructed in combination with the user attribute features and the behavior statistical features. Based on the comprehensive user features, multiple user understanding tasks are designed, and based on the task loss functions corresponding to the user understanding tasks, user feature representations of multiple dimensions are constructed to comprehensively obtain the multi-dimensional user portrait; Based on the multi-dimensional user portrait, a causal relationship between the user feature representation and the user question-answering behavior is established through a causal inference algorithm, the user feature representation is used as an action, and the user question-answering behavior is used as a result, and the difference in question-answering behavior under different user features is evaluated through a causal graph, and the causal relationship graph is constructed based on the difference in question-answering behavior; Based on the causal relationship graph, a personalized question-answering strategy function is constructed through a counterfactual method with user features as input and question-answering strategy as output. Based on the personalized question-answering strategy function, the causal effects of different question-answering strategies are evaluated through a counterfactual inference algorithm. Based on the effect evaluation results, the optimal question-answering strategy corresponding to the optimal causal effect is determined, and the personalized question recommendation list is generated based on the optimal question-answering strategy.
5. The method according to claim 4, characterized in that The causal effects of different question-answering strategies are evaluated through the counterfactual inference algorithm as shown in the following formula: ; in, ATE represents the effect evaluation results, n represents the number of samples, Y m Indicates user m The actual observation results, T m Indicates user m The processing status, e ( X m ) for users m The propensity score is given by X m The probability that the user accepts the treatment under the condition, H ( T =1) indicates the probability of actually receiving treatment in the sample, H ( T =0) indicates the probability that the sample actually did not receive treatment. Indicates that the covariate X m The probability that the user accepts the treatment under the condition, Indicates that the covariate X m The probability that the user will not accept the treatment under certain conditions.
6. The method according to claim 1, characterized in that Based on the semantic association graph and the multi-dimensional user portrait, for the target question generated according to the personalized question recommendation list, aggregating embedding vectors through a heterogeneous graph neural network, dynamically generating a personalized semantic association subgraph and performing rapid retrieval, obtaining a candidate answer set, performing multi-angle feature extraction on each answer in the candidate answer set, generating a comprehensive answer quality evaluation index, and solving it through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtaining feedback data and updating the safety production field knowledge base according to the feedback data, including: Initialize the heterogeneous graph neural network, convert the semantic association graph into a heterogeneous graph data structure and define nodes, collect and generate training data on the heterogeneous graph data structure through a meta-path-based random walk algorithm, train the heterogeneous graph neural network through the training data, embed the multi-dimensional user portrait into the heterogeneous graph neural network, map the user features to the graph semantic space through an additional user representation learning layer, determine the semantic encoding function, and obtain an optimized heterogeneous graph neural network; For each target question in the personalized question recommendation list, determine neighbor nodes and semantic similarities between the neighbor nodes and the multi-dimensional user portrait according to the nodes corresponding to each question through the optimized heterogeneous graph neural network, and generate the personalized semantic association subgraph; On the personalized semantic association subgraph, with the target question as the center, candidate answer nodes related to the question semantics are retrieved through a graph-based fast approximate nearest neighbor search algorithm to generate the candidate answer set. For each answer in the candidate answer set, semantic relevance, structural relevance, user relevance and knowledge quality are extracted respectively through a feature extraction algorithm, and multi-angle features are combined to obtain a comprehensive answer quality evaluation index based on the multi-angle features. A comprehensive answer quality evaluation vector is generated by normalizing and weighted combining the multi-angle features. The comprehensive answer quality evaluation vector corresponding to each candidate answer is used as the objective function value of the multi-objective optimization algorithm, the answer combination is used as the optimization variable, the search space of the answer combination is constructed, and the initial population is randomly generated. Each individual in the initial population represents an answer combination, and the comprehensive answer quality evaluation vector is the fitness value of the current individual; The initial population is non-dominatedly sorted, and the individuals are divided into different frontier surfaces according to the dominance relationship of each individual, and the crowding degree of each individual is calculated. The individuals are screened based on a preset crowding degree threshold. If the crowding degree is greater than the crowding degree threshold, the current individual is removed, otherwise the current individual is retained, and crossover and mutation operations are performed on the retained individuals to generate offspring individuals, and the offspring individuals are merged with the retained individuals to obtain candidate second-generation individuals, and the second-generation individuals are non-dominatedly sorted and crowding degree is calculated. The second-generation individuals are screened again based on the crowding degree, and the retained individuals are combined to obtain second-generation individuals. Iterations are repeated until a preset maximum number of iterations is reached, and an answer combination with an optimal comprehensive answer quality evaluation vector is selected as the optimal answer combination and returned to the user, and explicit feedback data and implicit feedback data of the user for the optimal answer combination are collected to update the safety production field knowledge base.
7. The method according to claim 6, characterized in that The non-dominated sorting of the initial population is shown in the following formula: ; in, F ( S ) represents the non-dominated sorting vector, θ represents the similarity threshold, f( S ) indicates a combination of answers S The mass vector of NU represents the total number of individuals, sin ( c a , c j ) represents an individual c a and individuals c j The similarity between a∈S Indicates the answer combination S Each element in a Perform a union operation, β represents the constraint violation weight, g ( S ) indicates a combination of answers S The degree of constraint violation.
8. A safety education and training question-answering optimization system based on demand feedback, used to implement the method described in any one of claims 1 to 7, characterized in that: include: The first unit is used to obtain a safety education and training question and answer corpus and a safety production domain knowledge base, and to transfer structured knowledge in the safety production domain knowledge base to the semantic encoding space of the safety education and training question and answer corpus based on a pre-constructed knowledge distillation network to obtain a semantic enhancement encoder, and to train a pre-set safety education and training question and answer matching model through contrastive learning based on the semantic enhancement encoder, and to calculate the semantic similarity of different question-answer pairs in the safety education and training question and answer corpus based on the safety education and training question and answer matching model, and to construct a semantic association map based on the semantic similarity; The second unit is used to obtain user question-answering interaction logs, build a heterogeneous interaction graph based on the user question-answering interaction logs, learn the semantic representation of each node in the heterogeneous interaction graph based on the meta-path and attention mechanism in combination with the graph representation learning algorithm, generate node embedding and combine with the multi-task learning algorithm to determine user features of different granularities and generate multi-dimensional user portraits, establish a causal relationship graph between the user features and user question-answering behavior through causal inference theory, learn personalized question-answering strategy functions through counterfactual methods and evaluate the effect of the current question-answering strategy, and adaptively generate a personalized question recommendation list based on the effect evaluation results; The third unit is used to aggregate embedding vectors through a heterogeneous graph neural network based on the semantic association graph and the multi-dimensional user portrait, dynamically generate personalized semantic association subgraphs and perform fast retrieval to obtain a candidate answer set for the target question generated according to the personalized question recommendation list, perform multi-angle feature extraction on each answer in the candidate answer set, generate a comprehensive answer quality evaluation index and solve it through a non-dominated sorting genetic algorithm to obtain the optimal answer combination and return it to the user, obtain feedback data and update the safety production field knowledge base according to the feedback data.
9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data processing method and related device
CN116595252A
Knowledge reasoning method based on heterogeneous knowledge fusion
CN117235216A
Answer scoring method and system based on knowledge graph
CN117648915A
Intelligent dialogue method and system based on natural language processing
CN118132719A
Dynamic adaptation question answering system and method based on hierarchical structure and retrieval enhancement
CN118193714A
