Continuous learning method and system for relation extraction, medium, intelligent cabin and vehicle

By using mixed sample training and routing network optimization, the problem of the relation extraction model misunderstanding the wrong relation type in real business scenarios was solved, achieving higher recognition accuracy and continuous learning ability in relation representation.

CN121189321APending Publication Date: 2025-12-23ZEBRED NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511328070.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-16
Publication Date
2025-12-23

AI Technical Summary

Technical Problem

Existing relation extraction models cannot effectively optimize the understanding of incorrect relation types in real-world business scenarios due to differences in data distribution, resulting in insufficient recognition accuracy.

Method used

By mixing difficult samples and trained samples, configuring the routing network and new expert branches, optimizing the routing network parameters, guiding difficult samples to the new expert branches, and training samples to the old expert branches, and combining entity semantic features to fuse relation representations, the model minimizes the learning degree difference loss and forms a new relation extraction model that takes into account both the preservation of historical relations and the correction of erroneous relations.

Benefits of technology

It significantly improves the recognition accuracy of the relation extraction model, and can balance the learning of new relations and the retention of historical relations in continuous learning, thus avoiding the forgetting of learned knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121189321A_ABST
    Figure CN121189321A_ABST
Patent Text Reader

Abstract

The invention discloses a continuous learning method and system for relation extraction, a medium, an intelligent cabin and a vehicle, and the method comprises the steps: on the basis of constructing a new relation extraction model containing a routing network and a new expert branch, taking the minimization of branch routing distribution loss as a target to independently optimize routing network parameters; a routing network accurately guides a difficult sample to a new expert branch and guides a trained sample to an old expert branch according to an expected branch label in a training sample. Besides, global optimization is carried out on the new relation extraction model by minimizing learning degree differentiation loss, during optimization, targeted learning and optimization are carried out on new expert branches, and branch parameters of old experts remain unchanged during global optimization, so that the model not only can optimize error relation types in a targeted manner, but also can efficiently utilize historical training results. And finally, the sustainable evolution capability considering historical relationship retention, error relationship correction and new relationship learning is formed, and the relationship recognition accuracy of the relationship extraction model is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of vehicle networking technology, and in particular to a continuous learning method, system, medium, smart cockpit, and vehicle for relation extraction. Background Technology

[0002] Semantic understanding systems, a key component of artificial intelligence, aim to enable computers to understand the meaning in human language, supporting subsequent information processing and decision-making. For example, in in-vehicle search engines, semantic understanding systems are used to parse user-input queries, thereby returning accurate search results.

[0003] Relation extraction models are an important component of semantic understanding systems. They need to learn the association patterns between entities and relations in the samples through the training set, understand the semantic associations between entities in the samples, identify entity pairs in the sample data, clarify the association relationships between entity pairs, and complete the transformation from unstructured samples to structured triples.

[0004] Currently, the training set used for model training relies on manual collection and construction. However, the data distribution in actual business scenarios differs significantly from the dataset distribution during model training, which directly affects the model's performance in real-world business scenarios.

[0005] To compensate for the performance defects caused by such scenario differences, existing technologies extract feature representations of specific relationships in samples through open relation extraction, then analyze and mine new relation types not covered in the training set to complete the sample expansion of new relation types, and then use the expanded samples to continuously train the classifier, thereby realizing the model's ability to recognize new relation types.

[0006] However, this approach focuses on discovering new relation types and completely ignores the optimization problem for relation types that are misunderstood by the model. Summary of the Invention

[0007] This specification provides a continuous learning method, system, medium, smart cockpit, and vehicle for relation extraction to solve or partially solve the technical problem of optimizing relation types that do not involve model understanding errors.

[0008] To address the aforementioned technical problems, this specification provides a continuous learning method for relation extraction, the method comprising:

[0009] The difficult samples and the trained samples are mixed to obtain a mixed sample set; wherein each training sample in the mixed sample set carries a real relation label and an expected branch label, the expected branch label being used to indicate the expert branch that the training sample is expected to be assigned;

[0010] Head entity words, tail entity words, and relation words are extracted from the training samples, and semantic parsing is performed to obtain a semantic feature sequence; wherein, the semantic feature sequence includes relation semantic features, head entity semantic features, and tail entity semantic features;

[0011] In the original relation extraction model, at least a routing network and a new expert branch are configured to obtain a new relation extraction model; the routing network is used to determine the expert-level allocation probability of the actual allocation expert branch of the training sample; wherein, the expert-level allocation probability includes the feature allocation probability of the relation semantic features relative to the expert branch, and the feature allocation probability is used to filter the target relation features of the expert branch;

[0012] With the goal of minimizing the branch routing assignment loss calculated from the expected branch label and the expert-level assignment probability, the routing network parameters are optimized individually so that the routing network guides the difficult samples to the new expert branch and the trained samples to the old expert branch.

[0013] Based on the target relationship features of several expert branches, the relationship representations are fused together with the semantic features of the head entity and the semantic features of the tail entity to obtain their respective target relationship representations; wherein, the target relationship representations of the several experts are used together to calculate the predicted relationship probability.

[0014] The new relation extraction model is globally optimized with the goal of minimizing the learning degree difference loss calculated from the predicted relation probability and the real relation label; wherein the parameters of the old expert branch remain unchanged during optimization.

[0015] Preferably, the loss function for the branch routing allocation loss is specifically:

[0016]

[0017] Among them, L cei (y ei a i ) represents the branch routing assignment loss for the i-th training sample, N represents the total number of samples in the mixed sample set, and y ei Let a represent the expected branch label of the i-th training sample. i Let represent the expert-level assignment probability of the actual assignment expert branch for the i-th training sample.

[0018] Preferably, the expected branch label of the difficult sample is 1, and the expected branch label of the trained sample is 0;

[0019] The step of optimizing the routing network parameters individually, with the objective of minimizing the branch routing assignment loss calculated from the expected branch label and the expert-level assignment probability, so that the routing network guides the difficult samples to the new expert branch and the trained samples to the old expert branch, specifically includes:

[0020] For the difficult sample, the expert-level allocation probability of the new expert branch and the expected branch label of the difficult sample are input into the loss function of the branch routing allocation loss to obtain the corresponding branch routing allocation loss. When the expected branch label of the difficult sample is 1, the routing network parameters are optimized with the goal of minimizing the branch routing allocation loss of the difficult sample, so that the branch routing allocation loss of the difficult sample gradually decreases until it is less than a set loss threshold, and the expert-level allocation probability of the new expert branch gradually increases until it is greater than the set allocation threshold, thereby prompting the difficult sample to be guided to the new expert branch.

[0021] For the trained sample, when the expected branch label of the trained sample is 0, the branch routing allocation loss of the trained sample is 0, and optimization of the routing network parameters is prohibited, so that the routing network maintains the preset allocation rules for the trained sample and guides the trained sample to the old expert branch.

[0022] Preferably, the step of fusing the relationship representations based on the target relationship features of several expert branches, combined with the semantic features of the head entity and the semantic features of the tail entity, to obtain their respective target relationship representations specifically includes:

