Federal cross-domain information recommendation method, device, terminal equipment and medium
Through the federal cross-domain information recommendation method, the server aggregates the cross-domain sequence recommendation model of multiple local models, combined with the basic global model and encoder, the problems of poor robustness and insufficient personalization of the recommendation model in the existing technology are solved, and the problem of poor self-contained recommendation model is realized. More efficient recommendation effects and data privacy protection.
Patent Information
- Application Number
- CN202311548012.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-17
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2043-11-17
AI Technical Summary
The existing cross-domain recommendation method is established on private multi-domain sequence data, resulting in poor robustness and no personalization of the recommendation model. In addition, traditional sequence information recommendation is usually based on a single domain, and is prone to deviations and is not targeted.
Using the federal cross-domain information recommendation method, the pre-trained cross-domain sequence recommendation model is obtained through the server, and the user's interactive information is used to make recommendations. The model is aggregated by multiple local models, and each local model is trained locally on the client. , ensure data privacy, and trained through a combination of basic global models and encoders, compute prototype characterization and loss functions to improve model performance.
Improves the robustness and personalization of the recommendation model, ensures client data privacy, and improves the performance and quality of cross-domain sequence recommendation models through the aggregation of multiple local models.
Smart Images

Figure CN117573975B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information recommendation, and in particular to a method, device, terminal equipment and medium for recommending federated cross-domain information. Background Art
[0002] Sequential information recommendation technology can capture the historical behavior patterns of users. This technology is widely used in user information recommendation in e-commerce, social media, music, news and other fields. Traditional sequential information recommendation is usually based on a single field, that is, it usually only considers the user's behavior in one field, and this recommendation method is prone to deviation and is not targeted.
[0003] The cross-domain sequence recommendation technology proposes an important paradigm for cross-domain identification and transmission of valuable knowledge, which involves aspects such as transfer learning, knowledge graphs, and contrastive learning. At present, the existing cross-domain recommendation methods are built on private multi-domain sequence data, and default to a customized service for a data owner, that is, one end corresponds to one recommendation model, and the data set used for training is also limited to local circulation. This will result in poor robustness of the recommendation model and lack of personalization. Summary of the invention
[0004] The present invention provides a federal cross-domain information recommendation method, apparatus, terminal equipment and medium to solve the technical problem of how to improve the robustness and personalization of the recommendation model.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a federated cross-domain information recommendation method, which is applied to a client and includes:
[0006] Obtain the pre-trained cross-domain sequence recommendation model from the server;
[0007] Obtain user interaction information, input the interaction information into the cross-domain sequence recommendation model, and determine recommendations for the user based on the output of the cross-domain sequence recommendation model; wherein the interaction information includes interaction items and interaction fields; the cross-domain sequence recommendation model is obtained by the server aggregating multiple pre-trained local models; each local model corresponds to a client, and each local model is trained locally on the corresponding client.
[0008] As a preferred solution, the training process of the cross-domain sequence recommendation model includes:
[0009] Obtaining a basic global model from the server;
[0010] The basic global model is trained using a local sequence data set, and when a preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained; wherein the local sequence data set includes a plurality of sequence instances, each sequence instance includes the cross-domain behavior sequence data of the client and the behavior sequence data of at least two domains, and the cross-domain behavior sequence data merges the behavior sequence data of the at least two domains according to the time order of interaction;
[0011] The cross-domain sequential recommendation model is sent to the server, so that the server aggregates the cross-domain sequential recommendation models sent by each client, and obtains the trained cross-domain sequence recommendation model when a preset second convergence condition is met.
[0012] As a preferred solution, the local sequence data set is used to train the basic global model, and when the preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained, specifically:
[0013] Dividing the local sequence dataset into a training set, a validation set and a test set;
[0014] Performing data enhancement on the original user interaction sequence in the training set to obtain an enhanced sequence; and training the basic global model using the enhanced sequence and the original user interaction sequence;
[0015] The performance of the basic global model is verified through the validation set; and when the performance of the basic global model is improved compared with the previous training, the performance of the basic global model is tested through the test set; when the basic global model meets the preset performance conditions, the trained cross-domain sequential recommendation model is obtained.
[0016] As a preferred solution, the basic global model includes a first encoder, a second encoder and a third encoder; wherein the encoding mapping process of the first encoder includes:
[0017] G=GNN(E, I)→Z=Attention(G, s)→H=MLP(Z);
[0018] Wherein, GNN is a graph neural network, MLP is a multi-layer perceptron, Attention is a self-attention mechanism, E represents an embedding matrix of items in two domains, s is the cross-domain behavior sequence data, I∈{0,1} represents an item-item matrix in domain X and domain Y, and H is the output of the first encoder;
[0019] The encoding mapping process of the second encoder includes:
[0020] G X =GNN(E X ,IX )→Z X =Attention(G X ,s x )→H X =MLP(Z X );
[0021] Among them, E X represents the item embedding matrix in the X domain, I X ∈{0, 1} represents the item-item matrix in domain X, H x is the output of the second encoder;
[0022] The encoding mapping process of the third encoder includes:
[0023] G Y =GNN(E Y ,I Y )→Z Y =Attention(G Y ,s y )→H Y =MLP(Z Y );
[0024] Among them, E Y represents the item embedding matrix in the Y domain, I Y ∈{0, 1} represents the item-item matrix in the Y domain, H Y is the output of the third encoder.
[0025] As a preferred solution, the basic global model further includes a Matcher layer and a twin network, wherein the Matcher layer is used to perform a Mean operation on the outputs of the first encoder, the second encoder, and the third encoder to obtain a prototype representation of the user; and the twin network is used to calculate the contrast loss of the X domain and the Y domain respectively based on the prototype representation of the user through a gradient stopping strategy.
[0026] As a preferred solution, before obtaining the trained cross-domain sequential recommendation model, it also includes: calculating the prototype representation of the cross-domain sequential recommendation model and the prototype representation of the basic global model; calculating the cosine similarity loss between the prototype representation of the cross-domain sequential recommendation model and the prototype representation of the basic global model.
[0027] As a preferred solution, the prediction loss function of the basic global model is:
[0028]
[0029]
[0030] in, and is the unified domain prediction loss function, and is the single domain prediction loss function, and is the cross-domain prediction loss function.
[0031] Correspondingly, an embodiment of the present invention further provides a federated cross-domain information recommendation device, which is applied to a client. The information recommendation device includes a model acquisition module and a recommendation module; wherein:
[0032] The model acquisition module is used to obtain a pre-trained cross-domain sequence recommendation model from a server;
[0033] The recommendation module is used to obtain user interaction information, input the interaction information into the cross-domain sequence recommendation model, and determine the recommendation suggestions for the user based on the output of the cross-domain sequence recommendation model; wherein the interaction information includes interaction items and interaction fields; the cross-domain sequence recommendation model is obtained by the server aggregating multiple pre-trained local models; each local model corresponds to a client, and each local model is trained locally on the corresponding client.
[0034] Correspondingly, an embodiment of the present invention further provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the federal cross-domain information recommendation method when executing the computer program.
[0035] Correspondingly, an embodiment of the present invention further provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the federal cross-domain information recommendation method.
[0036] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0037] The embodiment of the present invention provides a method, apparatus, terminal device and medium for recommending information across federation domains, wherein the information recommendation method obtains a pre-trained cross-domain sequence recommendation model from a server, and determines the recommendation suggestions for the user through the user's interactive information. The model is obtained by aggregating multiple local models by the server, each local model corresponds to a client, and each local model is trained locally on the corresponding client. In this way, for the client, there is no need to upload local data to the server, and the cross-domain sequence recommendation model can be obtained through server training, and then the model is obtained from the server and applied, ensuring the data privacy of the client data owner. In addition, compared with the existing customized recommendation model, the cross-domain sequence recommendation model is obtained by aggregating multiple local models and each local model is trained locally on the corresponding client, which can effectively improve the performance and quality of the cross-domain sequence recommendation model. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 : A flow chart of an embodiment of the federal cross-domain information recommendation method provided by the present invention.
[0039] Figure 2 A conceptual identification diagram of an embodiment of the federated cross-domain information recommendation method provided by the present invention.
[0040] Figure 3 : A schematic diagram of the framework of an embodiment of the federal cross-domain information recommendation method provided by the present invention.
[0041] Figure 4 : A structural diagram of an embodiment of a basic global model or a cross-domain sequence recommendation model provided by the present invention.
[0042] Figure 5 : A schematic diagram for comparing the effects of an embodiment of the Food-Kitchen cross-domain scenario provided by the present invention.
[0043] Figure 6 : A schematic diagram for comparing the effects of an embodiment of the Movie-Book cross-domain scenario provided by the present invention.
[0044] Figure 7 : A schematic diagram for comparing the effects of an embodiment of the Entertainment-Education cross-domain scenario provided by the present invention.
[0045] Figure 8 : A schematic diagram of experimental results of an embodiment of the ablation experiment of the present invention on the Food-Kitchen dataset.
[0046] Fig. 9: A structural diagram of an embodiment of a federal cross-domain information recommendation device provided by the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Embodiment 1
[0049] Please refer to Figure 1 , Figure 1 A federated cross-domain information recommendation method provided in an embodiment of the present invention is applied to a client, and includes steps S1 to S2; wherein:
[0050] Step S1, obtaining a pre-trained cross-domain sequence recommendation model from a server.
[0051] Step S2, obtaining user interaction information, inputting the interaction information into the cross-domain sequence recommendation model, and determining recommendation suggestions for the user based on the output of the cross-domain sequence recommendation model; wherein the interaction information includes interaction items and interaction fields; the cross-domain sequence recommendation model is obtained by the server aggregating multiple pre-trained local models; each local model corresponds to a client, and each local model is trained locally on the corresponding client.
[0052] In this embodiment, the application scenario includes a (central) server and K clients, and each client can implement a federated cross-domain information recommendation method as described in steps S1 to S2. k For example, it has a local sequence dataset D k Each local sequence data set contains sequence data of the user in at least two fields (for example, when the number of fields is two, field X and field Y respectively).
[0053] Then D k Each sequence instance in can be represented as (s, s x ,s y ).
[0054] in, and represent the user behavior sequences in domain X and domain Y respectively, Indicates merging s in the order of interaction time x ,s yThe cross-domain behavior sequence of , i represents the interacting item.
[0055] In this embodiment, for privacy reasons, the server and the client mainly transmit model parameters, while the user's behavior data, data sets, etc. are stored locally on the client. The server does not need to access the data sets of each client, and the clients do not need to exchange data. The main concepts involved in this application are as follows Figure 2 shown.
[0056] As a preferred implementation, the training process of the cross-domain sequence recommendation model includes (refer to Figure 3 ):
[0057] The server randomly extracts some clients for this round of training according to a certain ratio. When the client of step S1 to step S2 is extracted, the client obtains the basic global model and the model parameters of the model from the server; wherein the basic global model may be the model after the previous round of training or a pre-set model;
[0058] The basic global model (local model) is trained using the local sequence data set, and when the preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained; wherein the local sequence data set includes a plurality of sequence instances, each sequence instance includes the cross-domain behavior sequence data of the client (for example, the above ) and behavioral sequence data from at least two fields (such as the above and ), the cross-domain behavior sequence data merges the behavior sequence data of the at least two domains according to the time sequence of interaction;
[0059] The cross-domain sequential recommendation model is sent to the server, so that the server aggregates the cross-domain sequential recommendation models sent by each client, and obtains the trained cross-domain sequence recommendation model (global model) when a preset second convergence condition is met.
[0060] Preferably, the basic global model is trained using the local sequence data set, and when a preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained, specifically:
[0061] Dividing the local sequence dataset into a training set, a validation set and a test set;
[0062] Performing data enhancement on the original user interaction sequence in the training set to obtain an enhanced sequence; using the enhanced sequence and the original user interaction sequence to train the basic global model; calculating three losses (main loss, contrastive loss and proximal loss) of the basic global model, and using back propagation to calculate the gradient of the model parameters, thereby updating the basic global model;
[0063] The performance of the basic global model is verified through the validation set; and when the performance of the basic global model is improved compared with the previous training, the performance of the basic global model is tested through the test set; when the basic global model meets the preset performance conditions, the trained cross-domain sequential recommendation model is obtained.
[0064] Preferably, please refer to Figure 4 ,This embodiment constructs three encoders for user modeling user representation.,The basic global model includes a first encoder (Unified-Encoder), a second encoder (Single-Encoder-X) and a third encoder (Single-Encoder-Y);
[0065] Each encoder includes an embedding layer, a graph neural network (GNN) module, and a self-attention module. These encoders are used to capture sequential data in different ways and extract meaningful representations. Among them, Unified-Encoder is used to combine information from domain X and domain Y, while Single-Encoder-X and Single-Encoder-Y focus on the encoding sequences in domain X and domain Y, respectively. Through the above three encoders, the basic global model can effectively capture rich features from the input data and provide more accurate predictions for sequence-related tasks. In addition, since each encoder has its corresponding hidden space, this embodiment uses a multi-layer perceptron (MLP) network as a projection layer to map the representations generated by different encoders to a common hidden space for easy comparison and fusion.
[0066] The encoding mapping process of the first encoder includes:
[0067] G=GNN(E, I)→Z=Attention(G, s)→H=MLP(Z);
[0068] Where GNN is a graph neural network, MLP is a multi-layer perceptron, Attention is a self-attention mechanism, E represents an item embedding matrix containing two domains, s is the cross-domain behavior sequence data, I∈{0,1} represents the item-item matrix of domain X and domain Y, H is the output of the first encoder and is the user cross-domain representation, d is the embedding dimension, L is the maximum length of the sequence, is the field of real numbers;
[0069] The encoding mapping process of the second encoder includes:
[0070] G X =GNN(E X ,I X )→Z X =Attention(G X ,s x )→H X =MLP(Z X );
[0071] Among them, E X represents the item embedding matrix in the X domain, I X ∈{0, 1} represents the item-item matrix in domain X, H x is the output of the second encoder and It is the representation of the user in the field of X;
[0072] The encoding mapping process of the third encoder includes:
[0073] G Y =GNN(E Y ,I Y )→Z Y =Attention(G Y ,s y )→H Y =MLP(Z Y );
[0074] Among them, E Y represents the item embedding matrix in the Y domain, I Y ∈{0, 1} represents the item-item matrix in the Y domain, H Y is the output of the third encoder.
[0075] In the real world, due to various unobservable external factors, the order of interaction between users and items or fields is flexible and changeable. Therefore, this embodiment also considers adjusting the encoder to reduce the dependence on the sequence order, so that the model has better generalization performance when encountering new items. First, a data enhancement strategy can be used to generate more user sequences:
[0076] where s, s x ,s y , respectively represent cross-domain sequences, interactive sequences in domain X, and interactive sequences in domain Y, represents the enhanced sequence, and β represents the ratio of Reorder. Secondly, the three enhanced sequences after passing through the three encoders are
[0077] Preferably, the basic global model also includes a Matcher layer and a twin network.
[0078] The Matcher layer is used to perform a Mean operation on the outputs of the first encoder, the second encoder, and the third encoder to obtain a prototype representation of the user. Specifically:
[0079] The Mean() operation is used to obtain four prototype representations of the user: in
[0080] Finally, the gradient stopping strategy (stopgrad) in the twin network is used to calculate the contrast loss in the X and Y fields respectively, where the contrast loss in the X field is: Where D represents the cosine similarity, p X =MLP(r X ),
[0081] Similarly, the contrast loss in the Y field can be obtained: where p Y =MLP(r Y ), That is, the twin network is used to calculate the contrast loss of the X field and the Y field respectively based on the prototype representation of the user through the gradient stopping strategy.
[0082] Preferably, the prediction tasks of the model mainly include three types: cross-domain prediction, single-domain prediction and unified-domain prediction.
[0083] The cross-domain prediction uses the cross-domain feature H+H X or H+H Y Make a prediction. If the next item in the cross-domain sequence belongs to domain X, then:
[0084] in and represents the cross-domain representation and single-domain representation at position p in the domain X, 1 is the number of rows of the feature matrix at position p, and W X represents the prediction layer parameters in the X domain. in represents the cross-domain representation and single-domain representation of position p in domain Y, W Y Represents the prediction layer parameters in the Y domain.
[0085] Single domain prediction uses single domain features H X and H Y Make predictions:
[0086]
[0087]
[0088] Unified domain prediction uses cross-domain features H for prediction:
[0089]
[0090]
[0091] The prediction loss function of the basic global model is calculated as follows:
[0092]
[0093]
[0094] in, and is the unified domain prediction loss function, and is the single domain prediction loss function, and is the cross-domain prediction loss function.
[0095] As a preferred implementation, when clients have an unbalanced sequence distribution in a federated setting, local models may overemphasize specific patterns or sequences that are more prevalent in their local data. As a result, it is difficult for local models to capture broader patterns or generalize well to unseen data. This leads to a degradation in the quality of the sequence representations learned by local models.
[0096] In view of the above problem, this preferred implementation further includes, before obtaining the trained cross-domain sequential recommendation model: calculating a prototype representation r of the cross-domain sequential recommendation model. X , r Y and the prototype representation of the underlying global model Calculate the cosine similarity loss between the prototype representation of the cross-domain sequential recommendation model and the prototype representation of the basic global model
[0097] The implementation mode of the present application is implemented by calculating the cosine similarity loss and controlling the drift to bridge the gap between the representations learned by the local and global models, thereby ensuring the overall performance and generalization capability of the system (including the server and each client). This implementation mode adds a lightweight neighboring term in the local training phase to reduce the representation distance between the local model and the global model. This can effectively solve the technical problem that in the cross-domain sequential recommendation scenario, the local model is trained on a skewed sequence subset, and due to the skewed local sequence distribution, the local training phase may cause the model to learn a worse sequence representation.
[0098] In addition, this embodiment also provides experimental verification of the technical solution, and verifies the effectiveness and feasibility of the Federated Cross-Domain Sequence Recommendation (FedCSR) of this embodiment through performance verification and ablation experiments.
[0099] Specifically, this embodiment uses Mean Reciprocal Rank (MRR), Hit Ratio (HR) and Normalized Discounted Cumulative Gain (NDCG) as evaluation indicators of the model, and verifies whether the performance of the model on the validation set is improved based on the sum of the MRR indicators in the two fields. If the effect on the validation set is improved, the test set is used for testing, and the results of the test set are used as the evaluation of the model performance.
[0100] In addition, three groups of comparison methods are set up to verify the effect of FedCSR, namely sequence recommendation (FedTiSASRec, FedCLSR), cross-domain recommendation (FedCoNet, FedCCDR) and cross-domain sequence recommendation (Fedπ-Net, FedPSJNet, FedMIFN, FedC 2 DSR).
[0101] In order to improve the fairness of the comparison, the same federated learning parameters are set for the FedCSR method of this embodiment and all baseline methods. The verification of this embodiment sets ten clients and 150 rounds of training, 3 local epochs for each client, sets the early stopping parameter to 20, and the data partitioning between clients follows the Dirichlet distribution. The batch size is set to 256, the dropout ratio is selected from {0.1, 0.2, 0.3}, the learning rate is selected from {0.001, 0.0005, 0.0001}, the weight of multi-task learning is set to {0.5, 0.5, 1.5}, the data enhancement ratio β is selected from {0.4, 0.6, 0.8}, and the Adam optimizer is used to update the model parameters. For other baseline methods, we set the optimal parameters according to the parameter recommendations in their original methods.
[0102] The verification environment of this experiment is based on the PyTorch framework (1.8.1+cu11), and the device environment is Tesla V100and Intel(R)Xeon(R)Platinum 8268CPU@2.90GHz. Extensive experiments were conducted on three real-world cross-domain datasets (Food-Kitchen, Movie-Book, Entertainment-Education). The experimental results are as follows Figures 5 to 7 The results show that the performance of the federated cross-domain information recommendation method of this embodiment is better than other baseline models.
[0103] In addition, this embodiment also conducts an ablation experiment to verify the influence of the cross-domain sequence recommendation model and proximal terms included in this embodiment. Specifically, the experiment is mainly conducted on the Food-Kitchen dataset to analyze the contribution of each component such as the cross-domain sequence recommendation model (expressed as CLCSR) and the proximal term (expressed as proximal term). The experimental results are shown in Figure 2. Figure 8 As shown, Figure 8 It can be seen that the cross-domain sequence recommendation model and proximal items provided in this embodiment play an important role in the final performance improvement.
[0104] Accordingly, refer to Fig. 9 The embodiment of the present invention also provides a federated cross-domain information recommendation device, which is applied to a client. The information recommendation device includes a model acquisition module 101 and a recommendation module 102; wherein,
[0105] The model acquisition module 101 is used to obtain a pre-trained cross-domain sequence recommendation model from a server;
[0106] The recommendation module 102 is used to obtain user interaction information, input the interaction information into the cross-domain sequence recommendation model, and determine the recommendation suggestions for the user based on the output of the cross-domain sequence recommendation model; wherein the interaction information includes interaction items and interaction fields; the cross-domain sequence recommendation model is obtained by the server aggregating multiple pre-trained local models; each local model corresponds to a client, and each local model is trained locally on the corresponding client.
[0107] As a preferred implementation, the information recommendation device further includes a model training module, and the training process of the cross-domain sequence recommendation model includes:
[0108] The model training module obtains a basic global model from the server;
[0109] The basic global model is trained using a local sequence data set, and when a preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained; wherein the local sequence data set includes a plurality of sequence instances, each sequence instance includes the cross-domain behavior sequence data of the client and the behavior sequence data of at least two domains, and the cross-domain behavior sequence data merges the behavior sequence data of the at least two domains according to the time order of interaction;
[0110] The cross-domain sequential recommendation model is sent to the server, so that the server aggregates the cross-domain sequential recommendation models sent by each client, and obtains the trained cross-domain sequence recommendation model when a preset second convergence condition is met.
[0111] As a preferred implementation, the model training module uses a local sequence data set to train the basic global model, and when a preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained, specifically:
[0112] The model training module divides the local sequence data set into a training set, a validation set and a test set;
[0113] Performing data enhancement on the original user interaction sequence in the training set to obtain an enhanced sequence; and training the basic global model using the enhanced sequence and the original user interaction sequence;
[0114] The performance of the basic global model is verified through the validation set; and when the performance of the basic global model is improved compared with the previous training, the performance of the basic global model is tested through the test set; when the basic global model meets the preset performance conditions, the trained cross-domain sequential recommendation model is obtained.
[0115] As a preferred implementation, the basic global model includes a first encoder, a second encoder and a third encoder; wherein the encoding mapping process of the first encoder includes:
[0116] G=GNN(E, I)→Z=Attention(G, s)→H=MLP(Z);
[0117] Wherein, GNN is a graph neural network, MLP is a multi-layer perceptron, Attention is a self-attention mechanism, E represents an embedding matrix of items in two domains, s is the cross-domain behavior sequence data, I∈{0,1} represents an item-item matrix in domain X and domain Y, and H is the output of the first encoder;
[0118] The encoding mapping process of the second encoder includes:
[0119] G X =GNN(E X ,I X )→Z X =Attention(G X ,s x )→H X =MLP(Z X );
[0120] Among them, E X represents the item embedding matrix in the X domain, I X ∈{0, 1} represents the item-item matrix in domain X, H x is the output of the second encoder;
[0121] The encoding mapping process of the third encoder includes:
[0122] G Y =GNN(E Y ,I Y )→Z Y =Attention(G Y s y )→H Y =MLP(Z Y );
[0123] Among them, E Y represents the item embedding matrix in the Y domain, I Y ∈{0, 1} represents the item-item matrix in the Y domain, H Y is the output of the third encoder.
[0124] As a preferred implementation, the basic global model further includes a Matcher layer and a twin network, wherein the Matcher layer is used to perform a Mean operation on the outputs of the first encoder, the second encoder, and the third encoder to obtain a prototype representation of the user; and the twin network is used to calculate the contrast loss of the X domain and the Y domain respectively based on the prototype representation of the user through a gradient stopping strategy.
[0125] As a preferred implementation, before obtaining the trained cross-domain sequential recommendation model, it also includes: calculating the prototype representation of the cross-domain sequential recommendation model and the prototype representation of the basic global model; calculating the cosine similarity loss between the prototype representation of the cross-domain sequential recommendation model and the prototype representation of the basic global model.
[0126] As a preferred implementation, the prediction loss function of the basic global model is:
[0127]
[0128]
[0129] in, and is the unified domain prediction loss function, and is the single domain prediction loss function, and is the cross-domain prediction loss function.
[0130] Correspondingly, an embodiment of the present invention further provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the federal cross-domain information recommendation method when executing the computer program.
[0131] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal, and various interfaces and lines are used to connect various parts of the entire terminal.
[0132] The memory can be used to store the computer program, and the processor realizes various functions of the terminal by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0133] Correspondingly, an embodiment of the present invention further provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the federal cross-domain information recommendation method.
[0134] Wherein, if the module integrated in the federal cross-domain information recommendation device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium.
[0135] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0136] The embodiment of the present invention provides a method, apparatus, terminal device and medium for recommending information across federation domains, wherein the information recommendation method obtains a pre-trained cross-domain sequence recommendation model from a server, and determines the recommendation suggestions for the user through the user's interactive information. The model is obtained by aggregating multiple local models by the server, each local model corresponds to a client, and each local model is trained locally on the corresponding client. In this way, for the client, there is no need to upload local data to the server, and the cross-domain sequence recommendation model can be obtained through server training, and then the model is obtained from the server and applied, ensuring the data privacy of the client data owner. In addition, compared with the existing customized recommendation model, the cross-domain sequence recommendation model is obtained by aggregating multiple local models and each local model is trained locally on the corresponding client, which can effectively improve the performance and quality of the cross-domain sequence recommendation model.
[0137] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A federated cross-domain information recommendation method, characterized in that: Applied to the client, including: Obtain the pre-trained cross-domain sequence recommendation model from the server; Obtaining user interaction information, inputting the interaction information into the cross-domain sequence recommendation model, and determining recommendations for the user based on the output of the cross-domain sequence recommendation model; wherein the interaction information includes interaction items and interaction fields; the cross-domain sequence recommendation model is obtained by the server aggregating multiple pre-trained local models; each local model corresponds to a client, and each local model is trained locally on the corresponding client; The training process of the cross-domain sequence recommendation model includes: Obtaining a basic global model from the server; The basic global model is trained using a local sequence data set, and when a preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained; wherein the local sequence data set includes a plurality of sequence instances, each sequence instance includes the cross-domain behavior sequence data of the client and the behavior sequence data of at least two domains, and the cross-domain behavior sequence data merges the behavior sequence data of the at least two domains according to the time order of interaction; Sending the cross-domain sequential recommendation model to the server, so that the server aggregates the cross-domain sequential recommendation models sent by each client, and obtains the trained cross-domain sequence recommendation model when a preset second convergence condition is met; The basic global model includes a first encoder, a second encoder and a third encoder; wherein the encoding mapping process of the first encoder includes: ; Among them, GNN is a graph neural network, MLP is a multi-layer perceptron, and Attention is a self-attention mechanism. represents the item embedding matrix containing two domains, s is the cross-domain behavior sequence data, represents the item-item matrix of domain X and domain Y, and H is the output of the first encoder; The encoding mapping process of the second encoder includes: ; in, express The item embedding matrix of the domain, express The item-item matrix of the domain, H x is the output of the second encoder; The encoding mapping process of the third encoder includes: ; in, express The item embedding matrix of the domain, express The item-item matrix of the domain, H Y is the output of the third encoder; The basic global model also includes a Matcher layer and a twin network. The Matcher layer is used to perform a Mean operation on the outputs of the first encoder, the second encoder, and the third encoder to obtain a prototype representation of the user; the twin network is used to calculate the contrast loss of the X domain and the Y domain respectively based on the prototype representation of the user through a gradient stopping strategy.
2. A method for recommending federated cross-domain information as claimed in claim 1, characterized in that: The basic global model is trained by using the local sequence data set, and when the preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained, specifically: Dividing the local sequence dataset into a training set, a validation set and a test set; Performing data enhancement on the original user interaction sequence in the training set to obtain an enhanced sequence; Using the enhanced sequence and the original user interaction sequence, training the basic global model; The performance of the basic global model is verified through the validation set; and when the performance of the basic global model is improved compared with the previous training, the performance of the basic global model is tested through the test set; when the basic global model meets the preset performance conditions, the trained cross-domain sequential recommendation model is obtained.
3. A method for recommending federated cross-domain information as claimed in claim 1, characterized in that: Before obtaining the trained cross-domain sequential recommendation model, it also includes: calculating the prototype representation of the cross-domain sequential recommendation model and the prototype representation of the basic global model; calculating the cosine similarity loss between the prototype representation of the cross-domain sequential recommendation model and the prototype representation of the basic global model.
4. A method for recommending federated cross-domain information as claimed in claim 1, characterized in that: The prediction loss function of the basic global model is: ; ; in, and is the unified domain prediction loss function, and is the single domain prediction loss function, and is the cross-domain prediction loss function.
5. A federated cross-domain information recommendation device, characterized in that: Applied to the client, the information recommendation device includes a model acquisition module and a recommendation module; wherein, The model acquisition module is used to obtain a pre-trained cross-domain sequence recommendation model from a server; The recommendation module is used to obtain user interaction information, input the interaction information into the cross-domain sequence recommendation model, and determine the recommendation suggestions for the user based on the output of the cross-domain sequence recommendation model; wherein the interaction information includes interaction items and interaction fields; the cross-domain sequence recommendation model is obtained by the server aggregating multiple pre-trained local models; each local model corresponds to a client, and each local model is trained locally on the corresponding client; The information recommendation device further includes a model training module, and the training process of the cross-domain sequence recommendation model includes: The model training module obtains a basic global model from the server; The basic global model is trained using a local sequence data set, and when a preset first convergence condition is met, a trained cross-domain sequential recommendation model is obtained; wherein the local sequence data set includes a plurality of sequence instances, each sequence instance includes the cross-domain behavior sequence data of the client and the behavior sequence data of at least two domains, and the cross-domain behavior sequence data merges the behavior sequence data of the at least two domains according to the time order of interaction; Sending the cross-domain sequential recommendation model to the server, so that the server aggregates the cross-domain sequential recommendation models sent by each client, and obtains the trained cross-domain sequence recommendation model when a preset second convergence condition is met; The basic global model includes a first encoder, a second encoder and a third encoder; wherein the encoding mapping process of the first encoder includes: ; Among them, GNN is a graph neural network, MLP is a multi-layer perceptron, and Attention is a self-attention mechanism. represents the item embedding matrix containing two domains, s is the cross-domain behavior sequence data, represents the item-item matrix of domain X and domain Y, and H is the output of the first encoder; The encoding mapping process of the second encoder includes: ; in, express The item embedding matrix of the domain, express The item-item matrix of the domain, H x is the output of the second encoder; The encoding mapping process of the third encoder includes: ; in, express The item embedding matrix of the domain, express The item-item matrix of the domain, H Y is the output of the third encoder; The basic global model also includes a Matcher layer and a twin network. The Matcher layer is used to perform a Mean operation on the outputs of the first encoder, the second encoder, and the third encoder to obtain a prototype representation of the user; the twin network is used to calculate the contrast loss of the X domain and the Y domain respectively based on the prototype representation of the user through a gradient stopping strategy.
6. A terminal device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the federated cross-domain information recommendation method as described in any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the federated cross-domain information recommendation method according to any one of claims 1 to 4.
