Emotion model personalized generation method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202611276460.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-10-23
AI Technical Summary
[0003]然而,现有方案仍存在以下技术局限:
[0021]采用上述情感模型个性化生成方法、装置、电子设备及存储介质,其获取目标用户的多类溯源数据,并分别提取对应的特征向量;而后将多类特征向量输入多头交叉注意力融合模块,以每一类特征向量作为独立的注意力头,计算任意两类特征向量之间的交叉注意力权重,输出交互特征表示,并根据所述交互特征表示生成所述目标用户专属的个性化参数;最后将当前输入文本的语义信息输入动态门控路由网络,所述动态门控路由网络的输出维度与预训练的通用情感交互基座模型的层数对应,并根据所述动态门控路由网络的输出将所述个性化参数注入所述通用情感交互基座模型的对应层,生成当前交互场景下的个性化模型实例。本公开通过多头交叉注意力融合模块捕捉多类特征之间的交互效应,提升情感保真度;通过动态门控路由网络根据当前输入文本自适应调整个性化参数的注入位置与强度,实现模型的动态个性化适配。
Smart Images

Figure CN122964232A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and more specifically, to a method, apparatus, electronic device, and storage medium for personalized generation of emotion models. Background Technology
[0002] In the field of personalized generation of emotional interaction models, existing solutions typically adopt the following technical path: extract multi-dimensional features from multi-source user data, ensure feature independence through orthogonal constraints, map the features to control parameters and then inject them into the base model to achieve personalized adaptation, such as the personalized generation method of emotional interaction models based on multi-dimensional orthogonal source features proposed by the applicant (application number: CN202610918120.2).
[0003] However, existing solutions still have the following technical limitations:
[0004] On the one hand, the feature fusion process uses a simple splicing method, and the correlation information between the dimensions is lost during the splicing process, which limits the emotional fidelity of the model output.
[0005] On the other hand, multiple sets of control parameters are fixedly injected into specific layers of the model, and the injection location and injection intensity remain unchanged under different input scenarios, resulting in the emotional expression expressed by the model output tending to be consistent, which cannot meet personalized needs.
[0006] To address the aforementioned technical issues, this disclosure proposes an improved solution that captures the real interaction effects between dimensions while also achieving personalized dynamic adaptation. Summary of the Invention
[0007] This disclosure provides at least one method, apparatus, electronic device, and storage medium for generating personalized emotion models to solve the aforementioned technical problems.
[0008] In a first aspect, embodiments of this disclosure provide a method for personalized generation of emotion models, including: Obtain multiple types of source data for the target user and extract the corresponding feature vectors for each. The multi-class feature vectors are input into the multi-head cross-attention fusion module. Each class of feature vectors is used as an independent attention head. The cross-attention weight between any two classes of feature vectors is calculated, and the interaction feature representation is output. Based on the interaction feature representation, personalized parameters exclusive to the target user are generated. The semantic information of the current input text is input into a dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers in the pre-trained general emotional interaction base model. Based on the output of the dynamic gated routing network, the personalized parameters are injected into the corresponding layer of the general emotional interaction base model to generate a personalized model instance in the current interaction scenario.
[0009] In one possible implementation, the step of acquiring multiple types of source data of the target user and extracting corresponding feature vectors for each includes: Multiple types of source data are input into the corresponding variational autoencoders, and each variational autoencoder outputs the initial latent variables of the corresponding dimension. During training, the initial latent variables of any one variational autoencoder are fixed, and the initial latent variables of the other variational autoencoders are randomly perturbed. The difference between the reconstructed data after perturbation and the original data is calculated as the intervention loss. A total loss function is constructed based on the reconstruction loss of each variational autoencoder and the intervention loss, and the variational autoencoder is trained accordingly. After training, the latent variables of each variational autoencoder are used as the causal decoupling feature vectors of the corresponding dimension.
[0010] In one possible implementation, the total loss function is the weighted sum of the reconstruction loss and KL divergence of each variational autoencoder, plus the product of the intervention loss and the balance coefficient.
[0011] In one possible implementation, calculating the cross-attention weights between any two types of feature vectors includes: Select any two feature vectors from multiple feature vectors, use one feature vector as the query, and the other feature vector as the key and value; Calculate the attention weight between the query and the key; The values are weighted and summed according to the attention weights to obtain the cross-attention output between the two types of feature vectors; Perform the above operation on all pairs of feature vectors of the two classes respectively to obtain the cross-attention output of each group; The interaction feature representation is obtained by fusing the cross-attention outputs of each group.
[0012] In one possible implementation, injecting the personalized parameters into the corresponding layer of the general emotional interaction base model based on the output of the dynamic gated routing network includes: Input the current input text into the general emotional interaction base model and obtain the semantic representation vector output by the first layer of the general emotional interaction base model; The semantic representation vector is input into the dynamic gated routing network to generate a gated matrix. Each row of the gated matrix corresponds to a layer of the general emotional interaction base model, and each element in each row corresponds to the injection intensity of each set of personalized parameters. Normalize each row of the gate matrix to obtain the injection strength weights of the personalized parameters for each layer and group; Based on the injection intensity weight of each group of personalized parameters in each layer, the personalized parameters of each group are injected into the corresponding layer of the general emotional interaction base model.
[0013] In one possible implementation, it also includes: Obtain the injection strength weights of each layer of the general emotional interaction base model; When all injection strength weights in a certain layer are lower than the preset threshold, skip that layer and do not inject personalized parameters into it.
[0014] In one possible implementation, it also includes: Collect incremental interaction data during online interaction; When the update conditions are met, the Fisher information matrix of each trainable parameter used to generate the personalized model instance is calculated for the historical task. The diagonal elements of the Fisher information matrix are used to characterize the importance of the corresponding parameter to the historical task. Apply stronger update constraints to parameters with high diagonal values in the Fisher information matrix.
[0015] In one possible implementation, the incremental update employs an elastic weight consolidation mechanism, with the loss function being: L_update(θ) = L_new(θ) + (λ / 2) × Σ_i F_ii × (θ_i - θ_i*)² Where L_update(θ) is the total loss function during incremental update, L_new(θ) is the new task loss corresponding to the incremental interaction data, θ is the parameter before update, F_ii is the diagonal element of the Fisher information matrix, and λ is the global importance coefficient.
[0016] In one possible implementation, the personalized parameters include one or more of the following parameters: response intensity modulation parameters, stylized control vectors, and long-range state tracking variables; The response intensity modulation parameter is used to modulate the model's response amplitude to the input content; the stylization control vector is used to control the style tendency of the model's output text; and the long-range state tracking variable is used to track the user's state changes during long-term interaction.
[0017] In one possible implementation, the multiple types of traceability data include several of the following: personal life cycle data, kinship data, acquired interpersonal data, and spatiotemporal context data.
[0018] Secondly, this disclosure also provides an apparatus for generating personalized emotion models, including: The acquisition module is used to acquire multiple types of source data of the target user and extract the corresponding feature vectors for each. The representation module is used to input multiple types of feature vectors into the multi-head cross-attention fusion module, use each type of feature vector as an independent attention head, calculate the cross-attention weight between any two types of feature vectors, output the interaction feature representation, and generate personalized parameters exclusive to the target user based on the interaction feature representation. The generation module is used to input the semantic information of the current input text into a dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers of the pre-trained general emotional interaction base model. Based on the output of the dynamic gated routing network, the personalized parameters are injected into the corresponding layer of the general emotional interaction base model to generate a personalized model instance in the current interaction scenario.
[0019] Thirdly, this disclosure also provides an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the emotion model personalization generation method as described in any one of the first aspects and various embodiments thereof is executed.
[0020] Fourthly, this disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the emotion model personalization generation method as described in any one of the first aspects and various embodiments thereof.
[0021] The aforementioned personalized emotion model generation method, device, electronic device, and storage medium acquire multiple types of source data from the target user and extract corresponding feature vectors for each. Then, these feature vectors are input into a multi-head cross-attention fusion module, using each type of feature vector as an independent attention head. The cross-attention weight between any two types of feature vectors is calculated, outputting an interaction feature representation. Personalized parameters specific to the target user are generated based on this interaction feature representation. Finally, the semantic information of the current input text is input into a dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers in a pre-trained general emotion interaction base model. Based on the output of the dynamic gated routing network, the personalized parameters are injected into the corresponding layer of the general emotion interaction base model, generating a personalized model instance for the current interaction scenario. This disclosure captures the interaction effects between multiple types of features through a multi-head cross-attention fusion module, improving emotion fidelity; and dynamically adjusts the injection position and intensity of personalized parameters according to the current input text through a dynamic gated routing network, achieving dynamic personalized adaptation of the model.
[0022] Other advantages of this disclosure will be explained in more detail in conjunction with the following description and accompanying drawings.
[0023] It should be understood that the above description is merely an overview of the technical solution of this disclosure, so as to provide a general understanding of the technical means of this disclosure and to implement it in accordance with the contents of the specification. In order to make the above and other objects, features and advantages of this disclosure more apparent and understandable, specific embodiments of this disclosure are illustrated below. Attached Figure Description
[0024] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. The accompanying drawings are incorporated in and constitute a part of this specification. These drawings illustrate embodiments conforming to this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure. It should be understood that the drawings only illustrate certain embodiments of this disclosure and should not be considered as a limitation on the scope of protection. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. Furthermore, the same reference numerals denote the same components throughout the drawings. In the drawings: Figure 1 A flowchart of a personalized emotion model generation method provided by an embodiment of this disclosure is shown; Figure 2 A schematic diagram of an emotion model personalization generation device provided in an embodiment of this disclosure is shown; Figure 3 A schematic diagram of an electronic device provided in an embodiment of the present disclosure is shown. Detailed Implementation
[0025] 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.
[0026] In the description of embodiments disclosed herein, it should be understood that terms such as “comprising” or “having” are intended to indicate the presence of the disclosed features, figures, steps, behaviors, components, portions or combinations thereof in this specification, and do not exclude the possibility of the presence of one or more other features, figures, steps, behaviors, components, portions or combinations thereof.
[0027] Unless otherwise stated, " / " means "or". For example, A / B can mean A or B. In this article, "and / or" is merely a way of describing the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A alone, A and B at the same time, and B alone.
[0028] The terms "first," "second," etc., are used only for ease of description to distinguish identical or similar technical features and should not be construed as indicating or implying the relative importance or number of these technical features. Therefore, a feature defined by "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, the term "multiple" means two or more.
[0029] Research has found that in the field of personalized generation of emotional interaction models, existing solutions typically adopt the following technical path: extract multi-dimensional features from multi-source user data, ensure feature independence through orthogonal constraints, map the features to control parameters and then inject them into the base model to achieve personalized adaptation.
[0030] However, the above solutions still have the following technical limitations: (1) Statistical orthogonality cannot guarantee mechanism isolation. Existing solutions use orthogonal loss to force feature orthogonality, which is a statistical decoupling. It only ensures that the feature vectors are unrelated in the embedding space, but the features of each dimension are still passively fused through the shared splicing layer, which cannot fundamentally prevent information confusion.
[0031] (2) Feature fusion lacks dynamic interaction capabilities. Existing solutions use a simple splicing method to fuse features from various dimensions, which fails to capture the real interaction effects between dimensions, such as how "blood kinship" modulates the influence of "acquired interpersonal relationships" on personality. This loss of interaction effects limits the emotional fidelity of the model output.
[0032] (3) The parameter injection location is fixed and cannot be allocated as needed. Existing solutions inject multiple sets of control parameters into specific layers of the model (such as attention layer, feedforward layer, and location encoding layer), which cannot dynamically determine which personality trait should play a dominant role in which layer of the model based on the user's current input content or emotional state.
[0033] (4) Incremental updates lack knowledge protection mechanisms. Existing solutions use LoRA fine-tuning for incremental updates, without distinguishing between core personality parameters and short-term state parameters. Frequent updates may lead to catastrophic amnesia, that is, the user's deep personality is covered by recent fluctuations.
[0034] To at least partially address one or more of the aforementioned problems and other potential issues, this disclosure provides a method, apparatus, electronic device, and storage medium for personalized generation of emotion models. It employs a multi-head cross-attention fusion module, using each type of feature vector as an independent attention head, to calculate the cross-attention weight between any two types of feature vectors, thus preserving the correlation information between dimensions. Simultaneously, a dynamic gating routing network adaptively determines the optimal position and injection intensity of personalized parameters into a general emotion interaction base model (hereinafter referred to as the base model) based on the semantic information of the current input text, achieving dynamic personalized adaptation of the model.
[0035] To facilitate understanding of this embodiment, a detailed description of the personalized emotion model generation method disclosed in this disclosure is provided first. The executing entity of the personalized emotion model generation method provided in this disclosure is generally an electronic device with a certain computing power. This electronic device may include, for example, a terminal device, a server, or other processing devices. The terminal device may be a user equipment (UE), a mobile device, a personal digital assistant (PDA), a handheld device, an in-vehicle device, a wearable device, etc. In some possible implementations, this personalized emotion model generation method can be implemented by a processor calling computer-readable instructions stored in memory, or by a dedicated hardware acceleration unit, or by a combination of hardware and software.
[0036] The personalized emotion model generation system provided in this disclosure can be deployed in the aforementioned electronic device and used in conjunction with an emotion dialogue system based on the Transformer architecture. The emotion dialogue system, as the runtime carrier of the general emotion interaction base model, is responsible for executing general emotion interaction inference. The personalized emotion model generation system, as a front-end or collaborative system, is responsible for personalized adaptation of the base model. Specifically, it extracts causal decoupling features from multi-source user data and generates personalized control parameters, then injects these parameters into the corresponding computing nodes of the base model, thereby generating a personalized model instance specific to the user. The two systems work together to complete the entire process from general emotion interaction to personalized emotion interaction.
[0037] The personalized emotion model generation system here mainly includes a multi-source data acquisition and preprocessing module, a structural causal decoupling module, a multi-head cross-attention fusion module, a three-way parallel prediction branch, a dynamic gated routing network, and an elastic weight consolidation lifelong learning module, which will be explained in detail below.
[0038] Regarding the multi-source data acquisition and preprocessing module: This module can obtain multiple types of traceability data from users through an authorized interface. In this embodiment of the disclosure, the multiple types of traceability data include four types of traceability data obtained with user authorization: Personal lifecycle data includes timestamp sequences of users’ historical growth events, key node tags, and long-term behavioral statistics, which are used to depict the growth trajectory of individual users. Bloodline data, including structured relationship maps of immediate family members and intergenerational transmission characteristic tags, is used to reflect the influence of innate heredity and family environment on user traits; Acquired interpersonal data, including a graph of unrelated social relationships and feature vectors of core relationships, is used to characterize how acquired social interactions shape a user's personality. Spatiotemporal background data includes era characteristic tags and regional cultural characteristic codes for the user's growth period, used to identify the influence of the macro era and regional environment on the user's characteristics.
[0039] The four types of data depict user characteristics from four dimensions: personal life cycle, bloodline inheritance, acquired interactions, and spatiotemporal environment, thereby creating a complete user model.
[0040] In practical applications, named entity recognition and relation extraction can be performed on unstructured text in traceability data, discrete events can be arranged in chronological order, missing fields can be standardized and filled, and a structured time-series data sequence can be output.
[0041] Regarding the structural causal decoupling module: This module contains four identical but parameter-independent variational autoencoders (VAEs), each processing a type of source data. Each VAE consists of an encoder and a decoder.
[0042] Unlike existing schemes where orthogonal loss only guarantees statistical decoupling that feature vectors are uncorrelated in the embedding space, this scheme achieves mechanism decoupling through causal intervention regularization. By introducing a causal intervention regularization term into the total loss function, each latent variable is made independent of each other in terms of generation mechanism, ensuring that each latent variable of VAE is only responsible for its own dimension, thus achieving complete causal decoupling at the generation mechanism level.
[0043] The specific execution process of this module will be explained in detail in the following steps.
[0044] Regarding the multi-head cross-attention fusion module: This module is used to input four sets of causal decoupling features into a multi-head cross-attention fusion module. Each dimension is used as an independent attention head, and the interaction weights between any two dimensions are learned through a key-value pair query mechanism.
[0045] Specifically, the four dimensions are defined as Query, Key, and Value, respectively, and cross-attention weights are calculated. All six pairwise pairings are covered: "bloodline" query "interpersonal," "bloodline" query "personal trajectory," "bloodline" query "spatiotemporal context," "interpersonal" query "personal trajectory," "interpersonal" query "spatiotemporal context," and "personal trajectory" query "spatiotemporal context." The output is a feature representation incorporating interaction information.
[0046] Unlike existing solutions that simply stitch together dimensions and fail to capture the interaction effects between dimensions, this module explicitly models the pairwise interaction relationships between dimensions through a multi-head cross-attention mechanism. For example, it examines how the "bloodline" dimension modulates the influence of the "interpersonal" dimension on personality. This allows the model to capture the deep-seated correlation information lost during the stitching process, significantly improving the fidelity of emotion modeling.
[0047] The specific execution process of this module will be explained in detail in the following steps.
[0048] Regarding the three-way parallel prediction branch: This module takes the interactive feature representation as input to three parallel prediction branches and outputs user-specific parameters such as response intensity modulation parameter α, stylization control vector β, and long-range state tracking variable h_state.
[0049] Where α is a scalar or vector in the range [0,1], used to modulate the magnitude of the model's response to the input content; β is a low-dimensional embedding vector used to control the pragmatic style tendency of the response text; and h_state is a cyclically updated state vector used to track the user's state changes during long-term interaction.
[0050] The three branches here output three types of control parameters with different functions in parallel, each acting independently on different computation nodes of the model, realizing a precise mapping from features to parameters, and providing a parameterized basis for subsequent differential injection.
[0051] The specific execution process of this module will be explained in detail in the following steps.
[0052] Regarding dynamically gated routing networks: This module is one of the core innovations of this solution. It is a lightweight Multilayer Perceptron (MLP) that takes the semantic vector of the current dialogue context as input, such as the classification token (CLS) representation taken from the first layer of the base model, and outputs a gating matrix G with dimensions (L, 3), where L is the number of Transformer layers in the base model and 3 corresponds to three sets of parameters.
[0053] For the l-th layer, each row of the gating matrix, G_l, is a three-dimensional vector. After being normalized by Softmax, it is injected as the intensity weights α, β, and h_state into the layer. When all weights are below a preset threshold τ, no parameters are injected into the layer, thus automatically skipping it.
[0054] Unlike existing solutions that statically inject control parameters into specific layers, this module dynamically calculates the injection strength of each set of parameters in each layer based on the semantic content of the current input text. This allows the model to have different parameter activation modes for the same user in different dialogue scenarios, achieving a qualitative leap from static modification to dynamic adaptation. Simultaneously, the mechanism of automatically skipping low-weight layers further improves inference efficiency.
[0055] The specific execution process of this module will be explained in detail in the following steps.
[0056] Regarding the flexible weighting consolidation of the lifelong learning module: This module is used to apply greater update constraints to high-importance parameters by using the Fisher information matrix of historical tasks as importance weights when incremental updates are triggered, thus protecting core personality knowledge.
[0057] Unlike existing LoRA fine-tuning methods that do not differentiate between parameters based on their importance, this module automatically identifies the parameters that contribute most to the user's core personality through the Fisher information matrix. During incremental updates, it imposes greater constraints on highly important parameters, effectively avoiding catastrophic forgetting and achieving the lifelong learning goal of protecting core personality and flexibly absorbing new information.
[0058] The specific execution process of this module (including the calculation of the Fisher information matrix, the construction of the EWC loss function, and the incremental update conditions) will be explained in detail in the following steps.
[0059] The following is combined Figure 1 The complete workflow of the personalized emotion model generation method provided in this disclosure is described in detail. The method provided in this disclosure includes the following steps: S101: Obtain multi-class source data of the target user and extract the corresponding feature vectors respectively.
[0060] Here, the user's multi-type traceability data can first be obtained through an authorized interface. In this embodiment, the multi-type traceability data includes four types of traceability data obtained with the user's authorization: personal lifecycle data, kinship data, acquired interpersonal data, and spatiotemporal background data. These four types of data respectively characterize user traits from four dimensions: personal lifecycle, kinship inheritance, acquired interactions, and spatiotemporal environment, thereby enabling a complete user model.
[0061] S102: Input the multi-class feature vectors into the multi-head cross-attention fusion module, use each class of feature vectors as an independent attention head, calculate the cross-attention weight between any two classes of feature vectors, output the interactive feature representation, and generate personalized parameters exclusive to the target user based on the interactive feature representation.
[0062] In this step, multi-head cross-attention fusion module is used to interactively model multiple feature vectors, and then personalized parameters are output through three parallel prediction branches.
[0063] In this embodiment, each type of feature vector is used as an independent attention head, and the cross-attention weight between any two types of feature vectors is calculated. Specifically, any two types of feature vectors are selected from multiple types of feature vectors, with one type of feature vector serving as the query and the other type as the key and value. The interaction weight between the two is calculated using an attention mechanism. The above operation is performed on all pairs of two-type feature vectors to obtain each set of cross-attention outputs; the cross-attention outputs are then fused to obtain the interactive feature representation.
[0064] The fused interaction feature representation is then input into a multi-task prediction network to generate personalized parameters specific to the target user. These personalized parameters may include response intensity modulation parameter α, stylization control vector β, and long-range state tracking variable h_state, as described above, and will not be repeated here.
[0065] S103: Input the semantic information of the current input text into the dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers of the pre-trained general emotional interaction base model. Based on the output of the dynamic gated routing network, inject personalized parameters into the corresponding layer of the general emotional interaction base model to generate a personalized model instance in the current interaction scenario.
[0066] Here, a pre-trained general emotional interaction base model is obtained. The base model is a language model based on the Transformer architecture, which can be generated using the method previously proposed by the applicant (see application number CN202610918120.2) or other neural network models. A dynamic gated routing network is constructed, and the output dimension of the routing network corresponds to the number of layers in the base model.
[0067] The semantic information of the current input text is input into a dynamic gating routing network. Based on the semantic information of the current input text, the routing network determines the optimal position and injection strength of each set of personalized parameters into each layer of the base model. According to the output of the routing network, the personalized parameters generated in step S2 are injected into the corresponding layer of the base model to generate a personalized model instance for the current interaction scenario.
[0068] In this embodiment of the disclosure, feature extraction can be achieved through a structural causal decoupling module, specifically including the following steps: Step 1: Input the various types of source data into the corresponding variational autoencoders, and each variational autoencoder outputs the initial latent variables of the corresponding dimension; Step 2: During training, fix the initial latent variable of any one variational autoencoder, randomly perturb the initial latent variables of the other variational autoencoders, and calculate the difference between the reconstructed data after perturbation and the original data as the intervention loss. Step 3: Construct a total loss function based on the reconstruction loss and intervention loss of each variational autoencoder, and train the variational autoencoder. Step 4: After training is complete, the latent variables of each variational autoencoder are used as the causal decoupling feature vectors of the corresponding dimensions.
[0069] Here, multiple types of source data are input into the corresponding variational autoencoders, and each variational autoencoder outputs the initial latent variables of the corresponding dimension.
[0070] Each variational autoencoder consists of an encoder q_φ(z|x) and a decoder p_θ(x|z). The standard training objective is to minimize the weighted sum of the reconstruction loss MSE and the KL divergence. L_VAE_i = MSE(x_i, x_i') + β · KL( q_φ(z_i|x_i) || p(z_i) ) To ensure that the latent variables are independent in their generation mechanism, this embodiment of the disclosure may introduce a causal intervention operation: that is, fix the latent variable z_i of any one VAE, and randomly perturb the latent variables (z_j, z_k, z_l) of the other three VAEs, requiring the reconstructed corresponding dimension data to remain stable. This is achieved by minimizing the following intervention loss L_interv: L_interv = Σ_i || x_i - Decoder_i( z_i, shuffle(z_j, z_k, z_l) ) ||² Here, shuffle means randomly shuffling the latent variables of other dimensions to simulate an "intervention" operation.
[0071] The final total loss function for this module is: L_total = Σ_i L_VAE_i + λ_interv · L_interv Where λ_interv is the balance coefficient for causal intervention regularization, which is taken as an empirical value of 0.05 in one implementation. This value was determined through grid search experiments to achieve the optimal balance between feature decoupling and reconstruction accuracy.
[0072] The variational autoencoder is trained using the total loss function described above. After training, the latent variables of each variational autoencoder are used as the causal decoupling feature vectors of the corresponding dimensions.
[0073] In this embodiment of the disclosure, the calculation process for the cross-attention weight between the two types of feature vectors specifically includes: Step 1: Select any two types of feature vectors from the multiple types of feature vectors, use one type of feature vector as the query, and the other type of feature vector as the key and value; Step 2: Calculate the attention weight between the query and the key; Step 3: Sum the values according to the attention weights to obtain the cross-attention output between the two types of feature vectors; Step 4: Perform the above operation on all pairs of feature vectors of the two classes respectively to obtain the cross-attention output of each group; Step 5: Fuse the cross-attention outputs of each group to obtain the interaction feature representation.
[0074] In practical applications, any two types of feature vectors are selected from multiple types of feature vectors. One type of feature vector is used as the query, and the other type is used as the key and value. The attention weight between the query and the key is calculated, and the values are weighted and summed according to the attention weight to obtain the cross-attention output between the two types of feature vectors.
[0075] The above operation is performed on all pairings of the two types of feature vectors (i.e., pairing the four types of features into six pairs, resulting in six pairs of pairings), to obtain the cross-attention outputs for each pair. The cross-attention outputs are then fused to obtain the interactive feature representation.
[0076] In this embodiment of the disclosure, the personalized parameters are injected into the corresponding layer of the base model according to the output of the dynamic gated routing network, specifically including the following steps: Step 1: Input the current input text into the general sentiment interaction base model and obtain the semantic representation vector output by the first layer of the general sentiment interaction base model; Step 2: Input the semantic representation vector into the dynamic gated routing network to generate a gate matrix. Each row of the gate matrix corresponds to a layer of the general emotional interaction base model, and each element in each row corresponds to the injection intensity of each set of personalized parameters. Step 3: Normalize each row of the gating matrix to obtain the injection strength weights of the personalized parameters for each layer and group; Step 4: Based on the injection intensity weight of the personalized parameters of each layer and group, inject the personalized parameters of each group into the corresponding layer of the general emotional interaction base model.
[0077] Here, the current input text can be input into a general sentiment interaction base model to obtain the semantic representation vector output from the first layer of the base model. In one implementation, the semantic representation vector is taken from the CLS representation of the first layer of the base model, which contains global semantic information of the current input text.
[0078] The extracted semantic representation vector is input into the dynamic gated routing network. As a lightweight MLP, the dynamic gated routing network has the same input dimension as the semantic representation vector, and its output dimension corresponds to the number of layers in the base model and the number of personalized parameter groups. Specifically, the routing network outputs a gating matrix G with dimensions (L, K), where L is the number of Transformer layers in the base model, and K is the number of personalized parameter groups (in this embodiment, K=3, corresponding to the response intensity modulation parameter α, the stylization control vector β, and the long-range state tracking variable h_state, respectively).
[0079] Each row of the gating matrix corresponds to a layer of the base model, and each element in each row corresponds to the injection intensity of each set of personalized parameters in that layer. For example, the element in the l-th row and first column of the gating matrix represents the intensity weight of the response intensity modulation parameter α injected into the l-th layer, the element in the l-th row and second column represents the intensity weight of the stylization control vector β injected into the l-th layer, and the element in the l-th row and third column represents the intensity weight of the long-range state tracking variable h_state injected into the l-th layer.
[0080] Then, each row of the gating matrix is normalized to obtain the injection strength weights of each group of personalized parameters in each layer. In one implementation, the normalization process uses the Softmax function, which makes the sum of the three elements in each row equal to 1, and the value of each element is between 0 and 1, representing the relative injection strength of the three groups of personalized parameters in that layer.
[0081] For example, for the l-th layer, the l-th row G_l of the gating matrix is a three-dimensional vector, which is normalized by Softmax to obtain [g_l1, g_l2, g_l3], where g_l1, g_l2, and g_l3 represent the intensity weights of α, β, and h_state injected into the l-th layer, respectively.
[0082] It should be noted that when all injection strength weights in a certain layer are lower than the preset threshold, that layer is skipped and no personalized parameters are injected into it.
[0083] Specifically, for the l-th layer, if g_l1, g_l2, and g_l3 are all below a preset threshold τ (e.g., τ=0.3), it indicates that this layer is not sensitive to the semantic information of the current input text. Injecting any personalized parameters will not have a significant impact on the model output. In this case, the layer is skipped, and no injection operation is performed. This mechanism achieves automatic skipping, avoids invalid injection, and improves inference efficiency.
[0084] Based on the injection intensity weights of each group of personalized parameters in each layer, the personalized parameters are injected into the corresponding layer of the base model. In one implementation, the three groups of parameters can be injected into different computation nodes of the base model respectively: The response intensity modulation parameter α is injected into the attention computation layer: α is used as a scaling factor and multiplied element-wise with the query vector in the attention computation. This operation allows the model's attention allocation to different types of inputs to be differentially adjusted according to the target user's preference intensity. When the α value is high, the model gives stronger attention and a more complete response to the current input; when the α value is low, the model's response amplitude to the current input is correspondingly weakened.
[0085] Stylization control vector β is injected into the feedforward network layer: β is concatenated into the hidden layer representation of the feedforward network. This operation continuously conditions the text generation process under the control of this style vector, and the value of β determines the stylistic tendency of the response text (such as formal versus informal, detailed versus concise, rational versus emotional, etc.).
[0086] The long-range state tracking variable h_state is injected into the position encoding layer: h_state is linearly transformed from its original feature space to the same dimensional space as the position encoding vector through a learnable projection matrix, and then the transformed vector is added element-wise to the original position encoding vector. This operation integrates the long-range state tracking variable into the position encoding, enabling the model to acquire long-range state memory across sessions and produce specific responses to specific events such as birthdays, anniversaries, and life stage transitions.
[0087] After the above three injection operations are completed, the base model is reconstructed into a personalized model instance exclusive to the target user in the current interaction scenario.
[0088] This embodiment of the disclosure also includes incremental updates during the online interaction process, specifically including the following steps: Step 1: Collect incremental interaction data during online interaction; Step 2: When the update conditions are met, calculate the Fisher information matrix of each trainable parameter used to generate personalized model instances for the historical task. The diagonal elements of the Fisher information matrix are used to characterize the importance of the corresponding parameter to the historical task. Step 3: Apply stronger update constraints to parameters with high diagonal values in the Fisher information matrix.
[0089] When an incremental update is triggered, the Fisher information matrix F of each parameter of the current model relative to the historical core task is first calculated. The diagonal element F_ii of F represents the importance of parameter θ_i to the historical task.
[0090] The loss function during updates incorporates an Elastic Weight Consolidation (EWC) regularization term: L_update(θ) = L_new(θ) + (λ / 2) · Σ_i F_ii · (θ_i - θ_i*)² Where L_update(θ) is the total loss function during incremental updates, L_new(θ) is the loss of the new task corresponding to the incremental interaction data, θ is the parameter before the update, F_ii is the diagonal element of the Fisher information matrix, and λ is the global importance coefficient.
[0091] This regularization term imposes greater resistance to updating highly important parameters, protecting core personality knowledge; while allowing flexible updates for less important parameters, absorbing new information.
[0092] To facilitate a further understanding of the personalized emotion model generation method provided in this disclosure, specific examples will be used to illustrate the method below.
[0093] Example 1: In this embodiment of the disclosure, taking the emotional dialogue base model based on the Transformer architecture as an example, the target user authorization system obtains four types of traceability data.
[0094] The system inputs the four types of source data into the corresponding variational autoencoders for causal decoupling training. After training, the latent variables of each variational autoencoder are used as the causal decoupling feature vectors for the corresponding dimensions.
[0095] Four sets of causal decoupled feature vectors are input into the multi-head cross-attention fusion module, which calculates the cross-attention weights between six pairwise pairs and outputs the interactive feature representation. The three prediction branches output the response intensity modulation parameter α, the stylization control vector β, and the long-range state tracking variable h_state based on the interactive feature representation.
[0096] For example, when a user inputs "I'm not in a good mood today" into the base model, the semantic representation vector output from the first layer of the base model is fed into a dynamic gated routing network. The routing network outputs a gate matrix G, which is then normalized using Softmax to obtain the injection strength weights for each layer. Assuming the injection strength weight for layer 5 is 0.8, which is higher than the preset threshold of 0.3, then the personalized parameters are injected into layer 5; if the injection strength weight for layer 10 is 0.2, which is lower than the threshold, then that layer is skipped.
[0097] Ultimately, a personalized model instance is generated for the current interaction scenario. The model's output response retains the user's core personality traits while also adapting to the current input context of "not in a good mood".
[0098] Example 2: In this embodiment of the disclosure, during the long-term interaction between the user and the personalized model instance, the system continuously collects incremental interaction data. When the accumulated data volume reaches a preset threshold, an incremental update process is triggered.
[0099] The system calculates the Fisher information matrix of each parameter of the current model against historical tasks, identifying the parameters that contribute most to the user's core personality traits. Under the EWC regularization constraint, these high-importance parameters are subject to greater update resistance during updates, ensuring that the user's core personality knowledge is not overwritten by new data; while low-importance parameters are allowed to be updated flexibly, absorbing new interaction information.
[0100] Through the above mechanism, the model can learn about the user's recent changes while not forgetting the user's core personality traits during long-term companionship.
[0101] In summary, the technical solution provided in this disclosure has the following beneficial effects: First, through the multi-head cross-attention fusion module, each type of feature vector is used as an independent attention head to calculate the cross-attention weight between any two types of feature vectors, so that features of different dimensions can be interactively modeled under the attention mechanism, retaining the correlation information between each dimension and improving the fidelity of sentiment modeling.
[0102] Second, by using a dynamic gated routing network, the optimal position and injection strength of personalized parameters into the base model are determined based on the semantic information of the current input text, so that the injection position and strength can change dynamically with the input content, thereby achieving dynamic personalized adaptation of the model.
[0103] Third, by jointly training variational autoencoders and causal intervention regularization, the latent variables of each dimension are made independent of each other in terms of generation mechanism, realizing structural causal decoupling and ensuring the independence of features from the mechanism level.
[0104] Fourth, incremental updates are performed through a flexible weight consolidation mechanism. The Fisher information matrix is used to measure the importance of each parameter to historical tasks, and greater update constraints are imposed on highly important parameters to protect core personality knowledge and avoid catastrophic amnesia.
[0105] In the description of this specification, references to terms such as "some possible implementations," "some implementations," "example," "specific example," or "some examples" indicate that a specific feature, structure, material, or characteristic described in connection with that implementation or example is included in at least one implementation or example of this disclosure, and the aforementioned terms do not necessarily refer to the same implementation or example. Furthermore, the described specific features, structures, materials, or characteristics can be combined in a suitable manner in any one or more implementations or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different implementations or examples described in this specification, as well as the features of different implementations or examples.
[0106] Regarding the method flowcharts of embodiments of this disclosure, certain operations are described as different steps performed in a certain order. Such flowcharts are illustrative and not restrictive. Some steps described herein may be grouped together and performed in a single operation, or some steps may be divided into multiple sub-steps, and some steps may be performed in an order different from that shown herein. The various steps shown in the flowcharts may be implemented in any way by any circuit structure and / or tangible mechanism (e.g., software running on a computer device, hardware (e.g., logic functions implemented by a processor or chip), and / or any combination thereof).
[0107] Those skilled in the art will understand that in the methods described in the above specific embodiments, the order in which the steps are written does not imply a strict execution order, and the specific execution order of each step should be determined by its function and possible internal logic.
[0108] Based on the same inventive concept, this disclosure also provides an emotional model personalization generation device corresponding to the emotional model personalization generation method. Since the principle of the device in this disclosure for solving the problem is similar to the emotional model personalization generation method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0109] Reference Figure 2 The diagram shown is a schematic of an emotion model personalization generation device provided in an embodiment of this disclosure. The device includes: an acquisition module 201, a representation module 202, and a generation module 203; wherein: The acquisition module 201 is used to acquire multiple types of traceability data of the target user and extract the corresponding feature vectors respectively; The representation module 202 is used to input multi-class feature vectors into the multi-head cross-attention fusion module, use each class of feature vectors as an independent attention head, calculate the cross-attention weight between any two classes of feature vectors, output the interactive feature representation, and generate personalized parameters exclusive to the target user based on the interactive feature representation. The generation module 203 is used to input the semantic information of the current input text into the dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers of the pre-trained general emotional interaction base model. Based on the output of the dynamic gated routing network, personalized parameters are injected into the corresponding layer of the general emotional interaction base model to generate a personalized model instance in the current interaction scenario.
[0110] This disclosure embodiment captures the interaction effects between multiple types of features through a multi-head cross-attention fusion module, thereby improving sentiment fidelity; and achieves dynamic personalized adaptation of the model by adaptively adjusting the injection position and intensity of personalized parameters according to the current input text through a dynamic gated routing network.
[0111] In one possible implementation, the acquisition module 201 is specifically used to acquire multiple types of source data of the target user according to the following steps, and extract the corresponding feature vectors for each: Multiple types of source data are input into the corresponding variational autoencoders, and each variational autoencoder outputs the initial latent variables of the corresponding dimension. During training, the initial latent variables of any one variational autoencoder are fixed, and the initial latent variables of the other variational autoencoders are randomly perturbed. The difference between the reconstructed data after perturbation and the original data is calculated as the intervention loss. The total loss function is constructed based on the reconstruction loss and intervention loss of each variational autoencoder, and the variational autoencoder is trained. After training, the latent variables of each variational autoencoder are used as the causal decoupling feature vectors of the corresponding dimension.
[0112] In one possible implementation, the total loss function is the weighted sum of the reconstruction loss and KL divergence of each variational autoencoder, plus the product of the intervention loss and the balance coefficient.
[0113] In one possible implementation, representation module 202 is specifically configured to calculate the cross-attention weights between any two types of feature vectors according to the following steps: Select any two feature vectors from multiple feature vectors, use one feature vector as the query, and the other feature vector as the key and value; Calculate the attention weight between the query and the key; The values are weighted and summed according to the attention weights to obtain the cross-attention output between the two types of feature vectors. Perform the above operation on all pairs of feature vectors of the two classes respectively to obtain the cross-attention output of each group; The cross-attention outputs of each group are fused to obtain the interaction feature representation.
[0114] In one possible implementation, the generation module 203 is specifically configured to inject personalized parameters into the corresponding layer of the general emotional interaction base model according to the output of the dynamic gated routing network, as follows: Input the current input text into the general emotional interaction base model and obtain the semantic representation vector output by the first layer of the general emotional interaction base model; The semantic representation vector is input into the dynamic gated routing network to generate a gated matrix. Each row of the gated matrix corresponds to a layer of the general emotional interaction base model, and each element in each row corresponds to the injection intensity of each set of personalized parameters. Normalize each row of the gating matrix to obtain the injection strength weights of the personalized parameters for each layer and group; Based on the injection intensity weight of each group of personalized parameters in each layer, the personalized parameters of each group are injected into the corresponding layer of the general emotional interaction base model.
[0115] In one possible implementation, the generation module 203 is further configured to: Obtain the injection strength weights of each layer in the general emotional interaction base model; When all injection strength weights in a certain layer are lower than the preset threshold, skip that layer and do not inject personalized parameters into it.
[0116] In one possible implementation, it also includes: Incremental module 204 is used to collect incremental interaction data during online interaction; when the update conditions are met, it calculates the Fisher information matrix of each trainable parameter used to generate personalized model instances for the historical task. The diagonal elements of the Fisher information matrix are used to characterize the importance of the corresponding parameter to the historical task; and it applies greater update constraints to parameters with high diagonal element values in the Fisher information matrix.
[0117] In one possible implementation, the incremental update employs an elastic weight consolidation mechanism, with the loss function being: L_update(θ) = L_new(θ) + (λ / 2) × Σ_i F_ii × (θ_i - θ_i*)² Where L_update(θ) is the total loss function during incremental updates, L_new(θ) is the loss of the new task corresponding to the incremental interaction data, θ is the parameter before the update, F_ii is the diagonal element of the Fisher information matrix, and λ is the global importance coefficient.
[0118] In one possible implementation, the personalized parameters include one or more of the following parameters: response intensity modulation parameters, stylized control vectors, and long-range state tracking variables; The response intensity modulation parameter is used to modulate the amplitude of the model's response to the input content; the stylization control vector is used to control the style tendency of the model's output text; and the long-range state tracking variable is used to track the user's state changes during long-term interaction.
[0119] In one possible implementation, the multiple types of traceability data include several of the following: personal life cycle data, kinship data, acquired interpersonal data, and spatiotemporal context data.
[0120] It should be noted that the apparatus in this embodiment can implement the various processes of the aforementioned method and achieve the same effects and functions, which will not be elaborated here.
[0121] This disclosure also provides an electronic device, such as... Figure 3The diagram shown is a schematic representation of an electronic device structure provided in this embodiment of the present disclosure, including: a processor 301, a memory 302, and a bus 303. The memory 302 stores machine-readable instructions executable by the processor 301 (e.g., ...). Figure 2 The device includes modules such as acquisition module 201, representation module 202, and generation module 203 (for executing instructions). When the electronic device is running, the processor 301 and memory 302 communicate via bus 303. When a machine-readable instruction is executed by the processor 301, the following processing is performed: Obtain multiple types of source data for the target user and extract the corresponding feature vectors for each. The multi-class feature vectors are input into the multi-head cross-attention fusion module. Each class of feature vectors is used as an independent attention head. The cross-attention weight between any two classes of feature vectors is calculated, and the interactive feature representation is output. Based on the interactive feature representation, personalized parameters exclusive to the target user are generated. The semantic information of the current input text is input into the dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers of the pre-trained general emotional interaction base model. Based on the output of the dynamic gated routing network, personalized parameters are injected into the corresponding layer of the general emotional interaction base model to generate a personalized model instance in the current interaction scenario.
[0122] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the emotion model personalization generation method described in the above-described method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0123] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the personalized emotion model generation method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0124] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0125] The various embodiments in this disclosure are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments. In particular, the description of the apparatus, device, and computer-readable storage medium embodiments is simplified because they are basically similar to the method embodiments, and the relevant parts can be referred to the description of the method embodiments.
[0126] The apparatus, device, and computer-readable storage medium provided in this disclosure correspond one-to-one with the method. Therefore, the apparatus, device, and computer-readable storage medium also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the apparatus, device, and computer-readable storage medium will not be repeated here.
[0127] Those skilled in the art will understand that embodiments of this disclosure can be implemented as methods and apparatus (devices or systems), or as computer-readable storage media. Therefore, this disclosure can be implemented entirely in hardware, entirely in software, or in a combination of software and hardware. Furthermore, this disclosure can be implemented as a computer-readable storage medium on one or more computer-readable storage media containing computer-usable program code (including, but not limited to, disk storage, read-only optical disc storage (CD-ROM), optical storage, etc.).
[0128] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices or systems), and computer-readable storage media according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to create a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or block diagrams.
[0129] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article including instruction means, wherein the instruction means implement the functions specified in one or more flowcharts and / or one or more blocks in a block diagram.
[0130] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.
[0131] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0132] Memory can include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0133] Computer-readable media include permanent and non-permanent, removable and non-removable media, which can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer-readable storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory, read-only memory, electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device. Furthermore, although the operations of the methods of this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. Additionally, certain steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple sub-steps.
[0134] While the spirit and principles of this disclosure have been described above with reference to several specific embodiments, it should be understood that this disclosure is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined. This disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A method for personalized generation of emotion models, characterized in that, include: Obtain multiple types of source data for the target user and extract the corresponding feature vectors for each. The multi-class feature vectors are input into the multi-head cross-attention fusion module. Each class of feature vectors is used as an independent attention head. The cross-attention weight between any two classes of feature vectors is calculated, and the interaction feature representation is output. Based on the interaction feature representation, personalized parameters exclusive to the target user are generated. The semantic information of the current input text is input into a dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers in the pre-trained general emotional interaction base model. Based on the output of the dynamic gated routing network, the personalized parameters are injected into the corresponding layer of the general emotional interaction base model to generate a personalized model instance in the current interaction scenario.
2. The method according to claim 1, characterized in that, The process of acquiring multiple types of source data from the target user and extracting corresponding feature vectors for each type includes: Multiple types of source data are input into the corresponding variational autoencoders, and each variational autoencoder outputs the initial latent variables of the corresponding dimension. During training, the initial latent variables of any one variational autoencoder are fixed, and the initial latent variables of the other variational autoencoders are randomly perturbed. The difference between the reconstructed data after perturbation and the original data is calculated as the intervention loss. A total loss function is constructed based on the reconstruction loss of each variational autoencoder and the intervention loss, and the variational autoencoder is trained accordingly. After training, the latent variables of each variational autoencoder are used as the causal decoupling feature vectors of the corresponding dimension.
3. The method according to claim 2, characterized in that, The total loss function is the weighted sum of the reconstruction loss and KL divergence of each variational autoencoder, plus the product of the intervention loss and the balance coefficient.
4. The method according to claim 1, characterized in that, The calculation of the cross-attention weights between any two types of feature vectors includes: Select any two feature vectors from multiple feature vectors, use one feature vector as the query, and the other feature vector as the key and value; Calculate the attention weight between the query and the key; The values are weighted and summed according to the attention weights to obtain the cross-attention output between the two types of feature vectors; Perform the above operation on all pairs of feature vectors of the two classes respectively to obtain the cross-attention output of each group; The interaction feature representation is obtained by fusing the cross-attention outputs of each group.
5. The method according to claim 1, characterized in that, The step of injecting the personalized parameters into the corresponding layer of the general emotional interaction base model based on the output of the dynamic gating routing network includes: Input the current input text into the general emotional interaction base model and obtain the semantic representation vector output by the first layer of the general emotional interaction base model; The semantic representation vector is input into the dynamic gated routing network to generate a gated matrix. Each row of the gated matrix corresponds to a layer of the general emotional interaction base model, and each element in each row corresponds to the injection intensity of each set of personalized parameters. Normalize each row of the gate matrix to obtain the injection strength weights of the personalized parameters for each layer and group; Based on the injection intensity weight of each group of personalized parameters in each layer, the personalized parameters of each group are injected into the corresponding layer of the general emotional interaction base model.
6. The method according to claim 5, characterized in that, Also includes: Obtain the injection strength weights of each layer of the general emotional interaction base model; When all injection strength weights in a certain layer are lower than the preset threshold, skip that layer and do not inject personalized parameters into it.
7. The method according to claim 1, characterized in that, Also includes: Collect incremental interaction data during online interaction; When the update conditions are met, the Fisher information matrix of each trainable parameter used to generate the personalized model instance is calculated for the historical task. The diagonal elements of the Fisher information matrix are used to characterize the importance of the corresponding parameter to the historical task. Apply stronger update constraints to parameters with high diagonal values in the Fisher information matrix.
8. The method according to claim 7, characterized in that, The incremental update employs an elastic weight consolidation mechanism, and the loss function is: L_update(θ) = L_new(θ) + (λ / 2) × Σ_i F_ii × (θ_i - θ_i*)² Where L_update(θ) is the total loss function during incremental update, L_new(θ) is the new task loss corresponding to the incremental interaction data, θ is the parameter before update, F_ii is the diagonal element of the Fisher information matrix, and λ is the global importance coefficient.
9. The method according to claim 1, characterized in that, The personalized parameters include one or more of the following parameters: response intensity modulation parameters, stylized control vectors, and long-range state tracking variables; The response intensity modulation parameter is used to modulate the model's response amplitude to the input content; the stylization control vector is used to control the style tendency of the model's output text; and the long-range state tracking variable is used to track the user's state changes during long-term interaction.
10. The method according to claim 1, characterized in that, The various types of traceability data include multiple types of the following: personal life cycle data, blood relationship data, acquired interpersonal data, and spatiotemporal background data.
11. A personalized emotion model generation device, characterized in that, include: The acquisition module is used to acquire multiple types of source data of the target user and extract the corresponding feature vectors for each. The representation module is used to input multiple types of feature vectors into the multi-head cross-attention fusion module, use each type of feature vector as an independent attention head, calculate the cross-attention weight between any two types of feature vectors, output the interaction feature representation, and generate personalized parameters exclusive to the target user based on the interaction feature representation. The generation module is used to input the semantic information of the current input text into a dynamic gated routing network. The output dimension of the dynamic gated routing network corresponds to the number of layers of the pre-trained general emotional interaction base model. Based on the output of the dynamic gated routing network, the personalized parameters are injected into the corresponding layer of the general emotional interaction base model to generate a personalized model instance in the current interaction scenario.
12. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the machine-readable instructions, when executed by the processor, perform the emotion model personalization generation method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the emotion model personalization generation method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
A data processing method and related apparatus
CN122757798A