CN110851785B - Longitudinal federal learning optimization method, device, equipment and storage medium - Google Patents

Longitudinal federal learning optimization method, device, equipment and storage medium Download PDF

Info

Publication number
CN110851785B
CN110851785B CN201911124536.3A CN201911124536A CN110851785B CN 110851785 B CN110851785 B CN 110851785B CN 201911124536 A CN201911124536 A CN 201911124536A CN 110851785 B CN110851785 B CN 110851785B
Authority
CN
China
Prior art keywords
data
participant
target
main
queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911124536.3A
Other languages
Chinese (zh)
Other versions
CN110851785A (en
Inventor
范涛
杨恺
陈天健
杨强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN201911124536.3A priority Critical patent/CN110851785B/en
Priority to PCT/CN2019/119409 priority patent/WO2021092977A1/en
Publication of CN110851785A publication Critical patent/CN110851785A/en
Application granted granted Critical
Publication of CN110851785B publication Critical patent/CN110851785B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/18Complex mathematical operations for evaluating statistical data, e.g. average values, frequency distributions, probability functions, regression analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Theoretical Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Operations Research (AREA)
  • Probability & Statistics with Applications (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Computing Systems (AREA)
  • Storage Device Security (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to the technical field of financial science and technology, and discloses a longitudinal federal learning optimization method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring an encrypted value set of data in a main participant, and acquiring a new encrypted value set of new data in the main participant based on a preset judging condition; sending the encrypted value set and the new encrypted value set to the auxiliary participant as a target value set to acquire an intermediate result value fed back by the auxiliary participant based on the target value set; calculating main encryption data in a main participant according to the intermediate result value, and sending the main encryption data to a coordinator; and receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged. The invention reduces the traffic for longitudinal federal learning.

Description

Longitudinal federal learning optimization method, device, equipment and storage medium
Technical Field
The invention relates to the technical field of financial science (Fintech), in particular to a longitudinal federal learning optimization method, a longitudinal federal learning optimization device, longitudinal federal learning optimization equipment and a longitudinal federal learning optimization storage medium.
Background
With the development of computer technology, more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are applied in the financial field, and the traditional financial industry is gradually changing to the financial technology (Fintech), but due to the requirements of security and real-time performance of the financial industry, higher requirements are also put forward on the technologies. For example, the longitudinal logistic regression method of federal learning, but the existing longitudinal logistic regression scheme is a random gradient descent method based on one-step information. The principle of the scheme is that a loss (loss) function of logistic regression is firstly used for second-order Taylor expansion of zero points, then the approximate loss function value and the gradient value can be obtained through data federation of two sides of an AB, a homomorphic encryption is utilized to encrypt a calculation intermediate result, and the calculation intermediate result is decrypted by a side C and then transmitted back to the two sides of the AB for model parameter updating. The route adopted by the scheme is a random gradient descent method, namely small batch data are randomly selected, the AB parties obtain encryption gradient values of respective parameter components through calculation, encryption and data interaction, and the encryption gradient values are sent to the C party for decryption and multiplied by corresponding step sizes to obtain descent directions. The random gradient is reduced to a first-order algorithm, the convergence speed is low, and a large number of rounds of data interaction are needed, so that the communication quantity needed by the current longitudinal federal learning is high, the network bandwidth is consumed, and the calculation cost is high.
Disclosure of Invention
The invention mainly aims to provide a longitudinal federal learning optimization method, a device, equipment and a storage medium, and aims to solve the technical problem of high traffic of the conventional longitudinal federal learning.
In order to achieve the above object, the present invention provides a longitudinal federal learning optimization method, which includes the steps of:
acquiring an encrypted value set of data in a main participant, and acquiring a new encrypted value set of new data in the main participant based on a preset judging condition;
sending the encrypted value set and the new encrypted value set to a secondary participant as a target value set to acquire an intermediate result value fed back by the secondary participant based on the target value set;
calculating primary encryption data in the primary participant according to the intermediate result value, and sending the primary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix according to the primary encryption data and secondary encryption data sent by the secondary participant in response to the non-convergence of a longitudinal logistic regression model, and calculating a target primary gradient value according to the updated second derivative matrix;
And receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged.
Optionally, the step of receiving the target main gradient value fed back by the coordinator includes:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is acquired by the coordinator according to a second derivative matrix updated in response to the longitudinal logistic regression model meeting the preset judging condition.
Optionally, the step of receiving the target main gradient value fed back by the coordinator includes:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is obtained by the coordinator according to a second derivative matrix updated by target data, the target data is obtained by decrypting and combining the main encryption data and the auxiliary encryption data sent by the auxiliary participant in response to the condition that a longitudinal logistic regression model is not converged and a preset judgment condition is met.
Optionally, the receiving the target primary gradient value fed back by the coordinator includes:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is obtained by splitting a first target product by the coordinator, and the first target product is a product among a second derivative matrix updated according to the condition that the longitudinal logistic regression model meets the preset judgment condition, a long vector obtained by combining the main gradient value sent by the main participant and the auxiliary gradient value sent by the auxiliary participant, and a preset step length.
Optionally, the step of receiving the target main gradient value fed back by the coordinator includes:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is a second target product, and the second target product is the product between the calculated main gradient value sent by the main participant and a preset step length, wherein the longitudinal logistic regression model of the coordinator is not converged and a preset judging condition is not met.
Optionally, the step of acquiring a new encrypted value set of new data in the master participant based on a preset determination condition includes:
Detecting whether a longitudinal logistic regression model corresponding to the main participant meets a preset judging condition or not;
and if so, acquiring a new encryption value set of new data in the master participant according to the preset logistic regression algorithm.
Optionally, the step of obtaining the encrypted value set of the data in the master participant includes:
and acquiring a preset logistic regression algorithm in the master participant, calculating a logistic regression score of data in the master participant according to the preset logistic regression algorithm, and encrypting the logistic regression score to acquire an encrypted value set.
In addition, the invention provides a longitudinal federal learning optimization method comprising the following steps:
receiving primary encrypted data sent by a primary participant and secondary encrypted data sent by a secondary participant, wherein the primary encrypted data is calculated according to an intermediate result value fed back by the secondary participant based on a target value set sent by the primary participant, and the target value set comprises an encrypted value set corresponding to data and a new encrypted value set corresponding to new data;
in response to the longitudinal logistic regression model not converging, updating a second derivative matrix according to the primary encryption data and the secondary encryption data, and calculating a target primary gradient value according to the updated second derivative matrix;
And respectively sending the target main gradient values to the main participants, wherein the main participants are used for updating local model parameters in the main participants based on the target main gradient values, and continuing to execute the step of acquiring the encrypted value set of the data in the main participants until the longitudinal logistic regression model corresponding to the coordinator converges.
Optionally, the step of updating the second derivative matrix according to the primary encrypted data and the secondary encrypted data includes:
judging whether the longitudinal logistic regression model meets the preset judging condition or not;
if so, updating a second derivative matrix according to the primary encryption data and the secondary encryption data.
Optionally, the step of updating the second derivative matrix according to the primary encrypted data and the secondary encrypted data includes:
the coordinator decrypts and combines the primary encrypted data and the secondary encrypted data to obtain target data;
and storing the target data into a queue with a preset length to acquire a target queue, and updating a second derivative matrix through the target queue.
Optionally, after the step of determining whether the longitudinal logistic regression model meets the preset determination condition, the method includes:
If the primary gradient value is not met, the coordinator obtains a first product between the primary gradient value sent by the primary participant and a preset step length, and sends the first product to the primary participant as a target primary gradient value.
In addition, to achieve the above object, the present invention also provides a longitudinal federal learning optimization device, including:
the acquisition module is used for acquiring an encrypted value set of data in a main participant and acquiring a new encrypted value set of new data in the main participant based on a preset judgment condition;
the sending module is used for sending the encrypted value set and the new encrypted value set to a secondary participant as a target value set so as to obtain an intermediate result value fed back by the secondary participant based on the target value set;
the first calculation module is used for calculating main encryption data in the main participant according to the intermediate result value and sending the main encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix according to the main encryption data and auxiliary encryption data sent by the auxiliary participant and calculating a target main gradient value according to the updated second derivative matrix in response to the non-convergence of a longitudinal logistic regression model;
And the first updating module is used for receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged.
Optionally, the longitudinal federal learning optimization device includes:
the receiving module is used for receiving main encrypted data sent by a main participant and auxiliary encrypted data sent by an auxiliary participant, wherein the main encrypted data is calculated according to an intermediate result value fed back by the auxiliary participant based on a target value set sent by the main participant, and the target value set comprises an encrypted value set corresponding to data and a new encrypted value set corresponding to new data;
the second calculation module is used for responding to the unconvergence of the longitudinal logistic regression model, updating a second derivative matrix according to the primary encryption data and the secondary encryption data, and calculating a target primary gradient value according to the updated second derivative matrix;
and the second updating module is used for respectively sending the target main gradient values to the main participants, wherein the main participants are used for updating local model parameters in the main participants based on the target main gradient values, and continuing to execute the step of acquiring the encrypted value set of the data in the main participants until the longitudinal logistic regression model corresponding to the coordinator is converged.
In addition, to achieve the above object, the present invention also provides a longitudinal federal learning optimization apparatus, including: the system comprises a memory, a processor and a longitudinal federal learning optimization program stored on the memory and capable of running on the processor, wherein the longitudinal federal learning optimization program realizes the steps of the longitudinal federal learning optimization method when being executed by the processor.
In addition, in order to achieve the above object, the present invention also provides a storage medium having stored thereon a longitudinal federal learning optimization program which, when executed by a processor, implements the steps of the longitudinal federal learning optimization method as described above.
The method comprises the steps of obtaining an encrypted value set of data in a main participant, and obtaining a new encrypted value set of new data in the main participant based on a preset judging condition; sending the encrypted value set and the new encrypted value set to a secondary participant as a target value set to acquire an intermediate result value fed back by the secondary participant based on the target value set; calculating primary encryption data in the primary participant according to the intermediate result value, and sending the primary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix according to the primary encryption data and secondary encryption data sent by the secondary participant in response to the non-convergence of a longitudinal logistic regression model, and calculating a target primary gradient value according to the updated second derivative matrix; and receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged. The encryption value set and the new encryption value set in the main participant are sent to the auxiliary participant as target value sets according to preset judging conditions, so that the sending quantity of the sending target value set is improved, main encryption data are calculated according to the intermediate result value fed back by the auxiliary participant, then the main encryption data are sent to the coordinator, local model parameters in the main participant are updated according to the target main gradient value fed back by the coordinator, and the coordinator calculates the target main gradient value according to the second derivative matrix, so that the phenomenon that the convergence speed is low due to the fact that the first-order algorithm is adopted in the longitudinal federal learning in the prior art, and a large number of rounds of data interaction is needed is avoided, and the communication quantity for longitudinal federal learning is reduced.
Drawings
FIG. 1 is a schematic diagram of a device architecture of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a first embodiment of a longitudinal federal learning optimization method according to the present invention;
FIG. 3 is a schematic flow chart of another embodiment of a longitudinal federal learning optimization method according to the present invention;
FIG. 4 is a schematic diagram of a device module of the vertical federal learning optimization device of the present invention;
FIG. 5 is a schematic flow chart of calculation and interaction of the vertical federal learning optimization method of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic device structure of a hardware running environment according to an embodiment of the present invention.
The longitudinal federal learning optimization device in the embodiment of the invention can be a PC or a server device, and a Java virtual machine is operated on the device.
As shown in fig. 1, the longitudinal federal learning optimization device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). 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 optionally be a storage device separate from the processor 1001 described above.
It will be appreciated by those skilled in the art that the device structure shown in fig. 1 is not limiting of the device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a vertical federal learning optimization program may be included in the memory 1005 as one type of storage medium.
In the device shown in fig. 1, the network interface 1004 is mainly used for connecting to a background server, and performing data communication with the background server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to invoke the longitudinal federal learning optimization procedure stored in the memory 1005 and perform operations in the longitudinal federal learning optimization method described below.
Based on the hardware structure, the embodiment of the longitudinal federal learning optimization method is provided.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of a longitudinal federal learning optimization method according to the present invention, the method includes:
step S10, acquiring an encrypted value set of data in a main participant, and acquiring a new encrypted value set of new data in the main participant based on a preset judging condition;
The primary participant has part of the characteristics of the data, and in this embodiment, only the primary participant is taken as the a-party, the secondary participant is taken as the B-party, and the coordinator is taken as the C-party for explanation. Logistic regression is a classification method based on a probabilistic model. Model training for logistic regression is performed on a given data feature and label (x i ,y i ) The method comprises minimizing the loss function l (w) =log (1+exp (-yw) T x)) to obtain model parameters w. The longitudinal federal learning means that different parties respectively have different characteristic data, which is equivalent to longitudinally dividing each piece of complete data into a plurality of parts, and each party hopes to realize training of a logistic regression model under the condition of protecting data privacy, so that model parameters are utilized to predict and score new data. Loss function l (w) =log (1+exp (-yw) T x)) and (subscript i is omitted for simplicity of notation). The existing encryption calculation scheme cannot calculate the exponential function and the logarithmic function in the encryption state, in this embodiment, the existing encryption calculation scheme in longitudinal federal logistic regression is adopted, and encryption meeting the addition homomorphism is usedThe method being [ [ ax ]]]=a[[x]],[[x]]+[[y]]=[[x+y]]. Here [ ·]]Representing homomorphic encryption operations. Only one party holds the data tag in the longitudinal federal scene, and taking two parties as an example, party A holds the data x A Maintaining corresponding model parameters w A Party B holds x B ,y B Owning and maintaining the corresponding model parameters w B
In order to realize longitudinal federal logistic regression, the scheme adopts the existing approximation scheme of logistic regression function, and performs second-order taylor expansion at zero point, namely:
Figure BDA0002273903270000071
the gradient after approximation is:
Figure BDA0002273903270000072
the loss function and gradient can be expressed as an operation of two-party homomorphic encryption data, namely:
Figure BDA0002273903270000073
Figure BDA0002273903270000081
Figure BDA0002273903270000082
Figure BDA0002273903270000083
the scheme utilizes second-order information to provide a fast convergence technical scheme, and the second derivative matrix (i.e. Heisen matrix) of the approximate loss function is
Figure BDA0002273903270000084
In the present embodiment, quasi-Newton method is used, and second-order information estimation is usedAnd an inverse hessian matrix H adopts Hg as a descending direction instead of the gradient g in the algorithm, so that the convergence rate of the algorithm is increased. Since the inverse hessian matrix H is much larger in dimension than the gradient, the core point of the design is how to reduce the data traffic of each party. The scheme provides that an inverse hessian matrix H is maintained at the C end, a small batch of data is selected at random except the gradient is calculated in each L-step AB side, and the average value +.>
Figure BDA0002273903270000085
Mean +.>
Figure BDA0002273903270000086
Difference (I) of->
Figure BDA0002273903270000087
Then calculate a vector containing the second order information of the batch of data >
Figure BDA0002273903270000088
And the dimension of the data is the same as the gradient of the data sent to the C end. The C-terminal updates the inverse hessian matrix once by using the information of the first M vectors v. Therefore, in the present embodiment, the main participant is set as the A side and the auxiliary participant is set as the B side, and the logistic regression score of the calculated data on the A side can be expressed by the formula +.>
Figure BDA0002273903270000089
For calculation, i.e. representing the logistic regression score of each sample on the A side, where w represents the logistic regression linear model parameters, x represents data, y represents data tag, [ []]Representing homomorphic encryption, after randomly selecting a small batch of data ID as S, calculating a value set u in S corresponding to the data ID in a master participant (namely A party) A ,u A 2 And adopts homomorphic encryption calculation to all u A ,u A 2 The value is encrypted to obtain an encrypted value set [ [ u ] A ]],[[u A 2 ]]And transmits it to the B-party, and then updates +.>
Figure BDA00022739032700000810
And determining whether the current iteration number of the longitudinal logistic regression model corresponding to the master participant is greater than a preset number (i.e., determining whether the longitudinal logistic regression model meets a preset judgment condition). When determining whether the current iteration number is greater than the preset number, determining the relation between the current iteration number k and L, and when the current iteration number k is an integer multiple of L, judging whether the iteration number is greater than 2L, wherein 2L is the preset number, and when judging that the iteration number k is greater than 2L, enabling the end A (namely a main participant) to stop >
Figure BDA00022739032700000811
I.e. calculate +.>
Figure BDA00022739032700000812
And calculates the average value of this time (t) and the previous time (t-1)>
Figure BDA00022739032700000813
The difference, i.e.)>
Figure BDA00022739032700000814
In addition, randomly selecting a small lot of data ID s H The end A calculates s H Upper->
Figure BDA00022739032700000815
And homomorphically encrypted data ++>
Figure BDA00022739032700000816
To the B-terminal. That is, a new set of encrypted values is obtained and sent to the secondary participant as a target set of values together with the new set of encrypted values. But when the number of iterations k is not more than 2L, the A-side only updates +.>
Figure BDA00022739032700000817
And the primary participant only sends the encrypted value set to the secondary participant. Wherein, before the longitudinal federal learning optimization is carried out, the method also needs toTo perform an initialization operation, i.e. initializing model parameters w on both sides of A, B A ,w B And an all zero vector of the same size +.>
Figure BDA0002273903270000091
And initializing a matrix H in the C-terminal (i.e. coordinator) for estimating the memory length M of H and updating the iteration step interval L of H, and the all zero vector +.>
Figure BDA0002273903270000092
Step S20, the encrypted value set and the new encrypted value set are used as target value sets to be sent to a secondary participant, so that an intermediate result value fed back by the secondary participant based on the target value sets is obtained;
the primary participant sends the encrypted value set and the new encrypted value set as target value sets to the secondary participant, that is, after the secondary participant (i.e. the B side) receives the target value set sent by the primary participant (the A side), the B side also calculates the value set u corresponding to the data ID in S B ,u B 2 . And calculating a loss function value and an encryption coefficient according to the target value set. Namely, the B side calculates the value of the encrypted loss function by utilizing the homomorphic encryption property,
Figure BDA0002273903270000093
simultaneously calculating the encryption value of each piece of corresponding data>
Figure BDA0002273903270000094
I.e. the encryption coefficients, and transmits them to the a-terminal. Then update +.>
Figure BDA0002273903270000095
And judging the relation between the current iteration number k and L again, if the current iteration number k is an integer multiple of L, and the iteration number k is greater than 2L: b-side update->
Figure BDA0002273903270000096
And calculating +_f between the current time (t) and the last time (t-1)>
Figure BDA0002273903270000097
The difference, i.e.)>
Figure BDA0002273903270000098
In addition, the B side calculates s H Upper->
Figure BDA0002273903270000099
Thereby calculating the intermediate result value +.>
Figure BDA00022739032700000910
And transmitted to party a. If the current iteration number k is an integer multiple of L, and the iteration number k is not more than 2L; the B terminal only updates +>
Figure BDA00022739032700000911
And, after the encryption coefficient corresponding to each piece of data is calculated by the B party (namely the secondary participant), the B party returns each encryption coefficient to the A party, and the AB two parties respectively utilize the homomorphic encryption property to each [ [ d ]]]The value (i.e. homomorphic coefficient) multiplied by the corresponding data x A ,x B Then, the obtained vector sets are summed to calculate an encrypted gradient value [ [ g ] A ]]=∑[[d]]x A ,[[g B ]]=∑[[d]]x B
Step S30, calculating primary encryption data in the primary participant according to the intermediate result value, and sending the primary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix according to the primary encryption data and secondary encryption data sent by the secondary participant in response to the non-convergence of a longitudinal logistic regression model, and calculating a target primary gradient value according to the updated second derivative matrix;
The two parties AB will respectively get [ [ g ] A ]],[[g B ]]To party C (i.e., coordinator), and party B will pass the encrypted loss value to party C, i.e.The coordinator has received the loss function value, the gradient value (primary gradient value and secondary gradient value). At this time, it is still necessary to continuously determine the relationship between the current iteration number k and L, and when the current iteration number k is an integer multiple of L and the iteration number k is greater than 2L, the two ends of A, B are respectively according to [ [ h ]]]Calculating primary and secondary encrypted data, i.e., [ [ v ] A ]]=∑[[h]]x A ,[[v B ]]=∑[[h]]x B And transmitted to party C, i.e., the coordinator. The C side decrypts the received data to obtain g A ,g B And loss, judging whether the longitudinal logistic regression model is converged according to loss (loss function value), if the longitudinal logistic regression model is converged, sending an iteration stop signal to both sides (namely a main participant and a secondary participant) of A, B, and stopping acquiring an encryption value set with a logistic regression score in the main participant by the main participant according to the iteration stop signal.
If the longitudinal logistic regression model is not converged, updating
Figure BDA0002273903270000101
And the relation between the current iteration number k and the iteration step number interval L is required to be judged, if the relation is not more than 2L, the product of the step length and the gradient which are set in advance is calculated
Figure BDA0002273903270000102
And the respective products are respectively sent to the corresponding A side and B side, then the A side updates the local model parameters of the A side according to the obtained products (namely the target main gradient values), and carries out the next data model training, and similarly, the B side also updates the local model parameters of the B side according to the obtained products, and carries out the next model training until a new loss function value is obtained, and the new loss function value is transmitted to the C side (coordinator) for judgment, namely, whether the longitudinal logistic regression model is converged or not is determined, if so, an iteration stop signal is sent to the A side and the B side, and the training of the longitudinal logistic regression model is stopped. If not, execute ++again >
Figure BDA0002273903270000103
All operate until longitudinalConverging towards a logistic regression model. And when k is greater than 2L, combining the two gradients into a long vector g, calculating the product of the step length, H and g, splitting the long vector g into corresponding A, B parts (namely a target main gradient value corresponding to the A side and a target auxiliary gradient value corresponding to the B side), and respectively transmitting the corresponding A, B parts to A and B, namely:
Figure BDA0002273903270000104
further, if at the same time k is not an integer multiple of L, ending step 4; if k is an integer multiple of L, C also receives encrypted data [ [ v ] A ]],[[v B ]]Decrypting and combining the obtained materials to obtain
Figure BDA0002273903270000105
And stored in a v-queue of length M. Meanwhile, the ++I between the current time (t) and the last time (t-1) is calculated>
Figure BDA0002273903270000106
The difference, i.e.)>
Figure BDA0002273903270000107
It is stored in an s-queue of length M. If the current memory has reached the maximum memory length M, the first queue is pruned and the latest obtained v and s are placed at the end of the queue. H is calculated using M (M is not greater than M) v and s in the current memory. Wherein the method of calculating H is initialized with the value at the end of the memory queue, i.e. calculating +.>
Figure BDA0002273903270000108
Wherein I is an identity matrix. Then from the beginning of the queue to the end of the queue (j=1, m) iterative calculation to get updated H:
ρ[j]=1/(v[j]T s [j]),H←(I-ρ[j]s[j]v[j] T )H(I-ρ[j]v[j]s[j] T )+ρ[j]s[j]s[j] T
and step S40, receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuing to execute the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged.
The main participant receives the target main gradient value fed back by the coordinator and updates the local model parameters in the main participant according to the target main gradient value, and the auxiliary participant also receives the target auxiliary gradient value corresponding to the auxiliary participant fed back by the coordinator so as to update the local model parameters in the auxiliary participant. And continuing model training, namely randomly acquiring new data again, calculating an encryption value set of the new data through a corresponding algorithm until the coordinator sends a longitudinal logistic regression model convergence, and sending an iteration stop signal to the main participant and the auxiliary participant.
In addition, to assist understanding of the flow of the vertical federal learning optimization in this embodiment, an example will be described below.
For example, as shown in fig. 5, there are A, B, C three parties for model training, where party a is the primary participant, party B is the secondary participant, and party C is the coordinator. The A-side locally calculates and transmits data to the B-side, i.e. encrypts
Figure BDA0002273903270000111
Transmitting to B side, B side performing local calculation according to the encryption data transmitted by A side to obtain encryption loss function value and encryption value, and making [ [ d ]]][[h]]Transmitting to A side, and AB side simultaneously calculating respective gradient values according to encryption values, and transmitting to C side, namely AB side will [ [ g ] A ]],[[g B ]][[v A ]],[[v B ]]Send to party C and party B will also [ [ loss ]]]Transmitted to party C, who receives [ [ v ] A ]],[[v B ]],[[loss]]Decrypting to obtain decrypted g A ,g B ,lossμ A ,μ B Judging whether the algorithm is converged according to loss, if not, updating H according to the received gradient value, and calculating and transmitting, namely calculating the product of the step length and the gradient selected in advance when k is not more than 2L>
Figure BDA0002273903270000112
And transmits them to a and B, respectively; when k is larger than 2L, combining two gradients into a long vector g, calculating the product of step length, H and g, splitting the product into corresponding A, B parts, and respectively transmitting the corresponding A, B parts to A and B, namely:
Figure BDA0002273903270000113
and both AB parties update local model parameters based on the unencrypted vector passed by party C, i.e
Figure BDA0002273903270000114
In this embodiment, a new encrypted value set of new data in a master participant is obtained by obtaining an encrypted value set of data in the master participant and based on a preset determination condition; sending the encrypted value set and the new encrypted value set to a secondary participant as a target value set to acquire an intermediate result value fed back by the secondary participant based on the target value set; calculating primary encryption data in the primary participant according to the intermediate result value, and sending the primary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix according to the primary encryption data and secondary encryption data sent by the secondary participant, calculating a target primary gradient value according to the updated second derivative matrix and sending the target primary gradient value to the primary participant in response to the non-convergence of a longitudinal logistic regression model; and receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged. The encryption value set and the new encryption value set in the main participant are sent to the auxiliary participant as target value sets according to preset judging conditions, so that the sending quantity of the sending target value set is improved, main encryption data are calculated according to the intermediate result value fed back by the auxiliary participant, then the main encryption data are sent to the coordinator, local model parameters in the main participant are updated according to the target main gradient value fed back by the coordinator, and the coordinator calculates the target main gradient value according to the second derivative matrix, so that the phenomenon that the convergence speed is low due to the fact that the first-order algorithm is adopted in the longitudinal federal learning in the prior art, and a large number of rounds of data interaction is needed is avoided, and the communication quantity for longitudinal federal learning is reduced.
Further, based on the first embodiment of the longitudinal federal learning optimization method of the present invention, a second embodiment of the longitudinal federal learning optimization method of the present invention is provided. This embodiment is a refinement of step S40 of the first embodiment of the present invention, where the step of receiving the target main gradient value fed back by the coordinator includes:
and a step a of receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is acquired by the coordinator according to a second derivative matrix updated in response to the longitudinal logistic regression model meeting the preset judging condition.
When the main participant receives the target main gradient value fed back by the coordinator, the local model parameter of the main participant can be updated according to the target main gradient value, wherein the target main gradient value is obtained by calculating according to the updated second derivative matrix when the coordinator determines that the longitudinal logistic regression model is not converged and the preset judgment condition is met, and whether the longitudinal logistic regression model meets the preset judgment condition is judged, for example, whether the new iteration number of the longitudinal logistic regression model meets the preset number condition (for example, whether the new iteration number is an integral multiple of the iteration step interval and is more than twice more than the preset number is determined). And executing different operations according to different judging results.
In this embodiment, the accuracy of the obtained target main gradient value is ensured by determining that the target main gradient value is obtained by the second derivative matrix updated by the longitudinal logistic regression model satisfying the preset determination condition.
Further, the step of receiving the target primary gradient value fed back by the coordinator includes:
and b, receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is obtained by the coordinator according to a second derivative matrix updated by target data, the target data is obtained by decrypting and combining the main encryption data and the auxiliary encryption data sent by the auxiliary participant in response to the unconverged longitudinal logistic regression model and meeting a preset judgment condition.
When the main participant receives a target main gradient value fed back by the coordinator, the local model parameter of the main participant can be updated according to the target main gradient value, wherein the target main gradient value is obtained by updating a second derivative matrix according to target data when the coordinator determines that a longitudinal logistic regression model is not converged and a preset judging condition is met and calculating according to the updated second derivative matrix, and the target data is obtained by decrypting and combining main encryption data sent by the main participant and auxiliary encryption data sent by the auxiliary participant when the longitudinal logistic regression model is not converged and the preset judging condition is met.
In this embodiment, the accuracy of the obtained target main gradient value is ensured by determining that the target main gradient value is obtained according to the target data and the updated second derivative matrix, and the target data is obtained by combining the main encryption data and the auxiliary encryption data.
Further, the step of receiving the target primary gradient value fed back by the coordinator includes:
and c, receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is obtained by splitting a first target product by the coordinator, and the first target product is a product among a second derivative matrix updated according to the condition that the longitudinal logistic regression model meets the preset judgment condition, a long vector obtained by combining the main gradient value sent by the main participant and the auxiliary gradient value sent by the auxiliary participant, and a preset step length.
When the main participant receives a target main gradient value fed back by the coordinator, local model parameters of the main participant can be updated according to the target main gradient value, wherein the target main gradient value is obtained by splitting a first target product by the coordinator, and the first target product is calculated according to the updated second derivative matrix, a long vector combined by the main gradient value sent by the main participant and the auxiliary gradient value sent by the auxiliary participant and a preset step length when the longitudinal logistic regression model is not converged and a preset judging condition is met.
In this embodiment, the target main gradient value is determined by splitting a first target product by the coordinator, where the first target product is a product of a long vector, a preset step length and an updated second derivative matrix, so that accuracy of the obtained target main gradient value is ensured.
Further, the step of receiving the target primary gradient value fed back by the coordinator includes:
and d, receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is a second target product, and the second target product is the product between the calculated main gradient value sent by the main participant and a preset step size, wherein the longitudinal logistic regression model of the coordinator is not converged and a preset judging condition is not met.
When the main participant receives the target main gradient value fed back by the coordinator, the local model parameter of the main participant can be updated according to the target main gradient value, wherein the target main gradient value is a second product, and the second product is calculated between the main gradient value sent by the main participant and a preset step length when the longitudinal logistic regression model is not converged and a preset judging condition is not met by the coordinator, so that the product of the main gradient value and the preset step length is obtained, and the product is the second product, namely the target main gradient value.
In this embodiment, when the target main gradient value is determined that the longitudinal logistic regression model is not converged and the preset determination condition is not satisfied, the product of the main gradient value and the preset step length is calculated, so that the accuracy of the obtained target main gradient value is ensured.
Further, on the basis of any one of the first to second embodiments, a third embodiment of the longitudinal federal learning optimization method of the present invention is provided. This embodiment is a step S10 of the first embodiment of the present invention, which is a step of acquiring a new encrypted value set of new data in the master participant based on a preset determination condition, including:
step e, detecting whether a longitudinal logistic regression model corresponding to the main participant meets a preset judging condition or not;
after the master participant obtains the encryption value set, it is further required to detect whether the longitudinal logistic regression model corresponding to the master participant meets a preset determination condition, for example, whether the new iteration number of the longitudinal logistic regression model meets a preset number condition (for example, whether the new iteration number is an integer multiple of the iteration step number interval and is greater than twice and greater than preset number) is determined. And executing different operations according to different judging results.
And f, if yes, acquiring a new encryption value set of new data in the master participant according to the preset logistic regression algorithm.
If yes, new data are randomly acquired, the logistic regression score of the new data in the main participant is calculated through a preset logistic regression algorithm, and the new data are encrypted to obtain a new encrypted value set. However, if not satisfied, the encrypted value set may be directly transmitted to the secondary participant as the target value set.
In this embodiment, whether the longitudinal logistic regression model meets the preset judgment condition is detected, and if so, a new encryption value set of new data in the main participant is obtained, so that the model training efficiency is ensured.
Further, the refinement of the step of obtaining the set of encrypted values of the data in the primary participant includes:
and g, acquiring a preset logistic regression algorithm in the main participant, calculating a logistic regression score of data in the main participant according to the preset logistic regression algorithm, and encrypting the logistic regression score to acquire an encrypted value set.
Model parameters of the model of the master participant, namely local model parameters, are obtained, and a small batch of training data to be subjected to model training is randomly selected so as to carry out model training. Re-acquisition of preset logistic regression algorithms in master participants, e.g.
Figure BDA0002273903270000151
I.e., the logistic regression score for each sample on the a side, where w represents the linear model parameters of logistic regression, x represents the data, and T represents the number. And calculating each training data according to a preset logistic regression algorithm and local model parameters to obtain logistic regression scores corresponding to each training data in the main participants, and encrypting all the logistic regression scores to obtain an encrypted value set.
In this embodiment, the accuracy of the obtained encrypted value set is ensured by calculating each training data according to a preset logistic regression formula and local model parameters to obtain the encrypted value set.
Further, referring to fig. 3, fig. 3 is a schematic flow chart of another embodiment of the longitudinal federal learning optimization method according to the present invention, including:
step S100, receiving main encryption data sent by a main participant and auxiliary encryption data sent by an auxiliary participant, wherein the main encryption data is calculated according to an intermediate result value fed back by the auxiliary participant based on a target value set sent by the main participant, and the target value set comprises an encryption value set corresponding to data and a new encryption value set corresponding to new data;
When the longitudinal logistic regression model is determined to not be converged according to the loss function value sent by the auxiliary participant in the coordinator and a preset judging condition is met, for example, whether the new iteration number of the longitudinal logistic regression model meets the preset number condition (for example, whether the new iteration number is an integral multiple of the iteration step interval and is larger than twice and is larger than the preset number or not is determined), when the preset number condition is met, the longitudinal logistic regression model is determined to meet the preset judging condition, after the primary encryption data sent by the primary participant and the auxiliary encryption data sent by the auxiliary participant are received, the second derivative matrix is updated according to the primary encryption data and the auxiliary encryption data. The primary encryption data is calculated by the secondary participant based on an intermediate result value fed back by a target value set sent by the primary participant, namely the primary participant sends an encryption value set to the secondary participant, the secondary participant calculates an intermediate result value and a loss function value according to the encryption value set, sends the loss function value to the coordinator, calculates secondary encryption data according to the intermediate result value, sends the secondary encryption data to the coordinator, feeds back the intermediate result value to the primary participant, calculates according to the intermediate result value to obtain primary encryption data, and sends the primary encryption data to the coordinator. The target value set may include an encrypted value set corresponding to data and a new encrypted value set corresponding to new data, that is, if the current iteration number corresponding to the master participant meets a preset condition (for example, if the current iteration number passes through a preset number), if not, the encrypted value set is taken as the target value set, and if yes, the encrypted value set and the new encrypted value set are taken as the target value set. And in this application the data encryption may be by homomorphic encryption.
Step S200, in response to the non-convergence of the longitudinal logistic regression model, updating a second derivative matrix according to the primary encryption data and the secondary encryption data, and calculating a target primary gradient value according to the updated second derivative matrix;
when the coordinator detects that the longitudinal logistic regression model is not converged, the second derivative matrix can be updated according to the primary encrypted data sent by the primary participant and the secondary encrypted data sent by the secondary participant, namely the primary encrypted data and the secondary encrypted data are decrypted and combined and stored in a queue with a preset length to obtain a target queue, and the second derivative matrix H is updated according to the target queue, wherein the method for calculating H is initialized by utilizing the value at the tail of the memory queue, namely the calculation is performed
Figure BDA0002273903270000161
Wherein I is an identity matrix. Then from the beginning of the queue to the end of the queue (j=1, m) iterative calculation to get updated H: ρ [ j ]]=1/(v[j] T s[j]),H←(I-ρ[j]s[j]v[j] T )H(I-ρ[j]v[j]s[j] T )+ρ[j]s[j]s[j] T
And in this embodiment, if the longitudinal logistic regression model does not converge, updating
Figure BDA0002273903270000162
And the relation between the current iteration number k and the iteration step number interval L is required to be judged, if the relation is not more than 2L, the product of the step length and the gradient which are set in advance is calculated>
Figure BDA0002273903270000163
And the respective products are respectively sent to the corresponding A side and B side, then the A side updates the local model parameters of the A side according to the obtained products (namely the target main gradient values), and carries out the next data model training, and similarly, the B side also updates the local model parameters of the B side according to the obtained products, and carries out the next model training until a new loss function value is obtained, and the new loss function value is transmitted to the C side (coordinator) for judgment, namely, whether the longitudinal logistic regression model is converged or not is determined, if so, an iteration stop signal is sent to the A side and the B side, and the training of the longitudinal logistic regression model is stopped. If not, execute ++again >
Figure BDA0002273903270000171
Until the longitudinal logistic regression model converges. And when k is greater than 2L, combining the two gradients into a long vector g, calculating the product of the step length, H and g, splitting the long vector g into corresponding A, B parts (namely a target main gradient value corresponding to the A side and a target auxiliary gradient value corresponding to the B side), and respectively transmitting the corresponding A, B parts to A and B, namely:
Figure BDA0002273903270000172
and step S300, the target main gradient value is sent to the main participant, the main participant is used for updating local model parameters in the main participant based on the target main gradient value, and the step of acquiring the encrypted value set of the data in the main participant is continuously executed until the longitudinal logistic regression model corresponding to the coordinator is converged.
After the coordinator calculates the target main gradient value, the target main gradient value is sent to the main participant, the main participant updates the local model parameters in the main participant according to the target main gradient value, and the encrypted value set of the acquired data in the main participant is continuously executed until the longitudinal logistic regression model corresponding to the coordinator converges, and an iteration stop signal is sent to the main participant and the auxiliary participant. The same secondary participant also receives the target secondary gradient value corresponding to the secondary participant fed back by the coordinator to update the local model parameters in the secondary participant.
In the embodiment, the coordinator updates the second derivative matrix according to the primary encryption data and the secondary encryption data, calculates the target main gradient value according to the updated second derivative matrix, and sends the target main gradient value to the main participant to update the local model parameters in the main participant, so that the phenomenon that the convergence speed is low due to the adoption of a first-order algorithm in the longitudinal federation learning in the prior art and a large number of rounds of data interaction is required is avoided, and the traffic for the longitudinal federation learning is reduced.
Further, the step of updating the second derivative matrix based on the primary encrypted data and the secondary encrypted data includes:
step x, judging whether the longitudinal logistic regression model meets the preset judging condition or not;
after the coordinator receives the primary gradient value sent by the primary participant and the secondary gradient value and the loss value sent by the secondary coordinator and determines that the longitudinal logistic regression model does not converge, it is required to determine whether the longitudinal logistic regression model meets a preset determination condition, for example, whether the new iteration number of the longitudinal logistic regression model meets a preset number of times condition (for example, whether the new iteration number is an integer multiple of the iteration step number interval and is greater than twice and greater than preset number of times is determined). And executing different operations according to different judging results.
And step y, if yes, updating a second derivative matrix according to the primary encryption data and the secondary encryption data.
When the longitudinal logistic regression model is judged to meet the preset judging condition, the second derivative matrix in the coordinator needs to be updated according to the primary encryption data sent by the primary participant and the secondary encryption data sent by the secondary participant, which are received by the coordinator.
In the embodiment, when the longitudinal logistic regression model is not converged, whether the longitudinal logistic regression model meets the preset judging condition is judged, and when the longitudinal logistic regression model meets the preset judging condition, the second derivative matrix is updated, so that the model training efficiency of the longitudinal logistic regression model is ensured.
Further, the step of updating the second derivative matrix based on the primary encrypted data and the secondary encrypted data includes:
step z, the coordinator decrypts and merges the primary encrypted data and the secondary encrypted data to obtain target data;
after receiving the primary encrypted data sent by the primary participant and the secondary encrypted data sent by the secondary participant, the coordinator decrypts and combines the primary encrypted data and the secondary encrypted data to obtain target data, namely the encrypted data [ [ v ] A ]],[[v B ]]Decrypting and combining to obtain target data
Figure BDA0002273903270000181
And m, storing the target data into a queue with a preset length to acquire a target queue, and updating a second derivative matrix through the target queue.
The coordinator stores the target data in a v-queue of length M (i.e., a preset length). At the same time, calculate the current time (t) and the last time (t-1)
Figure BDA0002273903270000182
The difference, i.e.)>
Figure BDA0002273903270000183
It is stored in an s-queue of length M. If the current memory has reached the maximum memory length M, then the queue is setThe first prune and places the latest obtained v and s at the end of the queue. H (second derivative matrix) is calculated using M (M is not greater than M) v and s in the current memory. The calculation method comprises the following steps:
initialization by means of the value at the end of a memory queue, i.e. computation
Figure BDA0002273903270000184
Wherein I is an identity matrix. Then from the beginning of the queue to the end of the queue (j=1, m) iterative calculation to get updated H:
ρ[j]=1/(v[j] T s[j]),H←(I-ρ[j]s[j]v[j] T )H(I-ρ[j]v[j]s[j] T )+ρ[j]s[j]s[j] T
in this embodiment, the target data is obtained by decrypting and combining the primary encrypted data and the secondary encrypted data, and then the second derivative matrix is updated according to the target data, so that the effectiveness of updating the second derivative matrix is ensured.
Further, after the step of determining whether the longitudinal logistic regression model satisfies the preset determination condition, the method includes:
and step n, if the primary gradient value is not satisfied, the coordinator acquires a first product between the primary gradient value sent by the primary participant and a preset step length, and sends the first product to the primary participant as a target primary gradient value.
When the longitudinal logistic regression model is judged to not meet the preset judging condition, the coordinator calculates a first product of a preset step length and a main gradient value selected in advance and a third product of a secondary gradient value corresponding to the secondary participant in the preset step length, the first product is used as a target main gradient value to be sent to the primary participant to update local model parameters in the primary participant, the third product is sent to the secondary participant to update model parameters in the secondary participant, model training is conducted again according to the updated model parameters to obtain new loss function values, and the new loss function values are sent to the coordinator through the secondary participant.
In this embodiment, when it is determined that the longitudinal logistic regression model does not meet the preset determination condition, a first product between the main gradient value and the preset step length is calculated, and the first product is used as the target main gradient value, so that accuracy of the obtained target main gradient value is ensured.
The embodiment of the invention also provides a longitudinal federal learning optimization device, referring to fig. 4, the longitudinal federal learning optimization device comprises:
the acquisition module is used for acquiring an encrypted value set of data in a main participant and acquiring a new encrypted value set of new data in the main participant based on a preset judgment condition;
The sending module is used for sending the encrypted value set and the new encrypted value set to a secondary participant as a target value set so as to obtain an intermediate result value fed back by the secondary participant based on the target value set;
the first calculation module is used for calculating main encryption data in the main participant according to the intermediate result value and sending the main encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix according to the main encryption data and auxiliary encryption data sent by the auxiliary participant when a longitudinal logistic regression model is not converged and calculating a target main gradient value according to the updated second derivative matrix;
and the first updating module is used for receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged.
Optionally, the first updating module is further configured to:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is acquired by the coordinator according to a second derivative matrix updated in response to the longitudinal logistic regression model meeting the preset judging condition.
Optionally, the first updating module is further configured to:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is obtained by the coordinator according to a second derivative matrix updated by target data, the target data is obtained by decrypting and combining the main encryption data and the auxiliary encryption data sent by the auxiliary participant in response to the condition that a longitudinal logistic regression model is not converged and a preset judgment condition is met.
Optionally, the first updating module is further configured to:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is obtained by splitting a first target product by the coordinator, and the first target product is a product among a second derivative matrix updated according to the condition that the longitudinal logistic regression model meets the preset judgment condition, a long vector obtained by combining the main gradient value sent by the main participant and the auxiliary gradient value sent by the auxiliary participant, and a preset step length.
Optionally, the first updating module is further configured to:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is a second target product, and the second target product is the product between the calculated main gradient value sent by the main participant and a preset step length, wherein the longitudinal logistic regression model of the coordinator is not converged and a preset judging condition is not met.
Optionally, the acquiring module is further configured to:
detecting whether a longitudinal logistic regression model corresponding to the main participant meets a preset judging condition or not;
and if so, acquiring a new encryption value set of new data in the master participant according to the preset logistic regression algorithm.
Optionally, the acquiring module is further configured to:
and acquiring a preset logistic regression algorithm in the master participant, calculating a logistic regression score of data in the master participant according to the preset logistic regression algorithm, and encrypting the logistic regression score to acquire an encrypted value set.
The embodiment of the invention also provides a longitudinal federal learning optimization device, which comprises:
the receiving module is used for receiving main encrypted data sent by a main participant and auxiliary encrypted data sent by an auxiliary participant, wherein the main encrypted data is calculated according to an intermediate result value fed back by the auxiliary participant based on a target value set sent by the main participant, and the target value set comprises an encrypted value set corresponding to data and a new encrypted value set corresponding to new data;
the second calculation module is used for responding to the unconvergence of the longitudinal logistic regression model, updating a second derivative matrix according to the primary encryption data and the secondary encryption data, and calculating a target primary gradient value according to the updated second derivative matrix;
And the second updating module is used for respectively sending the target main gradient values to the main participants, wherein the main participants are used for updating local model parameters in the main participants based on the target main gradient values, and continuing to execute the step of acquiring the encrypted value set of the data in the main participants until the longitudinal logistic regression model corresponding to the coordinator is converged.
Optionally, the second computing module is further configured to:
judging whether the longitudinal logistic regression model meets the preset judging condition or not;
if so, updating a second derivative matrix according to the primary encryption data and the secondary encryption data.
Optionally, the second computing module is further configured to:
the coordinator decrypts and combines the primary encrypted data and the secondary encrypted data to obtain target data;
and storing the target data into a queue with a preset length to acquire a target queue, and updating a second derivative matrix through the target queue.
Optionally, the second computing module is further configured to:
if the primary gradient value is not met, the coordinator obtains a first product between the primary gradient value sent by the primary participant and a preset step length, and sends the first product to the primary participant as a target primary gradient value.
The method executed by each program module may refer to each embodiment of the longitudinal federal learning optimization method according to the present invention, and will not be described herein.
The embodiment of the invention also provides a storage medium.
The storage medium of the invention stores a longitudinal federal learning optimization program which, when executed by a processor, implements the steps of the longitudinal federal learning optimization method described above.
The method implemented when the longitudinal federation learning optimization program running on the processor is executed may refer to various embodiments of the longitudinal federation learning optimization method of the present invention, which are not described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (13)