[0023] For each of the several expert branches, the target relation features are subjected to average pooling to obtain the relation representation corresponding to the target relation features;

[0024] The semantic features of the head entity are subjected to average pooling to obtain the relation representation corresponding to the semantic features of the head entity.

[0025] The semantic features of the tail entity are subjected to average pooling to obtain the relation representation corresponding to the semantic features of the tail entity.

[0026] The target relation representation is obtained by fusing the relation representation corresponding to the target relation feature, the relation representation corresponding to the head entity semantic feature, and the relation representation corresponding to the tail entity semantic feature.

[0027] Preferably, the new relation extraction model further includes an aggregation layer connecting the plurality of expert branches, and the predicted relation probability is obtained according to the following steps:

[0028] In the aggregation layer of the new relation extraction model, the relation query vector is determined by using the relation representations corresponding to the relation semantic features, the relation representations corresponding to the head entity semantic features, and the relation representations corresponding to the tail entity semantic features.

[0029] Determine the matching degree score of the target relation representation of each of the several expert branches relative to the relation query vector in the relation representation;

[0030] Based on the matching degree scores of each of the expert branches, the attention weights of each of the expert branches are determined.

[0031] The final relation representation of the training samples is determined by weighted summation of the attention weights of the respective expert branches and their corresponding target relation representations.

[0032] The predicted relationship probability is determined based on the final relationship representation of the training samples.

[0033] Preferably, the loss function for the learning level differentiation loss is:

[0034]

[0035] Among them, L cei (y i y′ i ) represents the learning level differential loss of the i-th training sample, N represents the total number of the mixed sample set, and λ i y represents the probability of the original predicted relation output by the original relation extraction model. i The true relation label of the i-th training sample, y′ i Let represent the predicted relation probability of the i-th training sample.

[0036] Preferably, the global optimization of the new relation extraction model specifically includes:

[0037] When the number of iterations reaches a certain threshold, the fixed model parameters are triggered to obtain several new relation extraction models.

[0038] The several new relation extraction models are tested using a mixed test set to obtain corresponding test results; wherein, the mixed test set includes the trained samples and the difficult samples;

[0039] Select a target relation extraction model from the aforementioned new relation extraction models that meets the test results conditions, and replace the original relation extraction model for use.

[0040] This specification provides a continuous learning system for relation extraction, the system comprising:

[0041] A mixing module is used to mix hard samples and trained samples to obtain a mixed sample set; wherein each training sample in the mixed sample set carries a true relation label and an expected branch label, the expected branch label being used to indicate the expert branch that the training sample is expected to be assigned;

[0042] The semantic parsing module is used to extract head entity words, tail entity words, and relation words from the training samples, and perform semantic parsing to obtain a semantic feature sequence; wherein, the semantic feature sequence includes relation semantic features, head entity semantic features, and tail entity semantic features;

[0043] The first calculation module is used to configure at least a routing network and a new expert branch in the original relation extraction model to construct a new relation extraction model; and to use the routing network to determine the expert-level allocation probability of the actual allocation expert branch of the training sample; wherein, the expert-level allocation probability includes the feature allocation probability of the relation semantic features relative to the expert branch, and the feature allocation probability is used to filter the target relation features of the expert branch.

[0044] The first optimization module is used to optimize the routing network parameters separately with the goal of minimizing the branch routing assignment loss calculated from the expected branch labels of the training samples and the expert-level assignment probability, so that the routing network guides the difficult samples to the new expert branch and the trained samples to the old expert branch.

[0045] The second calculation module is used to perform relationship representation fusion based on the target relationship features of several expert branches, combined with the semantic features of the head entity and the semantic features of the tail entity, to obtain their respective target relationship representations; wherein, the target relationship representations of the several experts are used together to calculate the predicted relationship probability.

[0046] The second optimization module is used to globally optimize the new relation extraction model with the goal of minimizing the learning degree difference loss calculated from the predicted relation probability and the real relation label; wherein the parameters of the old expert branch remain unchanged during optimization.

[0047] This specification provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the above-described method.

[0048] This specification provides an intelligent cockpit, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method described above.

[0049] This specification provides a vehicle including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the method described above.

[0050] Through one or more embodiments of this specification, this specification has the following beneficial effects or advantages:

[0051] In this technical solution, based on the construction of a new relation extraction model containing a routing network and new expert branches, the routing network parameters are optimized separately with the goal of minimizing the branch routing assignment loss. This allows the routing network to accurately guide difficult samples to the new expert branch and trained samples to the old expert branch based on the expected branch labels in the training samples. Furthermore, the routing network filters the target relation features of each expert branch by calculating expert-level assignment probabilities. Subsequently, it combines entity semantic features to complete relation representation fusion and calculate predicted relation probabilities. Then, it globally optimizes the new relation extraction model by minimizing the learning degree differentiation loss. During optimization, the new expert branch is specifically learned and optimized, while the parameters of the old expert branches remain unchanged during global optimization. This allows the model to both specifically optimize erroneous relation types and efficiently utilize historical training results. Ultimately, this results in a continuous evolutionary capability that balances historical relation preservation, erroneous relation correction, and new relation learning, significantly improving the relation recognition accuracy of the relation extraction model.

[0052] The above description is only an overview of the technical solution in this specification. In order to better understand the technical means in this specification and to implement it in accordance with the contents of this specification, and to make the above and other objects, features and advantages of this specification more obvious and understandable, the specific implementation methods of this specification are given below. Attached Figure Description

[0053] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit this specification. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0054] Figure 1 A schematic diagram of a continuous learning system according to one embodiment of this specification is shown;

[0055] Figure 2 A schematic diagram of the model architecture of a raw relation extraction model according to an embodiment of this specification is shown;

[0056] Figure 3 A schematic diagram of the model architecture of a novel relation extraction model according to an embodiment of this specification is shown;

[0057] Figure 4 A flowchart of a continuous learning method for relation extraction according to one embodiment of this specification is shown;

[0058] Figure 5 A schematic diagram of a continuous learning system for relation extraction according to one embodiment of this specification is shown. Detailed Implementation

[0059] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0060] This specification provides an embodiment of a continuous learning method for relation extraction, used to continuously learn a relation extraction model, and applied to a continuous learning system for relation extraction.

[0061] To facilitate understanding of the technical solutions in this specification, please refer to the following: Figure 1 First, let's introduce the overall schematic diagram of the continuous learning system.

[0062] The system involves two datasets: an old dataset and difficult samples. The old dataset contains data samples that the original relation extraction model could identify. Difficult samples are those where the original relation extraction model failed to correctly identify relations, presented in text form. These mainly include data containing incorrectly identified relations, new, unlearned relations, complex interfering relations, special combinations of entity relations, or distributional shifts. Difficult samples can be obtained through user complaints or proactively collected.

[0063] The old dataset and the difficult samples are mixed to obtain three datasets: a mixed training set, a mixed validation set, and a mixed test set. The mixing method is randomized, but there are no restrictions.

