Matrix factorization method under federated learning framework

By adopting key exchange and gradient masking technology under the federated learning framework, the problems of low efficiency and insufficient data security of the existing secure matrix decomposition algorithm are solved, and an efficient and secure recommendation model training process is achieved.

CN116545735BActive Publication Date: 2025-10-17SHANGHAI LIGHT TREE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310622218.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2025-10-17
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

The existing secure matrix decomposition algorithm has low computational efficiency during training and cannot effectively guarantee the security of local data, posing a risk of data leakage.

Method used

In the federated learning framework, the client calculates and updates the gradient of the local embedding matrix through key exchange methods and gradient masking technology, and summarizes the gradient using a secure aggregation method to avoid direct encryption and decryption operations, combined with Gaussian noise processing to ensure data security.

Benefits of technology

It improves the training speed of the recommendation model, ensures that user data does not leave the local area, effectively avoids data leakage, reduces computational complexity, and enhances data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116545735B_ABST
    Figure CN116545735B_ABST
Patent Text Reader

Abstract

The application discloses a matrix decomposition method under a federated learning framework, which provides a new idea for enhancing data security of the federated learning by performing safe aggregation on gradients of an item matrix I of matrix decomposition under the federated learning framework; the training samples of a recommendation model (namely, a federated learning model) are efficiently utilized by using the local and safe aggregated gradients, so that the user data is ensured not to leave the local, and meanwhile, the recommendation model training process is made more secure; the gradients are masked and added with noise, so that the leakage of source data information caused by exposure of real gradients is effectively avoided; and the gradient aggregation mode based on safe aggregation is provided, and compared with the homomorphic encryption technology adopted in the background technology, the gradient encryption and decryption have lower calculation complexity and faster calculation speed, so that the training speed of the recommendation model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information processing technology, and in particular to a matrix decomposition method under a federated learning framework. Background Art

[0002] Currently, the secure matrix decomposition algorithm is mainly based on the distributed algorithm of matrix decomposition, and uses encryption technologies such as Paillier homomorphic encryption to ensure the security of transmitted information and prevent the leakage of user local data. The implementation steps of the existing secure matrix decomposition algorithm are mainly as follows:

[0003] 1. The server initializes the item matrix I, and the client locally initializes its own user matrix U. The public key is shared by the server and the client, and the private key is only available to the client.

[0004] 2. The server uses the public key to encrypt I to obtain the ciphertext C I Then broadcast to all clients;

[0005] 3. Each client gets C I Then use the local private key to C I Decryption obtains the real item matrix I, and uses it to calculate the gradient of U held by the client and update U. After the update, the gradient G of I is calculated and encrypted to obtain the ciphertext C. G ;

[0006] 4. Server collects C G And update to get C I =C I -C G , and then the updated C I Broadcast to all clients;

[0007] 5. Repeat steps 3-4 until the algorithm converges.

[0008] From steps 1-5 above, we can see that the existing solution ensures that user data does not leave the local server, and homomorphic encryption technology prevents the server from obtaining the plaintext gradient during the entire training process, making it impossible to infer the original data from a single gradient. However, the homomorphic encryption solution requires repeated encryption and decryption, making training less efficient. However, if homomorphic encryption is removed and the plaintext gradients of a single data piece are directly summarized, the original data can be inferred after multiple steps of training. However, the security of local data cannot be guaranteed. Therefore, how to solve the above technical problems of the existing security matrix decomposition algorithm has become a difficult problem that needs to be solved urgently in the industry. Summary of the Invention

[0009] The present invention aims to make the recommendation model training process more efficient and ensure that local data is not leaked during model training, and provides a matrix decomposition method under the federated learning framework.

[0010] To achieve this object, the present invention adopts the following technical solutions:

[0011] A matrix decomposition method under a federated learning framework is provided, comprising the following steps:

[0012] S1, the scheduling party of the federated learning framework is referred to as the server, and each party participating in the training is referred to as the client. The server broadcasts the initialized item embedding matrix I to each client;

