Model training methods, devices, equipment and storage media

By exchanging model prediction errors and training parameters among participants, and using homomorphic encryption and batch gradient descent algorithms to train linear regression models, the problem of user privacy leakage is solved, and secure and efficient model training is achieved.

CN116739113BActive Publication Date: 2025-10-31中移信息技术有限公司 +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310886352.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-18
Publication Date
2025-10-31
Estimated Expiration
2043-07-18

AI Technical Summary

Technical Problem

In existing technologies, training linear regression models requires providing data to a third party, which can easily lead to the leakage of user privacy.

Method used

By exchanging model prediction errors and training parameters among participants, using homomorphic encryption to protect data privacy, and employing batch gradient descent to update model parameters, the security and privacy of model training are achieved.

Benefits of technology

This method enables effective training of linear regression models without transmitting data to third parties, protecting user privacy and improving the security and efficiency of model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116739113B_ABST
    Figure CN116739113B_ABST
Patent Text Reader

Abstract

This invention relates to the field of data security technology and discloses a model training method, apparatus, device, and storage medium, comprising: determining a first prediction error based on model prediction results and sending the first prediction error to other participants, who then provide feedback on second training parameters based on the first prediction error; determining the first training parameters based on the second prediction error provided by the other participants; and updating the parameters of an initial user profile construction model based on the first and second training parameters to obtain a target user profile construction model. This invention sends the first prediction error to other participants to allow them to provide feedback on the second training parameters, determines the first training parameters based on the second prediction error, and then updates the model parameters based on the first and second training parameters to obtain an updated model. This solves the problem in existing technologies where data needs to be given to third parties when training linear regression models, which can easily lead to the leakage of user privacy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data security technology, and in particular to a model training method, apparatus, device, and storage medium. Background Technology

[0002] Linear regression, a widely used fundamental machine learning algorithm, models the relationship between one or more independent and dependent variables by fitting a linear model to multiple influencing factors and outcomes. Training a linear regression model typically relies on large amounts of data. However, in reality, datasets are usually held by different users and contain their private information. When multiple users want to pool a large amount of data to train a better model, user privacy issues inevitably arise.

[0003] Currently, homomorphic encryption can be used to address privacy leaks in model computation. For example, when telecom operators and banks need to use each other's data and linear regression to create user profiles, both parties typically send their data to a third-party training server for model training. In this case, the transmitted data is encrypted using homomorphic encryption. However, even with homomorphic encryption, the risk of data leakage still exists, impacting user experience. Summary of the Invention

[0004] The main objective of this invention is to provide a model training method, apparatus, device, and storage medium, aiming to solve the technical problem in the prior art that training linear regression models generally requires providing data to a third party for model training, which easily leads to the leakage of user privacy.

[0005] To achieve the above objectives, the present invention provides a model training method, which is applied to a system containing at least two participants, each of whom has deployed an initial user profile construction model. The model training method includes:

[0006] A first prediction error is determined based on the model prediction results of the model built from the initial user profile, and the first prediction error is sent to other participants, who then feed back second training parameters based on the first prediction error.

[0007] The first training parameter is determined based on the second prediction error fed back by the other participants, wherein the second prediction error is determined by the model prediction result output by the other participants based on their own training data;

[0008] The initial user profile construction model is updated based on the first training parameters and the second training parameters to obtain the target user profile construction model.

[0009] Optionally, before the step of determining the first prediction error based on the model prediction result of the model constructed from the initial user profile, and sending the first prediction error to other participants, the method further includes:

[0010] The first encrypted training parameters are determined based on the first initial training parameters and the encrypted second initial training parameters fed back by the other participants. The encrypted second initial training parameters are obtained by the other participants after encrypting the second initial training parameters. The second initial training parameters are the training parameters of the other participants.

[0011] The first training set data is encrypted using the encryption keys provided by the other participants to obtain the target semi-encrypted matrix;

[0012] The model prediction result of the initial user profile construction model is determined based on the first encrypted training parameters and the target semi-encrypted matrix.

[0013] Optionally, the step of determining a first prediction error based on the model prediction result of the model constructed from the initial user profile, and sending the first prediction error to other participants, includes:

[0014] The first data tag is encrypted using the encryption key to obtain the first encrypted data tag;

[0015] The model prediction result based on the initial user profile and the first encrypted data tag are used to determine the first prediction error, and the first prediction error is sent to other participants.

[0016] Optionally, the step of determining the first training parameters based on the second prediction error fed back by the other participants includes:

[0017] The second prediction error fed back by the other participants is decrypted using the first decryption key to obtain the decrypted second label error;

[0018] The target label error is determined based on the first label error and the second label error. The first label error is obtained by the other participants after decrypting the first prediction error using the second decryption key.

[0019] The first training parameters are determined based on the first training set data and the target label error.

[0020] Optionally, the step of determining the first training parameters based on the first training set data and the target label error includes:

[0021] The gradient change shared value is determined based on the first training set data, the first label error, the second label error, the second training set data, and the target label error, wherein the second training set data is the training set data of the other participants;

[0022] The first training parameters are determined based on the gradient change shared value and the first initial training parameters.

[0023] Optionally, before the step of determining the first prediction error based on the model prediction result of the model constructed from the initial user profile, and sending the first prediction error to other participants, the method further includes:

[0024] Get the learning rate and maximum number of iterations for the current model training;

[0025] The step of determining the first training parameters based on the gradient change shared value and the first initial training parameters includes:

[0026] The first training parameters are determined by batch gradient descent based on the gradient change shared value, the first initial training parameters, the learning rate, and the maximum number of iterations.

[0027] Optionally, the step of updating the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the target user profile construction model includes:

[0028] The initial user profile construction model is updated based on the first training parameters and the second training parameters to obtain the updated user profile construction model.

[0029] Determine whether the updated user profile construction model has converged based on a preset loss function;

[0030] If so, the updated user profile building model is determined as the target user profile building model.

[0031] Furthermore, to achieve the above objectives, the present invention also proposes a model training apparatus, the apparatus comprising:

[0032] An error determination module is used to determine a first prediction error based on the model prediction result of the model constructed from the initial user profile, and send the first prediction error to other participants, who in turn feed back second training parameters based on the first prediction error.

[0033] The parameter determination module is used to determine the first training parameters based on the second prediction error fed back by the other participants, wherein the second prediction error is determined by the model prediction results output by the other participants based on their own training data.

[0034] The parameter update module is used to update the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the target user profile construction model.

[0035] Furthermore, to achieve the above objectives, the present invention also proposes a model training device, the device comprising: a memory, a processor, and a model training program stored in the memory and executable on the processor, the model training program being configured to implement the steps of the model training method described above.

[0036] In addition, to achieve the above objectives, the present invention also proposes a storage medium storing a model training program, which, when executed by a processor, implements the steps of the model training method described above.

[0037] This invention discloses a method for determining a first prediction error based on the model prediction results of an initial user profile model, and sending this first prediction error to other participants. These participants then provide feedback on second training parameters based on the first prediction error. The second prediction error is determined by the other participants based on their own model prediction results from their training data. The initial user profile model is updated using both the first and second training parameters to obtain a target user profile model. Compared to existing technologies where both data providers must provide data to a third-party training server for model training, this invention addresses the technical problem of prior art where training linear regression models typically requires providing data to a third party, leading to potential privacy leaks. Attached Figure Description

[0038] Figure 1 This is a schematic diagram of the structure of the model training device in the hardware operating environment involved in the embodiments of the present invention;

[0039] Figure 2 This is a flowchart illustrating the first embodiment of the model training method of the present invention;

[0040] Figure 3 This is a flowchart illustrating the second embodiment of the model training method of the present invention;

[0041] Figure 4 This is a structural block diagram of the first embodiment of the model training device of the present invention.

[0042] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0043] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0044] Reference Figure 1 , Figure 1 This is a schematic diagram of the model training device structure of the hardware operating environment involved in the embodiments of the present invention.

[0045] like Figure 1 As shown, the model training device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0046] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the model training device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0047] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a model training program.

[0048] exist Figure 1In the model training device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the model training device of the present invention can be set in the model training device, and the model training device calls the model training program stored in the memory 1005 through the processor 1001 and executes the model training method provided in the embodiment of the present invention.

[0049] This invention provides a model training method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the model training method of the present invention.

[0050] In this embodiment, the model training method includes the following steps:

[0051] Step S10: Determine the first prediction error based on the model prediction result of the model constructed from the initial user profile, and send the first prediction error to other participants. The other participants feed back the second training parameters based on the first prediction error.

[0052] It should be noted that the executing entity of the method in this embodiment can be the first participant in training the linear regression model. The first participant and the aforementioned other participants are the two parties involved in training the linear regression model.

[0053] It should be understood that the aforementioned initial user profile construction model can be an untrained model that uses linear regression to profile users. In this solution, the initial user profile construction model can be any untrained linear regression model. This embodiment can use a linear regression model for user profile construction as an example to train the linear regression model.

[0054] It is understandable that this solution is not limited to scenarios involving training user profile models; it can be used in any scenario involving training linear regression models. In practical applications, if a telecom operator and a bank need to use each other's data to create user profiles using linear regression, but neither party is willing to share their user data with the other for training, and neither party wants to possess the trained model exclusively, then the issue of privacy computation arises. Therefore, the model training method proposed in this solution can be used to train the linear regression model while ensuring the security of both parties' data.

[0055] It should be noted that the above model prediction results can be those obtained using an untrained linear regression model. Linear regression, in this context, refers to training the parameters w of a linear regression model using gradient descent based on a known dataset, thereby predicting the unknown category of the data. It can be defined as follows: given an input sample x...i =(x i,1 x i,2 , ..., x i,d )∈R d+1 , 1≤i≤n, where n is the number of samples, and the related output is y. i ∈R, the goal of multiple linear regression is to find the parameters W = (w1, w2, ..., w...). d ), to satisfy f(x) i )=x i w, such that f(x) i As close to y as possible i ∈R, the matrix representation is:

[0056] It should be understood that the aforementioned first prediction error can be the error between the model prediction result and the true value in the first participating party.

[0057] It is understandable that the second training parameter mentioned above can be the updated model parameters corresponding to other participants.

[0058] Furthermore, to enable the first participant with training data and other participants to determine the predicted values ​​of their own data independently, thus protecting the privacy of both parties, the method further includes the following steps before step S10: determining first encrypted training parameters based on first initial training parameters and encrypted second initial training parameters fed back by the other participants, wherein the encrypted second initial training parameters are obtained by the other participants encrypting the second initial training parameters, and the second initial training parameters are the training parameters of the other participants; encrypting the first training set data according to the encryption key fed back by the other participants to obtain a target semi-encrypted matrix; and determining the model prediction result of the initial user profile construction model based on the first encrypted training parameters and the target semi-encrypted matrix.

[0059] It should be noted that the first initial training parameters mentioned above can be the initial model parameters of the first participant. Correspondingly, the second initial training parameters mentioned above can be the initial model parameters of the other participants. In practical applications, before training the linear regression model, the first participant and other participants need to initialize the model parameters θ respectively. A ∈R d θ B ∈R d θ A and θ B Both are m*1, i.e., θ A and θ B The combined coefficients are the complete regression coefficients, and θ A and θ BThe data is stored separately by the first participant and other participants, so that the first participant and other participants who have the training data do not need to give the data to each other or third parties when training the model, thus protecting user privacy.

[0060] It should be understood that the aforementioned first encrypted training parameters can be obtained by merging the first initial training parameters of the first participant with the encrypted second initial training parameters fed back by other participants. In practical applications, other participants can use their own public key PubB to configure the second initial training parameters θ. B Encryption is performed to obtain the encrypted second initial training parameters E. PubB (θ B ), and the second initial training parameter E PubB (θ B The first participant receives the second initial training parameters E and sends them to the first participant. PubB (θ B Then it can be compared with its first initial training parameter θ. A The parameters are merged to obtain the first encrypted training parameters θ1.

[0061] It is understandable that the aforementioned encryption key could be the public key of other participants.

[0062] It should be noted that the aforementioned first training set data can be data owned by the first participant for model training.

[0063] It should be understood that the aforementioned target semi-encrypted matrix can be the matrix obtained by the first participant encrypting its first training set data using the public keys of other participants. In practical applications, this scheme can use hierarchical homomorphic encryption technology to encrypt the data information. Its core idea is to regard the noise introduced in homomorphic encryption as part of the error in the approximate calculation process. For plaintext message m, it is encrypted using the private key SK to obtain ciphertext ct, and has the decryption structure <ct, sk> = m + e ≈ m (mod q).

[0064] In the specific implementation, the first participant and other participants in the training process can first establish a secure channel using VPN technologies such as SSL (Secure Socket Layer), so that all information for subsequent linear regression model training can be transmitted within the secure channel. During model training, the first participant and other participants each possess a portion of the initial training set data X. A Second training set data X B The data assumes both sides are average, each having a value of m*n, where n is a multiple of 2. The first participant and other participants can each initialize the first initial training parameter θ. A ∈R dSecond initial training parameters θ B ∈R d After parameter initialization is complete, the first participant can use their public key PubA to encrypt the initial training parameters θ. A The encrypted first initial training parameters E are obtained. PubA (θ A ), and encrypt the first initial training parameters E PubA (θ A The public key PubA is sent to other participants, who can then use their own public key PubB to encrypt the second initial training parameters θ. B The encrypted second initial training parameters E are obtained. PubB (θ B ), and encrypt the second initial training parameters E PubB (θ B The public key PubB is sent to the first participant. The first participant and other participants respectively receive the encrypted second initial training parameters E. PubB (θ B ) and the encrypted first initial training parameters E PubA (θ A After that, each can use its own first initial training parameter θ. A Second initial training parameters θ B The parameters are merged into a first encrypted training parameter θ1 and a second encrypted training parameter θ2. The first encrypted training parameter θ1 and the second encrypted training parameter θ2 are respectively:

[0065]

[0066]

[0067] After obtaining the first encrypted training parameters θ1 and the second encrypted training parameters θ2, the first participant and other participants can respectively use each other's public keys PubB and PubA to encrypt their own first training set data X. A Second training set data X B The part that yields the target semi-encryption matrix X 1 A Second half encryption matrix X 1 B (For the first participating user, the part from n / 2+1 to n is encrypted; for other participating users, the part from 1 to n / 2 is encrypted), where the target semi-encryption matrix X 1 A Second half encryption matrix X 1 B As shown below:

[0068]

[0069]

[0070] At this point, the first participant and other participants can calculate X separately. 1 A *θ1 and X 1 B *θ2, respectively, yields the model prediction result E of the first participant. PubB (y 1 A Model prediction results E from other participants PubA (y 1 B ), where E PubB (y 1 A ) and E PubA (y 1 B () represents the first training set data X corresponding to the model. A Second training set data X B Prediction result y 1 A and y 1 B The ciphertext value.

[0071] Further, step S10 may specifically include: encrypting the first data tag according to the encryption key to obtain the first encrypted data tag; determining the first prediction error based on the model prediction result of the model built based on the initial user profile and the first encrypted data tag, and sending the first prediction error to other participants.

[0072] It should be noted that the aforementioned first data tag can be a tag corresponding to the data of the first participant. Correspondingly, the aforementioned first encrypted data tag can be a tag obtained by the first participant encrypting the first data tag using the public key of other participants.

[0073] In the specific implementation, the first participant and other participants respectively correspond to the first data label y. A Second data label y B (y A and y B (All are m*1), where the first participant and other participants can respectively use each other's public keys PubB and PubA to encrypt the tag y of their own data. A and y B The first encrypted data tag E is obtained. PubB (y A ) and second encrypted data tag E PubA (y BThus, the first participant and other participants can calculate E separately. PubB (y 1 A )-E PubB (y A ) and E PubA (y 1 B )-E PubA (y B The encrypted value of the difference between the model prediction and the true value is obtained, representing the first prediction error E. PubB (Δy A ) and second prediction error E PubA (Δy B ), in determining the first prediction error E PubB (Δy A ) and second prediction error E PubA (Δy B After that, the first participant and other participants can exchange E. PubB (Δy A ) and E PubA (Δy B ).

[0074] Step S20: Determine the first training parameter based on the second prediction error fed back by the other participants. The second prediction error is determined by the model prediction result output by the other participants based on their own training data.

[0075] It should be noted that the aforementioned second prediction error can be the error between the model prediction results of other participants and the actual value.

[0076] It should be understood that the aforementioned first training parameter can be the updated model parameter corresponding to the first participant.

[0077] Further, step S20 may specifically include: decrypting the second prediction error fed back by the other participants using a first decryption key to obtain a decrypted second label error; determining a target label error based on the first label error and the second label error, wherein the first label error is obtained by the other participants decrypting the first prediction error using a second decryption key; and determining a first training parameter based on the first training set data and the target label error.

[0078] Understandably, the aforementioned first decryption key can be the private key of the first participant. In practical applications, the first participant, upon receiving the second prediction error E from other participants,... PubA (Δy B After that, you can use your own private key to access E. PubA (Δy BDecryption is performed to obtain the second label error Δy. B Other participants, upon receiving the first prediction error E sent by the first participant, PubB (Δy A After that, you can use your own private key to access E. PubB (Δy A Decryption is performed to obtain the first label error Δy. A , where Δy A and Δy A Both are m*1. At this point, the first participant and the second participant can exchange the first label error Δy. A Second label error Δy B The target label error Δy is calculated separately, and the formula for calculating Δy is as follows:

[0079]

[0080] It should be noted that the step of determining the first training parameter based on the first training set data and the target label error may include: determining a gradient change shared value based on the first training set data, the first label error, the second label error, the second training set data, and the target label error, wherein the second training set data is the training set data of the other participants; and determining the first training parameter based on the gradient change shared value and the first initial training parameter.

[0081] It should be understood that, in order to optimize the model convergence speed, the first participant and other participants in this embodiment can use the batch gradient descent algorithm for model training. The shared gradient change values ​​mentioned above can be parameter values ​​in the batch gradient descent algorithm. The gradient descent algorithm is an optimization algorithm used to find the minimum of the objective function, ensuring the convergence of the gradient descent method.

[0082] It is understood that before step S10 above, the method further includes: obtaining the learning rate and maximum number of iterations for the current model training; correspondingly, the step of determining the first training parameter based on the gradient change shared value and the first initial training parameter includes: determining the first training parameter by batch gradient descent based on the gradient change shared value, the first initial training parameter, the learning rate and the maximum number of iterations.

[0083] It should be noted that before training the linear regression model, the computational units involved in the model training need to jointly pre-set some necessary parameters to efficiently and accurately complete the regression task. In this embodiment, the first participant and other participants can first jointly negotiate the learning rate α, the maximum number of iterations E, and the number of mini-batch samples |B| (B is an even number), and in this embodiment, the gradient descent can adopt the batch gradient descent algorithm. The gradient descent process includes: selecting an initial parameter vector w, and in each iteration, for a random instance (x... i y i The update rule for the j-th component in the parameter vector is:

[0084]

[0085] Where α is the learning rate, a hyperparameter required for gradient descent; and e is the number of iterations. In the practical training, this scheme uses the batch gradient descent algorithm, and its parameter update rule is as follows:

[0086]

[0087] Where e is the number of iterations, α is the learning rate, n is the number of samples, and (X, y) is the training data required for the model.

[0088] In the specific implementation, the first participant and other participants exchange the first label error Δy. A Second label error Δy B After calculating the target label error Δy, the first participant and other participants can each calculate their own first training set data X. A Second training set data X B Transpose to obtain the transposed result. and in, and They are respectively:

[0089]

[0090] At this point, the first participant can calculate the first training set data X. A The transpose and second label error Δy B The product of, i.e. Other participants can calculate the second training set data X. B The transpose and first label error Δy A The product of, i.e. G were obtained respectively A and G B The first participant and other participants then exchange G. A and G B Then calculate GA and G B The sum of these values ​​yields G, allowing both sides to calculate their respective gradient change shared values, where G*Δy is the gradient change shared value. After obtaining the gradient change shared value, each side can update its own model parameters θ according to the parameter update rules of the batch gradient descent algorithm. A and θ B To obtain the updated first and second training parameters respectively, the parameter update rule of the batch gradient descent algorithm is as follows:

[0091]

[0092] In the formula, e is the maximum number of iterations, α is the learning rate, and G*Δy is the gradient change shared value.

[0093] Step S30: Update the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the target user profile construction model.

[0094] It should be noted that the first participant and other participants have different opinions on their parametric models θ. A and θ B After the update, the first training parameters corresponding to the first participant and the second training parameters corresponding to the other participants can be obtained. Since the entire linear regression model is composed of θ... A and θ B The initial user profile model is composed of n / 2*1 vectors, which can be used to update the parameters of the initial user profile model through the first and second training parameters to obtain the updated target user profile model. In other words, the linear regression model is updated with updated parameters through the updated first and second training parameters to obtain the updated target linear regression model.

[0095] It should be understood that the first and second training parameters mentioned above are stored by the first participant and the other participant respectively, and cannot be obtained by third parties. If prediction is required through the linear regression model in the future, both parties need to participate, thereby protecting the privacy interests of the model participants.

[0096] In practical implementation, if data prediction is required, a prediction request can be initiated by the first participant or other participants. The data x to be predicted can be divided into x1 and x2, where x1 and x2 are both 1*n / 2 vectors. x1 and x2 are then sent to the first participant and other participants respectively. Upon receiving x1 and x2, the first participant and other participants can calculate y1 = x1*θ. A and y2=x2*θ B y1+y2 is the final predicted value, where θ is at this point. A and θB These are the first training parameters and the second training parameters, respectively, which are the updated first and second initial training parameters. Because the first participant and other participants in this scheme use a semi-encrypted matrix (i.e., only half of the data in the matrix is ​​encrypted, and the other half is unencrypted) to calculate the predicted values, the amount of data involved in ciphertext operations can be reduced, thus improving data processing efficiency.

[0097] This embodiment discloses a method for determining a first prediction error based on the model prediction results of an initial user profile model, and sending the first prediction error to other participants. These participants then provide feedback on second training parameters based on the first prediction error. The second prediction error is determined by the other participants based on their own model prediction results from their training data. The initial user profile model is updated using the first and second training parameters to obtain a target user profile model. Compared to existing technologies where both data providers must provide data to a third-party training server for model training, this embodiment sends the first prediction error determined by the model prediction results to other participants, allowing them to provide feedback on the second training parameters. The first training parameters are then determined based on the second prediction error, and the model parameters are updated based on the first and second training parameters to obtain the updated target user profile model. This solves the technical problem in existing technologies where training linear regression models typically requires providing data to a third party for model training, which can easily lead to user privacy leaks.

[0098] refer to Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the model training method of the present invention.

[0099] Based on the first embodiment described above, in this embodiment, step S20 includes:

[0100] Step S301: Update the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the updated user profile construction model.

[0101] Step S302: Determine whether the updated user profile construction model has converged based on the preset loss function.

[0102] It should be noted that the aforementioned preset loss function can be used to evaluate the performance of the trained model. In practical applications, to measure the quality of a model, it is necessary to evaluate its performance. A commonly used evaluation metric is the sum of squared errors, which is the sum of the squares of the differences between the target value and the predicted result. Therefore, the loss function can be quantified.

[0103]

[0104] The task of linear regression is to find the value of w that minimizes L.

[0105] Step S303: If yes, then the updated user profile construction model is determined as the target user profile construction model.

[0106] In this specific implementation, after updating the model parameters using the first and second training parameters, the first participant and other participants can use the new parameter model to calculate the loss function L and determine whether it converges. If it converges, the training of the model is stopped, and the updated linear regression model is determined as the target linear regression model. If it does not converge, the process returns to the step of determining the first encrypted training parameters based on the first initial training parameters and the encrypted second initial training parameters fed back by the other participants, and the model training continues, thereby improving the model performance.

[0107] This embodiment discloses updating the parameters of the initial user profile construction model based on first and second training parameters to obtain an updated user profile construction model; determining whether the updated user profile construction model has converged according to a preset loss function; if so, the updated user profile construction model is determined as the target user profile construction model. Because this embodiment determines whether the updated user profile construction model has converged based on a preset loss function, and determines the updated user profile construction model as the target user profile construction model upon convergence, model performance can be improved.

[0108] Furthermore, this embodiment of the invention also proposes a storage medium storing a model training program, which, when executed by a processor, implements the steps of the model training method described above.

[0109] Reference Figure 4 , Figure 4 This is a structural block diagram of the first embodiment of the model training device of the present invention.

[0110] like Figure 4 As shown, the model training device proposed in this embodiment of the invention includes:

[0111] Error determination module 401 is used to determine a first prediction error based on the model prediction result of the model constructed from the initial user profile, and send the first prediction error to other participants, who in turn feed back second training parameters based on the first prediction error.

[0112] The parameter determination module 402 is used to determine the first training parameters based on the second prediction error fed back by the other participants, wherein the second prediction error is determined by the model prediction results output by the other participants based on their own training data;

[0113] The parameter update module 403 is used to update the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the target user profile construction model.

[0114] Furthermore, the error determination module 401 is also used to determine the first encrypted training parameters based on the first initial training parameters and the encrypted second initial training parameters fed back by the other participants, wherein the encrypted second initial training parameters are obtained by the other participants encrypting the second initial training parameters, and the second initial training parameters are the training parameters of the other participants; to encrypt the first training set data according to the encryption key fed back by the other participants to obtain a target semi-encrypted matrix; and to determine the model prediction result of the initial user profile construction model based on the first encrypted training parameters and the target semi-encrypted matrix.

[0115] Furthermore, the error determination module 401 is also used to encrypt the first data tag according to the encryption key to obtain the first encrypted data tag; determine the first prediction error based on the model prediction result of the model built based on the initial user profile and the first encrypted data tag, and send the first prediction error to other participants.

[0116] Furthermore, the parameter determination module 402 is also used to decrypt the second prediction error fed back by the other participants using the first decryption key to obtain the decrypted second label error; determine the target label error based on the first label error and the second label error, wherein the first label error is obtained by the other participants decrypting the first prediction error using the second decryption key; and determine the first training parameters based on the first training set data and the target label error.

[0117] Furthermore, the error determination module 401 is also used to obtain the learning rate and the maximum number of iterations for the current model training; correspondingly, the parameter determination module 402 is also used to determine the first training parameters based on the gradient change shared value, the first initial training parameters, the learning rate, and the maximum number of iterations, using the batch gradient descent method.

[0118] This embodiment of the model training apparatus discloses a method for determining a first prediction error based on the model prediction results of an initial user profile model, and sending the first prediction error to other participants. These other participants then provide feedback on second training parameters based on the first prediction error. The first training parameters are determined based on the second prediction error provided by the other participants, which is determined by the model prediction results output by the other participants based on their own training data. The initial user profile model is updated based on the first and second training parameters to obtain a target user profile model. Compared to existing technologies where both parties providing data need to send their data to a third-party training server for model training, this embodiment sends the first prediction error determined based on the model prediction results to other participants, allowing them to provide feedback on the second training parameters. The first training parameters are then determined based on the second prediction error, and the model parameters are updated based on the first and second training parameters to obtain an updated target user profile model. This solves the technical problem in existing technologies where training linear regression models typically requires sending data to a third party for model training, which can easily lead to user privacy leaks.

[0119] Based on the first embodiment of the model training device of the present invention, a second embodiment of the model training device of the present invention is proposed.

[0120] In this embodiment, the parameter update module 403 is further configured to update the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the updated user profile construction model; determine whether the updated user profile construction model has converged according to a preset loss function; if so, determine the updated user profile construction model as the target user profile construction model.

[0121] This embodiment discloses updating the parameters of the initial user profile construction model based on first and second training parameters to obtain an updated user profile construction model; determining whether the updated user profile construction model has converged according to a preset loss function; if so, the updated user profile construction model is determined as the target user profile construction model. Because this embodiment determines whether the updated user profile construction model has converged based on a preset loss function, and determines the updated user profile construction model as the target user profile construction model upon convergence, model performance can be improved.

[0122] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0123] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0124] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0125] The above are merely preferred embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A model training method, characterized in that, The method is applied to a system containing at least two participants, each of whom has an initial user profile building model deployed. The model training method includes: A first prediction error is determined based on the model prediction results of the model built from the initial user profile, and the first prediction error is sent to other participants, who then feed back second training parameters based on the first prediction error. The first training parameter is determined based on the second prediction error fed back by the other participants, wherein the second prediction error is determined by the model prediction result output by the other participants based on their own training data; The initial user profile construction model is updated based on the first training parameters and the second training parameters to obtain the target user profile construction model. Before the step of determining the first prediction error based on the model prediction result of the model constructed based on the initial user profile, and sending the first prediction error to other participants, the method further includes: The first encrypted training parameters are determined based on the first initial training parameters and the encrypted second initial training parameters fed back by the other participants. The encrypted second initial training parameters are obtained by the other participants after encrypting the second initial training parameters. The second initial training parameters are the training parameters of the other participants. The first training set data is encrypted using the encryption keys provided by the other participants to obtain the target semi-encrypted matrix; The model prediction result of the initial user profile construction model is determined based on the first encrypted training parameters and the target semi-encrypted matrix.

2. The model training method as described in claim 1, characterized in that, The step of determining a first prediction error based on the model prediction result of the model constructed based on the initial user profile, and sending the first prediction error to other participants, includes: The first data tag is encrypted using the encryption key to obtain the first encrypted data tag; The model prediction result based on the initial user profile and the first encrypted data tag are used to determine the first prediction error, and the first prediction error is sent to other participants.

3. The model training method as described in claim 1, characterized in that, The step of determining the first training parameters based on the second prediction error fed back by the other participants includes: The second prediction error fed back by the other participants is decrypted using the first decryption key to obtain the decrypted second label error; The target label error is determined based on the first label error and the second label error. The first label error is obtained by the other participants after decrypting the first prediction error using the second decryption key. The first training parameters are determined based on the first training set data and the target label error.

4. The model training method as described in claim 3, characterized in that, The step of determining the first training parameters based on the first training set data and the target label error includes: The gradient change shared value is determined based on the first training set data, the first label error, the second label error, the second training set data, and the target label error, wherein the second training set data is the training set data of the other participants; The first training parameters are determined based on the gradient change shared value and the first initial training parameters.

5. The model training method as described in claim 4, characterized in that, Before the step of determining the first prediction error based on the model prediction result of the model constructed based on the initial user profile, and sending the first prediction error to other participants, the method further includes: Get the learning rate and maximum number of iterations for the current model training; The step of determining the first training parameters based on the gradient change shared value and the first initial training parameters includes: The first training parameters are determined by batch gradient descent based on the gradient change shared value, the first initial training parameters, the learning rate, and the maximum number of iterations.

6. The model training method as described in claim 1, characterized in that, The step of updating the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the target user profile construction model includes: The initial user profile construction model is updated based on the first training parameters and the second training parameters to obtain the updated user profile construction model. Determine whether the updated user profile construction model has converged based on a preset loss function; If so, the updated user profile building model is determined as the target user profile building model.

7. A model training device, characterized in that, The device comprises a system with at least two participating parties, each of which has an initial user profile building model deployed. The device includes: An error determination module is used to determine a first prediction error based on the model prediction result of the model constructed from the initial user profile, and send the first prediction error to other participants, who in turn feed back second training parameters based on the first prediction error. The parameter determination module is used to determine the first training parameters based on the second prediction error fed back by the other participants, wherein the second prediction error is determined by the model prediction results output by the other participants based on their own training data. The parameter update module is used to update the parameters of the initial user profile construction model based on the first training parameters and the second training parameters to obtain the target user profile construction model. The error determination module is further configured to: determine first encrypted training parameters based on first initial training parameters and encrypted second initial training parameters fed back by the other participants; the encrypted second initial training parameters are obtained by the other participants encrypting the second initial training parameters, and the second initial training parameters are the training parameters of the other participants; encrypt the first training set data according to the encryption key fed back by the other participants to obtain a target semi-encrypted matrix; and determine the model prediction result of the initial user profile construction model based on the first encrypted training parameters and the target semi-encrypted matrix.

8. A model training device, characterized in that, The device includes: a memory, a processor, and a model training program stored in the memory and executable on the processor, the model training program being configured to implement the steps of the model training method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium stores a model training program, which, when executed by a processor, implements the steps of the model training method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Model training method, device and system

    CN112183757A