[0064] The mixed training set has a relatively small data volume and is obtained by mixing trained samples and hard samples from the trained sample set. The mixed training set is mainly used for model learning. The mixed validation set is obtained by mixing the validated set and a new validation set, with the new validation set containing hard samples. The mixed validation set is mainly used to assist in adjusting the model and preventing overfitting. On the one hand, by testing the model performance of different hyperparameter combinations on the mixed validation set, the optimal hyperparameter configuration can be selected, achieving precise optimization of the model architecture and training process. On the other hand, by monitoring the performance changes of the model on the mixed validation set, if it is found that the performance of the training set continues to improve while the performance of the validation set declines, the risk of overfitting can be identified in a timely manner, and measures such as early termination of training and enhanced regularization can be taken to ensure the model's generalization ability. The mixed test set is obtained by mixing the test set and a new test set, with the new test set containing hard samples. The mixed test set is mainly used to evaluate the generalization performance of the final model.

[0065] The system involves two models: the original relation extraction model and the new relation extraction model.

[0066] The original relation extraction model lacks continuous learning capability. See the model architecture for details. Figure 2 As shown, it includes: a semantic encoder, a Relational Representation Layer (RRL), and a relation extraction layer. In the processing logic of the original relation extraction model, after determining the head entity token, tail entity token, and relation token from the training samples, the semantic encoder is called to perform semantic parsing, obtaining the semantic features corresponding to each of the head entity token, tail entity token, and relation token, forming a semantic feature sequence; this sequence is then input into the RRL layer for relation representation fusion. The relation extraction layer is used to extract and normalize the fused relation representations to obtain the predicted relation probabilities.

[0067] Although the original relation extraction model has been pre-trained on large-scale general data and possesses basic semantic understanding and representation capabilities, its model architecture design has not been optimized for continuous learning scenarios. If difficult samples appear, because the relation patterns presented by the difficult samples differ significantly from the relation distribution in the data during the model training phase, the original relation extraction model lacks continuous learning capabilities and struggles to accurately identify the relations presented by the difficult samples.

[0068] To address this issue, this technical solution optimizes the structure of the original relation extraction model, resulting in a new relation extraction model. (See attached image.) Figure 3In the new relation extraction model, a routing network, a new expert branch, and an old expert branch are configured. The new expert branch and the old expert branch each have their own RRL layer. The RRL layer in the original relation extraction model can be considered as the RRL layer of the old expert branch. The new expert branch is used to specifically address difficult samples not covered or poorly performed by the old expert branch; that is, samples where the old expert branch performs poorly in relation recognition during training or inference. For example, the old expert branch can recognize common relations, such as gifting and cooperation, but performs poorly in recognizing novel network relations such as live streaming and interactive bullet comments. The new expert branch is then used to optimize the learning of these types of relations. It is worth noting that the new expert branch can be seen as a modular plug-in to the model; it does not replace the old expert branch but rather supplements its shortcomings, specifically handling new relations that the old expert branch is not good at. Through the collaborative work of the gating network and each expert branch, incremental learning is achieved. While continuously learning new relations, previously learned relations are not forgotten. This design allows the new relation extraction model to adapt to changes in data relations while efficiently utilizing historical training results. Furthermore, an aggregation layer is added to connect the new expert branch and the old expert branch for relation prediction calculations. The processing logic of the new relation extraction model will be introduced later, and will not be repeated here.

[0069] Furthermore, in the new relation extraction model, a loss function of branch routing allocation loss is designed to optimize the routing network separately, causing difficult samples to be directed to the new expert branch and learned samples to be directed to the old expert branch. In addition, a loss function of learning degree differentiation loss is designed to globally update the new relation extraction model. During the global update process, the new expert branch and aggregation layer are updated to maintain continuous learning capability, while the parameters of the old expert branch remain unchanged to avoid forgetting learned samples. This design enables the new relation extraction model to retain past relations while continuously learning, avoiding forgetting.

[0070] Furthermore, during the global optimization of the new relation extraction model, after each set number of iterations, fixed model parameters are triggered to save the model, resulting in several new relation extraction models. A test set is then used to evaluate these new relation extraction models, and the model with the best performance is selected as the target relation extraction model. Through hot model updates, the business system can seamlessly switch to the target relation extraction model. Once the update is complete, a notification is triggered, and the results are synchronized with relevant parties.

[0071] See below. Figure 4 This is a flowchart of a continuous learning method for relation extraction, which includes the following steps:

[0072] S401, mix the difficult samples and the trained samples to obtain a mixed sample set.

[0073] Specifically, training samples are randomly selected from the existing training sample set, but without any restrictions. The difficult samples are then mixed with the selected training samples to obtain a mixed sample set.

[0074] Each training sample in the mixed sample set is presented in text form, carrying a real relation label y. i And expected branch label y ei Among them, the real relationship label y i Used to identify the true relationships of training samples. Expected branch label y ei An expert branch used to indicate the expected assignment of the training samples. When y ei =1 indicates that the training samples are difficult samples, and the expected expert branch to be assigned is the new expert branch; when y ei =0 indicates that the training sample is a trained sample and the expected expert branch to be assigned is the old expert branch.

[0075] For example, the mixed sample set is:

[0076] Where N represents the number of training samples in the mixed sample set, x i Let y represent the word sequence of the i-th training sample. i Let y represent the true relation label of the i-th training sample. ei Let λ represent the expected branch label of the i-th training sample. i This represents the original predicted relation probability output by the original relation extraction model after processing the i-th training sample. When the training sample is a difficult sample, the original predicted relation probability λ... i =0. When the training samples are already trained samples, the original predicted relation probability λ is... i =1.

[0077] S402: Extract head entity words, tail entity words, and relation words from the training samples, and perform semantic parsing to obtain a semantic feature sequence.

[0078] Specifically, the training samples are segmented into words to obtain the word sequence x of the training samples. i .

[0079] In this context, a word unit is the smallest unit of word segmentation formed by dividing the training samples according to semantic and grammatical rules. In practical applications, word segmentation rules such as WordPiece, BPE (Byte Pair Encoding), and BBPE (Byte-level Byte Pair Encoding) can be referenced to obtain a word unit sequence. For example, a specific word unit sequence might be: x i = (w1, w2, ..., wn ), indicating that the i-th training sample consists of n words. Here, w1 represents, w2 represents, and so on.

[0080] The head entity lexicon, tail entity lexicon, and relation lexicon are extracted from the lexicon sequence. The head entity lexicon refers to the lexicon corresponding to the initial entity forming the relation; the tail entity lexicon refers to the lexicon corresponding to the final entity forming the relation, inheriting the object that the initial entity points to through the relation; the relation lexicon is used to represent the relationship between the head and tail entities, and consists of the remaining lexicon in the training sample excluding the head and tail entity lexicon.

[0081] For example, from the word sequence x i The extracted head entity term is: head e =(w h w h+1 , ..., w h+m ), indicating from the word sequence x i The word units ordered (h, h+1, ..., h+m) are extracted to form the head entity word unit. The extracted tail entity word unit is: tail e =(w g w g+1 , ..., w g+l ), indicating from the word sequence x i Extract the lexical units ordered (g, g+1, ..., g+l) to form the tail entity lexical units. The extracted relational lexical units are: text = (w1, w2, ..., w...). h-1 w h+k+1 , ..., w g-1 w g+l+1 , ..., w n ), indicating from the word sequence x i Extract the remaining word units excluding the head entity word unit and the tail entity word unit. Based on this, y i This represents the relationship between the head entity token and the tail entity token in the i-th training sample, totaling K tokens.