[0013] S2, each client X uses the embedding matrix I to calculate the embedding matrix U of its own local user X Gradient and use Update the local user embedding matrix U X ;

[0014] S3, each client X uses the locally updated U X , calculate the gradient of the embedding matrix I

[0015] S4, using the key exchange method to update the gradient And Summarize to get Afterwards, use Update the embedding matrix I;

[0016] S5, repeat steps S2-S4 until the termination condition of federated learning is reached.

[0017] Preferably, in step S2, the embedding matrix The embedding vector associated with local user i in Gradient It is calculated by the following formula (1):

[0018]

[0019] In formula (1), L is the loss function of federated learning performed by client X,

[0020] M X represents the score matrix at the client X;

[0021] I T is the matrix transpose of I;

[0022] ‖·‖ F represents the Frobenius norm of the matrix;

[0023] I j ∈R 1×kdenotes the embedding vector of item j common to all the clients, is the embedding matrix j ,…,I d ]∈R d×k is the j-th row of I

[0024] denotes the vector transpose of I j ;

[0025] denotes the rating of user i of client X on item j (missing entries for which user i has not actually rated item j are to be predicted after the model is completed) ;

[0026] j: denotes the items j on which user i of client X has actually rated;

[0027] denotes the sum over the items j on which user i of client X has actually rated with respect to the sign j.

[0028] As a preference, in step S2, the user embedding matrix U

[0029]

[0030] In formula (2), λ U denotes the regularization parameter of U X ,

[0031] As a preference, in step S3, the embedding vector I j of item j in the embedding matrix I is updated by the following formula (3) :

[0032]

[0033] In formula (3), I denotes the j-th row of ;

[0034] denotes the vector transpose of the embedding vector I j of item j common to all the clients;

[0035] denotes the embedding vector of local user i in the embedding matrix U X ;

[0036] represents the rating of the user i locally owned by the client X on the item j;

[0037] i: represents those users i who have ever rated the item j owned by the client X;

[0038] represents the summation of the ratings of those users i who have ever rated the item j owned by the client X on the item i.

[0039] As preferred, in step S4, the gradient The key exchange method adopted is specifically:

[0040] S41, each client X locally generates a private key s X and a public key p X The server exchanges the public key generated by each of the clients X, and each of the clients X obtains a corresponding set of exchanged public keys, denoted as C X ;

[0041] S42, according to C X and the private key s X locally generated by each of the clients X, a key agreement between the client X and each of the other clients Y is generated, denoted as key_agreement(X,Y);

[0042] S43, the client X generates a mask using the locally generated key_agreement(X,Y) as a seed, denoted as mask(X,Y), and then updates the gradient

[0043] As preferred, in step S41, C X is expressed by the following expression (4):

[0044] C X = {p1,…,p X ,…,p N} expression (4)

[0045] In expression (4), represents the public key locally generated by the client X;

[0046] p represents a prime number, which is agreed upon by each client in advance;

[0047] g represents a primitive root modulo p, which is agreed upon by each client in advance;

[0048] % p represents a modulo operation on the prime number p;