1. The longitudinal federal learning optimization method is characterized by being applied to longitudinal federal learning optimization equipment, wherein the longitudinal federal learning optimization equipment is server equipment, and comprises the following steps of:
acquiring an encrypted value set of data in a main participant, and acquiring a new encrypted value set of new data in the main participant based on a preset judging condition, wherein the data comprises a data ID;
sending the encrypted value set and the new encrypted value set to a secondary participant as a target value set to acquire an intermediate result value fed back by the secondary participant based on the target value set;
calculating primary encryption data in the primary participant according to the intermediate result value, and transmitting the primary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix according to the primary encryption data and secondary encryption data transmitted by the secondary participant and calculating a target primary gradient value according to the updated second derivative matrix in response to the non-convergence of a longitudinal logistic regression model, and if the coordinator receives encryption data [ [ v ] A ]],[[v B ]]And decrypting and combining to obtain
Figure FDA0004176338000000011
And stored in a v-queue of length M, calculating +.>
Figure FDA0004176338000000012
And storing in an s queue with length M, if the storage queue in the memory reaches the maximum storage length, deleting the first v queue and s queue in the storage queue, putting the latest v queue and s queue at the end of the queue, calculating updated H by using the v queue and s queue in the memory, wherein H is a second derivative matrix, and the primary encryption data and the secondary encryption data are [ [ v ] respectively A ]],[[v B ]];
Receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring an encryption value set of data in the main participant until a longitudinal logistic regression model corresponding to the coordinator is converged; the target main gradient value is obtained by the coordinator according to a second derivative matrix updated by target data, wherein the target data is obtained by decrypting and combining the main encryption data and the auxiliary encryption data sent by the auxiliary participant in response to the unconverged longitudinal logistic regression model and meeting a preset judgment condition; and the coordinator is used for sending an iteration stop signal to the master participant when the longitudinal logistic regression model is determined to be converged, and the master participant stops acquiring the encryption value set in the master participant according to the iteration stop signal.
2. The longitudinal federal learning optimization method according to claim 1, wherein the step of receiving the coordinator-fed-back target primary gradient value comprises:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is acquired by the coordinator according to a second derivative matrix updated in response to the longitudinal logistic regression model meeting the preset judging condition.
3. The longitudinal federal learning optimization method according to claim 2, wherein the step of receiving the coordinator-fed-back target primary gradient value comprises:
and receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is obtained by splitting a first target product by the coordinator, and the first target product is a product among a second derivative matrix updated according to the condition that the longitudinal logistic regression model meets the preset judgment condition, a long vector obtained by combining the main gradient value sent by the main participant and the auxiliary gradient value sent by the auxiliary participant, and a preset step length.
4. The longitudinal federal learning optimization method according to claim 1, wherein the step of receiving the coordinator-fed-back target primary gradient value comprises:
And receiving a target main gradient value fed back by the coordinator, wherein the target main gradient value is a second target product, and the second target product is the product between the calculated main gradient value sent by the main participant and a preset step length, wherein the longitudinal logistic regression model of the coordinator is not converged and a preset judging condition is not met.
5. The longitudinal federal learning optimization method according to claim 1, wherein the step of acquiring a new set of encrypted values of new data in the master participant based on a preset determination condition comprises:
detecting whether a longitudinal logistic regression model corresponding to the main participant meets a preset judging condition or not;
and if so, acquiring a new encryption value set of the new data in the master participant according to a preset logistic regression algorithm.
6. The longitudinal federal learning optimization method according to claim 1, wherein the step of acquiring the encrypted value set of data in the master participant comprises:
and acquiring a preset logistic regression algorithm in the master participant, calculating a logistic regression score of data in the master participant according to the preset logistic regression algorithm, and encrypting the logistic regression score to acquire an encrypted value set.
7. The longitudinal federal learning optimization method is characterized by being applied to longitudinal federal learning optimization equipment, wherein the longitudinal federal learning optimization equipment is server equipment, and comprises the following steps of:
receiving primary encrypted data sent by a primary participant and secondary encrypted data sent by a secondary participant, wherein the primary encrypted data is calculated according to an intermediate result value fed back by the secondary participant based on a target value set sent by the primary participant, the target value set comprises an encrypted value set corresponding to data and a new encrypted value set corresponding to new data, and the data comprises a data ID;
in response to the longitudinal logistic regression model not converging, updating a second derivative matrix from the primary and secondary encrypted data and calculating a target primary gradient value from the updated second derivative matrix, wherein if the coordinator receives the encrypted data [ [ v ] A ]],[[v B ]]And decrypting and combining to obtain
Figure FDA0004176338000000031
And stored in a v queue of length M, calculated
Figure FDA0004176338000000032
And storing in an s queue with length M, if the storage queue in the memory reaches the maximum storage length, deleting the first v queue and s queue in the storage queue, putting the latest v queue and s queue at the end of the queue, calculating updated H by using the v queue and s queue in the memory, wherein H is a second derivative matrix, and the primary encryption data and the secondary encryption data are [ [ v ] respectively A ]],[[v B ]]The method comprises the steps of carrying out a first treatment on the surface of the Wherein the step of updating a second derivative matrix from the primary encrypted data and the secondary encrypted data comprises: the coordinator decrypts and combines the primary encrypted data and the secondary encrypted data to obtain target data; storing the target data into a queue with a preset length to obtain a target queue, and performing second queue alignment through the target queueUpdating the order derivative matrix;
and sending the target main gradient value to the main participant, wherein the main participant is used for updating local model parameters in the main participant based on the target main gradient value, and continuing to execute the step of acquiring the encrypted value set of the data in the main participant until the longitudinal logistic regression model corresponding to the coordinator is converged, and sending an iteration stop signal to the main participant when the longitudinal logistic regression model corresponding to the coordinator is converged.
8. The longitudinal federal learning optimization method according to claim 7, wherein the step of updating a second derivative matrix from the primary encryption data and the secondary encryption data comprises:
judging whether the longitudinal logistic regression model meets a preset judging condition or not;
If so, updating a second derivative matrix according to the primary encryption data and the secondary encryption data.
9. The method for optimizing longitudinal federal learning of claim 7, wherein after the step of determining whether the longitudinal logistic regression model satisfies a preset determination condition, comprising:
if the primary gradient value is not met, the coordinator obtains a first product between the primary gradient value sent by the primary participant and a preset step length, and sends the first product to the primary participant as a target primary gradient value.
10. The utility model provides a vertical federal study optimizing apparatus, its characterized in that, vertical federal study optimizing apparatus locates server device, vertical federal study optimizing apparatus includes:
the acquisition module is used for acquiring an encrypted value set of data in a main participant and acquiring a new encrypted value set of new data in the main participant based on a preset judgment condition, wherein the data comprises a data ID;
the sending module is used for sending the encrypted value set and the new encrypted value set to a secondary participant as a target value set so as to obtain an intermediate result value fed back by the secondary participant based on the target value set;
A first calculation module for calculating the primary encrypted data in the primary participant according to the intermediate result value and transmitting the primary encrypted data to the coordinator, wherein if the coordinator receives the encrypted data [ [ v ] A ]],[[v B ]]And decrypting and combining to obtain
Figure FDA0004176338000000041
And stored in a v-queue of length M, calculating +.>
Figure FDA0004176338000000042
And storing in an s queue with length M, wherein the coordinator is used for updating a second derivative matrix according to the primary encryption data and the secondary encryption data sent by the secondary participant in response to determining that the longitudinal logistic regression model is not converged, and calculating a target primary gradient value according to the updated second derivative matrix, wherein if a storage queue in a memory reaches a maximum storage length, deleting a first v queue and an s queue in the storage queue, placing the latest obtained v queue and s queue at the end of the queue, calculating updated H by utilizing the v queue and s queue in the memory, wherein the H is the second derivative matrix, and the primary encryption data and the secondary encryption data are respectively [ [ v ] A ]],[[v B ]];
The first updating module is used for receiving a target main gradient value fed back by the coordinator, updating local model parameters in the main participant based on the target main gradient value, and continuously executing the step of acquiring an encryption value set of data in the main participant until a longitudinal logistic regression model corresponding to the coordinator is converged; the target main gradient value is obtained by the coordinator according to a second derivative matrix updated by target data, wherein the target data is obtained by decrypting and combining the main encryption data and the auxiliary encryption data sent by the auxiliary participant in response to the unconverged longitudinal logistic regression model and meeting a preset judgment condition; and the coordinator is used for sending an iteration stop signal to the master participant when the longitudinal logistic regression model is determined to be converged, and the master participant stops acquiring the encryption value set in the master participant according to the iteration stop signal.
11. The utility model provides a vertical federal study optimizing apparatus, its characterized in that, vertical federal study optimizing apparatus locates server device, vertical federal study optimizing apparatus still includes:
the receiving module is used for receiving main encrypted data sent by a main participant and auxiliary encrypted data sent by an auxiliary participant, wherein the main encrypted data is calculated according to an intermediate result value fed back by the auxiliary participant based on a target value set sent by the main participant, the target value set comprises an encrypted value set corresponding to data and a new encrypted value set corresponding to new data, and the data comprises a data ID;
a second calculation module for updating a second derivative matrix according to the primary encryption data and the secondary encryption data in response to the longitudinal logistic regression model not converging, and calculating a target primary gradient value according to the updated second derivative matrix, wherein if the coordinator receives the encryption data [ [ v ] A ]],[[v B ]]And decrypting and combining to obtain
Figure FDA0004176338000000051
And stored in a v-queue of length M, calculating +.>
Figure FDA0004176338000000052
And storing in an s queue with length M, if the storage queue in the memory reaches the maximum storage length, deleting the first v queue and s queue in the storage queue, putting the latest v queue and s queue at the end of the queue, calculating updated H by using the v queue and s queue in the memory, wherein H is a second derivative matrix, and the primary encryption data and the secondary encryption data are [ [ v ] respectively A ]],[[v B ]]The method comprises the steps of carrying out a first treatment on the surface of the Wherein, according to the primary encryptionDetermining a v queue of data and the secondary encrypted data; wherein the step of updating a second derivative matrix from the primary encrypted data and the secondary encrypted data comprises: the coordinator decrypts and combines the primary encrypted data and the secondary encrypted data to obtain target data; storing the target data into a queue with a preset length to obtain a target queue, and updating a second derivative matrix through the target queue;
and the second updating module is used for respectively sending the target main gradient values to the main participants, wherein the main participants are used for updating local model parameters in the main participants based on the target main gradient values, and continuing to execute the step of acquiring the encrypted value set of the data in the main participants until the longitudinal logistic regression model corresponding to the coordinator converges, and sending an iteration stop signal to the main participants when the longitudinal logistic regression model corresponding to the coordinator converges.
12. A longitudinal federal learning optimization apparatus, the longitudinal federal learning optimization apparatus comprising: memory, a processor and a longitudinal federal learning optimization program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the longitudinal federal learning optimization method according to any one of claims 1 to 9.
13. A storage medium having stored thereon a longitudinal federal learning optimization program which, when executed by a processor, implements the steps of the longitudinal federal learning optimization method according to any one of claims 1 to 9.
CN201911124536.3A 2019-11-14 2019-11-14 Longitudinal federal learning optimization method, device, equipment and storage medium Active CN110851785B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911124536.3A CN110851785B (en) 2019-11-14 2019-11-14 Longitudinal federal learning optimization method, device, equipment and storage medium
PCT/CN2019/119409 WO2021092977A1 (en) 2019-11-14 2019-11-19 Vertical federated learning optimization method, appartus, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911124536.3A CN110851785B (en) 2019-11-14 2019-11-14 Longitudinal federal learning optimization method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110851785A CN110851785A (en) 2020-02-28
CN110851785B true CN110851785B (en) 2023-06-06

