Factorization machine model construction method, device and readable storage medium
Through the combination of the secret sharing mechanism and homomorphic encryption of the factorization machine model, only the non-zero part of the sparse data is calculated, which solves the problem of low computational efficiency of sparse matrix federated learning and improves the computational efficiency and model performance.
Patent Information
- Application Number
- CN202010893538.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-28
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-08-28
AI Technical Summary
In the existing technology, federated learning based on sparse matrices has low computational efficiency due to the high computational complexity and large amount of calculation caused by the homomorphic encryption method.
The factorization machine model construction method is adopted, and through the combination of secret sharing mechanism and homomorphic encryption, only the non-zero part of the sparse data is used for calculation, which reduces the calculation of the zero part and reduces the computational complexity of federated interaction.
It significantly improves the computational efficiency of sparse matrix federated learning, overcomes the problem of low computational efficiency caused by too large sparse matrices, and improves the performance of the longitudinal federated factorization machine model.
Smart Images

Figure CN112016698B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence in financial technology (Fintech), and in particular to a factorization machine model construction method, device and readable storage medium. Background Art
[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, blockchain, artificial intelligence, etc.) are applied in the financial field, but the financial industry also puts forward higher requirements on technology, such as higher requirements on the distribution of corresponding to-do items in the financial industry.
[0003] With the continuous development of computer software and artificial intelligence, the application field of federated learning is becoming more and more extensive. At present, since the training data of federated learning is usually a dense matrix, the dense matrix is usually encrypted through homomorphic encryption, so that federated learning can be achieved without leaking data privacy. However, when the training data is sparse matrix data, such as user portrait data, the sparse matrix is much larger than the dense matrix when storing the same information. Therefore, the amount of calculation for federated learning based on homomorphic encryption is very large, and the calculation complexity is very high, which leads to extremely low computational efficiency of federated learning based on sparse matrices. Summary of the invention
[0004] The main purpose of this application is to provide a factorization machine model construction method, device and readable storage medium, aiming to solve the technical problem of low computational efficiency in federated learning based on sparse matrices in the prior art.
[0005] To achieve the above-mentioned object, the present application provides a factor decomposition machine model construction method, the factor decomposition machine model construction method is applied to a factor decomposition machine model construction device, and the factor decomposition machine model construction method includes:
[0006] Acquire initialization model parameters and first sparse data corresponding to a preset initialization model, and based on the initialization model parameters, perform secret sharing with a second device to obtain first-party secret sharing initial model parameters, so that the second device can determine second-party secret sharing initial model parameters;
[0007] Based on a first non-zero portion of the first sparse data and the first party secret sharing initial model parameter, perform a federated interaction with the second device to calculate a secret sharing model error by combining a second non-zero portion of the second sparse data obtained by the second device and the second party secret sharing initial model parameter;
[0008] Based on the secret sharing model error, the preset initialization model is updated to obtain a vertical federated factorization machine model.
[0009] The present application also provides a personalized recommendation method, which is applied to a personalized recommendation device, and the personalized recommendation method includes:
[0010] Acquire sparse data of the first-party user to be recommended, and perform secret sharing with the second device to obtain secret sharing model parameters;
[0011] Based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, perform a vertical federated prediction interaction with the second device to score the recommended item corresponding to the sparse data of the first-party user to be recommended, and obtain a first secret sharing scoring result;
[0012] Based on the first secret sharing scoring result, perform aggregate interaction with the second device to calculate a target scoring result in conjunction with the second secret sharing scoring result determined by the second device;
[0013] Based on the target scoring result, a target recommendation list corresponding to the to-be-recommended items is generated.
[0014] The present application also provides a factor decomposition machine model construction device, the factor decomposition machine model construction device is a virtual device, and the factor decomposition machine model construction device is applied to a factor decomposition machine model construction device, and the factor decomposition machine model construction device includes:
[0015] A secret sharing module, used to obtain initialization model parameters and first sparse data corresponding to a preset initialization model, and based on the initialization model parameters, perform secret sharing with a second device to obtain first-party secret sharing initial model parameters, so that the second device can determine second-party secret sharing initial model parameters;
[0016] an error calculation module, configured to perform a federated interaction with the second device based on a first non-zero portion of the first sparse data and the first party secret sharing initial model parameter, so as to calculate a secret sharing model error by combining a second non-zero portion of the second sparse data obtained by the second device and the second party secret sharing initial model parameter;
[0017] A generation module is used to update the preset initialization model based on the secret sharing model error to obtain a vertical federated factorization machine model.
[0018] The present application also provides a personalized recommendation device, which is a virtual device and is applied to a personalized recommendation device. The personalized recommendation device includes:
[0019] A secret sharing module, used to obtain sparse data of the first-party user to be recommended, and to perform secret sharing with the second device to obtain secret sharing model parameters;
[0020] a scoring module, configured to perform a vertical federated prediction interaction with the second device based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, so as to score the recommended item corresponding to the sparse data of the first-party user to be recommended, and obtain a first secret sharing scoring result;
[0021] an aggregation module, configured to perform aggregation interaction with the second device based on the first secret sharing scoring result, so as to calculate a target scoring result in conjunction with the second secret sharing scoring result determined by the second device;
[0022] A generation module is used to generate a target recommendation list corresponding to the to-be-recommended items based on the target scoring result.
[0023] The present application also provides a factor decomposition machine model building device, which is a physical device. The factor decomposition machine model building device includes: a memory, a processor, and a program of the factor decomposition machine model building method stored in the memory and executable on the processor. When the program of the factor decomposition machine model building method is executed by the processor, the steps of the factor decomposition machine model building method as described above can be implemented.
[0024] The present application also provides a personalized recommendation device, which is a physical device, comprising: a memory, a processor, and a program of the personalized recommendation method stored in the memory and executable on the processor. When the program of the personalized recommendation method is executed by the processor, the steps of the personalized recommendation method as described above can be implemented.
[0025] The present application also provides a readable storage medium, on which is stored a program for implementing a factor decomposition machine model construction method. When the program of the factor decomposition machine model construction method is executed by a processor, the steps of the factor decomposition machine model construction method as described above are implemented.
[0026] The present application also provides a readable storage medium, on which is stored a program for implementing the personalized recommendation method. When the program of the personalized recommendation method is executed by a processor, the steps of the personalized recommendation method as described above are implemented.
[0027] The present application provides a factorization machine model construction method, device and readable storage medium. Compared with the prior art technical means of using a homomorphic encryption-based method for federated learning, the present application performs secret sharing with a second device after obtaining the initialization model parameters and the first sparse data corresponding to the preset initialization model, so that the first device obtains the first-party secret sharing initial model parameters, and the second device obtains the second-party secret sharing initial model parameters, and then based on the first non-zero part of the first sparse data and the first-party secret sharing initial model parameters, performs federated interaction with the second device to jointly obtain the second non-zero part of the second sparse data obtained by the second device and the second-party secret sharing initial model parameters. type parameters, and calculate the secret sharing model error, wherein, during the federal interaction, only the first non-zero part of the first sparse data and the second non-zero part of the second sparse data are used for calculation, thereby reducing the calculation process of the zero part in the first sparse data and the second sparse data, so that the calculation amount and complexity in the federal interaction process are greatly reduced, and then based on the secret sharing model error, the preset initialization model is updated to obtain the vertical federated factorization machine model, which overcomes the technical defect of low computational efficiency in the prior art due to the large sparse matrix and the homomorphic encryption method when performing federated learning based on the sparse matrix, thereby improving the computational efficiency of federated learning based on the sparse matrix. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0029] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0030] Figure 1 This is a flow chart of the first embodiment of the factor decomposition machine model construction method of the present application;
[0031] Figure 2 This is a flow chart of the second embodiment of the factor decomposition machine model construction method of the present application;
[0032] Figure 3 This is a flowchart of the third embodiment of the personalized recommendation method of this application;
[0033] Figure 4 A schematic diagram of the device structure of the hardware operating environment involved in the factor decomposition machine regression model construction method of the embodiment of the present application;
[0034] Figure 5 A schematic diagram of the device structure of the hardware operating environment involved in the personalized recommendation method of the embodiment of the present application.
[0035] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0036] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0037] The present application embodiment provides a factor decomposition machine model construction method. In the first embodiment of the factor decomposition machine model construction method of the present application, refer to Figure 1 , the factor decomposition machine model construction method is applied to a first device, and the factor decomposition machine model construction method includes:
[0038] Step S10, obtaining initialization model parameters and first sparse data corresponding to a preset initialization model, and based on the initialization model parameters, performing secret sharing with a second device to obtain first-party secret sharing initial model parameters, so that the second device can determine second-party secret sharing initial model parameters;
[0039] In this embodiment, it should be noted that the first device and the second device are both participants in vertical federated learning. The first device has first sparse data with sample labels. The first sparse data can be represented by a first sparse matrix and sample labels. For example, assuming that the first sparse data is (X A , Y), X A is the first sparse matrix, Y is the sample label, and in addition, the second device has second sparse data without sample labels, and the second sparse data can be represented by a second sparse matrix. For example, assuming that the second sparse matrix is X B .
[0040] Additionally, in the present embodiment, the factor decomposition machine model is a machine learning model constructed based on vertical federated learning, and the model parameters of the factor decomposition machine model are jointly held by the first device and the second device, wherein the model parameters corresponding to the factor decomposition machine model can be represented by a matrix, and after the factor decomposition is initialized, the model parameters corresponding to the factor decomposition machine model include the initialization model parameters belonging to the first device and the second-party initialization model parameters belonging to the second device, wherein the initialization model parameters include the first-party first-type model parameter vector, the first-party second-type model parameter matrix, and the first-party transposed matrix corresponding to the first-party second-type model parameter matrix, and the second-party initialization model parameters include the second-party first-type model parameter vector, the second-party second-type model parameter matrix, and the second-party transposed matrix corresponding to the second-party second-type model parameter matrix. For example, assuming that the first-party first-type model parameter vector is w A , the second party first type model parameter vector is w B , the first-party second-type model parameter matrix is V A , the second-party second-type model parameter matrix is V B , and the model parameters of the factor decomposition machine model are the first type model parameters w=[w A , w B ] and the second type model parameter V=[V A , V B ].
[0041] In addition, it should be noted that the process of secret sharing of data is a process of splitting the data into two sub-data, and the two sub-data are held by two parties of secret sharing respectively. For example, assuming that the two parties of secret sharing are A and B, then data X is secret shared, and A holds the first share of data X [[X]] A , B holds the second share of data X [[X]] B , and X=[[X]] A +[[X]] B .
[0042] In addition, it should be noted that the model expression of the factor decomposition machine model is as follows:
[0043] z(x)=<w,x> +∑ i<j <V i , V j >x i x j
[0044] Wherein, x is the data matrix corresponding to the model input data, wherein the model input data includes the first sparse data (X A , Y) and the second sparse data XB , where Y is the sample label, X A With d A The first sparse matrix of feature dimensions, X B With d B The second sparse matrix of feature dimensions, the first type model parameter is w, where w is a d-dimensional vector, and the second type model parameter is V, where V is d*d x The matrix, and w=[w A , w B ], that is, w is the first-party first-type model parameter vector w A and the second-party first-type model parameter vector w B Composition, among which w A is d A dimensional vector, w B is d B dimensional vector, otherwise, V = [V A , V B ], where V is the first-party second-type model parameter matrix V A and the second party second type model parameter matrix V B Composition, among which, V A is d A *d X dimensional matrix, V B is d B *d X dimensional matrix,<w,x> is the inner product of w and x, V i is the column vector of the i-th column of V, V j is the column vector of the jth column of V, x i is the column vector of the i-th column of x, x j is the column vector of the j-th column of x.
[0045] Obtain initialization model parameters and first sparse data corresponding to a preset initialization model, and based on the initialization model parameters, perform secret sharing with a second device to obtain first-party secret-shared initial model parameters for the second device to determine second-party secret-shared initial model parameters. Specifically, initialize the factor decomposition machine model to obtain the preset initialization model, and obtain initialization model parameters corresponding to the preset initialization model, wherein the second device obtains the second-party initialization model parameters, and splits the second-party initialization model parameters into a first share of second-party initialization model parameters and a second share of second-party initialization model parameters, and then obtains the first sparse data, and splits the initialization model parameters into a first share of initialization model parameters and a second share of initialization model parameters, wherein the first share of initialization model parameters includes a first share of first-party first-type model parameter vector, a first share of first-party second-type model parameter matrix, and a first share of first-party transposed matrix, and the second share of initialization model parameters includes a first-party first The first party receives the second share of the first type model parameter vector, the second share of the first party second type model parameter matrix and the second share of the first party transposed matrix, and then sends the second share of the initialized model parameter to the second device, so that the second device uses the second share of the initialized model and the first share of the second party initialized model as the second party secret shared model parameters, and then receives the second share of the second party initialized model parameter sent by the second device, and uses the first share of the initialized model parameter and the second share of the second party initialized model parameter as the first party secret shared initial model parameters, wherein the first share of the second party initialized model parameter includes the first share of the second party first type model parameter vector, the first share of the second party second type model parameter matrix and the first share of the second party transposed matrix, and the second share of the second party initialized model parameter includes the second share of the second party first type model parameter vector, the second share of the second party second type model parameter matrix and the second share of the second party transposed matrix. For example, assuming that the initialized model parameter is G A , the second party initializes the model parameters G B , then after secret sharing, the first device has the first share of the initialization model [[G A ]] A and the second party initializes the model second share [[G B ]] A , the second device has the second share of the initialization model [[G A ]] B and the second party initializes the model first share [[G B ]] B , and G A =[[G A ]] A +[[GA ]] B , G B =[[G B ]] A +[[G B ]] B .
[0046] Step S20, based on the first non-zero part of the first sparse data and the first party secret sharing initial model parameter, perform a federation interaction with the second device to combine the second non-zero part of the second sparse data obtained by the second device and the second party secret sharing initial model parameter to calculate a secret sharing model error;
[0047] In this embodiment, it should be noted that the first non-zero part is each column vector in the first sparse matrix, and the second non-zero part is each column vector in the second sparse matrix.
[0048] Based on the first non-zero part of the first sparse data and the first-party secret sharing initial model parameters, a federal interaction is performed with the second device to jointly calculate the secret sharing model error with the second non-zero part of the second sparse data obtained by the second device and the second-party secret sharing initial model parameters. Specifically, based on the first non-zero part of the first sparse data and the first-party secret sharing initial model parameters, a federal interaction is performed with the second device to jointly calculate the second non-zero part of the second sparse data determined by the second device and the second-party secret sharing initial model parameters to calculate each secret sharing error parameter item, and then the secret sharing model error is calculated based on each secret sharing parameter item, the secret sharing sample label and a preset secret sharing model error calculation formula, wherein the secret sharing sample label is obtained by secretly sharing the sample label with the second device, wherein the secret sharing sample label is a first share of the sample label, and the second share of the sample label is the second-party secret sharing sample label, and is held by the second device.
[0049] The step of performing federated interaction with the second device based on the first non-zero part of the first sparse data and the first party secret sharing initial model parameter to calculate the secret sharing model error by combining the second non-zero part of the second sparse data obtained by the second device and the second party secret sharing initial model parameter comprises:
[0050] Step S21, based on a preset secret sharing multiplication triplet, the first non-zero part and the first party secret sharing initial model parameters, perform a federated interaction with the second device to combine the second non-zero part and the second party secret sharing initial model parameters to calculate a sparse matrix secure inner product and a secret sharing intermediate parameter;
[0051] In this embodiment, it should be noted that the secret sharing error parameter items are parameter items used to calculate the secret sharing error, and each of the secret sharing parameter items includes a coefficient matrix secure inner product and a secret sharing intermediate parameter.
[0052] Based on the preset secret sharing multiplication triplet, the first non-zero part and the first-party secret sharing initial model parameters, a federal interaction is performed with the second device to jointly calculate the sparse matrix secure inner product and secret sharing intermediate parameters with the second non-zero part and the second-party secret sharing initial model parameters. Specifically, based on the first non-zero part and the first-party secret sharing initial model parameters, a federal interaction is performed with the second device to jointly calculate the sparse matrix secure inner product with the second non-zero part and the second-party secret sharing initial model parameters, and based on the preset secret sharing multiplication triplet, the first non-zero part and the first-party secret sharing initial model parameters, a federal interaction is performed with the second device to jointly calculate the secret sharing intermediate parameters with the preset second-party secret sharing multiplication triplet corresponding to the preset secret sharing multiplication triplet, the second non-zero part and the second-party secret sharing initial model parameters.
[0053] The first party secret sharing initial model parameters include first type sharing model parameters and second type sharing model parameters, the second party secret sharing initial model parameters include second party first type sharing model parameters and second party second type sharing model parameters, the sparse matrix secure inner product includes first type sparse matrix secure inner product and second type sparse matrix secure inner product,
[0054] The step of performing federated interaction with the second device based on the preset secret sharing multiplication triplet, the first non-zero part, and the first party secret sharing initial model parameter to combine the second non-zero part and the second party secret sharing initial model parameter to calculate the sparse matrix secure inner product and the secret sharing intermediate parameter comprises:
[0055] Step S211: based on the first type of shared model parameters and the first non-zero part, perform federated interaction with the second device to combine the second party's first type of shared model parameters and the second non-zero part to calculate the first type of sparse matrix secure inner product;
[0056] In this embodiment, it should be noted that the first type of shared model parameters are first type model parameters of secret sharing held by the first device, wherein the first type of shared model parameters include a fifth shared parameter and a sixth shared parameter, wherein the fifth shared parameter is the first share of the first type model parameter vector of the first party, the sixth shared parameter is the second share of the first type model parameter vector of the second party, and the second party first type shared model parameters are first type model parameters of secret sharing held by the second device, wherein the second party first type shared parameters include a seventh shared parameter and an eighth shared parameter, wherein the seventh shared parameter is the second share of the first type model parameter vector of the first party, and the eighth shared parameter is the first share of the first type model parameter vector of the second party, and the first type sparse matrix secure inner product includes a third non-zero characteristic term cross inner product and The fourth non-zero characteristic item cross inner product, wherein the third non-zero characteristic item cross inner product is the cross characteristic item inner product of the first-party first type model parameter vector secretly shared in the first device and the first non-zero part, that is, the third non-zero characteristic item cross inner product is the cumulative value of the product of the first-party first type model parameter vector secretly shared in the first device and each column vector in the first non-zero part, wherein the third non-zero characteristic item cross inner product can be represented by a vector, the fourth non-zero characteristic item cross inner product is the cross characteristic item inner product of the second-party first type model parameter vector secretly shared in the first device and the second non-zero part, the fourth non-zero characteristic item cross inner product is the cumulative value of the product of the second-party first type model parameter vector secretly shared in the first device and each column vector in the second non-zero part, wherein the fourth non-zero characteristic item cross inner product can be represented by a vector.
[0057] Based on the first type of shared model parameters and the first non-zero part, a federated interaction is performed with the second device to combine the first type of shared model parameters of the second party and the second non-zero part to calculate the first type of sparse matrix security inner product. Specifically, the second device generates a third public key and a third private key corresponding to the third public key, and based on the third public key, performs homomorphic encryption on the seventh shared parameter to obtain the encrypted seventh shared parameter, and sends the third public key and the encrypted seventh shared parameter to the first device, and then the first device receives the third public key and the encrypted seventh shared parameter, and then based on the third public key, performs homomorphic encryption on the fifth shared parameter to obtain the encrypted fifth shared parameter, and then calculates The encrypted fifth shared parameter and the encrypted seventh shared parameter are summed to obtain the encrypted first-party first-type model parameter vector, and then the product of the encrypted first-party first-type model parameter vector and each first non-zero column vector in the first non-zero part of the first sparse matrix is calculated to obtain the first vector product corresponding to each first non-zero column vector, wherein each row of the first sparse matrix corresponds to a sample dimension, and each column of the first sparse matrix corresponds to a feature dimension, and then the first vector products are accumulated to obtain a third encrypted inner product, and then a third non-zero feature item cross inner product that is uniformly distributed and consistent with the feature dimension of the third encrypted inner product is constructed, and the third non-zero feature item cross inner product is encrypted based on the third public key. The cross inner product of the encrypted third non-zero feature items is homomorphically encrypted to obtain the encrypted third non-zero feature item cross inner product, and then the difference between the third encrypted inner product and the encrypted third non-zero feature item cross inner product is calculated to obtain the encrypted second-party third non-zero feature item cross inner product, and the encrypted second-party third non-zero feature item cross inner product is sent to the second device, and then the second device decrypts the encrypted second-party third non-zero feature item cross inner product based on the third private key to obtain the second-party third non-zero feature item cross inner product, wherein the second-party third non-zero feature item cross inner product is the cross feature item inner product of the first-party first-type model parameter vector and the first non-zero part secretly shared in the second device, that is, the second-party third non-zero feature item cross inner product. is the accumulated value of the product of the first-party first-type model parameter vector secretly shared in the second device and each column vector in the first non-zero part. Similarly, the first device generates a fourth public key and a fourth private key corresponding to the fourth public key, and based on the fourth public key, performs homomorphic encryption on the sixth shared parameter to obtain the encrypted sixth shared parameter, and then sends the fourth public key and the encrypted sixth shared parameter to the second device, and then the second device receives the fourth public key and the encrypted sixth shared parameter, and based on the fourth public key, performs homomorphic encryption on the eighth shared parameter to obtain the encrypted eighth shared parameter, and then calculates the encrypted sixth shared parameter and the encrypted eighth shared parameter to obtain the encrypted second-party first-type model parameter vector.Then calculate the product of the encrypted second-party first-type model parameter vector and each second non-zero column vector in the second non-zero part of the second sparse matrix to obtain the second vector product corresponding to each second non-zero column vector, wherein each row of the second sparse matrix corresponds to a sample dimension, and each column of the second sparse matrix corresponds to a feature dimension, and then accumulate each of the second vector products to obtain a fourth encrypted inner product, and then construct a second-party fourth non-zero feature item cross inner product consistent with the feature dimension of the fourth encrypted inner product, wherein the second-party fourth non-zero feature item cross inner product is the cross feature item inner product of the second-party first-type model parameter vector and the second non-zero part secretly shared in the second device, and the second-party fourth non-zero feature item cross inner product is the second-party first-type model parameter vector secretly shared in the second device. The accumulated value of the product of the model parameter vector and each column vector in the second non-zero part, and then based on the fourth public key, the second party's fourth non-zero feature item cross inner product is homomorphically encrypted to obtain the encrypted second party's fourth non-zero feature item cross inner product, and then the difference between the fourth encrypted inner product and the encrypted second party's fourth non-zero feature item cross inner product is calculated to obtain the encrypted fourth non-zero feature item cross inner product, and the encrypted fourth non-zero feature item cross inner product is sent to the first device, and then the first device receives the encrypted fourth non-zero feature item cross inner product, and decrypts the encrypted fourth non-zero feature item cross inner product to obtain the fourth non-zero feature item cross inner product, wherein the third non-zero feature item cross inner product and the fourth non-zero feature item cross inner product can be calculated at the same time or at different times. ,
[0058] Additionally, the expressions of the cross inner product of the third non-zero characteristic term and the cross inner product of the fourth non-zero characteristic term are as follows:
[0059]
[0060]
[0061] Wherein, Q1 is the cross inner product of the third non-zero characteristic term, Q2 is the cross inner product of the fourth non-zero characteristic term, and w A is the first-party first-type model parameter vector, is the first non-zero column vector, X A is the first sparse matrix, d A It means that the first sparse matrix has d A feature dimension, w B is the second-party first-type model parameter vector, is the second non-zero column vector, X B is the second sparse matrix, d B It means that the first sparse matrix has dB feature dimensions, [[ ]] A It indicates that the content in the brackets is secret shared data and belongs to the first device, and then the expression of the cross inner product of the third non-zero characteristic item of the second party and the cross inner product of the fourth non-zero characteristic item of the second party is as follows:
[0062]
[0063]
[0064] Wherein, Q3 is the cross inner product of the third non-zero characteristic term of the second party, Q4 is the cross inner product of the fourth non-zero characteristic term of the second party, [[ ]] B Indicates that the content in the brackets is secret shared data and belongs to the second device.
[0065] Additionally, the association relationship between the third non-zero feature item cross inner product and the second party third non-zero feature item cross inner product, and the association relationship between the fourth non-zero feature item cross inner product and the second party fourth non-zero feature item cross inner product are as follows:
[0066]
[0067]
[0068] Step S212: performing federated interaction with the second device based on the second type shared model parameters and the first non-zero part, so as to combine the second type shared model parameters of the second party and the second non-zero part to calculate the second type sparse matrix secure inner product;
[0069] In this embodiment, it should be noted that the second type of shared model parameters are second type model parameters of secret sharing held by the first device, wherein the second type of shared model parameters include first shared parameters and third shared parameters, wherein the first shared parameter is the second share of the second type model parameter matrix of the second party, the third shared parameter is the first share of the second type model parameter matrix of the first party, and the second type of shared model parameters of the second party are second type model parameters of secret sharing held by the second device, wherein the second type of shared model parameters of the second party include second shared parameters and fourth shared parameters, wherein the second shared parameter is the first share of the second type model parameter matrix of the second party, and the fourth shared parameter is the first share of the second type model parameter matrix of the first party. The shared parameter is the second share of the first-party second-type model parameter matrix, and the second-type sparse matrix security inner product includes a first non-zero feature item cross inner product and a second non-zero feature item cross inner product, wherein the first non-zero feature item cross inner product is the cross-feature item inner product of the second-party second-type model parameter matrix secretly shared in the first device and the second non-zero part, that is, the first non-zero feature item cross inner product is the cumulative value of the product of each column vector in the second-party second-type model parameter matrix secretly shared in the first device and each column vector in the second non-zero part, and the second non-zero feature item cross inner product is the cross-feature item inner product of the first-party second-type model parameter matrix secretly shared in the first device and the first non-zero part. , the second non-zero feature item cross inner product is the cumulative value of the product of each column vector in the first party second type model parameter matrix for secret sharing in the first device and each column vector in the first non-zero part. Similarly, based on the second type shared model parameter and the first non-zero part, a federal interaction is performed with the second device to jointly calculate the second type sparse matrix security inner product with the second party second type shared model parameter and the second non-zero part. Specifically, based on the first shared parameter, a federal interaction is performed with the second device to jointly calculate the first non-zero feature item cross inner product with the second shared parameter and the second non-zero part, and assist the second device in calculating the first non-zero feature item cross inner product. The corresponding second-party first non-zero feature item cross inner product, wherein the second-party first non-zero feature item cross inner product is the cross feature item inner product of the second-party second type model parameter matrix secretly shared in the second device and the second non-zero part, that is, the second-party first non-zero feature item cross inner product is the cumulative value of the product of each column vector in the second-party second type model parameter matrix secretly shared in the second device and each column vector in the second non-zero part. Similarly, based on the third shared parameter and the first non-zero part, a federal interaction is performed with the second device to jointly calculate the second non-zero feature item cross inner product with the fourth shared parameter, and assist the second device in calculating the second-party second non-zero feature item cross inner product, wherein,The second non-zero feature item cross inner product of the second party is the cross feature item inner product of the first party second type model parameter matrix and the first non-zero part that are secretly shared in the second device, and the second non-zero feature item cross inner product of the second party is the cumulative value of the product of each column vector in the first party second type model parameter matrix that is secretly shared in the second device and each column vector in the first non-zero part, wherein the first non-zero feature item cross inner product and the second non-zero feature item cross inner product can be calculated at the same time or at different times.
[0070] Additionally, the expressions of the cross inner product of the first non-zero feature term and the cross inner product of the second non-zero feature term are as follows:
[0071]
[0072]
[0073] Wherein, R1 is the cross inner product of the first non-zero characteristic term, R2 is the cross inner product of the second non-zero characteristic term, V A is the first-party second-type model parameter vector, is the first non-zero column vector, X A is the first sparse matrix, V B is the second-party second-type model parameter vector, is the second non-zero column vector, X B is the second sparse matrix, [[ ]] A It indicates that the content in the brackets is secret shared data and belongs to the first device. Furthermore, the expressions of the cross inner product of the first non-zero characteristic item of the second party and the cross inner product of the second non-zero characteristic item of the second party are as follows:
[0074]
[0075]
[0076] Wherein, R3 is the cross inner product of the first non-zero characteristic term of the second party, R4 is the cross inner product of the second non-zero characteristic term of the second party, [[ ]] B Indicates that the content in the brackets is secret shared data and belongs to the second device.
[0077] Additionally, the association relationship between the first non-zero feature item cross inner product and the second side first non-zero feature item cross inner product, and the association relationship between the second non-zero feature item cross inner product and the second side second non-zero feature item cross inner product are as follows:
[0078]
[0079]
[0080] Step S213, based on the second type sharing model parameters, the first non-zero part and the preset secret sharing multiplication triplet, federal interaction is performed with the second device to combine the second party's second type sharing model parameters and the second non-zero part to calculate the secret sharing intermediate parameters.
[0081] In this embodiment, it should be noted that the preset secret sharing multiplication triplet is a secret sharing multiplication triplet held by the first device, and the second device holds a second party secret sharing multiplication triplet corresponding to the preset secret sharing multiplication triplet, wherein the sum of the preset secret sharing multiplication triplet and the second party secret sharing multiplication triplet is the multiplication triplet, wherein the multiplication triplet is an array of three parameters having a product relationship, for example, assuming that the multiplication triplet is (a, b, c), then it has a product relationship c=a*b.
[0082] In addition, it should be noted that the second-type sharing model parameters include the first sharing parameter, the first sharing transposition parameter corresponding to the first sharing parameter, the third sharing parameter and the second sharing transposition parameter corresponding to the third sharing parameter, wherein the first sharing transposition parameter is the second-party transposition matrix of the secret sharing held by the first device, the second sharing transposition parameter is the first-party transposition matrix of the secret sharing held by the first device, and the second-party second-type sharing model parameters include the second sharing parameter, the third sharing transposition parameter corresponding to the second sharing parameter, the fourth sharing parameter and the fourth sharing transposition parameter corresponding to the fourth sharing parameter, wherein the third sharing transposition parameter is the second-party transposition matrix of the secret sharing held by the second device, and the fourth sharing transposition parameter is the first-party transposition matrix of the secret sharing held by the second device.
[0083] In addition, it should be noted that the secret sharing intermediate parameters include the first party's first secret sharing intermediate parameters and the first party's second secret sharing intermediate parameters, wherein the first party's first secret sharing intermediate parameters are the first intermediate parameters of the secret sharing held by the first device, and the first party's second secret sharing intermediate parameters are the second intermediate parameters of the secret sharing held by the first device, wherein the first intermediate parameter is the cross inner product of the secret sharing non-zero characteristic items composed of the second party's second type model parameter matrix, the second party's transposed matrix, the second non-zero part in the second sparse matrix, and the non-zero part in the transposed matrix corresponding to the second sparse matrix, that is, each value in the first intermediate parameter is a column vector of the second party's second type model parameter matrix, the second party's transposed matrix The second intermediate parameter is the secret shared product of the column vector of the first party second type model parameter matrix, the column vector of the second non-zero part in the second sparse matrix and the column vector of the non-zero part in the transposed matrix corresponding to the second sparse matrix. Similarly, the second intermediate parameter is the cross inner product of the secret shared non-zero characteristic terms composed of the first party second type model parameter matrix, the first party transposed matrix, the first non-zero part in the first sparse matrix and the non-zero part in the transposed matrix corresponding to the first sparse matrix, that is, each numerical value in the second intermediate parameter is the secret shared product of the column vector of the first party second type model parameter matrix, the column vector of the first party transposed matrix, the column vector of the first non-zero part in the first sparse matrix and the column vector of the non-zero part in the transposed matrix corresponding to the first sparse matrix.
[0084] Based on the second type of shared model parameters, the first non-zero part and the preset secret shared multiplication triplet, a federal interaction is performed with the second device to jointly calculate the secret shared intermediate parameter by combining the second party's second type shared model parameters and the second non-zero part. Specifically, based on the preset secret shared multiplication triplet, the first shared parameter and the first shared transposed parameter, a federal interaction is performed with the second device to jointly calculate the first party's first transposed matrix inner product by combining the second party's secret shared multiplication triplet, the second shared parameter and the third shared transposed parameter, and the second device is assisted in calculating the second party's first transposed matrix inner product. Furthermore, based on the first party's first transposed matrix inner product, a federal interaction is performed with the second device to jointly calculate the first party's first secret shared intermediate parameter by combining the second party's first transposed matrix inner product and the second non-zero part. And assist the second device to calculate the second party's first secret sharing intermediate parameter. Similarly, based on the preset secret sharing multiplication triplet, the third sharing parameter and the second sharing transposed parameter, the second device is federated to interact with the second device to jointly calculate the first party's second transposed matrix inner product with the second party's secret sharing multiplication triplet, the fourth sharing parameter and the fourth sharing transposed parameter, and assist the second device to calculate the second party's second transposed matrix inner product. Then, based on the first party's second transposed matrix inner product and the first non-zero part, the second device is federated to interact with the second device to jointly calculate the first party's second secret sharing intermediate parameter with the second party's second transposed matrix inner product, and assist the second device to calculate the second party's second secret sharing intermediate parameter, wherein the expressions of the first party's first secret sharing intermediate parameter and the first party's second secret sharing intermediate parameter are as follows:
[0085]
[0086]
[0087] Wherein, T1 is the first party's first secret sharing intermediate parameter, T2 is the first party's second secret sharing intermediate parameter, V B is the second-party second-type model parameter matrix, is the column vector of the second-party second-type model parameter matrix, X B is the second sparse matrix, is the column vector of the second non-zero part in the second sparse matrix, V A is the first-party second-type model parameter matrix, is the column vector of the first-party second-type model parameter matrix, X A is the first sparse matrix, is the column vector of the first non-zero part in the first sparse matrix.
[0088] The second type sharing model parameters include a second type secret sharing parameter matrix and a secret sharing transposed parameter matrix corresponding to the second type secret sharing parameter matrix, and the second party second type sharing model parameters include a second party second type secret sharing parameter matrix and a second party secret sharing transposed parameter matrix corresponding to the second party second type sharing parameter matrix.
[0089] The step of performing federated interaction with the second device based on the second type sharing model parameter, the first non-zero part and the preset secret sharing multiplication triplet to combine the second type sharing model parameter of the second party and the second non-zero part to calculate the secret sharing intermediate parameter comprises:
[0090] Step A10: Based on the preset secret sharing multiplication triplet, by performing federated interaction with the second device, calculate the secret sharing product between the second type of secret sharing parameter matrix and the secret sharing transposed parameter matrix, and obtain the inner product of the secret sharing matrix, so that the second device can calculate the secret sharing product between the second party's second type of secret sharing parameter matrix and the second party's secret sharing transposed parameter matrix, and obtain the inner product of the second party's secret sharing matrix;
[0091] In this embodiment, it should be noted that the inner product of the secret sharing matrix includes the inner product of the first-party first transposed matrix and the inner product of the first-party second transposed matrix, the inner product of the second-party secret sharing matrix includes the inner product of the second-party first transposed matrix and the inner product of the second-party second transposed matrix, the second-type secret sharing parameter matrix includes a first sharing parameter matrix and a third sharing parameter matrix, wherein the first sharing parameter matrix is a matrix representation of the first sharing parameter, the third sharing parameter matrix is a matrix representation of the third sharing parameter, the secret sharing transposed parameter matrix includes a first sharing transposed parameter matrix and a second sharing transposed parameter matrix, wherein the first sharing transposed parameter matrix is the first A matrix representation of shared transposed parameters, the second shared transposed parameter matrix is the matrix representation of the second shared transposed parameters, the second party second type secret shared parameter matrix includes a second shared parameter matrix and a fourth shared parameter matrix, wherein the second shared parameter matrix is the matrix representation of the second shared parameters, the fourth shared parameter matrix is the matrix representation of the fourth shared parameters, the second party secret shared transposed parameter matrix includes a third shared transposed parameter matrix and a fourth shared transposed parameter matrix, wherein the third shared transposed parameter matrix is the matrix representation of the third shared transposed parameters, and the fourth shared transposed parameter matrix is the matrix representation of the fourth shared transposed parameters.
[0092] Based on the preset secret sharing multiplication triplet, by performing federal interaction with the second device, the secret sharing product between the second type of secret sharing parameter matrix and the secret sharing transposed parameter matrix is calculated to obtain the inner product of the secret sharing matrix, so that the second device can calculate the secret sharing product between the second party's second type of secret sharing parameter matrix and the second party's secret sharing transposed parameter matrix to obtain the inner product of the second party's secret sharing matrix. Specifically, the first device blinds the first sharing parameter matrix and the first sharing transposed parameter matrix based on the preset secret sharing multiplication triplet to obtain the first party's first shared blinded parameter matrix corresponding to the first sharing parameter matrix and the first party's second shared blinded parameter matrix corresponding to the first sharing transposed parameter matrix. Similarly, the second device blinds the second sharing parameter matrix and the third sharing transposed parameter matrix based on the second party's secret sharing multiplication triplet to obtain the second party's first shared blinded parameter matrix corresponding to the second sharing parameter matrix and the second party's second shared blinded parameter matrix corresponding to the third sharing transposed parameter matrix, and converts the second party's first shared blinded parameter matrix and the second party's second shared blinded parameter matrix into a matrix. The first device calculates the sum of the first shared blind parameter matrix of the first party and the first shared blind parameter matrix of the second party to obtain a first blind parameter matrix, calculates the sum of the second shared blind parameter matrix of the first party and the second shared blind parameter matrix of the second party to obtain a second blind parameter matrix, and sends the first shared blind parameter matrix of the first party and the second shared blind parameter matrix of the first party to the second device, and then the second device calculates the sum of the first shared blind parameter matrix of the first party and the first shared blind parameter matrix of the second party to obtain a first blind parameter matrix, and calculates The sum of the first-party second shared blinding parameter matrix and the second-party second shared blinding parameter matrix is calculated to obtain the second blinding parameter matrix. Further, the first device calculates the inner product of the first-party first transposed matrix corresponding to the preset secret shared multiplication triplet, the first blinding parameter matrix and the second blinding parameter matrix based on a preset first-party transposed matrix inner product calculation formula. Similarly, the second device calculates the inner product of the second-party first transposed matrix corresponding to the second-party secret shared multiplication triplet, the first blinding parameter matrix and the second blinding parameter matrix based on a preset second-party transposed matrix inner product calculation formula.
[0093] Further, the first device blinds the third shared parameter matrix and the second shared transposed parameter matrix based on the preset secret shared multiplication triplet, and obtains the first-party third shared blinded parameter matrix corresponding to the third shared parameter matrix and the first-party fourth shared blinded parameter matrix corresponding to the second shared transposed parameter matrix. Similarly, the second device blinds the fourth shared parameter matrix and the fourth shared transposed parameter matrix based on the second-party secret shared multiplication triplet, and obtains the second-party third shared blinded parameter matrix corresponding to the fourth shared parameter matrix and the second-party fourth shared blinded parameter matrix corresponding to the fourth shared transposed parameter matrix, and sends the second-party third shared blinded parameter matrix and the second-party fourth shared blinded parameter matrix to the first device, and then the first device calculates the sum of the first-party third shared blinded parameter matrix and the second-party third shared blinded parameter matrix to obtain the third blinded parameter matrix, and calculates the sum of the first-party fourth shared blinded parameter matrix and the second-party fourth shared blinded parameter matrix. , obtain a fourth blinded parameter matrix, and send the first-party third shared blinded parameter matrix and the first-party fourth shared blinded parameter matrix to the second device, and then the second device calculates the sum of the first-party third shared blinded parameter matrix and the second-party third shared blinded parameter matrix to obtain a third blinded parameter matrix, calculates the sum of the first-party fourth shared blinded parameter matrix and the second-party fourth shared blinded parameter matrix to obtain a fourth blinded parameter matrix, further, the first device calculates the first-party second transposed matrix inner product corresponding to the preset secret shared multiplication triple, the third blinded parameter matrix and the fourth blinded parameter matrix based on a preset first-party transposed matrix inner product calculation formula, similarly, the second device calculates the second-party second transposed matrix inner product corresponding to the second-party secret shared multiplication triple, the third blinded parameter matrix and the fourth blinded parameter matrix based on a preset second-party transposed matrix inner product calculation formula, wherein the preset first-party first transposed matrix inner product calculation formula and the preset second-party first transposed matrix inner product formula are as follows:
[0094] [[x*y]] A =f*[[a]] A +e*[[b]] A +[[c]] A
[0095] [[x*y]] B =e*f+f*[[a]] B +e*[[b]] B +[[c]] B
[0096] Among them, [[x*y]] Ais the inner product of the first square and the first transposed matrix, [[x*y]] B is the inner product of the first transposed matrix of the second party, e is the first blinding parameter matrix, f is the second blinding parameter matrix, the multiplication triple is (a, b, c), where c = a*b, and the preset secret sharing multiplication triple is ([[a]] A ,[[b]] A , [[c]] A ), the second party secret shared multiplication triple is ([[a]] B ,[[b]] B , [[c]] B ), for example, in an implementable solution, the inner product of the first-side first transposed matrix and the inner product of the second-side first transposed matrix are calculated as follows:
[0097] First, assume that the first device has the secret shared multiplication triple ([[a]] A ,[[b]] A , [[c]] A ), the second device possesses the second party secret shared multiplication triplet ([[a]] B ,[[b]] B , [[c]] B ), where [[a]] A +[[a]] B =a,[[b]] A +[[b]] B =b,[[c]] A +[[c]] B =c, c=a*b, and the first shared parameter matrix is [[x]] A , the first shared transposed parameter matrix is [[y]] A , the second shared parameter matrix in the second device is [[x]] B , the third shared transposed parameter matrix is [[y]] B , where [[x]] A +[[x]] B =x,[[y]] A +[[y]] B =y, then the first shared blinding parameter matrix of the first party that the first device needs to calculate is [[x*y]] A , the second device calculates the first party's first shared blinding parameter matrix as [[x*y]] B , and must satisfy [[x*y]] A +[[x*y]] B =x*y, specifically, the calculation process is as follows:
[0098] First, the first device calculates [[e]] A =[[x]] A -[[a]] A and [[f]] A =[[y]] A -[[b]] A , the second device calculates [[e]] B =[[x]] B -[[a]] B and [[f]] B =[[y]] B -[[b]] B , and then the first device will [[e]] A and [[f]] A Send to the second device, the second device will [[e]] B and [[f]] B Send to the second device, so that the first device and the second device both obtain e=xa and f=yb, and then the first device calculates [[x*y]] A =f*[[a]] A +e*[[b]] A +[[c]] A , the second device calculates [[x*y]] B =e*f+f*[[a]] B +e*[[b]] B +[[c]] B , and then [[x*y]] A +[[x*y]] B =e*f+f*a+e*b+c, and then substitute e=xa and f=yb into the calculation expression to obtain [[x*y]] A +[[x*y]] B =x*y.
[0099] Step A20, based on the inner product of the secret sharing matrix and the first non-zero part, perform federal interaction with the second device to combine the inner product of the second party's secret sharing matrix and the second non-zero part to calculate the secret sharing intermediate parameter.
[0100] In this embodiment, it should be noted that the secret sharing intermediate parameters include a first-party first secret sharing intermediate parameter matrix and a first-party second secret sharing intermediate parameter matrix, wherein the first-party first secret sharing intermediate parameter matrix is a matrix representation of the first-party first secret sharing intermediate parameters, and the first-party second secret sharing intermediate parameter matrix is a matrix representation of the first-party second secret sharing intermediate parameters, and the second device obtains the second-party secret sharing intermediate parameters through federal interaction, wherein the second-party secret sharing intermediate parameters include a second-party first secret sharing intermediate parameter matrix and a second-party second secret sharing intermediate parameter matrix, wherein the second-party first secret sharing intermediate parameter matrix is a matrix representation of the second-party first secret sharing intermediate parameters, and the second-party second secret sharing intermediate parameter matrix is a matrix representation of the second-party second secret sharing intermediate parameters.
[0101] Based on the inner product of the secret sharing matrix and the first non-zero part, a federated interaction is performed with the second device to combine the inner product of the second party's secret sharing matrix and the second non-zero part to calculate the secret sharing intermediate parameter, specifically, a fifth public key and a fifth private key corresponding to the fifth public key are generated, and based on the fifth public key, the inner product of the first party's first transposed matrix is homomorphically encrypted to obtain the inner product of the encrypted first party's first transposed matrix, and the fifth public key and the inner product of the encrypted first party's first transposed matrix are sent to the second device, and then the second device performs homomorphic encryption on the inner product of the second party's first transposed matrix based on the fifth public key to obtain the inner product of the encrypted second party's first transposed matrix, and calculates the encrypted first party's first transposed matrix The inner product of the encrypted second square first transposed matrix is obtained by calculating the inner product of the encrypted first transposed matrix, wherein the inner product of the encrypted first transposed matrix is a vector, and then the second device generates the transposed matrix corresponding to the second sparse matrix to obtain the second sparse transposed matrix, and then calculates the first intermediate parameter product between each numerical value in the inner product of the encrypted transposed matrix, each non-zero column vector of the second sparse matrix and each non-zero column vector of the second sparse transposed matrix to obtain the first encrypted intermediate parameter inner product, wherein the first intermediate parameter inner product is the cumulative value of each of the first intermediate parameter products, and each numerical value in the inner product of the encrypted transposed matrix, each non-zero column vector of the second sparse matrix and each non-zero column vector of the second sparse transposed matrix The three vectors correspond one to one, and then in the preset first vector space, a vector consistent with the characteristic dimension of the second sparse matrix is constructed as the inner product of the second-party first transposed matrix, and based on the fifth public key, the inner product of the second-party first transposed matrix is homomorphically encrypted to obtain the encrypted second-party first transposed matrix inner product, and then the difference between the first encrypted intermediate parameter inner product and the encrypted second-party second transposed matrix inner product is calculated to obtain the encrypted first-party first transposed matrix inner product, and the encrypted first-party first transposed matrix inner product is sent to the first device, and then the first device decrypts the encrypted first-party first transposed matrix inner product based on the fifth private key to obtain the first-party first transposed matrix inner product. In addition, the second device generates a sixth public key. The first device performs homomorphic encryption on the inner product of the second-party second transposed matrix based on the sixth private key to obtain the encrypted inner product of the second-party second transposed matrix, and sends the encrypted inner product of the second-party second transposed matrix and the sixth public key to the first device, and then the first device performs homomorphic encryption on the inner product of the first-party second transposed matrix based on the sixth public key to obtain the encrypted inner product of the first-party second transposed matrix, and then calculates the sum of the encrypted inner product of the second-party second transposed matrix and the encrypted inner product of the first-party second transposed matrix to obtain the encrypted inner product of the second transposed matrix, wherein the encrypted inner product of the second transposed matrix is a vector, and then generates the transposed matrix corresponding to the first sparse matrix to obtain the first sparse transposed matrix,And calculate the second intermediate parameter product between each value in the inner product of the encrypted second transposed matrix, each non-zero column vector in the first sparse matrix and each non-zero column vector in the first sparse transposed matrix, and obtain the second encrypted intermediate parameter inner product, wherein the second encrypted intermediate parameter inner product is the cumulative value of each second intermediate parameter product, and each value in the inner product of the encrypted second transposed matrix, each non-zero column vector in the first sparse matrix and each non-zero column vector in the first sparse transposed matrix correspond one to one, and then in the preset second vector space, construct The vector with the same characteristic dimension of the matrix is used as the inner product of the first-party second transposed matrix, and the inner product of the first-party second transposed matrix is homomorphically encrypted based on the sixth public key to obtain the encrypted inner product of the first-party second transposed matrix, and then the difference between the inner product of the second encrypted intermediate parameter and the inner product of the encrypted first-party second transposed matrix is calculated to obtain the encrypted inner product of the second-party second transposed matrix, and the encrypted inner product of the second-party second transposed matrix is sent to the second device, and then the second device decrypts the encrypted inner product of the second-party second transposed matrix based on the sixth private key to obtain the inner product of the second-party second transposed matrix. ,
[0102] Step S22, calculating the secret sharing model error based on the sparse matrix secure inner product, the secret sharing intermediate parameter and a preset secret sharing model error calculation formula.
[0103] In this embodiment, it should be noted that the sparse matrix secure inner product includes the first type of sparse matrix secure inner product and the second type of sparse matrix secure inner product, wherein the first type of sparse matrix secure inner product includes a third non-zero feature item cross-inner product and a fourth non-zero feature item cross-inner product, the second type of sparse matrix secure inner product includes a first non-zero feature item cross-inner product and a second non-zero feature item cross-inner product, and the secret shared intermediate parameter includes a first party first secret shared intermediate parameter and a first party second secret shared intermediate parameter.
[0104] The secret sharing model error is calculated based on the sparse matrix security inner product, the secret sharing intermediate parameter and the preset secret sharing model error calculation formula. Specifically, based on the model output calculation formula, the first party first model output corresponding to the fourth non-zero feature item cross inner product, the first non-zero feature item cross inner product and the first party first secret sharing intermediate parameter is calculated, and the first party second model output corresponding to the third non-zero feature item cross inner product, the second non-zero feature item cross inner product and the first party second secret sharing intermediate parameter is calculated, and then the first device is substituted into the preset secret sharing model error calculation formula based on the first party first model output, the first party second model output and the secret sharing sample label held by the first device to calculate the secret sharing model error, wherein the calculation expression of the first party first model output is as follows:
[0105]
[0106] Among them, [[f(X B )]] A is the first party first model output, is the cross inner product of the fourth non-zero characteristic term, is the cross inner product of the first non-zero feature term, is the first party's first secret shared intermediate parameter, and the calculation expression of the first party's second model output is as follows:
[0107]
[0108] Among them, [[f(X A )]] A The second model output for the first party, is the cross inner product of the third non-zero characteristic term, is the cross inner product of the second non-zero characteristic term, is the second secret sharing intermediate parameter of the first party, and the calculation expression of the secret sharing model error is as follows:
[0109]
[0110] Where Y is the sample label, [[f(X A , X B )-Y]] A is the secret sharing model error.
[0111] Similarly, the second device calculates the second party's first model output and the second party's second model output, and substitutes the second party's first model output, the second party's second model output and the sample label of the secret sharing held by the second party into the preset secret sharing model error calculation formula to calculate the second party's secret sharing model error, wherein the calculation expression of the second party's first model output is as follows:
[0112]
[0113] Among them, [[f(X B )]] B The first model output for the second party, is the cross inner product of the fourth non-zero characteristic term of the second party, is the cross inner product of the first non-zero characteristic term of the second party, is the first secret shared intermediate parameter of the second party, and the calculation expression of the second model output of the second party is as follows:
[0114]
[0115] Among them, [[f(X A )]] B Output for the second model of the second party, is the cross inner product of the third non-zero characteristic term of the second party, is the cross inner product of the second non-zero characteristic term of the second party, is the second party second secret sharing intermediate parameter, and the calculation expression of the second party secret sharing model error is as follows:
[0116]
[0117] Where Y is the sample label, [[f(X A , X B )-Y]] B is the second party secret sharing model error.
[0118] Step S30: Based on the secret sharing model error, the preset initialization model is updated to obtain a vertical federated factorization machine model.
[0119] In this embodiment, it should be noted that the vertical federated factorization machine model includes a first target model parameter belonging to the first device and a second target model parameter belonging to the second device.
[0120] Based on the secret sharing model error, the preset initialization model is updated to obtain a vertical federated factorization machine model. Specifically, based on the secret sharing model error, the first-party secret sharing initial model parameters are updated to obtain the first-party secret sharing initial update parameters, and the second device updates the second-party secret sharing initial model parameters based on the second-party secret sharing model error to obtain the second-party secret sharing initial update parameters, and determines whether the first-party secret sharing initial update parameters meet the preset iterative update end conditions. If so, the first device uses the first-party secret sharing initial update parameters as secret sharing update parameters, and the second device uses the second-party secret sharing initial update parameters as second-party secret sharing update parameters. Then, based on the secret sharing update parameters, the first device performs decryption interaction with the second device to determine the first target model parameters in conjunction with the second-party secret sharing update parameters, and assists the second device in determining the second target model parameters, wherein the second device provides the second-party secret sharing update parameters when performing decryption interaction, and the preset iterative update end conditions include loss function convergence and reaching a maximum iteration number threshold.
[0121] The step of updating the preset initialization model based on the secret sharing model error to obtain the vertical federated factorization machine model includes:
[0122] Step S31, based on the secret sharing model error, updating the secret sharing initial model parameters to obtain secret sharing update parameters;
[0123] In this embodiment, it should be noted that, based on the secret sharing model error, the secret sharing initial model parameters are updated to obtain secret sharing update parameters. Specifically, the gradient information of the secret sharing model error with respect to the secret sharing initial model parameters is calculated respectively, and then based on the gradient information, the secret sharing initial model parameters are iteratively updated until the iteratively updated secret sharing initial model parameters reach a preset iterative update end condition, and the secret sharing update parameters are obtained, wherein, in a scheme of an illustrative embodiment, the gradient information includes a first type of gradient, a second type of gradient, a third type of gradient and a fourth type of gradient, wherein the calculation expression of the first type of gradient is as follows:
[0124]
[0125] Where D1 is the first type of gradient, α is a hyperparameter whose size can be set by yourself and is used to control the value range of the gradient, and w A is the first-party first-type model parameter vector, [[w A ]] AThe first-party first-type model parameter vector held by the first device for secret sharing, in addition, the calculation expression of the second-type gradient is as follows:
[0126]
[0127] Where D2 is the second type of gradient, α is a hyperparameter whose size can be set by yourself and is used to control the value range of the gradient, V A is the first-party second-type model parameter matrix, [[V A ]] A The first party second type model parameter matrix held by the first device for secret sharing, further, the calculation expression of the third type gradient is as follows:
[0128]
[0129] Where D3 is the third type of gradient, α is a hyperparameter whose size can be set by yourself and is used to control the value range of the gradient, and w B is the second party first type model parameter vector, [[w B ]] A The first type model parameter vector of the second party held by the first device for secret sharing, in addition, the calculation expression of the fourth type gradient is as follows:
[0130]
[0131] Where D4 is the fourth type of gradient, α is a hyperparameter whose size can be set by yourself and is used to control the value range of the gradient, V B is the second-party second-type model parameter matrix, [[V B ]] A A second party second type model parameter matrix held by the second device for secret sharing.
[0132] In addition, it should be noted that the second device can calculate the gradient information of the second-party secret sharing model error with respect to the second-party secret sharing initial model parameters, and based on the gradient information, iteratively update the second-party secret sharing initial model parameters until the preset iterative training end condition is reached to obtain the second-party secret sharing update parameters.
[0133] Furthermore, based on the gradient information, the calculation expression for updating the parameters of the secret sharing initial model is as follows:
[0134]
[0135]
[0136]
[0137]
[0138] Among them, δ1, δ2, δ3 and δ4 are pre-set learning rates. an updated model parameter corresponding to the first-party first-type model parameter vector of the secret share held by the first device, an updated model parameter corresponding to the first party second type model parameter matrix of the secret share held by the first device, an updated model parameter corresponding to the second party first type model parameter vector of the secret share held by the first device, The updated model parameters correspond to the second-party second-type model parameter matrix of the secret share held by the first device.
[0139] Step S32: Based on the secret sharing update parameter, perform decryption interaction with the second device to obtain the first target model parameter, so that the second device can obtain the second target model parameter.
[0140] In this embodiment, based on the secret sharing update parameters, decryption interaction is performed with the second device to obtain the first target model parameters, so that the second device can obtain the second target model parameters. Specifically, based on the secret sharing update parameters, decryption interaction is performed with the second device to calculate the first target model parameters in conjunction with the second party secret sharing update parameters in the second device, wherein when performing the decryption interaction, the second device will calculate the second target model parameters based on the second party secret sharing update parameters in conjunction with the secret sharing update parameters in the first device.
[0141] The secret shared update parameters include a first shared first-party model update parameter and a first shared second-party model update parameter.
[0142] The step of performing decryption interaction with the second device based on the secret sharing update parameter to obtain the first target model parameter so that the second device can obtain the second target model parameter includes:
[0143] Step S321, sending the first shared second-party model update parameter to the second device, so that the second device calculates the second target model parameter based on the determined second shared second-party model update parameter and the first shared second-party model update parameter;
[0144] In this embodiment, it should be noted that the first shared first-party model update parameter is the first-party model update parameter held by the secret shared first device, the first shared second-party model update parameter is the second-party model update parameter held by the secret shared first device, and the second shared second-party model update parameter is the second-party model update parameter held by the secret shared second device.
[0145] The first shared second-party model update parameter is sent to the second device so that the second device calculates the second target model parameter based on the determined second shared second-party model update parameter and the first shared second-party model update parameter. Specifically, the first shared second-party model update parameter is sent to the second device so that the second device calculates the sum of the second shared second-party model update parameter and the first shared second-party model update parameter to obtain the second target model parameter.
[0146] Step S322: Receive second shared first-party model update parameters sent by the second device, and calculate the first target model parameters based on the second shared first-party model update parameters and the first shared first-party model update parameters.
[0147] In this embodiment, it should be noted that the second shared first-party model update parameter is a first-party model update parameter held by the secret-shared second device.
[0148] Receive the second shared first-party model update parameter sent by the second device, and calculate the first target model parameter based on the second shared first-party model update parameter and the first shared first-party model update parameter. Specifically, receive the second shared first-party model update parameter sent by the second device, and calculate the sum of the second shared first-party model update parameter and the first shared first-party model update parameter to obtain the first target model parameter.
[0149] The vertical federated factor decomposition machine model includes a recommendation model for personalized recommendation. Compared with the existing vertical federated learning method, the present application combines the secret sharing mechanism and the homomorphic encryption method when constructing the vertical federated factor decomposition machine model based on vertical federated learning to calculate the cross inner product of non-zero feature items, thereby reducing the calculation process of the zero part in the sparse matrix, reducing the computational complexity when constructing the factor decomposition machine model based on the sparse matrix, and thus improving the computational efficiency when constructing the vertical federated factor decomposition machine model. Moreover, since the vertical federated factor decomposition machine model is constructed based on vertical federated learning modeling, the feature richness of the training samples when constructing the vertical federated factor decomposition machine model is higher, and thus the model performance of the vertical federated factor decomposition machine model will be better, and thus the personalized recommendation effect of the vertical federated factor decomposition machine model as a recommendation model will be better.
[0150] The embodiment of the present application provides a method for constructing a factorization machine model. Compared with the technical means of using a homomorphic encryption-based method for federated learning in the prior art, the embodiment of the present application, after obtaining the initialization model parameters and the first sparse data corresponding to the preset initialization model, performs secret sharing with the second device, so that the first device obtains the first-party secret sharing initial model parameters, and the second device obtains the second-party secret sharing initial model parameters, and then based on the first non-zero part of the first sparse data and the first-party secret sharing initial model parameters, performs federated interaction with the second device to jointly obtain the second non-zero part of the second sparse data obtained by the second device and the second-party secret sharing initial model parameters. number, calculate the secret sharing model error, wherein, during the federal interaction, only the first non-zero part of the first sparse data and the second non-zero part of the second sparse data are used for calculation, thereby reducing the calculation process of the zero part in the first sparse data and the second sparse data, so that the calculation amount and complexity in the federal interaction process are greatly reduced, and then based on the secret sharing model error, the preset initialization model is updated to obtain the vertical federal factor decomposition machine model, which overcomes the technical defect of low computational efficiency in the prior art due to the large sparse matrix and the homomorphic encryption method when performing federated learning based on the sparse matrix, thereby improving the computational efficiency of federated learning based on the sparse matrix.
[0151] Further, refer to Figure 2 Based on the first embodiment of the present application, in another embodiment of the present application, the second type of sparse matrix safety inner product includes a first non-zero characteristic item cross inner product and a second non-zero characteristic item cross inner product,
[0152] The step of performing federated interaction with the second device based on the second type shared model parameter and the first non-zero part to combine the second type shared model parameter and the second non-zero part of the second party to calculate the second type sparse matrix secure inner product includes:
[0153] Step B10: performing federated interaction with the second device based on the second type shared model parameter to calculate a cross inner product between the second type shared model parameter and the second non-zero part to obtain a cross inner product of the first non-zero feature item;
[0154] In this embodiment, it should be noted that the second-type shared model parameter includes a first shared parameter, wherein the first shared parameter is a second-party second-type model parameter matrix held by a first device for secret sharing, that is, the first shared parameter is a second share of the second-party second-type model parameter matrix, and the second-party second-type shared model parameter includes a second shared parameter, wherein the second shared parameter is a second-party second-type model parameter matrix held by a second device for secret sharing, that is, the second shared parameter is a first share of the second-party second-type model parameter matrix. For example, assuming that the second-party second-type shared model parameter is V B , construct V B =[[V B ]] A +[[V B ]] B , then [[V B ]] A is the first shared parameter, [[V B ]] B is the second shared parameter.
[0155] Based on the second type of shared model parameters, a federal interaction is performed with the second device to calculate the cross inner product between the second type of shared model parameters and the second non-zero part, and obtain the cross inner product of the first non-zero characteristic item. Specifically, a homomorphically encrypted first public-private key pair is generated, wherein the first public-private key pair includes a first public key and a first private key, and then based on the first public key, the first shared parameter is homomorphically encrypted to obtain an encrypted first shared parameter, and then the encrypted first shared parameter and the first public key are sent to the second device, and then the second device can perform homomorphic encryption on the second shared parameter based on the first public key to obtain an encrypted second shared parameter, and then calculate the sum of the first encrypted shared parameter and the second encrypted shared parameter to obtain the encrypted second party second type model parameter matrix of this round of iteration, and then The encrypted second-party second-type model parameter matrix and the non-zero feature item cross inner product of the second non-zero part are obtained to obtain the second encrypted inner product, and then based on the first target feature dimension of the second-party second-type model parameter matrix, a uniformly distributed second-party first non-zero feature item cross inner product in the first target feature dimension is generated, and based on the first public key, the second-party first non-zero feature item cross inner product is homomorphically encrypted to obtain the encrypted second-party first non-zero feature item cross inner product, and based on the second encrypted inner product and the second-party first non-zero feature item cross inner product, the encrypted first non-zero feature item cross inner product is calculated, and the encrypted first non-zero feature item cross inner product is sent to the first device, and the first device can decrypt the encrypted first non-zero feature item cross inner product based on the first private key to obtain the first non-zero feature item cross inner product.
[0156] The second type of shared model parameters include first shared parameters, and the second party second type of shared model parameters include second shared parameters.
[0157] The step of performing federated interaction with the second device based on the second type shared model parameter to calculate the cross inner product between the second type shared model parameter and the second non-zero part to obtain the cross inner product of the first non-zero feature item includes:
[0158] Step B11, generating a first public key, and encrypting the first shared parameter based on the first public key to obtain an encrypted first shared parameter;
[0159] In this embodiment, it should be noted that the encryption method includes homomorphic encryption.
[0160] Step B12, sending the first public key and the encrypted first shared parameter to the second device, so that the second device can determine the cross inner product of the second party's first non-zero feature item and the cross inner product of the encrypted first non-zero feature item based on the first public key, the encrypted first shared parameter, the second shared parameter and the second non-zero part;
[0161] In this embodiment, the first public key and the encrypted first shared parameter are sent to the second device, so that the second device can determine the cross inner product of the second party's first non-zero characteristic item and the cross inner product of the encrypted first non-zero characteristic item based on the first public key, the encrypted first shared parameter, the second shared parameter and the second non-zero part. Specifically, the encrypted first shared parameter and the first public key are sent to the second device, and then the second device can perform homomorphic encryption on the second shared parameter based on the first public key to obtain the encrypted second shared parameter, and then calculate the sum of the first encrypted shared parameter and the second encrypted shared parameter to obtain the encrypted second party second type model parameter matrix of this iteration. Further, calculate The products of each column vector in the encrypted second-party second-type model parameter matrix and each column vector in the second non-zero part are obtained pairwise to obtain the products of each first vector, and then the products of each first vector are accumulated to obtain the second encrypted inner product, and then a vector that is consistent with the characteristic dimension of the second-party second-type model parameter matrix and uniformly distributed is generated as the cross inner product of the second-party first non-zero feature items, and based on the first public key, the cross inner product of the second-party first non-zero feature items is homomorphically encrypted to obtain the cross inner product of the encrypted second-party first non-zero feature items, and then the difference between the second encrypted inner product and the cross inner product of the encrypted second-party first non-zero feature items is calculated to obtain the encrypted first non-zero feature item cross inner product.
[0162] Step B13, receiving the encrypted first non-zero feature item cross inner product sent by the second device, and decrypting the encrypted first non-zero feature item cross inner product based on the first private key corresponding to the first public key to obtain the first non-zero feature item cross inner product.
[0163] Step B20: Based on the first non-zero part, perform a federated interaction with the second device to calculate the cross inner product between the first non-zero part and the second type shared model parameter of the second party to obtain the cross inner product of the second non-zero feature item.
[0164] In this embodiment, it should be noted that the third shared parameter is the first-party second-type model parameter matrix held by the first device of secret sharing, that is, the third shared parameter is the first share of the first-party second-type model parameter matrix, and the fourth shared parameter is the first-party second-type parameter matrix held by the second device of secret sharing, that is, the fourth shared parameter is the second share of secret sharing. For example, assuming that the first-party second-type shared model parameter is V A , construct V A =[[V A ]] A +[[V A ]] B , then [[V A ]] A is the third shared parameter, [[V A ]] B is the fourth shared parameter.
[0165] Based on the first non-zero part, a federal interaction is performed with the second device to calculate the cross inner product between the first non-zero part and the second-party second-type shared model parameter to obtain the second non-zero characteristic item cross inner product. Specifically, the second device generates a second public-private key pair, wherein the public-private key pair includes a second private key and a second public key, and then based on the second public key, the fourth shared parameter is encrypted to obtain an encrypted fourth shared parameter, and the second public key and the encrypted fourth shared parameter are sent to the first device, and then the first device encrypts the third shared parameter based on the second public key to obtain an encrypted third shared parameter, and then based on the encrypted third shared parameter and the encrypted fourth shared parameter, the encrypted first-party second-type model parameter matrix is calculated, and then the encrypted first-party second-type model parameter matrix is calculated. The first encrypted inner product is obtained by constructing a cross inner product of the non-zero characteristic items of the model parameter matrix and the first non-zero part. Furthermore, based on the second target characteristic dimension of the encrypted first-party second type model parameter matrix, a second non-zero characteristic item cross inner product that is uniformly distributed and is in the second target characteristic dimension is constructed, and based on the second public key, the second non-zero characteristic item cross inner product is encrypted to obtain an encrypted second non-zero characteristic item cross inner product, and then based on the first encrypted inner product and the encrypted second non-zero characteristic item cross inner product, an encrypted second party second non-zero characteristic item cross inner product is obtained, and the encrypted second party second non-zero characteristic item cross inner product is sent to the second device, and then the second device decrypts the encrypted second party second non-zero characteristic item cross inner product based on the second private key to obtain the second party second non-zero characteristic item cross inner product.
[0166] The second type of shared model parameters include a third shared parameter, and the second party second type of shared model parameters include a fourth shared parameter.
[0167] The step of performing federated interaction with the second device based on the first non-zero part to calculate the cross inner product between the first non-zero part and the second type shared model parameter of the second party to obtain the cross inner product of the second non-zero feature item includes:
[0168] Step B21, receiving the second public key and the encrypted fourth shared parameter sent by the second device, wherein the encrypted fourth shared parameter is the fourth shared parameter encrypted by the second device based on the second public key;
[0169] In this embodiment, the method by which the second device encrypts the fourth shared parameter includes homomorphic encryption.
[0170] Step B22, calculating the cross inner product of the second non-zero characteristic term and the cross inner product of the encrypted second party second non-zero characteristic term based on the second public key, the encrypted fourth shared parameter, the first non-zero part and the third shared parameter;
[0171] In this embodiment, based on the second public key, the encrypted fourth shared parameter, the first non-zero part and the third shared parameter, the second non-zero feature item cross inner product and the encrypted second party second non-zero feature item cross inner product are calculated. Specifically, based on the second public key, the third shared parameter is homomorphically encrypted to obtain the encrypted third shared parameter, and then based on the encrypted third shared parameter and the encrypted fourth shared parameter, the encrypted first party second type model parameter matrix is calculated, and then the encrypted first party second type model parameter matrix and the non-zero feature item cross inner product of the first non-zero part are calculated to obtain the first encrypted inner product. Further, based on the second target feature dimension of the encrypted first party second type model parameter matrix, a uniformly distributed second non-zero feature item cross inner product in the second target feature dimension is constructed, and based on the second public key, the second non-zero feature item cross inner product is encrypted to obtain the encrypted second non-zero feature item cross inner product, and then based on the first encrypted inner product and the encrypted second non-zero feature item cross inner product, the encrypted second party second non-zero feature item cross inner product is obtained.
[0172] The step of calculating the cross inner product of the second non-zero feature item and the cross inner product of the encrypted second non-zero feature item of the second party based on the second public key, the encrypted fourth shared parameter, the first non-zero part and the third shared parameter comprises:
[0173] Step B221: encrypt the third shared parameter based on the second public key to obtain the encrypted third shared parameter, and calculate the encryption model parameter corresponding to the encrypted third shared parameter and the encrypted fourth shared parameter;
[0174] In this embodiment, it should be noted that the encrypted model parameter is the sum of the encrypted third shared parameter and the encrypted fourth shared parameter, and the encrypted model parameter is the encrypted first-party second-type model parameter matrix.
[0175] Step B222, calculating the cross inner products between each column vector in the encrypted model parameter and each column vector in the first non-zero part, to obtain the first encrypted inner product;
[0176] In this embodiment, the cross inner products between each column vector in the encrypted model parameter and each column vector in the first non-zero part are calculated to obtain the first encrypted inner product. Specifically, the products between each column vector in the encrypted model parameter and each column vector in the first non-zero part are calculated to obtain each second vector product, and then the second vector products are accumulated to obtain the first encrypted inner product. In another feasible scheme, the second vector products can be aggregated into a vector to obtain the first encrypted inner product.
[0177] Step B223, constructing the second non-zero feature item cross inner product based on the feature dimension of the encryption model parameter, and calculating the encrypted second non-zero feature item cross inner product corresponding to the second non-zero feature item cross inner product and the first encrypted inner product;
[0178] In this embodiment, based on the characteristic dimension of the encryption model parameters, the second non-zero feature item cross inner product is constructed, and the encrypted second party second non-zero feature item cross inner product corresponding to the second non-zero feature item cross inner product and the first encrypted inner product is calculated. Specifically, a uniformly distributed vector consistent with the characteristic dimension of the encryption model parameters is constructed as the second non-zero feature item cross inner product, and then based on the second public key, the second non-zero feature item cross inner product is homomorphically encrypted to obtain the encrypted second non-zero feature item cross inner product, and based on the difference between the first encrypted inner product and the encrypted second non-zero feature item cross inner product, the encrypted second party second non-zero feature item cross inner product is obtained.
[0179] Step B23, sending the encrypted second-party second non-zero characteristic item cross inner product to the second device, so that the second device decrypts the encrypted second-party second non-zero characteristic item cross inner product based on the second private key corresponding to the second public key to obtain the second-party second non-zero characteristic item cross inner product.
[0180] In this embodiment, it should be noted that the second public key and the second private key are a homomorphically encrypted public-private key pair.
[0181] The present embodiment provides a method for calculating the secure inner product of a second type of sparse matrix of secret sharing based on a method combining secret sharing and homomorphic encryption, that is, based on the second type of shared model parameters, a federal interaction is performed with the second device to calculate the cross inner product between the second type of shared model parameters and the second non-zero part, and obtain the cross inner product of the first non-zero feature item, and based on the first non-zero part, a federal interaction is performed with the second device to calculate the cross inner product between the first non-zero part and the second type of shared model parameters of the second party, and obtain the cross inner product of the second non-zero feature item, wherein only the first non-zero part of the first sparse data is used in the whole process. The first non-zero part and the second non-zero part of the second sparse data are calculated, thereby reducing the calculation process of the zero part in the first sparse data and the second sparse data. The proportion of zero parts in sparse data is usually much larger than the non-zero part, thereby greatly reducing the amount of calculation and complexity of calculation in the federated interaction process. Compared with the prior art that uses a method based on homomorphic encryption to perform federated learning, the technical defect of low calculation efficiency in federated learning based on sparse matrices due to too many zero parts in the sparse matrix is overcome in the prior art, thereby improving the calculation efficiency of federated learning based on sparse matrices.
[0182] Further, refer to Figure 3 Based on the first and second embodiments of the present application, in another embodiment of the present application, the personalized recommendation method is applied to a first device, and the personalized recommendation method includes:
[0183] Step C10, obtaining sparse data of the first-party user to be recommended, and performing secret sharing with the second device to obtain secret sharing model parameters;
[0184] In this embodiment, it should be noted that the second device includes second-party user sparse data to be recommended, the second-party user sparse data to be recommended is a second sparse matrix corresponding to multiple user data, and the first-party user sparse data to be recommended is a first sparse matrix corresponding to multiple user data, wherein each vector of the first sparse matrix and each vector in the second sparse matrix are encoding vectors corresponding to the user data to be recommended of one user, and the encoding values in the first sparse matrix and the encoding values in the second sparse matrix are mostly 0. For example, the first sparse matrix represents the click results of different users on different items, the encoding value 1 indicates that the user clicked the item, and the encoding value 0 indicates that the user did not click the item. Since the user usually only clicks on a small part of the items, the encoding values in the first sparse matrix are mostly 0. Further, it should be noted that the first device and the second device are both participants in vertical federated learning, and before secret sharing, the first device and the second device have trained a preset personalized recommendation model based on secret sharing and vertical federated learning, wherein the preset personalized recommendation model is a trained factor decomposition machine regression model for predicting the score of the user's corresponding item, and the model expression of the preset personalized recommendation model is as follows:
[0185]
[0186] Among them, x is the model input data, w and V are model parameters, and f(x) is the model output, which is the score output by the preset personalized recommendation model or a vector composed of the scores output by the preset personalized recommendation model.
[0187] Acquire the sparse data of first-party users to be recommended, and share the data with the second device in secret to obtain secret sharing model parameters. Specifically, acquire the first-party model parameters of the preset personalized recommendation model and the sparse data of first-party users to be recommended, and at the same time, the second device acquires the second-party model parameters of the preset personalized recommendation model and the sparse data of second-party users to be recommended. Since the preset personalized recommendation model is constructed based on vertical federated learning, part of the model parameters of the preset personalized recommendation model held by the first device are first-party model parameters, and part of the model parameters of the preset personalized recommendation model held by the second device are second-party model parameters. The sparse data of the first-party users to be recommended are the associated data of the users collected by the first device, and the sparse data of the second-party users to be recommended are the associated data of the users collected by the second device. The associated data of the users include the data of the users' interests and hobbies and the historical rating data of the users on the items, etc. In the vertical federation scenario, the sparse data of the first-party users to be recommended and the sparse data of the second-party users to be recommended correspond to the same group of users to be recommended, and the sparse data of the first-party users to be recommended and the sparse data of the second-party users to be recommended can both be represented by vectors or matrices. For example, assuming that the first-party user sparse data to be recommended is a vector (1, 0, 1, 0), wherein code 1 indicates that the user clicked the corresponding item, and code 0 indicates that the user did not click the corresponding item, then the vector (1, 0, 1, 0) indicates that the user clicked on item A and item C, but did not click on item B and item D. Further, based on the first-party model parameters, secret sharing is performed with the second device, wherein the second device provides the second-party model parameters in the secret sharing, and then the first device obtains the secret sharing model parameters, and the second device obtains the second-party secret sharing model parameters, wherein the secret sharing model parameters include a first shared first-party model parameter and a first shared second-party model parameter, and the second-party secret sharing model parameters include a second shared first-party model parameter and a second shared second-party model parameter, wherein the first shared first-party model parameter is a first share of the first-party model parameter, the second shared first-party model parameter is a second share of the first-party model parameter, the first shared second-party model parameter is a first share of the second model parameter, and the second shared second-party model parameter is a second share of the second model parameter.
[0188] Step C20, based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, performing a vertical federated prediction interaction with the second device to score the recommended item corresponding to the sparse data of the first-party user to be recommended, and obtaining a first secret sharing scoring result;
[0189] In this embodiment, it should be noted that the first non-zero part is the remaining part of the first sparse matrix excluding the zero vector.
[0190] Based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, a vertical federal prediction interaction is performed with the second device to score the recommended items corresponding to the sparse data of the first-party user to be recommended, and a first secret sharing scoring result is obtained. Specifically, based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, a vertical federal prediction interaction is performed with the second device to combine the second non-zero part of the sparse data of the second-party user to be recommended and the second-party secret sharing model parameters, and calculate the first secret sharing scoring result through a preset secret sharing multiplication and a preset homomorphic encryption algorithm.
[0191] The secret sharing model parameters include the first party first sharing type model parameters and the first party second type sharing model parameters, the second device includes the second party to be recommended user sparse data and the second party secret sharing model parameters, wherein the second party secret sharing model parameters include the second party first sharing type model parameters and the second party second sharing type model parameters, the first secret sharing scoring result includes the first type sharing scoring result and the second type sharing scoring result,
[0192] The step of performing vertical federated prediction interaction with the second device based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters to score the recommended item corresponding to the sparse data of the first-party user to be recommended, and obtaining the first secret sharing scoring result includes:
[0193] Step C21, based on the first non-zero part and the first sharing type model parameter of the first party, performing vertical federation prediction interaction with the second device to combine the first sharing type model parameter of the second party to calculate the first type sharing score result;
[0194] In this embodiment, it should be noted that the first-party first sharing type model parameter is a first-party model parameter of secret sharing held by the first device, the second-party first sharing type model parameter is a first-party model parameter of secret sharing held by the second device, and the first-type sharing score result includes at least a first shared first-party score, and a first shared first-party score corresponds to a user, wherein the first secret sharing score calculation formula corresponding to the first shared first-party score is as follows:
[0195]
[0196] Among them, [[f(X A )]] A Score the first shared first party, X Ais the sparse data of the first party to be recommended users, w A and V A are the first-party model parameters, is the first safe inner product calculated in the same manner as the cross inner product of the third non-zero feature term in the model training process, is the second safe inner product calculated in the same way as the cross inner product of the second non-zero feature term in the model training process, is the third secure inner product calculated in the same manner as the intermediate parameter of the first party's second secret sharing during the model training process, [[ ]] is a symbol representing secret sharing, [[ ]] A A secret sharing symbol indicating that the secret shared data belongs to the first device.
[0197] Based on the first non-zero part and the first sharing type model parameters of the first party, a vertical federated prediction interaction is performed with the second device to jointly use the second party's first sharing type model parameters to calculate the first type sharing score result. Specifically, based on the first non-zero part and the first sharing type model parameters of the first party, a vertical federated prediction interaction is performed with the second device to jointly use the second party's first sharing type model parameters to respectively calculate the first security inner product, the second security inner product and the third security inner product, and the first security inner product, the second security inner product and the third security inner product are substituted into the first secret sharing score calculation formula to obtain the first type sharing score result.
[0198] Additionally, it should be noted that the second device may calculate the second party first type sharing score result based on the second party first secret sharing score calculation formula, and the second party first type sharing score result includes at least one second shared first party score, and one second shared first party score corresponds to one user, wherein the second party first secret sharing score calculation formula is as follows:
[0199]
[0200] Among them, [[f(X A )]] B Score the second shared first party, X A is the sparse data of the first party to be recommended users, w A and V A are the first-party model parameters, is the second-party first safety inner product calculated in the same manner as the cross inner product of the second-party third non-zero feature item in the model training process, is the second-party second safety inner product calculated in the same manner as the cross inner product of the second-party second non-zero feature item in the model training process, is the second party third secure inner product calculated in the same manner as the second party second secret sharing intermediate parameter in the model training process, [[ ]] is a symbol representing secret sharing, [[ ]] B A secret sharing symbol indicating that the secret shared data belongs to the first device.
[0201] Step C22, based on the first party's second sharing type model parameters, perform vertical federated prediction interaction with the second device to combine the second party's second sharing type model parameters and the second non-zero part of the second party's recommended user sparse data to calculate the second type sharing scoring result.
[0202] In this embodiment, it should be noted that the first-party second sharing type model parameter is a second-party model parameter of secret sharing held by the first device, the second-party second sharing type model parameter is a second-party model parameter of secret sharing held by the second device, and the second-type sharing score result includes at least a first sharing second-party score, and a first sharing second-party score corresponds to a user, wherein the second secret sharing score calculation formula corresponding to the first sharing second-party score is as follows:
[0203]
[0204] Among them, [[f(X B )]] A Score the first shared second party, X B is the sparse data of the second party user to be predicted, w B and V B are the second-party model parameters, is a fourth safe inner product calculated in the same manner as the cross inner product of the fourth non-zero characteristic term, is a fifth safe inner product calculated in the same manner as the cross inner product of the first non-zero characteristic term, is the sixth secure inner product calculated in the same manner as the first party's first secret sharing intermediate parameter, [[ ]] is a symbol representing secret sharing, [[ ]] A A secret sharing symbol indicating that the secret shared data belongs to the first device.
[0205] Based on the second sharing type model parameters of the first party, a vertical federated prediction interaction is performed with the second device to combine the second sharing type model parameters of the second party and the second non-zero part of the second party's user sparse data to be recommended, and calculate the second type sharing score result. Specifically, based on the second sharing type model parameters of the first party, a vertical federated prediction interaction is performed with the second device to combine the second sharing type model parameters of the second party and the second non-zero part of the second party's user sparse data to be predicted, and respectively calculate the fourth security inner product, the fifth security inner product and the sixth security inner product, and substitute the fourth security inner product, the fifth security inner product and the sixth security inner product into the second secret sharing score calculation formula to obtain the second type sharing score result.
[0206] Additionally, it should be noted that the second device may calculate the second party second type sharing score result based on the second party second secret sharing score calculation formula, and the second party second type sharing score result includes at least one second shared second party score, and one second shared second party score corresponds to one user, wherein the second party second secret sharing score calculation formula is as follows:
[0207]
[0208] Among them, [[f(X B )]] B Score the second shared second party, X B is the sparse data of the second party user to be predicted, w B and V B are the second-party model parameters, is the second-party fourth safety inner product calculated in the same manner as the cross inner product of the second-party fourth non-zero feature item in the model training process, is the second-party fifth safe inner product calculated in the same manner as the cross inner product of the second-party first non-zero feature item in the model training process, is the second party sixth secure inner product calculated in the same manner as the second party first secret sharing intermediate parameter in the model training process, [[ ]] is a symbol representing secret sharing, [[ ]] B A secret sharing symbol indicating that the secret shared data belongs to the second device.
[0209] Step C30: Based on the first secret sharing scoring result, perform aggregate interaction with the second device to calculate a target scoring result in conjunction with the second secret sharing scoring result determined by the second device;
[0210] In this embodiment, based on the first secret sharing scoring result, aggregate interaction is performed with the second device to combine the second secret sharing scoring result determined by the second device to calculate the target scoring result. Specifically, based on the first secret sharing scoring result, aggregate interaction is performed with the second device to aggregate the first secret sharing scoring result and the second secret sharing scoring result to obtain the target scoring result.
[0211] The first secret sharing score result includes at least a first shared first-party score and a first shared second-party score, the second secret sharing score result includes at least a second shared first-party score and a second shared second-party score, and the target score result includes at least a target score.
[0212] The step of performing aggregate interaction with the second device based on the first secret sharing scoring result to calculate a target scoring result in conjunction with the second secret sharing scoring result determined by the second device comprises:
[0213] Step C31, receiving the second shared first-party score and the second shared second-party score sent by the second device;
[0214] Step C32, calculating a first-party score based on the first shared first-party score and the second shared second-party score;
[0215] In this embodiment, the first party score is calculated based on the first shared first party score and the second shared second party score. Specifically, the sum of the first shared first party score and the second shared second party score is calculated to obtain the first party score.
[0216] Step C33, calculating a second-party score based on the first shared second-party score and the second shared second-party score;
[0217] In this embodiment, the second party score is calculated based on the first shared second party score and the second shared second party score. Specifically, the sum of the first shared second party score and the second shared second party score is calculated to obtain the second party score.
[0218] Step C34, aggregating the first party score and the second party score to obtain the target score;
[0219] In this embodiment, the first-party score and the second-party score are aggregated to obtain the target score. Specifically, based on preset aggregation rules, the first-party score and the second-party score are aggregated to obtain the target score, wherein the preset aggregation rules include summation and weighted averaging.
[0220] Step C40: generating a target recommendation list corresponding to the items to be recommended based on the target scoring result.
[0221] In this embodiment, based on the target scoring results, a target recommendation list corresponding to the items to be recommended is generated. Specifically, based on the size of each target score in the target scoring results, the target users are sorted to generate a recommended user list of the items to be recommended, wherein each target score is a score given by different target users to the same item to be recommended, and the recommended user list is used as the target recommendation list.
[0222] In another feasible scheme, based on the target scoring result, a target recommendation list corresponding to the user to be recommended is generated. Specifically, based on each target score in the target scoring result, wherein each target score is a score given by the same target user to different items to be recommended, and then based on the size of each target score, each item to be recommended is sorted to generate a recommended item list for the user to be recommended, and the recommended item list is used as the target recommendation list.
[0223] This embodiment provides a method for predicting click-through rate based on secret sharing and vertical federated learning, by obtaining sparse data of a first-party user to be recommended and performing secret sharing with a second device to obtain secret sharing model parameters, and then performing vertical federated prediction interaction with the second device based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, so as to score the recommended items corresponding to the sparse data of the first-party user to be recommended, and obtain a first secret sharing scoring result, and then performing aggregate interaction with the second device based on the first secret sharing scoring result, so as to calculate a target scoring result in conjunction with a second secret sharing scoring result determined by the second device, and then generating a target recommendation list corresponding to the recommended items based on the target scoring result, wherein: When the first device and the second device interact, the data sent or received are all secret shared data. There is no need for public-private keys generated by a third party to encrypt the data. All data transmission processes are carried out between the two parties participating in vertical federated learning, which protects the privacy of the data while reducing the complex encryption and decryption calculation processes of the data. Moreover, since only simple mathematical operations are required for secret sharing and the corresponding decryption of secret sharing, the calculation complexity is reduced. When the user data is sparse data, the present application can complete the generation of the target recommendation list based only on the non-zero part of the user data, thereby reducing the amount of calculation on the zero part of the user data, thereby further reducing the calculation complexity, thereby improving the calculation efficiency of the factor decomposition machine regression model for personalized recommendations.
[0224] Reference Figure 4 , Figure 4 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0225] like Figure 4 As shown, the factor decomposition machine model building device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0226] Optionally, the factorization machine model building device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0227] Those skilled in the art will understand that Figure 4 The factor decomposition machine model building device structure shown in does not constitute a limitation of the factor decomposition machine model building device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0228] like Figure 4 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a factor decomposition machine model construction program. The operating system is a program that manages and controls the hardware and software resources of the factor decomposition machine model construction device, and supports the operation of the factor decomposition machine model construction program and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the factor decomposition machine model construction system.
[0229] exist Figure 4 In the factor decomposition machine model building device shown, the processor 1001 is used to execute the factor decomposition machine model building program stored in the memory 1005 to implement the steps of any of the above-mentioned factor decomposition machine model building methods.
[0230] The specific implementation of the factor decomposition machine model construction device of the present application is basically the same as the various embodiments of the factor decomposition machine model construction method described above, and will not be repeated here.
[0231] Reference Figure 5 , Figure 5 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0232] like Figure 5 As shown, the personalized recommendation device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0233] Optionally, the personalized recommendation device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0234] Those skilled in the art will understand that Figure 5 The personalized recommendation device structure shown in the figure does not constitute a limitation on the personalized recommendation device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0235] like Figure 5 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a personalized recommendation program. The operating system is a program that manages and controls the hardware and software resources of the personalized recommendation device, and supports the operation of the personalized recommendation program and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the personalized recommendation system.
[0236] exist Figure 5 In the personalized recommendation device shown, the processor 1001 is used to execute the personalized recommendation program stored in the memory 1005 to implement the steps of any of the personalized recommendation methods described above.
[0237] The specific implementation of the personalized recommendation device of the present application is basically the same as the embodiments of the personalized recommendation method described above, and will not be repeated here.
[0238] The present application also provides a factor decomposition machine model construction device, which is applied to a factor decomposition machine model construction device, and the factor decomposition machine model construction device includes:
[0239] A secret sharing module, used to obtain initialization model parameters and first sparse data corresponding to a preset initialization model, and based on the initialization model parameters, perform secret sharing with a second device to obtain first-party secret sharing initial model parameters, so that the second device can determine second-party secret sharing initial model parameters;
[0240] an error calculation module, configured to perform a federated interaction with the second device based on a first non-zero portion of the first sparse data and the first party secret sharing initial model parameter, so as to calculate a secret sharing model error by combining a second non-zero portion of the second sparse data obtained by the second device and the second party secret sharing initial model parameter;
[0241] A generation module is used to update the preset initialization model based on the secret sharing model error to obtain a vertical federated factorization machine model.
[0242] Optionally, the error calculation module includes:
[0243] a first calculation submodule, configured to perform a federated interaction with the second device based on a preset secret sharing multiplication triplet, the first non-zero part, and the first party secret sharing initial model parameter, so as to calculate a sparse matrix secure inner product and a secret sharing intermediate parameter by combining the second non-zero part and the second party secret sharing initial model parameter;
[0244] The second calculation submodule is used to calculate the secret sharing model error based on the sparse matrix secure inner product, the secret sharing intermediate parameter and a preset secret sharing model error calculation formula.
[0245] Optionally, the first calculation module includes:
[0246] A first computing unit, configured to perform a federated interaction with the second device based on the first type of shared model parameters and the first non-zero part, so as to calculate the first type of sparse matrix secure inner product by combining the second party's first type of shared model parameters and the second non-zero part;
[0247] A second computing unit, configured to perform a federated interaction with the second device based on the second-type shared model parameters and the first non-zero part, so as to jointly calculate the second-type sparse matrix secure inner product with the second-type shared model parameters of the second party and the second non-zero part;
[0248] The third computing unit is used to perform a federal interaction with the second device based on the second type sharing model parameters, the first non-zero part and the preset secret sharing multiplication triplet to jointly calculate the secret sharing intermediate parameters with the second party's second type sharing model parameters and the second non-zero part.
[0249] Optionally, the second computing unit includes:
[0250] a first interactive calculation subunit, configured to perform a federated interaction with the second device based on the second type shared model parameter, so as to calculate a cross inner product between the second type shared model parameter and the second non-zero part, and obtain a cross inner product of the first non-zero feature item;
[0251] The second interactive calculation subunit is used to perform federal interaction with the second device based on the first non-zero part to calculate the cross inner product between the first non-zero part and the second type shared model parameter of the second party to obtain the cross inner product of the second non-zero feature item.
[0252] Optionally, the first interactive calculation subunit is further used for the following steps:
[0253] Generate a first public key, and encrypt the first shared parameter based on the first public key to obtain an encrypted first shared parameter;
[0254] Sending the first public key and the encrypted first shared parameter to a second device, so that the second device determines the cross inner product of the second party's first non-zero feature term and the cross inner product of the encrypted first non-zero feature term based on the first public key, the encrypted first shared parameter, the second shared parameter and the second non-zero part;
[0255] Receive the encrypted first non-zero feature item cross inner product sent by the second device, and decrypt the encrypted first non-zero feature item cross inner product based on the first private key corresponding to the first public key to obtain the first non-zero feature item cross inner product.
[0256] Optionally, the second interactive calculation subunit is further used for the following steps:
[0257] receiving a second public key and an encrypted fourth shared parameter sent by the second device, wherein the encrypted fourth shared parameter is the fourth shared parameter encrypted by the second device based on the second public key;
[0258] Calculate a second non-zero feature item cross inner product and an encrypted second party second non-zero feature item cross inner product based on the second public key, the encrypted fourth shared parameter, the first non-zero part and the third shared parameter;
[0259] The encrypted second-party second non-zero characteristic item cross inner product is sent to the second device, so that the second device decrypts the encrypted second-party second non-zero characteristic item cross inner product based on the second private key corresponding to the second public key to obtain the second-party second non-zero characteristic item cross inner product.
[0260] Optionally, the second interactive calculation subunit is further used for the following steps:
[0261] Based on the second public key, encrypt the third shared parameter to obtain the encrypted third shared parameter, and calculate the encryption model parameter corresponding to the encrypted third shared parameter and the encrypted fourth shared parameter;
[0262] Calculate the cross inner product between each column vector in the encrypted model parameter and each column vector in the first non-zero part to obtain the first encrypted inner product;
[0263] Based on the characteristic dimension of the encryption model parameter, the second non-zero characteristic item cross inner product is constructed, and the encrypted second party second non-zero characteristic item cross inner product corresponding to the second non-zero characteristic item cross inner product and the first encrypted inner product is calculated.
[0264] Optionally, the third calculation unit further includes:
[0265] a third interactive calculation subunit, configured to calculate, based on the preset secret sharing multiplication triplet, a secret sharing product between the second type secret sharing parameter matrix and the secret sharing transposed parameter matrix by performing federated interaction with the second device, and obtain an inner product of the secret sharing matrix, so that the second device can calculate the secret sharing product between the second type secret sharing parameter matrix of the second party and the secret sharing transposed parameter matrix of the second party, and obtain the inner product of the second party secret sharing matrix;
[0266] The fourth interactive calculation subunit is used to perform federal interaction with the second device based on the inner product of the secret sharing matrix and the first non-zero part, so as to jointly calculate the secret sharing intermediate parameter with the inner product of the second party's secret sharing matrix and the second non-zero part.
[0267] Optionally, the generating module includes:
[0268] An updating submodule, configured to update the secret sharing initial model parameters based on the secret sharing model error to obtain secret sharing update parameters;
[0269] A decryption submodule is used to perform decryption interaction with the second device based on the secret sharing update parameter to obtain the first target model parameter so that the second device can obtain the second target model parameter.
[0270] Optionally, the decryption submodule includes:
[0271] a first interactive calculation unit, configured to send the first shared second-party model update parameter to the second device, so that the second device calculates the second target model parameter based on the determined second shared second-party model update parameter and the first shared second-party model update parameter;
[0272] The second interactive calculation unit is used to receive the second shared first-party model update parameter sent by the second device, and calculate the first target model parameter based on the second shared first-party model update parameter and the first shared first-party model update parameter.
[0273] The specific implementation of the factor decomposition machine model construction device of the present application is basically the same as the various embodiments of the factor decomposition machine model construction method described above, and will not be repeated here.
[0274] The embodiment of the present application further provides a personalized recommendation device, which is applied to a personalized recommendation device, and the personalized recommendation device includes:
[0275] A secret sharing module, used to obtain sparse data of the first-party user to be recommended, and to perform secret sharing with the second device to obtain secret sharing model parameters;
[0276] a scoring module, configured to perform a vertical federated prediction interaction with the second device based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, so as to score the recommended item corresponding to the sparse data of the first-party user to be recommended, and obtain a first secret sharing scoring result;
[0277] an aggregation module, configured to perform aggregation interaction with the second device based on the first secret sharing scoring result, so as to calculate a target scoring result in conjunction with the second secret sharing scoring result determined by the second device;
[0278] A generation module is used to generate a target recommendation list corresponding to the to-be-recommended items based on the target scoring result.
[0279] Optionally, the aggregation module includes:
[0280] a receiving unit, configured to receive the second shared first-party score and the second shared second-party score sent by the second device;
[0281] a first calculation unit, configured to calculate a first-party score based on the first shared first-party score and the second shared second-party score;
[0282] a second calculation unit, configured to calculate a second-party score based on the first shared second-party score and the second shared second-party score;
[0283] An aggregation unit is used to aggregate the first-party score and the second-party score to obtain the target score.
[0284] Optionally, the scoring module includes:
[0285] A first joint calculation unit, configured to perform a vertical federated prediction interaction with the second device based on the first non-zero part and the first sharing type model parameter of the first party, so as to calculate the first type sharing score result by combining the first sharing type model parameter of the second party;
[0286] A second joint calculation unit is used to perform a vertical federated prediction interaction with the second device based on the second sharing type model parameters of the first party, so as to combine the second sharing type model parameters of the second party and the second non-zero part of the sparse data of the second party's user to be recommended to calculate the second type sharing score result.
[0287] The specific implementation of the personalized recommendation device of the present application is basically the same as the embodiments of the personalized recommendation method described above, and will not be repeated here.
[0288] An embodiment of the present application provides a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the above-mentioned factor decomposition machine model construction methods.
[0289] The specific implementation of the readable storage medium of the present application is basically the same as the above-mentioned embodiments of the factor decomposition machine model construction method, and will not be repeated here.
[0290] An embodiment of the present application provides a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the personalized recommendation methods described above.
[0291] The specific implementation of the readable storage medium of the present application is basically the same as the embodiments of the above-mentioned personalized recommendation method, and will not be repeated here.
[0292] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
Claims
1. A factor decomposition machine model construction method, characterized in that: The factor decomposition machine model construction method is applied to a first device, and the factor decomposition machine model construction method includes: Acquire initialization model parameters and first sparse data corresponding to a preset initialization model, and based on the initialization model parameters, perform secret sharing with a second device to obtain first-party secret sharing initial model parameters, so that the second device can determine second-party secret sharing initial model parameters; Based on a first non-zero portion of the first sparse data and the first party secret sharing initial model parameter, perform a federated interaction with the second device to calculate a secret sharing model error by combining a second non-zero portion of the second sparse data obtained by the second device and the second party secret sharing initial model parameter; The step of updating the preset initialization model based on the secret sharing model error to obtain the vertical federated factorization machine model comprises: Based on the secret sharing model error, updating the secret sharing initial model parameters to obtain secret sharing update parameters; Based on the secret shared update parameters, decryption interaction is performed with the second device to obtain first target model parameters so that the second device can obtain second target model parameters, wherein the vertical federated factor decomposition machine model includes first target model parameters belonging to the first device and second target model parameters belonging to the second device.
2. The method for constructing a factorization machine model according to claim 1, wherein: The step of performing federated interaction with the second device based on the first non-zero part of the first sparse data and the first party secret sharing initial model parameter to calculate the secret sharing model error by combining the second non-zero part of the second sparse data obtained by the second device and the second party secret sharing initial model parameter comprises: Based on a preset secret sharing multiplication triplet, the first non-zero part, and the first party secret sharing initial model parameter, perform a federated interaction with the second device to combine the second non-zero part and the second party secret sharing initial model parameter to calculate a sparse matrix secure inner product and a secret sharing intermediate parameter; The secret sharing model error is calculated based on the sparse matrix secure inner product, the secret sharing intermediate parameter and a preset secret sharing model error calculation formula.
3. The factorization machine model construction method according to claim 2, characterized in that: The first party secret sharing initial model parameters include first type sharing model parameters and second type sharing model parameters, the second party secret sharing initial model parameters include second party first type sharing model parameters and second party second type sharing model parameters, the sparse matrix security inner product includes first type sparse matrix security inner product and second type sparse matrix security inner product, The step of performing federated interaction with the second device based on the preset secret sharing multiplication triplet, the first non-zero part, and the first party secret sharing initial model parameter to combine the second non-zero part and the second party secret sharing initial model parameter to calculate the sparse matrix secure inner product and the secret sharing intermediate parameter comprises: Based on the first type of shared model parameters and the first non-zero part, perform federated interaction with the second device to combine the second party's first type of shared model parameters and the second non-zero part to calculate the first type of sparse matrix secure inner product; Based on the second-type shared model parameters and the first non-zero part, perform federated interaction with the second device to combine the second-type shared model parameters and the second non-zero part of the second party to calculate the second-type sparse matrix secure inner product; Based on the second type sharing model parameters, the first non-zero part and the preset secret sharing multiplication triplet, a federated interaction is performed with the second device to combine the second party second type sharing model parameters and the second non-zero part to calculate the secret sharing intermediate parameter.
4. The method for constructing a factorization machine model as claimed in claim 3, characterized in that: The second type of sparse matrix safe inner product includes a first non-zero characteristic item cross inner product and a second non-zero characteristic item cross inner product. The step of performing federated interaction with the second device based on the second type shared model parameter and the first non-zero part to combine the second type shared model parameter and the second non-zero part of the second party to calculate the second type sparse matrix secure inner product includes: Based on the second type shared model parameter, perform federated interaction with the second device to calculate a cross inner product between the second type shared model parameter and the second non-zero part to obtain a cross inner product of the first non-zero feature item; Based on the first non-zero part, a federated interaction is performed with the second device to calculate a cross inner product between the first non-zero part and the second-party second-type shared model parameter to obtain a cross inner product of the second non-zero feature item.
5. The method for constructing a factorization machine model according to claim 4, characterized in that: The second type of shared model parameters include first shared parameters, and the second type of shared model parameters include second shared parameters. The step of performing federated interaction with the second device based on the second type shared model parameter to calculate the cross inner product between the second type shared model parameter and the second non-zero part to obtain the cross inner product of the first non-zero feature item includes: Generate a first public key, and encrypt the first shared parameter based on the first public key to obtain an encrypted first shared parameter; Sending the first public key and the encrypted first shared parameter to a second device, so that the second device determines the cross inner product of the second party's first non-zero feature term and the cross inner product of the encrypted first non-zero feature term based on the first public key, the encrypted first shared parameter, the second shared parameter and the second non-zero part; Receive the encrypted first non-zero feature item cross inner product sent by the second device, and decrypt the encrypted first non-zero feature item cross inner product based on the first private key corresponding to the first public key to obtain the first non-zero feature item cross inner product.
6. The method for constructing a factorization machine model according to claim 4, wherein: The second type of shared model parameters include a third shared parameter, and the second party second type of shared model parameters include a fourth shared parameter. The step of performing federated interaction with the second device based on the first non-zero part to calculate the cross inner product between the first non-zero part and the second type shared model parameter of the second party to obtain the cross inner product of the second non-zero feature item includes: receiving a second public key and an encrypted fourth shared parameter sent by the second device, wherein the encrypted fourth shared parameter is the fourth shared parameter encrypted by the second device based on the second public key; Calculate a second non-zero feature item cross inner product and an encrypted second party second non-zero feature item cross inner product based on the second public key, the encrypted fourth shared parameter, the first non-zero part and the third shared parameter; The encrypted second-party second non-zero characteristic item cross inner product is sent to the second device, so that the second device decrypts the encrypted second-party second non-zero characteristic item cross inner product based on the second private key corresponding to the second public key to obtain the second-party second non-zero characteristic item cross inner product.
7. The method for constructing a factorization machine model according to claim 6, wherein: The step of calculating the cross inner product of the second non-zero feature item and the cross inner product of the encrypted second non-zero feature item of the second party based on the second public key, the encrypted fourth shared parameter, the first non-zero part and the third shared parameter comprises: Based on the second public key, encrypt the third shared parameter to obtain the encrypted third shared parameter, and calculate the encryption model parameter corresponding to the encrypted third shared parameter and the encrypted fourth shared parameter; Calculate the cross inner product between each column vector in the encrypted model parameter and each column vector in the first non-zero part to obtain a first encrypted inner product; Based on the characteristic dimension of the encryption model parameter, the second non-zero characteristic item cross inner product is constructed, and the encrypted second party second non-zero characteristic item cross inner product corresponding to the second non-zero characteristic item cross inner product and the first encrypted inner product is calculated.
8. The method for constructing a factorization machine model as claimed in claim 3, characterized in that: The second-type sharing model parameters include a second-type secret sharing parameter matrix and a secret sharing transposed parameter matrix corresponding to the second-type secret sharing parameter matrix, and the second-party second-type sharing model parameters include a second-party second-type secret sharing parameter matrix and a second-party secret sharing transposed parameter matrix corresponding to the second-party second-type sharing parameter matrix. The step of performing federated interaction with the second device based on the second type sharing model parameter, the first non-zero part and the preset secret sharing multiplication triplet to combine the second type sharing model parameter of the second party and the second non-zero part to calculate the secret sharing intermediate parameter comprises: Based on the preset secret sharing multiplication triplet, by performing federated interaction with the second device, a secret sharing product between the second type of secret sharing parameter matrix and the secret sharing transposed parameter matrix is calculated to obtain an inner product of the secret sharing matrix, so that the second device can calculate the secret sharing product between the second type of secret sharing parameter matrix of the second party and the secret sharing transposed parameter matrix of the second party to obtain an inner product of the second party secret sharing matrix; Based on the inner product of the secret sharing matrix and the first non-zero part, a federated interaction is performed with the second device to combine the inner product of the second party secret sharing matrix and the second non-zero part to calculate the secret sharing intermediate parameter.
9. The factorization machine model construction method according to claim 1, characterized in that: The secret shared update parameters include a first shared first party model update parameter and a first shared second party model update parameter, The step of performing decryption interaction with the second device based on the secret sharing update parameter to obtain the first target model parameter so that the second device can obtain the second target model parameter includes: sending the first shared second-party model update parameter to the second device, so that the second device calculates the second target model parameter based on the determined second shared second-party model update parameter and the first shared second-party model update parameter; A second shared first-party model update parameter sent by the second device is received, and the first target model parameter is calculated based on the second shared first-party model update parameter and the first shared first-party model update parameter.
10. A personalized recommendation method, characterized in that: The personalized recommendation method is applied to the first device described in any one of claims 1 to 9, and the personalized recommendation method includes: Acquire sparse data of the first-party user to be recommended, and perform secret sharing with the second device to obtain secret sharing model parameters; The step of obtaining the sparse data of the first-party user to be recommended, performing secret sharing with the second device, and obtaining the secret sharing model parameters includes: Acquire first-party model parameters of a preset personalized recommendation model and sparse data of first-party users to be recommended, and at the same time, the second device acquires second-party model parameters of the preset personalized recommendation model and sparse data of second-party users to be recommended; The second device provides the second party model parameter in secret sharing, so that the first device obtains the secret sharing model parameter, and the second device obtains the second party secret sharing model parameter; Based on the first non-zero part of the sparse data of the first-party user to be recommended and the secret sharing model parameters, perform a vertical federated prediction interaction with the second device to score the recommended item corresponding to the sparse data of the first-party user to be recommended, and obtain a first secret sharing scoring result; The step of performing vertical federated prediction interaction with the second device based on the first non-zero part of the sparse data of the first user to be recommended and the secret sharing model parameters to score the recommended item corresponding to the sparse data of the first user to be recommended, and obtaining the first secret sharing scoring result includes: Based on the first non-zero part and the first sharing type model parameter of the first party, perform a vertical federated prediction interaction with the second device to combine the first sharing type model parameter of the second party to calculate a first type sharing score result; Based on the second sharing type model parameters of the first party, a vertical federated prediction interaction is performed with the second device to combine the second sharing type model parameters of the second party and the second non-zero part of the sparse data of the second party's user to be recommended, and calculate the second type sharing score result, wherein the secret sharing model parameters include the first sharing type model parameters of the first party and the second type sharing model parameters of the first party, the second device includes the sparse data of the second party's user to be recommended and the second party secret sharing model parameters, wherein the second party secret sharing model parameters include the first sharing type model parameters of the second party and the second sharing type model parameters of the second party, and the first secret sharing score result includes the first type sharing score result and the second type sharing score result; Based on the first secret sharing scoring result, perform aggregate interaction with the second device to calculate a target scoring result in conjunction with the second secret sharing scoring result determined by the second device; Based on the target scoring result, a target recommendation list corresponding to the to-be-recommended items is generated.
11. The personalized recommendation method according to claim 10, characterized in that: The first secret sharing score result includes at least a first shared first-party score and a first shared second-party score, the second secret sharing score result includes at least a second shared first-party score and a second shared second-party score, and the target score result includes at least a target score. The step of performing aggregate interaction with the second device based on the first secret sharing scoring result to calculate a target scoring result in conjunction with the second secret sharing scoring result determined by the second device comprises: receiving the second shared first-party score and the second shared second-party score sent by the second device; calculating a first-party score based on the first shared first-party score and the second shared second-party score; calculating a second-party score based on the first shared second-party score and the second shared second-party score; The first-party score and the second-party score are aggregated to obtain the target score.
12. A factor decomposition machine model building device, characterized in that: The factor decomposition machine model building device includes: a memory, a processor, and a program stored in the memory for implementing the factor decomposition machine model building method. The memory is used to store a program for implementing a factorization machine model building method; The processor is used to execute a program for implementing the factor decomposition machine model construction method to implement the steps of the factor decomposition machine model construction method as described in any one of claims 1 to 9.
13. A readable storage medium, characterized in that: The readable storage medium stores a program for implementing a factor decomposition machine model construction method, and the program for implementing a factor decomposition machine model construction method is executed by a processor to implement the steps of the factor decomposition machine model construction method as described in any one of claims 1 to 9.
14. A personalized recommendation device, characterized in that: The personalized recommendation device includes: a memory, a processor, and a program stored in the memory for implementing the personalized recommendation method. The memory is used to store a program for implementing a personalized recommendation method; The processor is used to execute a program for implementing the personalized recommendation method, so as to implement the steps of the personalized recommendation method as claimed in any one of claims 10 to 11.
15. A readable storage medium, characterized in that: The readable storage medium stores a program for implementing the personalized recommendation method, and the program for implementing the personalized recommendation method is executed by a processor to implement the steps of the personalized recommendation method as claimed in any one of claims 10 to 11.