[0049] {p1,…,pX p N represents a set of all the public keys generated locally by the clients in the server received.

[0050] As a preference, in step S42, the generating method of key_agreement(X,Y) is:

[0051] The client X takes the public key p X of the client Y from the exchange public key set C Y ;

[0052] The client X generates key_agreement(X,Y) according to the public key p Y and the locally generated private key s X .

[0053] As a preference, the generating formula of key_agreement(X,Y) is expressed as follows:

[0054]

[0055] In formula (5), represents s Y power of p X ;

[0056] p represents a prime number agreed in advance by each client;

[0057] % p represents a modulo operation on the prime number p.

[0058] As a preference, in step S43, the gradient is updated by the following formula (6):

[0059]

[0060] In formula (6), a(X,Y) represents 1 or -1, and the clients are numbered in {1,2,…,X,…,N}. If the number of the client X is greater than that of the client Y, the value is equal to 1, otherwise, it is equal to -1.

[0061] ∑ Y∈{,,…,}\{} represents the sum of all the clients Y other than X with respect to the mark Y.

[0062] As a preference, in step S4, the method of summarizing is expressed by the following formula (7):

[0063]

[0064] In step S4, the method of updating the embedding matrix I is expressed by the following formula (8):

[0065]

[0066] In formula (8), lambda I represents a regularization parameter of the embedding matrix I.

[0067] As preferred, the gradient generated in step S3 is added with noise and then transferred to step S4, and the gradient added with noise is expressed by the following formula (9):

[0068]

[0069] In formula (9), n X represents Gaussian noise.

[0070] The present application has the following beneficial effects:

[0071] 1. The gradient of secure aggregation is used and The training sample of the recommendation model is obtained, which ensures that the user data does not leave the local and makes the recommendation model training process more secure.

[0072] 2. The gradient is added with a mask and noise, which effectively avoids the leakage of source data information due to the exposure of the real gradient;

[0073] 3. Compared with the homomorphic encryption technology adopted in the background technology, the gradient aggregation method based on secure aggregation provided has lower calculation complexity and faster calculation speed for the encryption and decryption of the gradient, which is beneficial to improve the training speed of the recommendation model.

[0074] 4. The recommendation model is trained based on the matrix decomposition algorithm provided in the present application under the federated learning framework, and in the model training process, the participants do not need to exchange the local data, which more effectively ensures that the local data is not leaked. BRIEF DESCRIPTION OF DRAWINGS

[0075] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0076] Figure 1 is the implementation step diagram of the matrix decomposition method under the federated learning framework provided by an embodiment of the present application;

[0077] Figure 2 is the flow chart of the matrix decomposition method under the federated learning framework provided by the embodiment of the present application. DETAILED DESCRIPTION

[0078] The technical solution of the present invention will be further described below with reference to the accompanying drawings and through specific implementation methods.

[0079] Among them, the drawings are only used for illustrative purposes and represent only schematic diagrams rather than actual pictures, and should not be understood as limiting this patent; in order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.

[0080] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "inside", "outside" and the like indicate an orientation or position relationship based on the orientation or position relationship shown in the drawings, it is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0081] In the description of the present invention, unless otherwise expressly specified or limited, when the term "connection" or the like appears to indicate a connection relationship between components, such term should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be internal communication between two components or an interaction between two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood in specific circumstances.

[0082] The following uses three clients A, B, and C as an example to illustrate how to implement the matrix decomposition method under the federated learning framework provided in this embodiment:

[0083] The scheduler in the federated learning framework is referred to as the server, each participant in the training is referred to as the client, M is the rating matrix (such as the matrix corresponding to the movie ratings of multiple users in imdb, which contains some missing items that need to be predicted and filled), U A 、U B 、U C Respectively represent the embedding matrix of the local users of clients A, B, and C (using the matrix to digitize the local users), and I represents the embedding matrix of the item (using the matrix to digitize the shared items). Figure 2As shown, the specific implementation steps of the matrix decomposition method under the federated learning framework provided in this embodiment are as follows:

[0084] 1. All parties determine the embedding dimension (the embedding dimension indicates how many dimensions of space are used to digitize users and items). The server initializes the embedding matrix I of the item based on the embedding dimension. Clients A, B, and C initialize the embedding matrix U of their local users based on the embedding dimension. A 、U B 、U C

[0085] 2. The server broadcasts the embedding matrix I to clients A, B, and C;

[0086] 3. Client A uses the embedding matrix I to calculate U A Gradient Then update the local user's embedding matrix U A , in m A Indicates the total number of users of client A, I j represents the embedding vector of item j that is common to all clients, Indicates I j The vector transpose of represents the rating of user i on item j owned by client A, j: represents the items j that have actually been rated by user i owned by client A, U represents the sum of items j actually rated by user i owned by client A with respect to token i; A The update method is: λ U Show U A Regularization parameter of ;

[0087] The gradients corresponding to clients B and C respectively The calculation method of U B 、U C The method is the same as client A, so I will not repeat it here;