Family

ID=69600633

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911124536.3A Active CN110851785B (en) 2019-11-14 2019-11-14 Longitudinal federal learning optimization method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN110851785B (en)
WO (1) WO2021092977A1 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111160573B (en) * 2020-04-01 2020-06-30 支付宝(杭州)信息技术有限公司 Method and device for protecting business prediction model of data privacy joint training by two parties
CN112668038A (en) * 2020-06-02 2021-04-16 华控清交信息科技(北京)有限公司 Model training method and device and electronic equipment
CN111783139A (en) * 2020-06-29 2020-10-16 京东数字科技控股有限公司 Federal learning classification tree construction method, model construction method and terminal equipment
CN112001500B (en) * 2020-08-13 2021-08-03 星环信息科技(上海)股份有限公司 Model training method, device and storage medium based on longitudinal federated learning system
WO2022094888A1 (en) * 2020-11-05 2022-05-12 浙江大学 Decision tree-oriented longitudinal federation learning method
CN112651170B (en) * 2020-12-14 2024-02-27 德清阿尔法创新研究院 Efficient characteristic contribution assessment method in longitudinal federal learning scene
CN112733967B (en) * 2021-03-30 2021-06-29 腾讯科技(深圳)有限公司 Model training method, device, equipment and storage medium for federal learning
CN113536667B (en) * 2021-06-22 2024-03-01 同盾科技有限公司 Federal model training method, federal model training device, readable storage medium and federal model training device
CN113487042B (en) * 2021-06-28 2023-10-10 海光信息技术股份有限公司 Federal learning method, device and federal learning system
CN114003939B (en) * 2021-11-16 2024-03-15 蓝象智联(杭州)科技有限公司 Multiple collinearity analysis method for longitudinal federal scene
CN114338144A (en) * 2021-12-27 2022-04-12 杭州趣链科技有限公司 Method for preventing data from being leaked, electronic equipment and computer-readable storage medium
CN116567652B (en) * 2023-05-19 2024-02-23 上海科技大学 Omnidirectional super-surface-assisted air calculation energized vertical federal learning method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109299728A (en) * 2018-08-10 2019-02-01 深圳前海微众银行股份有限公司 Federal learning method, system and readable storage medium storing program for executing
CN110263936A (en) * 2019-06-14 2019-09-20 深圳前海微众银行股份有限公司 Laterally federation's learning method, device, equipment and computer storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10635409B2 (en) * 2018-01-15 2020-04-28 Cognizant Technology Solutions India Pvt. Ltd. System and method for improving software code quality using artificial intelligence techniques
CN109165515A (en) * 2018-08-10 2019-01-08 深圳前海微众银行股份有限公司 Model parameter acquisition methods, system and readable storage medium storing program for executing based on federation's study
CN109711529B (en) * 2018-11-13 2022-11-08 中山大学 Cross-domain federated learning model and method based on value iterative network
CN110414688A (en) * 2019-07-29 2019-11-05 卓尔智联(武汉)研究院有限公司 Information analysis method, device, server and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109299728A (en) * 2018-08-10 2019-02-01 深圳前海微众银行股份有限公司 Federal learning method, system and readable storage medium storing program for executing
CN110263936A (en) * 2019-06-14 2019-09-20 深圳前海微众银行股份有限公司 Laterally federation's learning method, device, equipment and computer storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Federated Learning with Non-IID Data;Yue Zhao et al.,;《arXiv:1806.00582v1》;第1-13页 *

