Recommendation method for privacy protection, electronic equipment and medium
By using homogenous encryption technology and value assessment functions in the federal learning system, the problem of privacy leakage of user privacy in federal learning has been solved, and the balance of efficient privacy protection and model performance have been achieved.
Patent Information
- Application Number
- CN202411220170.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2025-01-24
AI Technical Summary
Federated learning systems may still compromise user privacy without transmitting raw data, existing privacy protection methods are difficult to balance between privacy protection and model performance, and cryptography-based approaches are complex and difficult to find trusted crypto service providers .
Uses homomorphic encryption to share keys between clients without sending them to the server, preventing encryption service providers from colluding with referral servers. At the same time, the value evaluation function is used to evaluate each client and iterate on the best ones to reduce communication costs.
Effectively protect users' privacy, prevent privacy leakage, while maintaining model performance, simplify the system implementation and reduce communication costs.
Smart Images

Figure CN119359399A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data privacy and security technology, and in particular relates to a recommendation method, electronic equipment, and medium for privacy protection. Background Art
[0002] Even if the federated learning system does not transmit the original data, it is still possible to leak the user's privacy. In other words, federated learning itself is vulnerable and there is a risk of privacy leakage.
[0003] Existing privacy protection methods can be roughly divided into privacy protection methods based on obfuscation, privacy protection methods based on cryptography, etc. These fuzzy-based methods obfuscate the original data of user preferences before publishing them to the central server to ensure a certain degree of privacy protection. However, the drawback is that obfuscation inevitably leads to the loss of predictive power of the learned latent feature vectors. Therefore, these methods usually require a trade-off between privacy protection and model performance. Although privacy protection methods based on cryptography usually do not need to sacrifice predictive power to protect privacy, they usually require a third-party encryption service provider. This makes the system implementation complicated because such providers are not easy to find in practice. In addition, if the encryption service provider colludes with the recommendation server, user privacy cannot be protected.
[0004] Therefore, there is an urgent need to provide privacy protection methods for privacy issues from data and models. Summary of the invention
[0005] In view of the deficiencies in the prior art, the present invention provides a recommendation method, electronic device, and medium for privacy protection.
[0006] In a first aspect, an embodiment of the present invention provides a product recommendation method for privacy protection, which is applied to a client, and the method includes:
[0007] Get the public key and the secret key;
[0008] Setting a loss function, and using a local data set and a shared data set to train a local recommendation model deployed on the client; the local data set includes user ratings of products, and the shared data set includes product attributes;
[0009] Encrypt the weight of the trained local recommendation model using a public key to obtain an encrypted weight; calculate the value of the trained local recommendation model; and upload each encrypted weight and value to the server;
[0010] Some clients receive the global weights, use the key to decrypt the global weights to obtain updated local recommendation model weights, and complete one iteration; wherein, the some clients are screened and confirmed by the server according to their value; the global weights are obtained by aggregating all encrypted weights by the server;
[0011] The local recommendation model is trained based on the updated local recommendation model weights, and the above steps are repeated to perform federated learning iterations until the preset federated learning iteration cycle is reached; the recommendation results are output through the trained local recommendation model.
[0012] In a second aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-mentioned product recommendation method for privacy protection.
[0013] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned product recommendation method for privacy protection when the program is executed by a processor.
[0014] In a fourth aspect, an embodiment of the present invention provides a computer program product, including a computer program / instruction. When the computer program / instruction is executed by a processor, the above-mentioned product recommendation method for privacy protection is implemented.
[0015] Compared with the prior art, the present invention has the following beneficial effects:
[0016] The present invention provides a recommendation method for privacy protection. The present invention applies homomorphic encryption technology in federated learning, shares the key among clients, and does not send it to the server to prevent the encryption service provider from colluding with the recommendation server, thereby preventing privacy leakage; at the same time, a value evaluation function is used to evaluate each client and iterate the best to solve the problem of high communication cost, thereby achieving efficient privacy protection. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0018] Figure 1 A flowchart of a recommended method for privacy protection provided by an embodiment of the present invention;
[0019] Figure 2 A schematic diagram of a recommended method for privacy protection provided by an embodiment of the present invention;
[0020] Figure 3 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] 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.
[0022] It should be noted that, in the absence of conflict, the features in the following embodiments and implementations may be combined with each other.
[0023] like Figure 1 and Figure 2 As shown, an embodiment of the present invention provides a recommendation method for privacy protection, the method comprising:
[0024] Step S1, generate a public key and a secret key, and send the public key and the secret key to each client through a TLS / SSL secure channel;
[0025] Furthermore, a public key pk and a secret key sk are generated; all parties including the server know the public key, and the secret key sk is only shared between clients, and the server needs to be protected. Since the secret key is only shared between clients, the server cannot modify it, which prevents the encrypted client from colluding with the server, thereby preventing privacy leakage. After the key is generated, different TLS / SSL secure channels will be established to send the public key and secret key to the corresponding client.
[0026] Step S2: Each client uses a local data set to train a local recommendation model according to a loss function.
[0027] Furthermore, the local dataset and the shared dataset are commonly used public recommendation system datasets; the public recommendation system dataset includes user ratings of items, i.e., interaction data, user profiles, and item profiles. For example, the public recommendation system dataset may be MovieLens dataset, Book-Crossing dataset, Amazon dataset, etc.
[0028] For example, in this example, the local dataset uses the MovieLens 1M dataset, which is a dataset for movie recommendation scenarios. Users rate the movies they have watched, with scores ranging from 1 to 5. The dataset contains 1,000,209 rating records of 3,706 movies by 6,040 users, with a dataset density of 95.53%. The preprocessing of the rating data includes the coordination of positive and negative ratios. For the MovieLens 1M dataset, the numerical rating needs to be converted into implicit feedback, that is, the user's rating of the item x. ui is a binary score indicating whether the user interacted with the item. If so, then x ui = 1. Otherwise, x ui =0.
[0029] Furthermore, each client A corresponding local recommendation model is deployed on Define the user set U and the product set I, the local data set D u Contains the user-item matrix The user-item matrix X includes the rating x of user u∈U for item i∈I ui In this example, the local recommendation model adopts a Neural Collaborative Filtering (NCF) model.
[0030] Among them, the expression of the loss function is as follows:
[0031]
[0032] In the formula, u represents the user, i represents the product, Represents the predicted score output by the local recommendation model.
[0033] In step S3, each client encrypts the weight of the trained local recommendation model using a public key to obtain an encrypted weight; each client calculates the value of the trained local recommendation model; and uploads the encrypted weight and value to the server.
[0034] Furthermore, the weight of the trained local recommendation model is encrypted using the public key, and the expression of the encrypted weight is as follows:
[0035]
[0036] In the formula, represents the weight of the trained local recommendation model, k represents the number of clients, pk represents the public key,
[0037] The value evaluation function is selected as the loss function during the client model training, so the valuation after t rounds of federated learning training iterations is:
[0038]
[0039]
[0040] Among them, S t is a randomly selected subset of clients, Represents the parameters of the local recommendation model.
[0041] Step S4: The server receives the encrypted weights and values uploaded by all clients; aggregates all encrypted weights to obtain the encrypted global weights; converts the values of all clients into sampling distributions, and determines the clients that will participate in the training in the next iteration based on the sampling distribution. The global weights are then sent to the clients that will participate in the federated learning training in the next iteration.
[0042] Specifically, all encrypted weights are aggregated to obtain the expression of the global weight in the encrypted state as follows:
[0043]
[0044] In the formula, represents the global weight, M i represents the encrypted weight corresponding to the i-th local recommendation model, represents the middle value of the encrypted weight corresponding to the i-th local recommendation model, It represents the middle value of the encrypted weight corresponding to the k-th local recommendation model, where k represents the number of clients.
[0045] Furthermore, the process of determining the client participating in the training in the next iteration includes:
[0046] The server converts the value uploaded by each client into a sampling distribution, calculates the probability of the client being selected to participate in the next model training, and selects the client to continue training in the next round. The probability calculation formula is as follows
[0047]
[0048] In this example, the top eight clients with the highest value probability are selected for the next round of federated learning iteration.
[0049] In step S5, the client receives the global weight sent by the server, and uses the key sk to decrypt the global weight to obtain the updated local recommendation model weight, and trains the local recommendation model based on the updated local recommendation model weight.
[0050] Step S6, repeating the above steps S2 to S5 to perform federated learning iterations until a preset federated learning iteration cycle is reached. Each client outputs a recommendation result through the trained local recommendation model deployed thereon, thereby generating a recommendation list of items for the user.
[0051] like Figure 3 As shown, an embodiment of the present application provides an electronic device, which includes a memory 101 for storing one or more programs and a processor 102. When the one or more programs are executed by the processor 102, any method in the first aspect described above is implemented.
[0052] The memory 101, the processor 102 and the communication interface 103 are directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The memory 101 can be used to store software programs and modules, and the processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 101. The communication interface 103 can be used to communicate signaling or data with other node devices.
[0053] Among them, the memory 101 can be, but is not limited to, a random access memory 101 (Random Access Memory, RAM), a read only memory 101 (Read Only Memory, ROM), a programmable read-only memory 101 (Programmable Read-Only Memory, PROM), an erasable read-only memory 101 (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable read-only memory 101 (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0054] The processor 102 may be an integrated circuit chip having signal processing capability. The processor 102 may be a general-purpose processor 102, including a central processing unit 102 (CPU), a network processor 102
[0055] (Network Processor, NP), etc.; it can also be a digital signal processor 102 (Digital Signal Processing, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0056] In the embodiments provided in the present application, it should be understood that the disclosed method and system can also be implemented in other ways. The method and system embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the method and system, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0057] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0058] On the other hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by the processor 102, a method as in any one of the first aspects described above is implemented. If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory 101 (ROM, Read-Only Memory), a random access memory 101 (RAM, RandomAccess Memory), a disk or an optical disk.
[0059] The above embodiments are only used to illustrate the design ideas and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.
Claims
1. A product recommendation method for privacy protection, characterized in that: Applied to a client, the method comprises: Get the public key and the secret key; Setting a loss function, and using a local data set and a shared data set to train a local recommendation model deployed on the client; the local data set includes user ratings of products, and the shared data set includes product attributes; Encrypt the weight of the trained local recommendation model using a public key to obtain an encrypted weight; calculate the value of the trained local recommendation model; and upload each encrypted weight and value to the server; Some clients receive the global weights, use the key to decrypt the global weights to obtain updated local recommendation model weights, and complete one iteration; wherein, the some clients are screened and confirmed by the server according to their value; the global weights are obtained by aggregating all encrypted weights by the server; The local recommendation model is trained based on the updated local recommendation model weights, and the above steps are repeated to perform federated learning iterations until the preset federated learning iteration cycle is reached; the recommendation results are output through the trained local recommendation model.
2. A product recommendation method for privacy protection according to claim 1, characterized in that: The corresponding loss function expression during the local recommendation model training process is as follows: In the formula, u represents the user, i represents the product, and D u represents the training set, i.e., the local dataset and the shared dataset, x ui Represents the user's rating of the product in the local dataset, Represents the predicted score output by the local recommendation model.
3. A product recommendation method for privacy protection according to claim 1, characterized in that: The weight of the trained local recommendation model is encrypted using the public key, and the expression of the encrypted weight is as follows: In the formula, represents the weight of the trained local recommendation model, k represents the number of clients, pk represents the public key, 4. The method for recommending products for privacy protection according to claim 1, characterized in that: Calculating the value of the trained local recommendation model includes: The value of the local recommendation model after the tth round of federated learning training iteration is expressed as follows: Among them, S t is a randomly selected subset of clients, Represents the parameters of the local recommendation model.
5. The method for recommending products for privacy protection according to claim 1, characterized in that: Aggregate all encryption weights to get the global weight, expressed as follows: In the formula, represents the global weight, M i represents the encrypted weight corresponding to the i-th local recommendation model, represents the middle value of the encrypted weight corresponding to the i-th local recommendation model, It represents the middle value of the encrypted weight corresponding to the k-th local recommendation model, where k represents the number of clients.
6. A method for recommending products for privacy protection according to claim 4, characterized in that: The process of selecting some clients to participate in the next round of federated learning based on value includes: Convert the client's value into a sampling distribution; Calculate the probability of a client being selected, the expression is as follows: Set a threshold and use the clients with probabilities higher than the threshold as the clients participating in the next round of federated learning.
7. An electronic device comprising a memory and a processor, characterized in that: The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the product recommendation method for privacy protection as described in any one of claims 1-6 above.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the product recommendation method for privacy protection as described in any one of claims 1 to 6 is implemented.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the method for recommending products for privacy protection described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Graph neural network federal recommendation method for privacy protection
CN113420232A
Federal learning privacy protection method based on block chain and homomorphic encryption
CN115549888A
Dynamic fairness privacy protection federal deep learning method
CN116523074A
Channel-based hierarchical structure differential privacy federal learning method and device
CN117473548A