[0088] 4. Client A uses the locally updated U A , calculate the gradient of the user pair embedding matrix I in d represents the total number of items, i: represents the users i owned by client A who have rated item j. Sum the tokens i of all users i who have rated item j owned by client A;

[0089] The gradients corresponding to clients B and C respectively The calculation method is the same as that of client A, so I will not repeat it here;

[0090] In order to avoid exposing the true gradient, it is preferred to add noise to the gradient corresponding to each client. More preferably, the gradients of clients A, B, and C are processed by differential privacy technology. Add Gaussian noise n A 、n B 、n C Taking client A as an example, n A Represents a random matrix generated to obey Gaussian distribution (size and same), Updated to

[0091] 5. Clients A, B, and C generate their own public and private keys locally. A 、p B 、p C Represents the public keys generated locally by clients A, B, and C, respectively. A 、s B 、s C They represent the private keys generated locally by clients A, B, and C respectively. Taking client A as an example, the private key s A is a locally generated random number (numerically smaller than p), p A (via private key s A Calculated) Where g represents the generator (modulo the primitive root of p, which can be a smaller number, such as 2 for simplicity), s for g A Power, p is a large prime number (usually 2048 bits), %p represents the modulo operation on p, and g and p are predetermined for each client;

[0092] 6. The server collects all public keys p A 、p B 、p C , and the public key sent to client A is p B 、p C , the public key sent to client B is p A 、p C , the public key sent to client C is p A 、p B ;

[0093] 7. Client A uses the public key p B 、p C and locally generated private key s AGenerate key_agreement(A, B) with client B, key_agreement(A, C) with client C; Client B generates key_agreement(A, B) according to public key p A , p C and private key s B Generate key_agreement(A, B) with client B, key_agreement(B, C) with client C; Client C generates key_agreement(A, C) according to public key p A , p B and private key s C Generate key_agreement(A, C) with client A, key_agreement(B, C) with client B. Take client A as an example, s B and s A , and p V and s A , and p I

[0094] 8, Client A generates a mask mask(A, B) with the local key_agreement(A, B) as the seed, generates a mask mask(A, C) with the local key_agreement(A, C) as the seed, and updates the gradient Client B generates a mask mask(A, B) with the local key_agreement(A, B) as the seed, generates a mask mask(B, C) with the local key_agreement(B, C) as the seed, and updates the gradient Client C generates a mask mask(A, C) with the local key_agreement(A, C) as the seed, generates a mask mask(B, C) with the local key_agreement(B, C) as the seed, and updates the gradient

[0095] Take client A as an example, the mask mask(A, B) is a random matrix (you can call an open source library function to directly generate by inputting a seed parameter) with the same size, shape and key_agreement(A, B) as the seed.

[0096] 9, The server aggregates the gradients to obtain Then update I to obtain λ I Indicates the regularization parameter of the embedding matrix I;

[0097] 10. Repeat steps 2-8 until the maximum number of training times for the federated recommendation model is reached or the algorithm converges.

[0098] In short, the matrix decomposition method under the federated learning framework provided in this embodiment is as follows: Figure 1 As shown, the steps include:

[0099] S1, the scheduling party of the federated learning framework is called the server, and each party participating in the training is called the client. The server broadcasts the initialized item embedding matrix I to each client;

[0100] S2, each client X uses the embedding matrix I to calculate the embedding matrix U of its own local user X Gradient and use Update the local user embedding matrix U X ;

[0101] S3, each client X uses the locally updated U X , calculate the gradient of the embedding matrix I

[0102] S4, update the gradient using key exchange method And Summarize to get Afterwards, use Update the embedding matrix I;

[0103] S5, repeat steps S2-S4 until the termination condition of federated learning is reached.

[0104] In summary, the present invention securely aggregates the gradient of the item matrix I in the matrix decomposition under the federated learning framework, which provides a new idea for enhancing data security in federated learning. and Obtaining training samples for the recommendation model (i.e., the federated learning model) ensures that user data does not leave the local machine, while making the recommendation model training process more secure. Masking and noise are added to the gradient to effectively prevent the leakage of source data information due to the exposure of the true gradient. Compared with the homomorphic encryption technology used in the background technology, the gradient aggregation method provided based on secure aggregation has lower computational complexity and faster calculation speed for gradient encryption and decryption, which is conducive to improving the training speed of the recommendation model.

[0105] It should be noted that the above detailed description is only the preferred embodiment of the present application and the applied technical principles. Those skilled in the art should understand that various modifications, equivalent replacements, changes and the like can also be made to the present application. However, as long as these changes do not deviate from the spirit of the present application, they should be within the protection scope of the present application. In addition, some terms used in the present application specification and claims are not limited, but only for the convenience of description.

Claims

1. A matrix decomposition method under a federated learning framework, characterized in that the steps include: S1, the scheduling party of the federated learning framework is called the server, and each party participating in the training is called the client. The server embeds the initialized item Broadcast to each of the clients; S2, per client Using the embedding matrix Calculate the embedding matrix for each local user Gradient , and use Update the local user's embedding matrix ; S3, each of the clients Using local updated , calculate the embedding matrix The resulting gradient ; S4, the client Link the server to update the gradient using a key exchange method , and Summarize to get Afterwards, use Update the embedding matrix ; S5, repeat steps S2-S4 until the termination condition of federated learning is reached; In step S4, the gradient is changed The key exchange method used is specifically: S41, each client Generate a private key locally and public key , the server for each of the client The generated public keys are exchanged, each of the clients Get the corresponding exchange public key set, recorded as ; S42, according to and each of said clients Locally generated private key , on the client and each other client A key agreement is generated between two clients, denoted as ; S43, the client The locally generated As a seed to generate a mask, denoted as , then update the gradient in step S3 ; Step S1 is as follows: the parties determine the embedding dimension, which indicates how many dimensions of space are used to digitize users and items. The parties include the server and the client. The server initializes the embedding matrix of the item according to the embedding dimension. Each client initializes the embedding matrix of its own local user according to the embedding dimension.

2. The matrix decomposition method under the federated learning framework according to claim 1, characterized in that: In step S41, It is expressed by the following expression (4): In expression (4), Represents the client Locally generated public key; Represents a prime number, which is agreed upon in advance by each client; Representation model The original root is agreed upon in advance by each client; Represents prime numbers Modulo operation; Indicates all the shared A collection of public keys generated locally by the client.

3. The matrix decomposition method under the federated learning framework according to claim 2, characterized in that: In step S42, The generation method is: The client From the exchanged public key set Remove the client Public key ; The client According to the public key and the locally generated private key Generated as .

4. The matrix decomposition method under the federated learning framework according to claim 3, characterized in that: The generation formula is expressed as follows: In formula (5), express of power; Indicates the prime number agreed upon in advance by each client; Represents prime numbers Modulo operation.

5. The matrix decomposition method under the federated learning framework according to claim 1, characterized in that: In step S43, the gradient is updated by the following formula (6): : In formula (6), Indicates 1 or -1, press the client Numbering, if the number of client X is greater than the number of client Y, then the value is equal to 1, otherwise it is equal to -1; Indicates that all non Client About Marks Summation.

6. The matrix decomposition method under the federated learning framework according to claim 1, characterized in that In step S4, the The method is expressed by the following formula (7): In step S4, the embedding matrix is ​​updated The method is expressed by the following formula (8): In formula (8), Denotes the embedding matrix The regularization parameter of .

7. The matrix decomposition method under the federated learning framework according to claim 1, characterized in that: The gradient generated in step S3 After adding noise, go to step S4 and adjust the gradient The noise addition method is expressed by the following formula (9): In formula (9), represents Gaussian noise.

Citation Information

Patent Citations

  • Graph neural network federal recommendation method for privacy protection

    CN113420232A

  • Federal learning privacy protection method based on homomorphic encryption

    CN113434873A