Federal training method, device and storage medium of terminal recommendation model
By employing a federated learning approach that combines cloud-based pre-training and self-supervised knowledge distillation, we address the issues of low accuracy and data sparsity in recommendation model training under resource-constrained terminal devices. This approach achieves stronger generalization capabilities and personalized recommendations while reducing communication overhead.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2026-03-24
AI Technical Summary
Given the limited resources of terminal devices, how can we achieve more accurate and lightweight recommendation model training while protecting user privacy, and solve the problem of low recommendation accuracy caused by data sparsity?
The federated learning approach is adopted to build teacher and student models in the cloud. The student model is pre-trained using historical datasets in the cloud, and the parameters of the global model are enhanced through self-supervised knowledge distillation and knowledge distillation. The model is then federated and trained using local datasets, with the local model parameters updated round by round.
It improves the generalization and personalized recommendation capabilities of the recommendation model, reduces the low accuracy problem caused by data sparsity, and reduces the communication overhead during training.
Smart Images

Figure CN117150122B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure belongs to the technical field of data processing, and particularly relates to a federated training method, device and storage medium of a terminal recommendation model. BACKGROUND
[0002] A recommendation system is an information filtering system, aiming to predict user preferences and interests and provide personalized recommendations to users in real time. Recommendation systems are widely used in e-commerce, advertising, music, movies and other fields. Federated recommendation system is a distributed machine learning framework that combines federated learning with recommendation system, which can accurately provide personalized recommendations to users while protecting user recommendation data privacy. With the development of terminal miniaturization and intelligence, end-to-end recommendation systems have received more and more attention in recent years. However, due to the limitation of computing resources on terminals (such as smartphones), many applications on terminals such as Taobao, Douban and TikTok have strong restrictions on the size of recommendation models, and hope to use smaller models to provide more accurate recommendations to users.
[0003] In the current era of attaching great importance to data privacy protection, federated learning as a new distributed machine learning paradigm not only reduces the risk of data privacy leakage but also reduces the cost of data transmission and breaks the limitation of data silos. However, it is crucial to implement a more accurate and lightweight federated training method of terminal recommendation model and allow users participating in federated recommendation to accurately obtain recommendation suggestions on resource-constrained terminals. SUMMARY
[0004] The present disclosure aims to at least solve one of the technical problems existing in the prior art.
[0005] To this end, the first aspect of the present disclosure provides a federated training method of a terminal recommendation model, which can provide a lightweight recommendation model with stronger generalization ability while protecting user privacy and reducing the problem of low accuracy caused by data sparsity in federated recommendation. The federated training method comprises:
[0006] Step S1, constructing a teacher model and a student model on the cloud, pre-training the teacher model and the student model using a historical data set on the cloud, and sending the pre-trained student model to a plurality of terminals participating in federated training;
[0007] Step S2, each terminal respectively performs first-round federated training on the pre-trained student model using a local data set to obtain a first-round local student model;
[0008] Step S3, each terminal sends the parameters of the current-round local student model to the cloud, and the cloud aggregates the parameters of all current-round local student models to obtain a current-round global model and its parameters;
[0009] Step S4, parameters of the current round global model are enhanced in a self-supervised knowledge distillation manner by using the teacher model and the historical data set in the cloud, to obtain enhanced parameters of the current round global model, and the enhanced parameters of the current round global model are sent to each terminal to update parameters of the local student model of each terminal;
[0010] Step S5, the training round is incremented by 1, and each terminal performs federated training on the current round local student model using its own local data set, and returns to step S3 until the training round reaches the upper limit of the iteration round number.
[0011] In some embodiments, the input data of the teacher model and the student model is a sequence of goods clicked by a user at a historical time, and the output data is a prediction result of an order of each good in a to-be-ordered good set clicked by the user at a next time according to the input data and the to-be-ordered good set.
[0012] In some embodiments, the teacher model and the student model are pre-trained, and a cross-entropy loss function is used when the student model is first round federated training.
[0013] In some embodiments, the parameters of the current round global model are calculated according to the following formula:
[0014]
[0015] Wherein, N represents the number of terminals participating in federated training in the current round, D u represents a local data set composed of local recommendation data owned by terminal u, represents the parameters of the current round local student model trained by terminal u using the local data set, represents the parameters of the current round global model obtained by the cloud after parameter aggregation, and τ represents the current round of federated training.
[0016] In some embodiments, the loss function used when the parameters of the current round global model are enhanced in a self-supervised knowledge distillation manner by using the teacher model and the historical data set in the cloud is L τ , and the calculation formula is as follows:
[0017]
[0018]
[0019]
[0020]
[0021]
[0022] wherein,
[0023] is the cross-entropy loss function adopted by the current round τ training, and is the total number of samples contained in the historical data set, M is the total number of commodity categories contained in each sample in the historical data set, Y i,m is the true label of the mth commodity category of the ith sample x i in the historical data set, represents the prediction probability of the mth commodity category of the ith sample x i in the historical data set by the current round global model;
[0024] is the knowledge distillation loss function adopted by the current round τ training, which is used to train the recognition ability of the current round global model for different commodity categories, and represents the output probability of the vth commodity by the current round teacher model, represents the output probability of the vth commodity by the current round global model;
[0025] is the self-supervised knowledge distillation loss function adopted by the current round τ training, which is used to make the output of the global model closer to the teacher model, and λ SSKD is the SSKD coefficient, respectively, are the representations obtained by inputting the samples x h in the historical data set D i to the current round teacher model and the current round global model respectively, respectively, are the representations obtained by inputting the samples x h in the historical data set D j to the current round teacher model and the current round global model respectively, j≠i, ψ(·) is an introduced intermediate function, and E(·) is a function for calculating expectation, is a function for calculating the KL divergence between and , and is a temperature coefficient.
[0026] In some embodiments, in step S5, the parameters of the current round local student model are guided based on the self-supervised contrast distillation method using the parameters of the last round local student model, so as to improve the personalization effect of the current round local student model.
[0027] In some embodiments, the loss function adopted in step S5 is:
[0028]
[0029]
[0030] wherein, is the representation obtained by inputting the sample u in the local data set D to the personalized trained local student model of the terminal u at the τth round of training; is the representation obtained by inputting the sample u in the local data set D to the model corresponding to the parameters of the current round enhanced global model received by the terminal u at the τth round of training; is the representation obtained by inputting the sample u in the local data set D to the model corresponding to the parameters of the enhanced global model received by the terminal u at the last round of training; ψ(·) is an introduced intermediate function, and E(·) is a function for calculating expectation, is a function for calculating the KL divergence between and , is a temperature coefficient; is a cross-entropy loss function used when training the current round τ local student model by using the local data set D u .
[0031] The second aspect of the present disclosure provides a device for federated training of a terminal recommendation model, comprising:
[0032] a pre-training module configured to construct a teacher model and a student model in the cloud, pre-train the teacher model and the student model by using a historical data set in the cloud, and send the pre-trained student model to a plurality of terminals participating in federated training;
[0033] a first round of federated training module configured to perform first round of federated training on the pre-trained student model by using a local data set in each terminal, to obtain a first round of local student model;
[0034] an aggregation module configured to make each terminal send the parameters of the current round of local student model to the cloud, and aggregate the parameters of all current round of local student models in the cloud to obtain a current round of global model and its parameters;
[0035] an enhancement module configured to perform parameter enhancement on the parameters of the current round of global model by using the teacher model and the historical data set in the cloud in a self-supervised distillation and knowledge distillation manner, to obtain enhanced parameters of the current round of global model, and send the enhanced parameters of the current round of global model to each terminal to update the parameters of the local student model of each terminal;
[0036] The local training module is configured to start federated training of the current round of local student models by the terminals using respective local data sets from the second round of federated training.
[0037] In some embodiments, the local training module is further configured to guide the parameters of the current round of local student models based on a self-supervised contrast distillation method using the parameters of the last round of local student models to improve the personalization effect of the current round of local student models.
[0038] The third aspect of the present disclosure provides a computer-readable storage medium storing computer instructions for causing the computer to perform the federated training method of the terminal recommendation model according to any one of the embodiments of the first aspect of the present disclosure.
[0039] The federated training method of the terminal recommendation model provided by the embodiments of the present disclosure has the following characteristics and beneficial effects:
[0040] 1. Under the premise of sparse user recommendation data and limited resources, the global model of federated learning is guided by the teacher model and historical data in the cloud, which can provide a lightweight recommendation model with stronger generalization ability while protecting privacy, thereby reducing the problem of low accuracy caused by data sparseness in federated recommendation.
[0041] 2. The parameter enhancement method adopted by the present disclosure uses the teacher model in the cloud to assist the global model in training in the historical data set in the cloud after each parameter aggregation of federated learning, which improves the convergence speed and upper limit of the global model, thereby improving the upper limit of the capability of the lightweight recommendation model deployed locally, and greatly reducing the communication overhead of the terminal device when the training reaches the set precision.
[0042] 3. The present disclosure uses a personalization algorithm to enable the user to use the training results of the last round to help the current round of training quickly find the gradient descent direction and speed up the gradient descent speed when training with local data, thereby achieving better personalized recommendation capability. BRIEF DESCRIPTION OF DRAWINGS
[0043] Figure 1 is an architecture schematic diagram of the federated training method of the terminal recommendation model provided by the first aspect of the present disclosure;
[0044] Figure 2 is a flowchart of the federated training method of the terminal recommendation model provided by the first aspect of the present disclosure;
[0045] Figure 3 is a comparison chart of the recommendation accuracy of the terminal recommendation model obtained according to one specific embodiment of the first aspect of the present disclosure and the recommendation model obtained by the existing federated training method.
[0046] Figure 4 is a comparison chart of recommendation accuracy of a terminal recommendation model obtained according to one specific embodiment of the first aspect of the present disclosure and a recommendation model obtained by an existing federated training method in terms of personalization;
[0047] Figure 5 is a comparison chart of communication overhead of a federated training method according to one specific embodiment of the first aspect of the present disclosure and an existing federated training method;
[0048] Figure 6 is a structural schematic diagram of an electronic device provided by the third aspect of the present disclosure. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0050] On the contrary, the present application covers any alternative, modification, equivalent method and solution made on the essence and scope of the present application as defined by the claims. Further, in order to make the public better understand the present application, some specific details are described in detail in the following detailed description of the present application. The present application can also be completely understood without the description of these details by those skilled in the art.
[0051] As a new distributed machine learning paradigm, federated learning not only reduces the risk of data privacy leakage, but also reduces the overhead of data transmission and breaks the limitation of data silos. However, combining federated learning and recommendation system needs to face the following three problems:
[0052] Firstly, in the field of recommendation system, there is often a scenario that the number of user clicks on a product is small, but the total number of products is large. In such a scenario, the accuracy of the recommendation model for not recommending products is as high as 90%, which will make the user experience poor. This problem in the field of recommendation system is called sparsity of recommendation data.
[0053] Secondly, the protection of data privacy by federated learning makes it impossible for users to exchange data, and the local data of each user is relatively small. The recommendation model trained by local data cannot achieve accurate product recommendation for users.
[0054] Thirdly, the computing resources and storage resources of the terminal devices used by users participating in federated recommendation are limited. How to deploy a lightweight recommendation model in the case of limited user resources to accurately recommend products for users is an urgent problem.
[0055] Therefore, the application aims to optimize the training of a federated recommendation model from the perspective of improving the recommendation accuracy due to data sparsity.
[0056] Referring to Figure 1 , Figure 2 The federated training method of the terminal recommendation model provided by the first aspect of the present disclosure comprises the following steps:
[0057] Step S1, constructing a teacher model and a student model in the cloud, and using a historical data set D h The teacher model and the student model are pre-trained, and the pre-trained student model is sent to multiple terminals participating in the federated training;
[0058] Step S2, each terminal respectively uses a local data set D u The pre-trained student model is subjected to a first round of federated training to obtain a first round of local student model;
[0059] Step S3, each terminal sends the parameters of the current round of local student model to the cloud, and the cloud aggregates the parameters of all current round of local student model to obtain a current round of global model and its parameters;
[0060] Step S4, using the teacher model and the historical data set D h The parameters of the current round of global model are enhanced in a self-supervised knowledge distillation (SSKD) manner to obtain enhanced parameters of the current round of global model, and the enhanced parameters of the current round of global model are sent to each terminal to update the parameters of the local student model of each terminal;
[0061] Step S5, let the training round be incremented by 1, each terminal uses its own local data set to federatedly train the current round of local student model, and returns to step S3 until the training round reaches the upper limit of the iteration round number.
[0062] Figure 1 An architecture diagram of a system involved in a federated training method of a terminal recommendation model according to one embodiment of the present disclosure is shown, which specifically comprises a cloud and multiple terminals. The cloud can adopt a cloud server, which has abundant resources, and stores a historical data set D h in the cloud, and is provided with a teacher model M t which requires more computing resources, and a student model M s which is lightweight and suitable for deployment on a terminal, and the historical data set D hD h is composed of the data collected by the cloud before the privacy protection regulations (including the Data Security Law, the Regulations on the Protection of Critical Information Infrastructure, and the Personal Information Protection Law) are issued. In this paper, D u is composed of the data of the first 3000 users. Each terminal is used to provide recommendation results for an individual user, and each terminal stores the local data set D u of its user, and the data held by each terminal is not shared with other terminals participating in model training. Specifically, the local data set D t is composed of the recommendation data of the user locally after the privacy protection regulations are issued.
[0063] Further, the teacher model M s and the student model M t can adopt any model suitable for sequence recommendation, such as the Bert model (Bert4Rec). The difference between the two is that the dimensions of the embedding layers in the teacher model M s and the student model M t are different. The higher the dimension of the embedding layer indicates that the model can better distinguish the embedding layer of the item, thereby achieving better recommendation results, but the higher the dimension of the embedding layer, the larger the size of the model, which is not conducive to terminal deployment. In an embodiment of the present application, the teacher model M s and the student model M t both adopt the Bert model, the dimension of the embedding layer of the teacher model M s is 512, and the dimension of the embedding layer of the student model M t is 32.
[0064] In an embodiment of the present application, after the teacher model M s and the student model M h are constructed in the cloud in step S1, the teacher model and the student model need to be pre-trained using the historical data set D u of the cloud. In the pre-training phase, the teacher model and the student model use the same training method, and the teacher model and the student model in the pre-training phase are collectively referred to as the initial model. The upper limit of the number of iterations for pre-training is set to 1000 rounds. In each round of iterative training in the pre-training, the input data input of the initial model is the sequence S T-1 ={itemid1, itemid2,..., itemid T-1} clicked by the user u at time 0-T-1, and the output data of the initial model is the set of items clicked by the user u at time T obtained according to the sequence S u and the set of items to be sorted . The prediction result of each commodity sequence is used to calculate a loss value by using a cross-entropy loss function, and then the initial model is back propagated according to the loss value to update the network parameters of the initial model. The above pre-training process is repeatedly performed until the pre-training round number reaches the upper limit of the iteration round number of pre-training, and a pre-trained teacher model and a student model are obtained. The cloud sends the pre-trained student model to the terminals of the users participating in federated training and deploys the student model.
[0065] In an embodiment of the present application, in step S2, after receiving the pre-trained student model sent by the cloud, the terminal u of the user uses the local data set D u The respective pre-trained student models are subjected to the first round of federated training to obtain the current round local student model. In the first round of federated training, the terminals participating in federated training train the respective pre-trained student models by using the local recommendation data, wherein the loss function and the model parameter updating method used are consistent with those in the pre-training process, which will not be described herein again.
[0066] In an embodiment of the present application, in step S3, when the terminal u of the user trains the local student model by using the local data set D u After the respective local student models are trained, the terminal u sends the parameters of the current round local student model to the cloud, and the cloud aggregates the parameters of all the current round local student models received to obtain a current round global model, wherein the parameters of the current round global model are denoted as The following formula is used to calculate the parameters of the current round global model:
[0067]
[0068] wherein N represents the number of terminals participating in federated learning training in the current round, D u represents the local data set composed of the local recommendation data possessed by the terminal u, represents the parameters of the current round local student model trained by the terminal u by using the local data set, represents the parameters of the current round global model obtained by the cloud after parameter aggregation, and τ represents the current round of federated training.
[0069] In an embodiment of the present application, considering that the local recommendation data has strong sparsity, the global model obtained after aggregation cannot accurately determine the preferences of users and may recommend unsatisfactory commodities to users. Therefore, it is also necessary to enable the global model after aggregation to have better generalization capability. In step S4 of the embodiment of the present application, the teacher model M t pre-trained before and the historical data set D h are used to enhance the parameters of the current round global model by using the SSKD to obtain the enhanced parameters of the current round global model The loss function used in parameter augmentation considers three factors. Let L be the loss function used in the current round of parameter augmentation. τ The calculation formula is as follows:
[0070]
[0071]
[0072]
[0073]
[0074]
[0075] in,
[0076] Utilizing historical datasets in the cloud D h The cross-entropy loss function used when training the global model for the current round τ. Historical dataset D stored in the cloud h The total number of samples contained in the dataset, M is the total number of product categories contained in each sample in the historical dataset, and Y is the total number of samples contained in the dataset. i,m Represents the i-th sample x in the historical dataset i The real label of the m-th product category, This indicates that the current round of the global model is working on the i-th sample x in the historical dataset. i The predicted probability of the m-th product category.
[0077] The loss function used to perform knowledge distillation on the current round's global model using the teacher model is denoted as the knowledge distillation loss function used in the current round's training, τ. This loss function is used to train the current round's global model's ability to recognize different product categories. Specifically, for the historical dataset D... h Each sample x in i This improves the global model's ability to identify different product categories. Loss function middle, This represents the output probability of the teacher model for the v-th item in the current round. This represents the output probability of the global model for the v-th product category in the current round. Since the global model lacks strong ability to identify each product category individually, a loss function is used. By leveraging a powerful teacher model to guide the global model, the global model's ability to identify each type of product becomes closer to that of the teacher model.
[0078] Let λ be the loss function used when enhancing the parameters of the global model in the current round through SSKD training. Let λ be the self-supervised knowledge distillation loss function used in the current round of training (τ). SSKD is the coefficient of SSKD. Through experiments, the effect is optimal when it is set to 50. The historical dataset D is used for the current round of training τ. h Data x in i Input into the current round of teacher model respectively and global model The subsequent characterization, The historical dataset D is respectively h Sample x in j The representations obtained after inputting into the current round teacher model and the current round global model respectively, j≠i; ψ(·) is an introduced intermediate function used to calculate the representations of the teacher model and the global model for the same input sample x. i The output is the KL divergence, and D(·) is the function used to calculate the expectation. For use in calculation and The function of the KL divergence between them In this embodiment, the temperature coefficient is used. We set the value to 0.5. The purpose of parameter augmentation using SSKD is to make the output of the global model closer to the teacher model, thereby enabling the global model to learn more knowledge from the teacher model and achieve better generalization ability by imitating the teacher model.
[0079] Once the terminal receives the enhanced parameters of the current round global model sent from the cloud. Then, this parameter is used to replace the parameters of the local student model on the terminal. This allows for the updating of local student model parameters in the terminal.
[0080] Furthermore, after step S4, the enhanced global model for the current round is still far from sufficient to handle the personalized capabilities of the recommendation system for each user, and because the historical dataset on the cloud is not time-sensitive (i.e., the historical dataset is not updated in this disclosure), it cannot meet the user's needs in real time. Therefore, in order to improve the personalized capabilities for each user, the federated training method provided in the first aspect of this disclosure adopts a personalized training method based on self-supervised contrastive distillation (SCD) in the local training performed in step S5, and the specific implementation process is as follows:
[0081] The terminal receives the parameters of the enhanced global model for the second time. Then, i.e., τ≥2, for any terminal u, using the local dataset D uparameters of the enhanced current round global model The local student model is personalized trained, and the loss function used for the local personalized training of the terminal u is The specific formula is as follows:
[0082]
[0083] wherein, is the representation obtained by inputting the sample u in the local data set D to the personalized trained local student model of the terminal u (i.e. the local student model expected to be obtained in the current round) in the τth round of training; is the representation obtained by inputting the sample u in the local data set D to the model corresponding to the parameters of the enhanced global model of the current round received by the terminal u in the τth round of training; is the representation obtained by inputting the sample u in the local data set D to the model corresponding to the parameters of the enhanced global model received by the terminal u in the last round of training (τ-1th round) after the end of the last round of training, i.e. The physical meaning of is described in , which will not be repeated here; is the cross-entropy loss function used for training the current round τ local student model by using the local data set D u .
[0084] At this point, the purpose of the personalized training method described above is to help the terminal quickly find the gradient descent direction and speed up the gradient descent when training with local data by using the training results of the last round, so as to achieve better personalized recommendation ability.
[0085] The effectiveness of the method of the embodiment of the present disclosure is verified:
[0086] In order to verify the performance of the federated training method provided by the embodiment of the present disclosure in terms of recommendation accuracy, personalization ability and communication overhead, the federated training method provided by the embodiment of the present disclosure (denoted as Fosses) is compared with the existing federated recommendation system learning method-FedFast (KDD20), DeepRec (WWW21) and the centralized training method (Centralized) on the public data set Yelp of the recommendation system. The comparison result is shown in Figures 3 to 5 .
[0087] Figure 3It is shown that, after 300 rounds of federated training, the global results of the Yelp dataset test, the analysis example selects DeepRec, FedFast and 300 rounds of local student model of centralized training for comparison, takes NDCG@5 as the evaluation index, the federated training method of the embodiment of the present disclosure improves 40% on NDCG@5 compared with the FedFast method, improves 8.7% compared with DeepRec, and improves 0.46% compared with the centralized training.
[0088] Figure 4 It is shown that, after 300 rounds of federated training, the global results of the Yelp dataset test, the analysis example selects DeepRec, FedFast and 300 rounds of local student model of centralized training for comparison, takes NDCG@5 as the evaluation index, the federated training method of the embodiment of the present disclosure improves 40% on NDCG@5 compared with the FedFast method, improves 8.7% compared with DeepRec, and improves 0.46% compared with the centralized training. Figure 4
[0089] Figure 5 It is shown that, when the model test precision NDCG@10 reaches 0.53, the communication overhead required (i.e. the training rounds required for the convergence of the recommendation model), the federated training method of the embodiment of the present disclosure can reduce the communication overhead of the user compared with DeepRec and FedFast, and provides faster convergence speed.
[0090] The federated training device for the terminal recommendation model provided by the second aspect of the embodiment of the present disclosure comprises:
[0091] The pre-training module is configured to build a teacher model and a student model on the cloud, pre-train the teacher model and the student model by using a historical dataset of the cloud, and send the pre-trained student model to a plurality of terminals participating in federated training;
[0092] The first-round federated training module is configured to perform first-round federated training on the pre-trained student model by using a local dataset on each terminal, to obtain a first-round local student model;
[0093] The aggregation module is configured to make each terminal send the parameters of the current-round local student model to the cloud, and aggregate the parameters of all current-round local student models on the cloud to obtain a current-round global model and its parameters;
[0094] The enhancement module is configured to perform parameter enhancement on the parameters of the current-round global model by using the teacher model and the historical dataset on the cloud in a self-supervised knowledge distillation manner, to obtain the enhanced parameters of the current-round global model, and send the enhanced parameters of the current-round global model to each terminal to update the parameters of the local student model of each terminal.
[0095] The local training module is configured to start federated training of the current round of local student models by each terminal using a respective local data set from the second round of federated training.
[0096] In some embodiments, the local training module is further configured to guide the parameters of the current round of local student models based on a self-supervised contrast distillation method using the parameters of the last round of local student models to improve the personalization effect of the current round of local student models.
[0097] It should be noted that the foregoing explanations of the embodiments of the federated training method of a terminal recommendation model also apply to the federated training device of a terminal recommendation model of the present embodiment, and will not be repeated here.
[0098] To implement the above-mentioned embodiments, the present embodiment also proposes a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to perform the federated training method of a terminal recommendation model of the above-mentioned embodiments.
[0099] Reference will now be made to the drawings, and specific examples thereof will be described hereinbelow. Figure 6 which shows a structural schematic diagram of an electronic device suitable for implementing the embodiments of the present disclosure. It should be noted that the electronic device in the embodiments of the present disclosure can include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Personal Computers), PMPs (Portable Multimedia Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and the like, as well as fixed terminals such as digital TVs, desktop computers, servers, and the like. Figure 6 The electronic device shown is only an example and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.
[0100] As shown in Figure 6 , the electronic device can include a processing device (such as a central processing unit, a graphics processing unit, etc.) 101, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 102 or loaded from a storage device 108 into a random access memory (RAM) 103. In the RAM 103, various programs and data required for the operation of the electronic device are also stored. The processing device 101, the ROM 102, and the RAM 103 are connected to each other through a bus 104. An input / output (I / O) interface 105 is also connected to the bus 104.
[0101] In general, the following devices can be connected to the I / O interface 105: input devices 106 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, etc.; output devices 107 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 108 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 109. The communication devices 109 can allow the electronic device to communicate wirelessly or wired with other devices to exchange data. Although Figure 6 An electronic device with various devices is shown, but it is understood that all of the shown devices are not required to be implemented or possessed. More or less devices can be alternatively implemented or possessed.
[0102] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, the present embodiments include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication devices 109, or installed from the storage devices 108, or installed from the ROM 102. When the computer program is executed by the processing devices 101, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
[0103] It should be noted that the computer-readable medium described above in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present disclosure, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained in the computer-readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, a RF (radio frequency) or the like, or any suitable combination thereof.
[0104] The computer-readable medium described above can be contained in the electronic device described above; or can exist separately and not be assembled into the electronic device.
[0105] The computer-readable medium described above carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the federated training method of the terminal recommendation model described above.
[0106] Computer program code for carrying out operations of the present disclosure can be written in any one or more programming languages or combinations of languages including object or visual programming languages such as Java, Smalltalk, C++, Python, conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0107] In the description of the specification, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Also, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the specification and the features of the different embodiments or examples, without contradiction.
[0108] In addition, the terms "first", "second", etc. are used only for the purpose of description and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality of" is at least two, for example, two, three, etc., unless otherwise explicitly specified.
[0109] Any process or method descriptions or descriptions of the flow diagrams in the specification or otherwise described herein can be understood as representing code modules, segments, or portions of code which include one or more executable instructions for implementing specific logic functions (or steps) in the process, and the various embodiments of the application include additional implementations in which the order of execution or the specific logic functions (or steps) can be changed, including according to the functionality involved, without departing from the scope of the embodiments of the application. It should be understood that the embodiments of the application can be practiced with additional combinations of hardware and software, and that the embodiments of the application can be implemented with hardware equivalent to software, with software equivalent to hardware, or with both, without departing from the scope of the embodiments of the application.
[0110] The logic and / or steps represented in the flowcharts and / or described herein, for example, can be considered as a sequence of instructions to implement logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device, such as a computer-based system, processor- based system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The computer-readable medium can be a computer- readable storage medium or a computer-readable signal medium. The computer- readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include the following: an electrical connection having one or more wires (electrical connections), a portable computer diskette (a magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium can even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, for example, via optical scanning of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and stored in a computer memory.
[0111] It should be understood that aspects of the application can be implemented in hardware, software, firmware or combinations thereof. In the above embodiments, the various steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, and in another embodiment, any of the following technologies, known in the art, or their combinations can be used: discrete logic circuitry having logic gates for implementing logic functions on data signals, application specific integrated circuits having appropriate combinational logic gates, programmable gate arrays (PGA), field programmable gate arrays (FPGA), and the like.
[0112] Those skilled in the art can understand that all or part of the steps carried out by the above-mentioned embodiment methods can be completed by programs instructing related hardware, and the developed programs can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.
[0113] In addition, each of the functional units in the various embodiments of the present application can be integrated in one processing module, or each of the units can be physically present separately, or two or more units can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software functional module. When the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium.
[0114] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.
Claims
1. A federated training method for a terminal recommendation model, characterized in that, include: Step S1: Construct teacher and student models in the cloud, pre-train the teacher and student models using historical datasets in the cloud, and send the pre-trained student models to multiple terminals participating in federated training. Step S2: Each terminal uses its local dataset to perform the first round of federated training on the pre-trained student model to obtain the first round of local student model. Step S3: Each terminal sends the parameters of the local student model in the current round to the cloud. The cloud aggregates the parameters of all local student models in the current round to obtain the global model and its parameters for the current round. Step S4: Using the teacher model and historical dataset in the cloud, the parameters of the current round global model are enhanced by self-supervised knowledge distillation to obtain the enhanced parameters of the current round global model. The enhanced parameters of the current round global model are then sent to each terminal to update the parameters of the local student model on each terminal. Step S5: Increment the training round by 1. Each terminal uses its own local dataset to perform federated training on the local student model in the current round. Return to step S3 until the training round reaches the upper limit of the number of iteration rounds. The parameters of the current round global model are calculated according to the following formula: in, This indicates the number of terminals participating in the current round of federated training. Indicates by terminal The local dataset consists of the local recommendation data it possesses. Indicates terminal The parameters of the local student model for the current round are obtained by training using the local dataset. This represents the parameters of the current round of the global model obtained after parameter aggregation in the cloud. Indicates the current round of federal training.
2. The federated training method according to claim 1, characterized in that, The input data for the teacher model and the student model is the sequence of items clicked by the user at historical moments, and the output data is the prediction result of the order in which the user will click on each item in the unsorted set at the next moment, obtained from the input data and the unsorted set of items.
3. The federated training method according to claim 1, characterized in that, The cross-entropy loss function is used when pre-training the teacher model and the student model, and when performing the first round of federated training on the student model.
4. The federated training method according to claim 1, characterized in that, Suppose that the loss function used when augmenting the parameters of the current round of the global model in the cloud using a teacher model and historical dataset through self-supervised knowledge distillation is: The calculation formula is as follows: in, For the current round The training uses the cross-entropy loss function. Let M be the total number of samples in the historical dataset, and M be the total number of product categories in each sample of the historical dataset. For the first in the historical dataset Sample The Authentic labels for each product category This indicates that the current round of the global model is based on the first [number] [item] in the historical dataset. Sample The Predicted probabilities for each product category; For the current round The knowledge distillation loss function used in training is employed to train the current round of the global model's ability to recognize different product categories. This is represented as the current round teacher model for the first... Output probability of class of goods This indicates that the current round of the global model is related to the first... Output probability of product class; For the current round The training employs a self-supervised knowledge distillation loss function to make the output of the global model closer to the teacher model. for coefficient, The historical datasets are respectively Samples in The representations obtained after inputting them into the current round teacher model and the current round global model, respectively. The historical datasets are respectively Samples in The representations obtained after inputting them into the current round teacher model and the current round global model, respectively. , This is an intermediate function that is introduced. For the function used to calculate the expectation, For use in calculation and The function of the KL divergence between them This is the temperature coefficient.
5. The federated training method according to any one of claims 1 to 4, characterized in that, In step S5, the parameters of the previous round of local student model are used to guide the parameters of the current round of local student model using a self-supervised comparative distillation method, so as to improve the personalization effect of the current round of local student model.
6. The federated training method according to claim 5, characterized in that, The loss function used in step S5 is: in, In the first During training rounds, the local dataset is used. Samples in Input to terminal The representation obtained after the local student model has been trained individually. In the first During training rounds, the local dataset is used. Samples in Input to terminal The representation obtained after receiving the parameters of the current round of enhanced global model; During the previous training round, the local dataset was used. Samples in Input to terminal The representation obtained after the model corresponds to the parameters of the enhanced global model received in the previous round; This is an intermediate function that is introduced. For the function used to calculate the expectation, For use in calculation and The function of the KL divergence between them Temperature coefficient; To utilize local datasets For the current round The cross-entropy loss function used when training the local student model.
7. A federated training device for a terminal recommendation model, characterized in that, include: The pre-training module is configured to build teacher and student models in the cloud, pre-train the teacher and student models using historical datasets in the cloud, and send the pre-trained student models to multiple terminals participating in federated training. The first round of federated training module is configured to perform the first round of federated training on the pre-trained student model on each terminal using the local dataset, so as to obtain the first round of local student model. The aggregation module is configured to enable each terminal to send the parameters of the local student model in the current round to the cloud. The cloud aggregates the parameters of all local student models in the current round to obtain the global model and its parameters for the current round. The enhancement module is configured to use the teacher model and historical dataset in the cloud to enhance the parameters of the current round global model through self-supervised distillation and knowledge distillation, so as to obtain the enhanced parameters of the current round global model. The enhanced parameters of the current round global model are then sent to each terminal to update the parameters of the local student model on each terminal. The local training module is configured to enable each terminal to perform federated training on the local student model in the current round using its own local dataset, starting from the second round of federated training. The parameters of the current round global model are calculated according to the following formula: in, This indicates the number of terminals participating in the current round of federated training. Indicates by terminal The local dataset consists of the local recommendation data it possesses. Indicates terminal The parameters of the local student model for the current round are obtained by training using the local dataset. This represents the parameters of the current round of the global model obtained after parameter aggregation in the cloud. Indicates the current round of federal training.
8. The federated training device according to claim 7, characterized in that, The local training module is also configured to use the parameters of the previous round of local student model to guide the parameters of the current round of local student model using a self-supervised comparative distillation method, so as to improve the personalization effect of the current round of local student model.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the federated training method of the terminal recommendation model according to any one of claims 1 to 6.
Citation Information
Patent Citations
Federal learning model training method and device, electronic equipment and storage medium
CN113689000A
Federal learning method and device, computer equipment and storage medium
CN116227623A