[0082] After determining the head entity lexical, tail entity lexical, and relation lexical in the above manner, the lexical sequence is transformed into: [CLS], w1, w2, ..., w h-1 w h w h+1 , ..., w h+k w h+k+1 , ..., w g-1 w g w g+1 , ..., w g+l w g+l+1 , ..., wn [CLS] is the head marker of the lexical sequence, and [SEP] is the tail marker; neither carries specific textual semantic content. The individual lexical units are arranged between the head and tail markers. Other lexical sequences can be concatenated after the tail marker [SEP].

[0083] The above-mentioned lexical units are input into a semantic encoder for semantic parsing to obtain a semantic feature sequence. An example of a semantic encoder is ROBERT, but this is not a limitation.

[0084] The semantic feature sequence includes relational semantic features, head entity semantic features, and tail entity semantic features, forming a semantic triplet of head entity-relation-tail entity.

[0085] For example, a semantic feature sequence is shown below: Among them, z i Let represent the semantic feature sequence of the i-th training sample.

[0086] In the semantic feature sequence z i In the text, the semantic features of the head entity are: The semantic features of the tail entity are: The semantic features of the relation are:

[0087] S403, Configure at least a routing network and a new expert branch in the original relation extraction model to obtain a new relation extraction model; Use the routing network to determine the expert-level assignment probability of the actual assignment expert branch of the training samples.

[0088] For the model architecture of the new relation extraction model, please refer to [link / reference]. Figure 3 As shown.

[0089] The new relation extraction model includes: a semantic encoder, a routing network, new expert branches, old expert branches, and an aggregation layer. The semantic encoder connects to the routing network; the routing network connects to the respective RRL layers of the new and old expert branches. For example, if there are p expert branches, there will be p RRL layers: RRL1, RRL2, ..., RRL2. p The RRL layer in the original model architecture of the relation extraction model can be viewed as the RRL layer of the old expert branch. The new expert branch is used to learn from difficult samples. The RRL layers of the new expert branch and the old expert branch are connected together to the aggregation layer for subsequent model prediction processing.

[0090] A semantic encoder is used to perform semantic parsing on a sequence of lexical terms to obtain a sequence of semantic features.

[0091] The routing network is used to guide the allocation of training samples to appropriate expert branches for processing. For example, it directs difficult samples to new expert branches and already trained samples to established expert branches. Furthermore, it is used to filter target relation features for each expert branch.

[0092] The new expert branch and the old expert branch are each used to fuse the target relationship features selected by the routing network to obtain their respective target relationship representations.

[0093] The aggregation layer is used to aggregate the target relationship representations output by all experts to calculate the probability of the predicted relationship.

[0094] In the routing network, the expert-level assignment probability of the training sample to several expert branches, including the new expert branch and the old expert branch, is calculated.

[0095] The expert-level allocation probability includes the feature allocation probability of the relation semantic features relative to the expert branches; the feature allocation probability is used to filter the target relation features of the expert branches.

[0096] In the specific implementation process, the routing network is used to calculate the feature allocation probability of each feature in the relational semantic features to each of the several expert branches. For each expert branch, referring to the feature allocation probability of each feature in the relational semantic features to the expert branch, the b features ranked first according to probability are selected as the corresponding target relation features.

[0097] The following is an example of the computational logic for calculating the target relationship features of a single expert branch in a routing network:

[0098]

[0099] Among them, s j This represents the target relation features that the routing network selects for the j-th expert branch. This represents the i-th feature in the semantic features of a relation. This represents a feedforward neural network in a gated network used to compute semantic features of relations. The symbol 'j' indicates that the computation is currently being performed on the j-th expert branch. When computing other expert branches, the symbol changes to the corresponding index. Softmax() represents the normalization function. This represents calculating the feature assignment probability of the i-th feature relative to the j-th expert branch. `topb` indicates that the top b semantic features are selected as the target relation features for the j-th expert branch based on their probabilities, excluding the remaining semantic features after the top b to prevent interference and ensure a close correlation between each expert and their selected target relation features. The processing method for other expert branches is similar and will not be elaborated further. An example of the target relation feature for the j-th expert branch is: s j = (v1, v2, ..., v b ).

[0100] In the specific computational logic, for the i-th feature... Calling the feedforward neural network ffn local () Calculate its score for each expert branch, where ffn local The parentheses define weights for each expert branch. The feedforward neural network has dimensions (h, p), where h represents the input dimension of the semantic feature, and p represents the number of expert branches, which is also the output dimension of the feedforward neural network. The feedforward neural network processes the h-dimensional features of a single semantic feature, mapping them to scores belonging to p expert branches. Then, a normalization function is used to normalize the i-th feature... The score belonging to each expert branch is converted into the feature assignment probability belonging to each expert branch.

[0101] All relational semantic features are processed in the manner described above, resulting in the feature assignment probabilities of all relational semantic features relative to the p expert branches. Using the expert branches as the standard, the b semantic features ranked highest in probability are selected as the corresponding target relation features. In this way, the target relation features for each expert branch can be obtained.

[0102] Furthermore, the corresponding expert-level allocation probability is determined by utilizing the feature allocation probability corresponding to the target relationship feature of each expert branch. Specifically, the feature allocation probability of each expert branch is calculated by averaging the probability of the feature allocation probability corresponding to the target relationship feature of each expert branch. The feature allocation probability of each expert branch is then used as the expert-level allocation probability of each expert branch.

[0103] The calculation process is illustrated in the following example:

[0104]

[0105] in, This represents the feature assignment probability of the j-th expert branch. This represents the feature assignment probability of the target relation feature of the j-th expert branch.

[0106] In one optional implementation, the expert-level allocation probability includes the feature allocation probability of the relational semantic features relative to expert branches and the semantic allocation probability of the semantic feature sequence relative to expert branches. Therefore, after obtaining the feature allocation probability of each expert branch, the semantic allocation probability of the semantic feature sequence being assigned to the expert branch is calculated using the routing network.

[0107] The following is an example of the calculation logic for semantic assignment probabilities in a routing network:

[0108]

[0109] Where, p j Let z represent the semantic assignment probability of the j-th expert. i Represents a sequence of semantic features. This represents a feedforward neural network in a gated network used to compute semantic feature sequences. The symbol 'j' indicates that the computation is currently being performed on the j-th expert branch. When computing other expert branches, the symbol changes to the corresponding index. This represents the computation of semantic feature sequence z. i The semantic assignment probability relative to the j-th expert branch.

[0110] In the specific computational logic, for the semantic feature sequence z i Using a feedforward neural network ffn global () Calculate the semantic feature sequence z i The original scores belonging to each expert branch. Among them, the feedforward neural network ffn global The parentheses contain weights for each expert branch, used to adjust the raw scores of each expert branch. A normalization function is then used to normalize the semantic feature sequence z. i The original scores belonging to each expert branch are converted into semantic assignment probabilities belonging to each expert branch.