Also Published As

Publication number Publication date
CN110851785A (en) 2020-02-28
WO2021092977A1 (en) 2021-05-20

Similar Documents

Publication Publication Date Title
CN110851785B (en) Longitudinal federal learning optimization method, device, equipment and storage medium
CN110851786B (en) Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning
CN110572253B (en) Method and system for enhancing privacy of federated learning training data
CN112822005B (en) Secure transfer learning system based on homomorphic encryption
WO2015155896A1 (en) Support vector machine learning system and support vector machine learning method
CN111523673B (en) Model training method, device and system
CN110753926A (en) Homomorphic data analysis
CN113239404A (en) Federal learning method based on differential privacy and chaotic encryption
CN112800478B (en) Method, device and system for determining shared data for protecting private data
JP2014504741A (en) Method and server for evaluating the probability of observation sequence stored at client for Hidden Markov Model (HMM) stored at server
CN113221105B (en) Robustness federated learning algorithm based on partial parameter aggregation
CN114696990B (en) Multi-party computing method, system and related equipment based on fully homomorphic encryption
CN111368336B (en) Secret sharing-based training method and device, electronic equipment and storage medium
CN111340247A (en) Longitudinal federated learning system optimization method, device and readable storage medium
CN113065660B (en) Quantum state measurement method, device, equipment, storage medium and system
CN111523556A (en) Model training method, device and system
CN112865953A (en) Safe multi-party computing method, device and system based on auxiliary server
CN114492850A (en) Model training method, device, medium, and program product based on federal learning
CN114330673A (en) Method and device for performing multi-party joint training on business prediction model
CN111523674A (en) Model training method, device and system
CN112560107B (en) Method and device for processing private data
CN111737756B (en) XGB model prediction method, device and system performed through two data owners
US20210194671A1 (en) Apparatus and method for set intersection operation
Zheng et al. SecDR: Enabling secure, efficient, and accurate data recovery for mobile crowdsensing
JP5579327B2 (en) Privacy protection probabilistic inference based on hidden Markov model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant