A non-sampling factor decomposition machine service method under a longitudinal federated learning architecture
By transforming the factorization machine into a matrix factorization model and optimizing the loss function, this method combines longitudinal federated learning with non-sampling factorization machines, solving the problem of low efficiency of factorization machines under the longitudinal federated learning architecture and achieving efficient machine learning service recommendation with data privacy protection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HARBIN UNIV OF SCI & TECH
- Filing Date
- 2022-12-08
- Publication Date
- 2026-05-08
AI Technical Summary
In a vertical federated learning architecture, traditional non-sampling factorization machine methods are inefficient and cannot effectively utilize the datasets of Company A and Company B for efficient machine learning service recommendations.
Combining longitudinal federated learning with non-sampling factorization machine, a mathematical method is used to transform the factorization machine into a matrix factorization model and optimize the loss function. The data training process of company A and company B is coordinated through a trusted third-party server, and homomorphic encryption technology is used to protect data privacy.
This approach improves the efficiency of factorization machine service recommendation under a vertical federated learning architecture while ensuring data privacy, thus solving the problem of low efficiency.
Smart Images

Figure CN116011594B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of recommender system technology, specifically to a non-sampling factorization machine service method under a vertical federated learning architecture. Background Technology
[0002] Factorization machines are a general framework that integrates the advantages of flexible feature engineering and high-precision predictions from latent factor models. Federated learning, as a new machine learning paradigm, allows different participants to collaborate in building intelligent systems without revealing private data, while addressing the issues of privacy and data sparsity. Vertical federated learning is generally suitable for federated learning scenarios involving participants with the same sample space but different feature spaces on the dataset; vertical federated learning can also be understood as federated learning based on feature partitioning.
[0003] Suppose two companies, A and B, want to collaboratively train a machine learning service recommendation model, each possessing its own data. For example, a social media portal and an e-commerce website. The social media portal only has user personal information such as occupation and gender, while the e-commerce website only has implicit user feedback data on products, such as clicks. Furthermore, the user sets of companies A and B have a high degree of overlap. The e-commerce website wants to obtain the social media portal's dataset while ensuring user privacy, and then jointly train it with its own dataset to provide customized recommendation services to users.
[0004] Due to user privacy and data security concerns, parties A and B cannot directly exchange data. To ensure data confidentiality during training, a third-party coordinator C is introduced. C is a semi-honest third party primarily responsible for assisting the participants in secure federated learning. Independent of the participants, C collects intermediate results to calculate gradients and loss values and forwards the results to each participant. The information received by C from the participants is encrypted or obfuscated; therefore, the raw data of each party is not exposed to the others, and each participant only receives model parameters relevant to the features they possess.
[0005] In the above scenario, in order to provide more accurate recommendations, in addition to modeling user item interactions, contextual characteristics must also be considered. However, the traditional non-sampling federated factorization machine method is not efficient. Summary of the Invention
[0006] (a) Technical problems to be solved
[0007] To address the shortcomings of existing technologies, this invention provides a non-sampling factorization machine service method under a vertical federated learning architecture. This method is applicable when data cannot typically be directly transferred from one data owner to another, and two companies, A and B, want to collaboratively train a machine learning service recommendation model. Each company possesses its own data, and both datasets share the same sample space but have different feature spaces. This invention combines vertical federated learning with a non-sampling factorization machine. Vertical federated learning ensures data privacy, while an improved non-sampling factorization machine model is used for training. Mathematical methods are employed to transform the traditional factorization machine model into a matrix factorization model, and the loss function is optimized. These advantages solve the problem of poor efficiency in non-sampling factorization machine recommendation frameworks based on a vertical federated learning architecture.
[0008] (II) Technical Solution
[0009] To achieve the above objectives, the present invention provides the following technical solution: a non-sampling factorization machine service method under a vertical federated learning architecture, comprising the following steps:
[0010] S1. Company A and Company B each initialize their local models; that is, for Company A, the initialization parameter w is... A v A And based on this, vector P is calculated. A For company B, the initialization parameter w B v B And based on this, the vector Q is calculated. B ;
[0011] S2. Trusted third-party server C sends the public key pub to companies A and B. Company B then sends the intermediate result Q. B Encryption yields [[Q] B The data was transmitted to Company A.
[0012] S3. Company A receives the encrypted intermediate result transmitted by Company B [[Q] B ]], and through P A Q B ]], h aux Find the cryptographic prediction function of the vertical federated factorization machine algorithm. Company A will [[P] A ]]and Send it back to Company B.
[0013] S4. Company A and Company B each use the data transmitted locally and to each other to calculate the loss function L. Company A solves for the encryption gradient.
[0014] S5. Company A and Company B respectively upload these encrypted parameter gradients to the third-party server C for decryption. The results are then returned to Company A and Company B respectively, and the parameters are updated using gradient descent.
[0015] S6. Repeat steps S2 to S5 until the model converges.
[0016] Preferably, the calculation of P in step S1 A With Q B The specific method is:
[0017]
[0018] in,
[0019]
[0020]
[0021] h aux,d =h2;h aux,d+1 =1; h aux,d+2 =1
[0022] Where d represents the number of latent factors, P A ∈R d+2 Q B ∈R d+2 and h aux ∈R d+2 P represents the feature vector of company A, the feature vector of company B, and the weights of the auxiliary neurons in the prediction layer. A and Q B All depend solely on the local characteristic data of Company A and Company B, where, and These are the global biases of the local models of companies A and B participating in the joint modeling, respectively, where m and n represent the number of features in the data of companies A and B, respectively. and f is the weight of the i-th variable of company A and the j-th variable of company B in the model. BI (A) and f BI (B) represents the second-order interaction between the data features of company A and the data features of company B, respectively. h1 represents the neuron weight of the sum of the interaction terms of the internal features of companies A and B in the prediction layer, and h2 represents the neuron weight of the interaction terms of the features of companies A and B in the prediction layer.
[0023] Preferably, the specific method of the encryption method used in step S2 is as follows:
[0024] Q B ]] = E pub (Q B )
[0025] Where E pub (·) is an additive homomorphic encryption function using the public key pub, [[Q B ]] is the result after homomorphic encryption.
[0026] Preferably, step S3 involves [[P] A ]], [[Q B ]], [[h aux Calculate the predicted values using the vertical federated factorization machine algorithm. The specific method is:
[0027]
[0028] Among them, [[P] A ]] and [[Q B [] indicates that the feature vectors of company A and company B are homomorphically encrypted using the public key pub's homomorphic encryption function, h aux P represents the weights of the auxiliary neurons in the prediction layer, ⊙ denotes the element-wise product of vectors. A and Q B All of these depend solely on the local characteristic data of Company A and Company B.
[0029] Preferably, the specific method for calculating the loss function L in step S4 is as follows:
[0030]
[0031] Where U is the dataset of company B, and V + For the dataset with positive feedback in Company A, To substitute the u-th item in dataset U and the data set V + The predicted value of the v-th feature, where d represents the number of latent factors, h i b j They are vectors h respectively aux The i-th and j-th terms, p u,i p u,j They are vectors P A The i-th and j-th terms, p v,i p u,j They are vectors Q B The i-th and j-th terms.
[0032] Preferably, step S5, which involves companies A and B first receiving the decrypted gradient data from company C, and then companies A and B updating their respective parameters using the data they received, specifically includes the following steps:
[0033] S5.1, Companies A and B received the data from Company C using the addition homomorphic decryption function D. pub (·) The decryption result, in which Company A received Company B received
[0034] S5.2 The specific method for updating parameters using gradient descent is as follows:
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041] Where α is the learning rate. and These are the global biases of the local models of companies A and B, respectively, which are participating in the joint modeling. A and w B These are the linear weights of the local models of companies A and B, respectively, which participated in the joint modeling. A and v B These are the latent vectors of the local models of Company A and Company B, which participated in the joint modeling.
[0042] (III) Beneficial Effects
[0043] Compared with existing technologies, this invention provides a non-sampling factorization machine service method under a vertical federated learning architecture, which has the following beneficial effects:
[0044] This non-sampling factorization machine service method under the vertical federated learning architecture transforms the factorization machine into a matrix factorization form and uses a new loss function for model training. Combined with the vertical federated learning method, it achieves efficient factorization machine service recommendation under the fully sampled implicit feedback vertical federated learning architecture, solving the technical problem of poor operating efficiency of implicit feedback fully sampled factorization machine based on the vertical federated learning architecture. Attached Figure Description
[0045] The accompanying drawings, which are provided to further illustrate this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application.
[0046] Figure 1 This is a schematic diagram of the service recommendation method for the vertical federated learning factorization machine proposed in this invention.
[0047] Figure 2 This is a schematic diagram of the vertical federated learning factorization machine service recommendation model proposed in this invention. Detailed Implementation
[0048] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0049] For examples, please refer to Figure 1-2 This embodiment of a vertical federated learning factorization machine service recommendation method includes the following steps:
[0050] S1. Company A and Company B each initialize their local models; that is, for Company A, the initialization parameter w is... A v A And based on this, vector P is calculated. A For company B, the initialization parameter w B v B And based on this, the vector Q is calculated. B ;
[0051] Specifically,
[0052] S2. Trusted third-party server C sends the public key pub to companies A and B. Company B then sends the intermediate result Q. B Encryption yields [[Q] B The data was transmitted to Company A.
[0053] S3. Company A receives the encrypted intermediate result transmitted by Company B [[Q] B ]], and through P A Q B ]], h aux Find the cryptographic prediction function of the vertical federated factorization machine algorithm. Company A will [[P] A ]]and Send it back to Company B.
[0054] S4. Company A and Company B each use the data transmitted locally and to each other to calculate the loss function L. Company A solves for the encryption gradient.
[0055] S5. Company A and Company B respectively upload these encrypted parameter gradients to the third-party server C for decryption. The results are then returned to Company A and Company B respectively, and the parameters are updated using gradient descent.
[0056] S6. Repeat steps S2 to S5 until the model converges.
[0057] Preferably, step S1 calculates P A With Q B The specific method is:
[0058]
[0059] in,
[0060]
[0061]
[0062] h aux,d =h2;h aux,d+1 =1; h aux,d+2 =1
[0063] Where d represents the number of latent factors, P A ∈R d+2 Q B ∈R d+2 and h aux ∈R d+2 P represents the feature vector of company A, the feature vector of company B, and the weights of the auxiliary neurons in the prediction layer. A and Q B All depend solely on the local characteristic data of Company A and Company B, where, and These are the global biases of the local models of companies A and B participating in the joint modeling, respectively, where m and n represent the number of features in the data of companies A and B, respectively. and f is the weight of the i-th variable of company A and the j-th variable of company B in the model. BI (A) and f BI (B) represents the second-order interaction between the data features of company A and the data features of company B, respectively. h1 represents the neuron weight of the sum of the interaction terms of the internal features of companies A and B in the prediction layer, and h2 represents the neuron weight of the interaction terms of the features of companies A and B in the prediction layer.
[0064] Specifically, the method for initializing the model parameters for Company A and Company B is as follows: Assuming that Company A's dataset has n1 items and Company B's dataset has n2 items, and the latent vector length is d, then w A Initialize as a one-dimensional vector of length n1, w B Initialize as a one-dimensional vector of length n², v A Initialize as an n1-order d-dimensional matrix, v B Initialize as an n²-order d-dimensional matrix, with initialization parameter w. A vA w B v B These represent the weights of individual variables in Company A's model, the latent vectors of each dimension of Company A's features, the weights of individual variables in Company B's model, and the latent vectors of each dimension of Company B's features, respectively.
[0065] Specifically, the generalized vertical federated factorization machine is transformed into a matrix factorization form. The classic vertical federated factorization machine model is as follows:
[0066]
[0067] in, and These are the global biases of the local models of companies A and B participating in the joint modeling, respectively, where m and n represent the number of features in the data of companies A and B, respectively. and These are the weights of the i-th and j-th variables in the model, where h represents the neuron weights in the prediction layer, and ⊙ represents the element-wise product of the vectors. The output... It is a predicted score that indicates the degree of user preference for a specified item.
[0068] User-defined interactions are independent of project characteristics, and project-defined interactions are also independent of user characteristics. Therefore, we can apply a memory strategy to pre-compute these two parameters. We will describe the above process in detail by constructing three auxiliary vectors:
[0069]
[0070] P A ∈R d+2 Q B ∈R d+2 and h aux ∈R d+2 Given Company A, Company B, and forecast parameters, calculate P. A With Q B The specific method is:
[0071]
[0072]
[0073] h aux,d =h2;h aux,d+1 =1; h aux,d+2 =1
[0074] Where d represents the number of latent factors, P A ∈R d+2 Q B ∈R d+2 and h aux ∈R d+2P represents the feature vector of company A, the feature vector of company B, and the weights of the auxiliary neurons in the prediction layer. A and Q B All depend solely on the local characteristic data of Company A and Company B, where, and These are the global biases of the local models of companies A and B participating in the joint modeling, respectively, where m and n represent the number of features in the data of companies A and B, respectively. and Here, h1 represents the weights of the i-th variable in company A and the j-th variable in company B in the model, h2 represents the weights of the neurons representing the sum of the interaction terms of the internal features of companies A and B in the prediction layer, and f represents the weights of the neurons representing the interaction terms of the features of companies A and B in the prediction layer. BI (A) and f BI (B) represents the second-order interaction between the data characteristics of Company A and the data characteristics of Company B, respectively.
[0075] Specifically, f BI (A) and f BI (B) The formula is shown below:
[0076]
[0077]
[0078] Where m is the number of items in the dataset of company A, and n is the number of items in the dataset of company B. Let i and j represent the i-th and j-th projects in company A, respectively. Let i and j represent the i-th and j-th projects in company B, respectively. Let represent the latent vectors of the i-th and j-th projects in company A, respectively. Let represent the implicit vectors of the i-th and j-th projects in company A, respectively, and let ⊙ represent the element-wise product of the vectors.
[0079] Reference Figure 2 It describes a specific full-sampling longitudinal federated factorization machine model.
[0080] The specific encryption method used in step S2 is as follows:
[0081] Q B ]] = E pub (Q B )
[0082] Where E pub (·) is an additive homomorphic encryption function using the public key pub, [[Q B ]] is the result after homomorphic encryption.
[0083] Step S3 via [[P]A ]], [[Q B ]], [[h aux Calculate the predicted values using the vertical federated factorization machine algorithm. The specific method is:
[0084]
[0085] Among them, [[P] A ]] and [[Q B [] indicates that the feature vectors of company A and company B are homomorphically encrypted using the public key pub's homomorphic encryption function, h aux P represents the weights of the auxiliary neurons in the prediction layer, ⊙ denotes the element-wise product of vectors. A and Q B All of these depend solely on the local characteristic data of Company A and Company B.
[0086] The basic principle is that the prediction function of the generalized longitudinal federated factorization machine can be reformulated as a matrix factorization function:
[0087]
[0088] Where P A and Q B Let h represent the eigenvectors of company A and company B. aux P represents the weights of the auxiliary neurons in the prediction layer, ⊙ denotes the element-wise product of vectors. A and Q B All depend solely on the local characteristic data of Company A and Company B.
[0089] The specific method for calculating the loss function L in step S4 is as follows:
[0090]
[0091] Where U is the dataset of company B, and V + For the dataset with positive feedback in Company A, To substitute the u-th item in dataset U and the data set V + The predicted value of the v-th feature, where d represents the number of latent factors, h i h j They are vectors h respectively aux The i-th and j-th terms, p u,i p u,j They are vectors P A The i-th and j-th terms, q v,i q v,j They are vectors Q B The i-th and j-th terms.
[0092] Specifically, the loss function L in step four is derived losslessly from the following non-sampling loss function:
[0093]
[0094] Where U represents the dataset of company B, and V represents the dataset of company A. To substitute the predicted values of the u-th feature in dataset U and the v-th feature in dataset V, y uv Let be the label values corresponding to the u-th feature in dataset U and the v-th feature in dataset V.
[0095] Step S5: First, companies A and B receive the decrypted gradient data from company C. Then, companies A and B use the data they received to update their respective parameters.
[0096] Specifically, the computational complexity of equation L is The computational complexity of equation L* is O(|U||V|d), where U is the number of dataset items in company B and V is the number of dataset items in company A. Let d be the number of items with positive feedback, and d be the dimension of the latent vector. This is because in practical applications... Therefore, the training complexity of the factorization machine model using formula L is reduced by several orders of magnitude compared to using L*.
[0097] Specifically, the following steps are included:
[0098] S5.1, Companies A and B received the data from Company C using the addition homomorphic decryption function D. pub (·) The decryption result, in which Company A received Company B received
[0099] S5.2 The specific method for updating parameters using gradient descent is as follows:
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106] Where α is the learning rate. and These are the global biases of the local models of companies A and B, respectively, which are participating in the joint modeling. A and wB These are the linear weights of the local models of companies A and B, respectively, which participated in the joint modeling. A and v B These are the latent vectors of the local models of Company A and Company B, which participated in the joint modeling.
[0107] In summary, this non-sampling factorization machine service method under the vertical federated learning architecture transforms the factorization machine into a matrix factorization form. Based on this, a new loss function is used for model training. Combined with the vertical federated learning method, it achieves efficient factorization machine service recommendation under the fully sampled implicit feedback vertical federated learning architecture, solving the technical problem of poor operating efficiency of implicit feedback fully sampled factorization machines based on the vertical federated learning architecture.
[0108] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0109] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A non-sampling factorization machine service method under a vertical federated learning architecture, characterized in that: Includes the following steps: S1. Company A and Company B each initialize their local models; that is, for Company A, initialize the parameters. And based on this, the vector is calculated. For company B, initialization parameters And based on this, the vector is calculated. ;calculate and The specific method is: ; in, ; ; ; in, Represents the number of latent factors. , and This represents the feature vector of company A, the feature vector of company B, and the weights of the auxiliary neurons in the prediction layer. and All depend solely on the local characteristic data of Company A and Company B, where, and These are the global biases of the local models of Company A and Company B, which participated in the joint modeling. and The number of features representing the data of companies A and B, respectively. and Company A in the model Company B The weights of each variable, and These represent the second-order interactions between the data characteristics of company A and the data characteristics of company B, respectively. The neuron weights represent the sum of the feature interaction terms within companies A and B in the prediction layer. The neuron weights represent the intersecting terms of features between companies A and B in the prediction layer; S2. Trusted third-party server C sends the public key pub to companies A and B. Company B then sends the intermediate results... Encryption obtained Transmitted to Company A; S3. Company A receives the encrypted intermediate result transmitted by Company B. and through Find the cryptographic prediction function of the vertical federated factorization machine algorithm. Company A will and Send back to Company B; S4. Company A and Company B respectively calculate the loss function using the data transmitted between their local machines and each other. Company A solves the encryption gradient. , , , , , ; S5. Company A and Company B respectively upload these encrypted parameter gradients to the third-party server C for decryption, and the results are returned to Company A and Company B respectively. The parameters are then updated using gradient descent. S6. Repeat steps S2 to S5 until the model converges.
2. The non-sampling factorization machine service method under a vertical federated learning architecture according to claim 1, characterized in that: The specific encryption method used in step S2 is as follows: ; in To use the addative homomorphic encryption function with public key pub, This is the result after homomorphic encryption.
3. The non-sampling factorization machine service method under a vertical federated learning architecture according to claim 1, characterized in that: In step S3, through Calculate the predicted values using the longitudinal federated factorization machine algorithm. The specific method is: ; in and This indicates that the feature vectors of company A and company B are homomorphically encrypted using the public-key pub homomorphic encryption function. These represent the weights of the auxiliary neurons in the prediction layer, where ⊙ denotes the element-wise product of the vectors. and All of these depend solely on the local characteristic data of Company A and Company B.
4. The non-sampling factorization machine service method under a vertical federated learning architecture according to claim 1, characterized in that: In step S4, the loss function is calculated. The specific method is: ; Where U is the dataset of company B, For the dataset with positive feedback in Company A, To substitute the u-th item in dataset U and the dataset The predicted value of the vth feature in the middle. Represents the number of latent factors. They are vectors The i-th and j-th terms, They are vectors The i-th and j-th terms, They are vectors The i-th and j-th terms.
5. The non-sampling factorization machine service method under a vertical federated learning architecture according to claim 1, characterized in that: In step S5, companies A and B first receive the decrypted gradient data from company C. Then, companies A and B use their respective received data to update their parameters, which includes the following steps: S5.1, Companies A and B receive the data from Company C using the addition homomorphic decryption function. The decryption results showed that Company A received... , , Company B received , , ; S5.2 The specific method for updating parameters using gradient descent is as follows: ; ; ; ; ; ; in, For learning rate, and These are the global biases of the local models of Company A and Company B, which participated in the joint modeling. and These are the linear weights of the local models of companies A and B, which participated in the joint modeling. and These are the latent vectors of the local models of Company A and Company B, which participated in the joint modeling.
Citation Information
Patent Citations
Factorization machine classification model construction method and device and readable storage medium
CN112000987A
Model protection method based on trilateral homomorphic encryption longitudinal federated learning
CN114936372A