[0111] For each expert branch, the feature assignment probability corresponding to the target relation feature and the semantic assignment probability are combined to obtain the expert-level assignment probability. The combination method is a weighted summation, but this is not a restriction. The expert-level assignment probability is used to characterize the probability that a training sample is assigned to an expert branch.

[0112] Referring to the expert-level allocation probabilities of each expert branch, the expert-level allocation probability of the actual allocation expert branch for the training sample is selected. If the training sample is a difficult sample, the expert-level allocation probability of the new expert branch is extracted from the expert-level allocation probabilities of each expert branch. If the training sample is a previously trained sample, the expert-level allocation probability of the corresponding old expert branch is extracted from the expert-level allocation probabilities of each expert branch.

[0113] S404, with the goal of minimizing the branch routing allocation loss calculated from the expected branch label and the expert-level allocation probability, optimize the routing network parameters individually so that the routing network guides the difficult samples to the new expert branch and guides the trained samples to the old expert branch among the several expert branches.

[0114] The loss function for branch route allocation loss is exemplified by the cross-entropy loss function, but this does not constitute a limitation.

[0115] The specific loss function for branch route allocation loss is as follows:

[0116]

[0117] Among them, L cei (y ei a i ) represents the branch routing assignment loss for the i-th training sample, N represents the total number of samples in the mixed sample set, and y ei Let a represent the expected branch label of the i-th training sample. i The expert-level assignment probability of the actual expert branch assigned to the i-th training sample can also be interpreted as: the expected probability of the expert branch selected for the i-th training sample, and the expected label y of the expert branch for the i-th training sample. ei They are positively correlated.

[0118] During the optimization process, the branch route allocation loss of the routing network depends on the expected branch label yei and the probability a of actually allocating the expert branch. i The differences.

[0119] Among them, the expected branch label y of the difficult sample ei =1, representing the expert-level assignment probability a of a difficult sample to a new expert branch. i The value is approximately 1, with a probability close to 100%.

[0120] For the difficult sample, during the optimization of the routing network, the expert-level allocation probability of the new expert branch and the expected branch label of the difficult sample are input into the loss function of the branch routing allocation loss to obtain the corresponding branch routing allocation loss. When the expected branch label of the difficult sample is 1, the routing network parameters are optimized with the goal of minimizing the branch routing allocation loss of the difficult sample, so that the branch routing allocation loss of the difficult sample gradually decreases until it is less than a set loss threshold, for example, a loss threshold of 0.15 is set, but this does not constitute a restriction, so that the branch routing allocation loss of the difficult sample is approximately 0. The expert-level allocation probability of the new expert branch gradually increases until it is greater than a set allocation threshold, for example, an allocation threshold of 0.85 is set, but this does not constitute a restriction, so that the expert-level allocation probability of the new expert branch is approximately 1, prompting the difficult sample to be guided to the new expert branch.

[0121] Specifically, the feedforward neural network inside the routing network contains two types of core weight matrices: the new expert routing weight matrix and the old expert routing weight matrix.

[0122] When the expected branch label yei = 1 for a difficult sample, the branch route assignment loss of the routing network actually depends on the probability a of the new expert branch. i If the probability of a new expert branch is a i If the expected outcome is not achieved, i.e., if the branch does not become the most probable expert branch, the loss will increase. The gradient from backpropagation will drive the routing network to adjust its parameters. For example, it may adjust the routing weights of the new expert branch in the routing network, increasing the inner product of its semantic features related to the difficult samples, thereby increasing the expert-level assignment probability of the new expert branch. This gradually reduces the branch routing loss until the target (approximately 0) is reached or the number of iterations is satisfied. In this way, difficult samples can be guided to the new expert branch.

[0123] Furthermore, since hard samples are those whose relationships cannot be correctly identified by the established expert branch, the semantic features of relationships within these hard samples are also unrecognizable by the established expert branch. In this case, the loss function increases the matching degree between the new expert routing weight matrix and the semantic features of the hard samples, maximizing the probability of assigning hard samples to the new expert branch. Ultimately, the matching degree between the semantic features of the hard samples and the new expert routing weight matrix is ​​significantly superior, ultimately guiding the hard samples to the new expert branch.

[0124] It is evident that the essence of guiding difficult samples to new expert branches is that, for difficult samples, the routing network optimizes the new expert routing weight matrix in a targeted manner to achieve a higher-dimensional match with the relational semantic features of the difficult samples. This improves the matching degree between the new expert routing weight matrix and the relational semantic features of the difficult samples, ultimately making it more likely that difficult samples will be assigned to the new expert branches than to the old expert branches.

[0125] It is worth noting that when optimizing for difficult samples, the routing network focuses on enhancing the matching degree between the new expert routing weight matrix and the semantic features of the relationship between the difficult samples, without modifying the old expert routing weight matrix.

[0126] For a trained sample, the expected branch label y of the trained sample ei =0, the routing network will direct trained samples to the old expert branch.

[0127] Since the expected branch label yei = 0 for the trained samples, the actual branch route allocation loss of the routing network is 0. This indicates that the current allocation result of the routing network for the trained samples already meets expectations, and there is no need to adjust the parameters of the routing network further. Therefore, it is prohibited to optimize the parameters of the routing network so that the routing network maintains the preset allocation rules for the trained samples and guides the trained samples to the old expert branch.

[0128] Specifically, when trained samples are input into the routing network, the inner product of the old expert branch and the semantic features of the trained samples remains high because the old expert branch has been pre-trained using the trained sample set. However, the inner product with the new expert branch remains low due to the mismatch in semantic attributes. After normalization using the Softmax function, the assignment probability of the old expert will have an absolute advantage, ensuring that the trained samples are stably guided to the old expert branch.

[0129] As can be seen, guiding trained samples to the old expert branch essentially means that, for trained samples that have already been learned, the routing network relies on the structural matching of the learned semantic features of the trained samples and the old expert routing weight matrix to ensure that the inner product of the old expert routing weight matrix and the semantic features of the trained samples in the routing network maintains a high score. Furthermore, since the old expert routing weight matrix is ​​not modified during the routing network optimization, the matching score of the trained samples with the old expert routing weight matrix is ​​much higher than its matching score with the new expert routing weight matrix. After normalization by the Softmax function, the probability of assigning the old expert branch has an absolute advantage.

[0130] To illustrate and explain this logic in detail, specific examples are provided below, see Table 1.

[0131] Table 1

[0132]

[0133]

[0134] For difficult samples:

[0135] In the feedforward neural network of the routing network, the inner product of the routing weight matrices of difficult samples and experienced experts is calculated, and the score is: (0.1×0.9)+(0.2×0.8)+(0.9×0.0)=0.09+0.16+0=0.25. Furthermore, the inner product of the routing weight matrices of difficult samples and new experts is calculated, and the score is: (0.1×0.1)+(0.2×0.2)+(0.9×0.9)=0.01+0.04+0.81=0.86.

[0136] Using a normalization function to calculate the probability, the expert-level assignment probability of difficult samples to the senior expert branch is obtained as follows: The probability of a difficult sample being assigned to a new expert branch by an expert-level assignment is: Therefore, difficult samples will be routed to new expert branches via a routing network.

[0137] For the trained samples:

[0138] In the feedforward neural network of the routing network, the inner product of the trained samples and the routing weight matrix of the old expert is calculated, and the score is: (0.9×0.9)+(0.8×0.8)+(0.0×0.0)=0.81+0.64+0=1.45. Furthermore, the inner product of the trained samples and the routing weight matrix of the new expert is calculated, and the score is: (0.9×0.1)+(0.8×0.2)+(0.0×0.9)=0.09+0.16+0=0.25.

[0139] Using a normalization function to calculate the probability, the expert-level assignment probability of the trained samples to the old expert branch is obtained as follows: The expert-level assignment probability of the trained samples to the new expert branch is obtained as follows: Therefore, the trained samples will have a routing network that directs them to the old expert branch.

[0140] It is worth noting that, in extreme cases, the new expert routing weight matrix can also retain only the weight of the blockchain being focused on, with the remaining weights set to 0. The specific values ​​are determined by the routing network optimization.

[0141] Since the expert-level allocation probability includes the feature allocation probability of the relational semantic features relative to the expert branches, the routing network determines the target relational features for each expert branch according to the optimized network parameters. It is worth noting that for each training sample, whether it is a difficult sample or a trained sample, the routing network filters out the target relational features for both new and old expert branches; however, the target relational features for new expert branches focus on new relational semantic features, such as the semantic features corresponding to blockchain terminology; while the target relational features for old expert branches focus on basic relational semantic features, such as the semantic features of kinship terms, blood relations, etc.

[0142] S405, based on the target relationship features of several expert branches, and combined with the semantic features of the head entity and the semantic features of the tail entity, the relationship representation is fused to obtain the respective target relationship representation.

[0143] In the specific implementation process, for each of the several expert branches, the target relation features are subjected to average pooling to obtain the relation representation corresponding to the target relation features. An example is: h text =averagepool(v1,v2,...,v b ).

[0144] The semantic features of the head entity are subjected to average pooling to obtain the relation representation corresponding to the semantic features of the head entity. An example is shown below:

[0145] The semantic features of the tail entity are subjected to average pooling to obtain the relation representation corresponding to the semantic features of the tail entity. An example is shown below:

[0146] During fusion, the relation representations corresponding to the target relation features, the relation representations corresponding to the head entity semantic features, and the relation representations corresponding to the tail entity semantic features are fused, and a feedforward neural network is used for learning to obtain the target relation representation from the expert branch's perspective. An example is: h rj =ffn2([h head :h tail :h text ]).

[0147] After the routing network identifies the target relationship features for each expert branch, it sends these features to the corresponding expert branch. Each expert branch, within its own RRL layer, learns an internal target relationship representation based on the target relationship features and the head and tail entities, preparing for the subsequent output of the final predicted relationship probability. The target relationship representations of each of the experts are used together to calculate the predicted relationship probability.

[0148] Furthermore, the predicted relation probability is calculated in the aggregation network of the relation extraction model. The specific calculation process is as follows:

[0149] S501, determine the relation query vector using the relation representation corresponding to the relation semantic features, the relation representation corresponding to the head entity semantic features, and the relation representation corresponding to the tail entity semantic features.

[0150] Specifically, average pooling is performed on the relational semantic features to obtain the relation representation corresponding to the relational semantic features. An example is: h s =averagepool(z iThen, in the relation representation h corresponding to the relation semantic features... s Based on this, integrate h head and h tail This ensures information integrity. Then, a feedforward neural network is used to transform the fragmented relation representations into explicit relation query tasks, resulting in a relation query vector. An example is: q r =ffn3([h head :h tail :h s The relation query vector is used by subsequent expert branches to query the relationship between the head and tail entities.

[0151] S502, determine the matching degree score of the target relation representation of each of the several expert branches relative to the relation query vector in the relation representation.

[0152] In the specific implementation process, the relation query vector q r Transpose to get q r T For example, if q r It is a column vector, which becomes a row vector after transposition. The transposed query vector q... r T The target relationship representation h with the j-th expert branch rj By performing an inner product operation, the matching degree score can be determined.

[0153] For example, the matching scores for several expert branches are calculated as follows:

[0154] e j =q r T h rj

[0155] Among them, e j Let represent the matching score of the j-th expert branch, and T denote the transpose. A higher matching score indicates that the expert is more suitable for handling the i-th training sample.

[0156] S503, determine the attention weight of each of the expert branches based on their respective matching degree scores.

[0157] In the specific implementation process, an exponential operation is performed on the matching degree table of each expert branch to amplify the score differences in matching degree among the expert branches. Then, the sum of the exponential scores of all expert branches is calculated. After normalization, the attention weights of each expert are obtained.

[0158] For example, the attention weights of several experts are calculated as follows:

[0159]

[0160] Among them, a j Let e ​​represent the attention weight of the j-th expert branch, and let e represent the probability that the relation of the training sample is explained by the j-th expert. j This represents the score indicating the degree of matching for the j-th expert branch. Since the exponential function amplifies the difference, the attention weight of expert branches with high matching degrees will be significantly amplified.

[0161] S504, using the attention weights of the several expert branches and the corresponding target relationship representations to perform a weighted summation, the final relationship representation of the training samples is determined.

[0162] The final relation representation is calculated as follows:

[0163]

[0164] Among them, h r This represents the final relationship representation. Because the attention weight of expert branches with high matching degrees will be significantly amplified, the resulting final relationship representation will be more focused on the representation of the best-fitting expert branch.

[0165] S505, Based on the final relation representation of the training samples, determine the predicted relation probability.

[0166] Specifically, the final relation representation is transformed using a feedforward neural network ffn4(), and the predicted relation probability is obtained by combining it with the normalization function soffmax().

[0167] The probability of predicting a relationship is calculated as follows:

[0168] p i =softmax(ffn4(h r ))

[0169] Where, p i This represents the predicted relation probability. Due to the relationships between the head and tail entity words in the training samples, there are a total of K relations. The output is the predicted probability of each of these K relations.

[0170] S406, with the goal of minimizing the learning degree differentiation loss calculated from the predicted relation probability and the real relation label, the new relation extraction model is globally optimized.

[0171] The learning-level differential loss function introduces the probability λ of the original predicted relation output by the original relation extraction model into the cross-entropy loss function. i As obtained by transforming as an adjustment factor, an example is shown below:

[0172]

[0173] Among them, L cei (y i y′ i ) represents the learning level differential loss of the i-th training sample, N represents the total number of the mixed sample set, and λ i y represents the probability of the original predicted relation output by the original relation extraction model. i The true relation label of the i-th training sample, y′ i Let represent the predicted relation probability of the i-th training sample.

[0174] By introducing the original predicted relation probability λ output by the original relation extraction model... i As a regulating factor, the cross-entropy loss of each training sample is weighted, and for training samples of different difficulties, the weighting is adjusted using λ. i By dynamically adjusting the gradient update step size, the learning intensity can be differentiated for training samples of different difficulties, thereby improving the accuracy and effectiveness of relation extraction for various training samples, especially difficult samples.

[0175] When globally optimizing the relation extraction model, the parameters of the old expert branch remain unchanged during optimization, while the focus is on optimizing the parameters of the new expert branch (such as weights and biases) and the parameters of the aggregation layer (such as weights and biases) until the learning degree differential loss reaches the target or the number of iterations is satisfied.

[0176] When faced with difficult samples, the probability of selecting target relation features from the old expert branch is extremely low due to its extremely low matching degree with difficult samples. In the attention weight calculation of the aggregation layer, the attention weight of the old expert branch will also be extremely low. In the final relation representation, the target relation representation of the new expert branch accounts for the largest proportion. In extreme cases, the final relation representation approximates the target relation representation of the new expert branch. In this case, the predicted relation probability is calculated based on the target relation representation, resulting in the predicted probability of a new relation between the head and tail entities in the difficult sample. The new relation extraction model is globally optimized with the goal of minimizing the difference in learning degree between the predicted relation probability and the true relation label.

[0177] Furthermore, during the global optimization process, since the original predicted relation probability λi = 0 for difficult samples, the parameters of the old expert branch remain unchanged during optimization, while the parameters of the new expert branch (e.g., weights, biases) and the aggregation layer (e.g., weights, biases) are optimized, and the step size of the dynamic gradient update of the new expert branch and the aggregation layer is dynamically adjusted. This ensures that the adjustment step size gradually decreases as the difference value decreases, until the difference in the learning degree of the new relation prediction probability and the true relation label is reduced below a set threshold, or the required number of iterations is met.

[0178] For trained samples, since the original predicted relation probability λi = 1, the learning level differential loss is actually 0. This indicates that for trained samples, the relation predicted by the new relation extraction model already meets expectations, and there is no need to adjust the parameters of the new relation extraction model.

[0179] It is worth noting that in the use of the two types of loss functions in this technical solution, the routing network parameters are optimized separately with the goal of minimizing the branch routing allocation loss. The core is to enable the routing network to accurately distinguish between difficult samples and trained samples and guide them to the corresponding expert branches. After the routing network achieves the desired routing effect, the global optimization stage of the new relation extraction model is entered. At this time, two types of losses can be used in combination in a single iteration: on the one hand, the differential learning degree loss is used to optimize the relation prediction accuracy of the new expert branches, ensuring the correction effect of incorrect relation types; on the other hand, the branch loss of the routing network is continuously calculated to prevent the routing network from losing its accurate routing ability in subsequent optimizations, so as to achieve synergistic optimization of accurate routing and accurate prediction.

[0180] In one optional implementation, during the global optimization of the new relation extraction model, when the number of iterations reaches various predetermined thresholds, the model parameters are fixed to obtain several new relation extraction models. For example, the model parameters are fixed every three iterations, triggering the generation of new relation extraction models. The several new relation extraction models are tested using a mixed test set to obtain corresponding test results. The mixed test set includes both trained samples and difficult samples. The target relation extraction model, which meets certain conditions (e.g., the best test result) from the several new relation extraction models, is selected to replace the original relation extraction model and put into use.

[0181] Of course, each time the scenario is updated, a new expert branch can be added. The example of the new scenario is an in-vehicle dialogue scenario, but this does not constitute a limitation. This allows the new relationship extraction model to continuously learn, adapt to new data and new scenarios, and ensure the effectiveness of the new relationship extraction model in extracting new relationships.

[0182] In the process of using the new relation extraction model, the text to be detected is input into the new relation extraction model, and the association relationship between the head and tail entity pairs in the text to be detected can be output, thereby completing the transformation from unstructured samples to structured triples for further processing by the semantic understanding system.

[0183] Secondly, based on the same inventive concept, this specification provides a continuous learning system for relation extraction, see [link to documentation]. Figure 5 The system includes:

[0184] The mixing module 501 is used to mix hard samples and trained samples to obtain a mixed sample set; wherein each training sample in the mixed sample set carries a real relation label and an expected branch label, and the expected branch label is used to indicate the expert branch that the training sample is expected to be assigned.

[0185] The semantic parsing module 502 is used to extract head entity words, tail entity words, and relation words from the training samples, and perform semantic parsing to obtain a semantic feature sequence; wherein, the semantic feature sequence includes relation semantic features, head entity semantic features, and tail entity semantic features;

[0186] The first calculation module 503 is used to configure at least a routing network and a new expert branch in the original relation extraction model to construct a new relation extraction model; to use the routing network to calculate the expert-level allocation probability of the training sample to several expert branches including the new expert branch and the old expert branch, and to determine the expert-level allocation probability of the actual allocation of the training sample to the expert branch; wherein, the expert-level allocation probability includes the feature allocation probability of the relation semantic features relative to the expert branches, and the feature allocation probability is used to filter the target relation features of the expert branches.

[0187] The first optimization module 504 is used to optimize the routing network parameters separately with the goal of minimizing the branch routing allocation loss calculated from the expected branch labels of the training samples and the expert-level allocation probability, so that the routing network guides the difficult samples to the new expert branch and the trained samples to the old expert branch.

[0188] The second calculation module 505 is used to perform relationship representation fusion based on the target relationship features of several expert branches, combined with the semantic features of the head entity and the semantic features of the tail entity, to obtain their respective target relationship representations; wherein, the target relationship representations of the several experts are used together to calculate the predicted relationship probability.

[0189] The second optimization module 506 is used to globally optimize the new relation extraction model with the goal of minimizing the learning degree difference loss calculated from the predicted relation probability and the real relation label; wherein the parameters of the old expert branch remain unchanged during optimization.

[0190] Thirdly, based on the same inventive concept, embodiments of this specification also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.

[0191] Fourthly, based on the same inventive concept, embodiments of this specification also provide an intelligent cockpit, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods described above.

[0192] Fifthly, based on the same inventive concept, embodiments of this specification also provide a vehicle including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods described above.

[0193] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is readily apparent from the above description. Furthermore, this specification is not directed to any particular programming language. It should be understood that the contents of this specification can be implemented using various programming languages, and the descriptions of specific languages ​​above are for the purpose of disclosing preferred embodiments of this specification.

[0194] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this specification may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0195] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more of the various inventive aspects, in the foregoing description of exemplary embodiments of this specification, various features of this specification are sometimes grouped together in a single embodiment, figure, or description thereof. However, this approach to disclosure should not be construed as reflecting an intention that the claimed specification requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this specification.

[0196] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0197] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are intended to be within the scope of this specification and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.

[0198] The various component embodiments of this specification can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components of the gateway, proxy server, or system according to embodiments of this specification. This specification can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing some or all of the methods described herein. Such implementations of this specification can be stored on a computer-readable medium or can take the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0199] It should be noted that the above embodiments are illustrative of this specification and not limiting of it, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This specification can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

Claims

1. A continuous learning method for relation extraction, the method comprising: The difficult samples and the trained samples are mixed to obtain a mixed sample set; wherein each training sample in the mixed sample set carries a real relation label and an expected branch label, the expected branch label being used to indicate the expert branch that the training sample is expected to be assigned; Head entity words, tail entity words, and relation words are extracted from the training samples, and semantic parsing is performed to obtain a semantic feature sequence; wherein, the semantic feature sequence includes relation semantic features, head entity semantic features, and tail entity semantic features; In the original relation extraction model, at least a routing network and a new expert branch are configured to obtain a new relation extraction model; the routing network is used to determine the expert-level allocation probability of the actual allocation expert branch of the training sample; wherein, the expert-level allocation probability includes the feature allocation probability of the relation semantic features relative to the expert branch, and the feature allocation probability is used to filter the target relation features of the expert branch; With the goal of minimizing the branch routing assignment loss calculated from the expected branch label and the expert-level assignment probability, the routing network parameters are optimized individually so that the routing network guides the difficult samples to the new expert branch and the trained samples to the old expert branch. Based on the target relationship features of several expert branches, the relationship representations are fused together with the semantic features of the head entity and the semantic features of the tail entity to obtain their respective target relationship representations; wherein, the target relationship representations of the several experts are used together to calculate the predicted relationship probability. The new relation extraction model is globally optimized with the goal of minimizing the learning degree difference loss calculated from the predicted relation probability and the real relation label; wherein the parameters of the old expert branch remain unchanged during optimization.

2. The method as described in claim 1, wherein the loss function for the branch routing allocation loss is specifically: in, L cei (y ei a i ) represents the branch routing assignment loss for the i-th training sample, N represents the total number of samples in the mixed sample set, and y ei Let a represent the expected branch label of the i-th training sample. i Let represent the expert-level assignment probability of the actual assignment expert branch for the i-th training sample.

3. The method as described in claim 1 or 2, wherein the expected branch label of the difficult sample is 1, and the expected branch label of the trained sample is 0; The step of optimizing the routing network parameters individually, with the objective of minimizing the branch routing assignment loss calculated from the expected branch label and the expert-level assignment probability, so that the routing network guides the difficult samples to the new expert branch and the trained samples to the old expert branch, specifically includes: For the difficult sample, the expert-level assignment probability of the new expert branch and the expected branch label of the difficult sample are input into the loss function of the branch routing assignment loss to obtain the corresponding branch routing assignment loss; When the expected branch label of the difficult sample is 1, the routing network parameters are optimized with the goal of minimizing the branch routing allocation loss of the difficult sample, so that the branch routing allocation loss of the difficult sample gradually decreases until it is less than a set loss threshold, and the expert-level allocation probability of the new expert branch gradually increases until it is greater than a set allocation threshold, thereby prompting the difficult sample to be guided to the new expert branch. For the trained sample, when the expected branch label of the trained sample is 0, the branch routing allocation loss of the trained sample is 0, and optimization of the routing network parameters is prohibited, so that the routing network maintains the preset allocation rules for the trained sample and guides the trained sample to the old expert branch.

4. The method as described in claim 1, wherein the step of fusing relation representations based on the target relation features of several expert branches, combined with the semantic features of the head entity and the semantic features of the tail entity, to obtain their respective target relation representations, specifically includes: For each of the several expert branches, the target relation features are subjected to average pooling to obtain the relation representation corresponding to the target relation features; The semantic features of the head entity are subjected to average pooling to obtain the relation representation corresponding to the semantic features of the head entity. The semantic features of the tail entity are subjected to average pooling to obtain the relation representation corresponding to the semantic features of the tail entity. The target relation representation is obtained by fusing the relation representation corresponding to the target relation feature, the relation representation corresponding to the head entity semantic feature, and the relation representation corresponding to the tail entity semantic feature.

5. The method of claim 1, wherein the new relation extraction model further comprises an aggregation layer connecting the plurality of expert branches, and the predicted relation probability is obtained according to the following steps: In the aggregation layer of the new relation extraction model, the relation query vector is determined by using the relation representations corresponding to the relation semantic features, the relation representations corresponding to the head entity semantic features, and the relation representations corresponding to the tail entity semantic features. Determine the matching degree score of the target relation representation of each of the several expert branches relative to the relation query vector in the relation representation; Based on the matching degree scores of each of the expert branches, the attention weights of each of the expert branches are determined. The final relation representation of the training samples is determined by weighted summation of the attention weights of the respective expert branches and their corresponding target relation representations. The predicted relationship probability is determined based on the final relationship representation of the training samples.

6. The method as described in claim 1, wherein the loss function of the learning level differentiation loss is: in, L cei (y i y′ i ) represents the learning level differential loss of the i-th training sample, N represents the total number of the mixed sample set, and λ i y represents the probability of the original predicted relation output by the original relation extraction model. i The true relation label of the i-th training sample, y′ i Let represent the predicted relation probability of the i-th training sample.

7. The method as described in claim 1, wherein the global optimization of the new relation extraction model specifically includes: When the number of iterations reaches a certain threshold, the fixed model parameters are triggered to obtain several new relation extraction models. The several new relation extraction models are tested using a mixed test set to obtain corresponding test results; wherein, the mixed test set includes the trained samples and the difficult samples; Select a target relation extraction model from the aforementioned new relation extraction models that meets the test results conditions, and replace the original relation extraction model for use.

8. A continuous learning system for relation extraction, the system comprising: A mixing module is used to mix hard samples and trained samples to obtain a mixed sample set; wherein each training sample in the mixed sample set carries a true relation label and an expected branch label, the expected branch label being used to indicate the expert branch that the training sample is expected to be assigned; The semantic parsing module is used to extract head entity words, tail entity words, and relation words from the training samples, and perform semantic parsing to obtain a semantic feature sequence; wherein, the semantic feature sequence includes relation semantic features, head entity semantic features, and tail entity semantic features; The first calculation module is used to configure at least a routing network and a new expert branch in the original relation extraction model to construct a new relation extraction model; and to use the routing network to determine the expert-level allocation probability of the actual allocation expert branch of the training sample; wherein, the expert-level allocation probability includes the feature allocation probability of the relation semantic features relative to the expert branch, and the feature allocation probability is used to filter the target relation features of the expert branch. The first optimization module is used to optimize the routing network parameters separately with the goal of minimizing the branch routing assignment loss calculated from the expected branch labels of the training samples and the expert-level assignment probability, so that the routing network guides the difficult samples to the new expert branch and the trained samples to the old expert branch. The second calculation module is used to perform relationship representation fusion based on the target relationship features of several expert branches, combined with the semantic features of the head entity and the semantic features of the tail entity, to obtain their respective target relationship representations; wherein, the target relationship representations of the several experts are used together to calculate the predicted relationship probability. The second optimization module is used to globally optimize the new relation extraction model with the goal of minimizing the learning degree difference loss calculated from the predicted relation probability and the real relation label; wherein the parameters of the old expert branch remain unchanged during optimization.

9. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method according to any one of claims 1-7.

10. A smart cockpit, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the method according to any one of claims 1-7.

11. A vehicle comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the method according to any one of claims 1-7.