CN110851786B - Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning - Google Patents

Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning Download PDF

Info

Publication number
CN110851786B
CN110851786B CN201911124702.XA CN201911124702A CN110851786B CN 110851786 B CN110851786 B CN 110851786B CN 201911124702 A CN201911124702 A CN 201911124702A CN 110851786 B CN110851786 B CN 110851786B
Authority
CN
China
Prior art keywords
participant
value
data
auxiliary
encryption
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
CN201911124702.XA
Other languages
Chinese (zh)
Other versions
CN110851786A (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 CN201911124702.XA priority Critical patent/CN110851786B/en
Priority to PCT/CN2019/119418 priority patent/WO2021092980A1/en
Publication of CN110851786A publication Critical patent/CN110851786A/en
Application granted granted Critical
Publication of CN110851786B publication Critical patent/CN110851786B/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)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Operations Research (AREA)
  • Probability & Statistics with Applications (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: the secondary participant obtains an encrypted value set with a linear regression value sent by the primary participant, and calculates secondary encrypted data according to the encrypted value set; the method comprises the steps of sending secondary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of a longitudinal federal model; and receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, updating local model parameters in the auxiliary participants based on the target auxiliary gradient value, and continuously executing the step that the auxiliary participants acquire the encryption value set with the linear regression value sent by the main participants until the longitudinal federal model corresponding to the coordinator is converged. The invention reduces the learning time in longitudinal federal learning.

Description

Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning
Technical Field
The invention relates to the technical field of financial science (Fintech), in particular to a method, a device, equipment and a storage medium for data interaction among enterprises based on longitudinal federal learning.
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 linear regression method in federal learning, the existing longitudinal linear regression scheme is a random gradient descent method based on one-step information. Taking longitudinal federal linear regression in which two parties participate as an example, for example, setting party A and party B, wherein party A is host party, only has partial characteristics of data, party B is guest party, and has partial data characteristics completely different from party A and also has a data tag. The method comprises the steps that a B party needs to request an inner product of current model parameters and data from an A party for calculating loss function values and gradients, the A party transmits calculation data encrypted by the A party to the B party in the process, the B party calculates an encrypted coefficient, gradient components corresponding to the encryption coefficients can be calculated by the B party through the AB party, the gradient components are transmitted to a third party C for decryption and processing, the gradient components are transmitted back to the A party and the B party as descending directions, model parameters held by the AB party are updated, and the steps are iterated so that a trained model can be obtained by the A party and the B party. The existing scheme carries out iterative optimization based on one-step degree information of the target loss function, the convergence speed is low, so that data interaction with a large number of rounds is needed between ABCs, and a large amount of time is occupied for communication in inter-enterprise cooperation.
Disclosure of Invention
The invention mainly aims to provide a method, a device, equipment and a storage medium for data interaction among enterprises based on longitudinal federal learning, and aims to solve the technical problem of long time consumption in the conventional longitudinal federal learning.
In order to achieve the above object, the present invention provides a method for data interaction between enterprises based on longitudinal federal learning, the method comprising the steps of:
the secondary participant obtains an encrypted value set with a linear regression value sent by the primary participant, and calculates secondary encrypted data according to the encrypted value set;
transmitting the loss function value and the secondary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model;
and receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, updating local model parameters in the auxiliary participants based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participants acquire the encryption value set with the linear regression value sent by the main participants until the longitudinal federal model corresponding to the coordinator converges.
Optionally, the step of the secondary participant obtaining the encrypted value set with the linear regression value sent by the primary participant includes:
detecting whether the longitudinal federal model meets a preset judging condition or not;
if yes, the auxiliary participant obtains the main encryption value and the new encryption value sent by the main participant, and takes the main encryption value and the new encryption value as an encryption value set with a linear regression value sent by the main participant.
Optionally, the step of calculating secondary encrypted data according to the encrypted value set includes:
determining whether the current iteration number corresponding to the secondary participant meets a preset number of times condition,
if yes, calculating an intermediate result value according to the encryption value set, and calculating auxiliary encryption data through the intermediate result value.
Optionally, the step of calculating an intermediate result value according to the encrypted value set and calculating secondary encrypted data from the intermediate result value includes:
acquiring a current average value of local model parameters in the auxiliary participants based on the encryption value set, and acquiring a historical average value of a preset step number interval before the current average value;
and calculating a difference value between the current average value and the historical average value, calculating an intermediate result value according to the difference value, and calculating auxiliary encryption data through the intermediate result value.
Optionally, the step of receiving the target secondary gradient value sent by the coordinator based on the secondary encrypted data includes:
and receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, wherein the target auxiliary gradient value is obtained by the coordinator according to a second derivative matrix updated by the 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.
Optionally, the step of receiving the target secondary gradient value fed back by the coordinator includes:
and receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary 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 a main gradient value sent by the main participant and an auxiliary gradient value sent by the auxiliary participant, and a preset step length.
Optionally, the step of receiving the target secondary gradient value fed back by the coordinator includes:
And receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary 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.
In addition, the invention also provides an inter-enterprise data interaction method based on longitudinal federal learning, which comprises the following steps:
receiving primary encrypted data sent by a primary participant and secondary encrypted data sent by a secondary participant, wherein the secondary encrypted data is calculated according to an intermediate result value in the secondary participant, the intermediate result value is calculated by the secondary participant according to a primary participant sending encrypted value set, and the encrypted value set comprises a primary encrypted value and a new encrypted value;
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 secondary gradient value according to the updated second derivative matrix;
and sending the target auxiliary gradient value to the auxiliary participant, wherein the auxiliary participant is used for updating local model parameters in the auxiliary participant based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participant obtains the encrypted value set with the linear regression value sent by the main participant until the longitudinal federal 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 yes, decrypting and combining the main encryption data and the auxiliary encryption 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 acquires a first product between the primary gradient value sent by the secondary participant and a preset step length, and sends the first product to the secondary participant as a target secondary gradient value.
In addition, in order to achieve the above object, the present invention further provides an inter-enterprise data interaction device based on longitudinal federal learning, the inter-enterprise data interaction device comprising:
the acquisition module is used for the secondary participant to acquire an encrypted value set with a linear regression value sent by the primary participant and calculate secondary encrypted data according to the encrypted value set;
The sending module is used for sending the secondary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model;
the first receiving module is configured to receive a target secondary gradient value sent by the coordinator based on the secondary encrypted data, update a local model parameter in the secondary participant based on the target secondary gradient value, and continue to execute a step that the secondary participant obtains an encrypted value set with a linear regression value sent by the primary participant until a longitudinal federal model corresponding to the coordinator converges.
Optionally, the inter-enterprise data interaction device further includes:
the second receiving module is used for receiving primary encrypted data sent by a primary participant and secondary encrypted data sent by a secondary participant, wherein the secondary encrypted data is calculated according to an intermediate result value in the secondary participant, the intermediate result value is calculated by the secondary participant according to a primary participant sending encrypted value set, and the encrypted value set comprises a primary encrypted value and a new encrypted value;
The updating 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 secondary gradient value according to the updated second derivative matrix;
and the convergence module is used for sending the target auxiliary gradient value to the auxiliary participant, wherein the auxiliary participant is used for updating local model parameters in the auxiliary participant based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participant obtains the encrypted value set with the linear regression value sent by the main participant until the longitudinal federal model corresponding to the coordinator is converged.
In addition, in order to achieve the above object, the present invention further provides an inter-enterprise data interaction device based on longitudinal federal learning, the inter-enterprise data interaction device comprising: the system comprises a memory, a processor and an inter-enterprise data interaction program stored on the memory and capable of running on the processor, wherein the inter-enterprise data interaction program realizes the steps of the inter-enterprise data interaction 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 an inter-enterprise data interaction program which, when executed by a processor, implements the steps of the inter-enterprise data interaction method as described above.
The method comprises the steps that an encryption value set with a linear regression value sent by a main participant is obtained through a secondary participant, and secondary encryption data are calculated according to the encryption value set; the secondary encryption data are sent to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model; and receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, updating local model parameters in the auxiliary participants based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participants acquire the encryption value set with the linear regression value sent by the main participants until the longitudinal federal model corresponding to the coordinator converges. After the secondary participant obtains the encryption value set of the main participant, the loss function value and the secondary encryption data are calculated and sent to the coordinator, so that the coordinator can determine whether the longitudinal federal model is converged according to the loss function value, if not, the secondary encryption data are updated according to the second derivative matrix, the target secondary gradient value is calculated according to the updated second derivative matrix, and then the local model parameters of the secondary participant are updated according to the target secondary gradient value, thereby avoiding the phenomenon that the longitudinal federal learning in the prior art adopts a first-order algorithm to enable the convergence speed to be slower and a large number of rounds of data interaction are required to occur, reducing the communication quantity of the longitudinal federal learning, improving the convergence speed when the longitudinal federal logistic regression model is trained, and reducing the time for the longitudinal federal learning.
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 flowchart of a first embodiment of an inter-enterprise data interaction method according to the present invention;
FIG. 3 is a flow chart illustrating another embodiment of the method for data interaction between enterprises according to the present invention;
FIG. 4 is a schematic diagram of a device module of the inter-enterprise data interaction device according to the present invention;
FIG. 5 is a schematic flow chart of the data interaction method between enterprises according to 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 inter-enterprise data interaction device in the embodiment of the invention can be a PC or a server device, and a Java virtual machine is operated on the inter-enterprise data interaction device.
As shown in fig. 1, the inter-enterprise data interaction 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 an inter-enterprise data interaction 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 used to call the inter-enterprise data interaction program stored in the memory 1005 and perform operations in the inter-enterprise data interaction method described below.
Based on the hardware structure, the embodiment of the inter-enterprise data interaction method based on longitudinal federal learning is provided.
Referring to fig. 2, fig. 2 is a flow chart of a first embodiment of a longitudinal federal learning-based inter-enterprise data interaction method according to the present invention, the method includes:
step S10, the secondary participant obtains an encrypted value set with a linear regression value sent by the primary participant, and calculates secondary encrypted data according to the encrypted value set;
Linear regression is a method based on a linear model to fit data features (independent variables) and data labels (dependent variables). Longitudinal federal linear regression means that multiple parties wish to combine data for linear regression modeling, but each holds a portion of the different data characteristics, and often only one party holds a data tag. Thus, in this embodiment, the primary participant has only a partial characteristic of the data, while the secondary participant has a portion of the data characteristic that is completely different from the primary participant. Model training of linear regression (linear regression) is performed on a given data feature and label (x i ,y i ) Lower pass minimization loss function L (w) = Σ i ||w T x i -y i || 2 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 the training of a linear regression model under the condition of protecting data privacy, so that model parameters are utilized to predict dependent variable values on new data. The scheme adopts an encryption method meeting the addition homomorphism, namely [ [ 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
To achieve longitudinal federal linear regression, calculations are requiredLoss function value and gradient are respectively: loss=l (w) = ||w T x-y|| 2
Figure GDA0003848097100000071
The loss function and gradient can be expressed as an operation of two-party homomorphic encryption data, namely:
Figure GDA0003848097100000072
Figure GDA0003848097100000073
the scheme utilizes second-order information to provide a fast convergence technical scheme, and is based on a second derivative matrix (i.e. a Heisen matrix) of a loss function
Figure GDA0003848097100000074
The design idea of the scheme is to estimate an inverse hessian matrix H by utilizing second-order information based on a quasi-Newton method, and the algorithm convergence speed is accelerated by adopting Hg as a descending direction without gradient g in the algorithm. 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 GDA0003848097100000076
Mean +.>
Figure GDA0003848097100000077
Difference (I) of->
Figure GDA0003848097100000075
Then calculate a vector containing the second order information of the batch of data>
Figure GDA0003848097100000081
And the dimension of the data is the same as the gradient of the data sent to the C end. And the C end updates the inverse hessian matrix once by using the information of the first M vectors v. Therefore, in this embodiment, the explanation can be made with the primary participant as the a-party, the secondary participant as the B-party, and the coordinator as the C-party. Therefore, a small batch of data ID is randomly selected as S, and the A side calculates the value set u of the corresponding data ID in S A ,u A 2 . A uses homomorphic encryption techniques for all u A ,u A 2 The value is encrypted to obtain an encrypted data set [ [ u ] A ]],[[u A 2 ]]Transmitting it to party B. Then, update->
Figure GDA0003848097100000083
Judging the relation between the current iteration times k and L, and if the current iteration times k are integer multiples of L, and the iteration times k are more than 2L; a-terminal order->
Figure GDA0003848097100000084
And calculating +_f between the current time (t) and the last time (t-1)>
Figure GDA0003848097100000085
The difference, i.e.)>
Figure GDA0003848097100000086
In addition, randomly selecting a small lot of data ID as S H The A end calculates S H Upper->
Figure GDA0003848097100000087
And homomorphically encrypted data ++>
Figure GDA0003848097100000088
To the B-terminal. If the current iteration number k is an integer multiple of L, and the iteration number k is not greater than 2L: the A terminal only updates +>
Figure GDA0003848097100000089
The B side calculates the corresponding numberValue set u in S according to ID B ,u B 2 . The B side calculates the value of the loss function value of the encryption by utilizing the homomorphic encryption property, namely
Figure GDA0003848097100000082
Simultaneously calculating the encryption value [ [ d ] of each piece of corresponding data]]=2([[u A ]]+[[u B ]]+[[-y]]) And transmits it to the a-terminal. Then, update->
Figure GDA00038480971000000810
And judging the relation between the current iteration times k and L. 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 GDA00038480971000000811
And calculating +_f between the current time (t) and the last time (t-1)>
Figure GDA00038480971000000812
The difference, i.e
Figure GDA00038480971000000813
In addition, the end B calculates S H Upper->
Figure GDA00038480971000000814
Thereby calculating +.>
Figure GDA00038480971000000815
And transmitted to the a-terminal. If the current iteration number k is an integer multiple of L, and the iteration number k is not greater than 2L: the B end only updates
Figure GDA00038480971000000816
Step S20, the secondary encryption data are sent to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model;
AB two sides respectively utilize homomorphic encryption property to each [ [ d ]]]Value multiplied by 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 . And the B end transmits the encrypted loss value to the C end. A. B will be [ [ g ] respectively A ]],[[g B ]]Transmitted to C. Then, the relation between the current iteration number k and L is judged. If 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 based on the intermediate result value [ [ h ]]]Calculating primary encryption data and secondary encryption data [ [ v ] A ]]=∑[[h]]x A ,[[v B ]]=∑[[h]]x B And transmitted to party C. The C side (i.e. coordinator) decrypts the received data to obtain g A ,g B And loss. And judging whether the longitudinal linear regression model is converged or not according to loss, and if so, sending an iteration stop signal to A, B to finish the algorithm. If not, updating
Figure GDA0003848097100000098
Judging the relation between the iteration times k and 2L, if k is not more than 2L, calculating the product of the step length and the gradient selected in advance +. >
Figure GDA0003848097100000097
And transmits them to a and B, respectively (i.e., the target secondary gradient value is obtained and sent to the primary participant and the corresponding product of the secondary participant is sent to the secondary participant). If 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 product into corresponding A, B parts, and respectively transmitting the corresponding A, B parts to A and B, namely:
Figure GDA0003848097100000091
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 GDA0003848097100000092
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 GDA0003848097100000099
The difference, i.e.)>
Figure GDA0003848097100000093
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. The calculation method comprises the following steps: initialization by means of the value at the end of a memory queue, i.e. computation
Figure GDA0003848097100000094
H←ρ[m]I, 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
step S40, receiving a target secondary gradient value sent by the coordinator based on the secondary encrypted data, updating a local model parameter in the secondary participant based on the target secondary gradient value, and continuing to execute the step that the secondary participant obtains the encrypted value set with the linear regression value sent by the primary participant until the longitudinal federal model corresponding to the coordinator converges.
After the secondary participant receives the target secondary gradient value sent by the coordinator, the local model parameters of the secondary participant are updated according to the target secondary gradient value, and meanwhile, after the primary participant receives the target primary gradient value sent by the coordinator, the model parameters of the primary participant are updated according to the product. I.e. the AB two parties update their own local model parameters with the received unencrypted vectors, respectively, i.e.:
Figure GDA0003848097100000095
and according to the updated local model parameters and formulas
Figure GDA0003848097100000096
To recalculate a new set of encrypted values with logistic regression scores in the master participant and to perform the step of obtaining the set of encrypted values with linear regression values again to obtain new loss function values until it is determined from the new loss function values that the longitudinal federation model has converged.
In addition, to assist in understanding the flow of data interaction between enterprises in this embodiment, the following description will be given by way of example.
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 [ [ u ] A ]],[[u A 2 ]]
Figure GDA0003848097100000101
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
Figure GDA0003848097100000105
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 GDA0003848097100000102
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 GDA0003848097100000103
and both AB parties update local model parameters based on the unencrypted vector passed by party C, i.e
Figure GDA0003848097100000104
In the embodiment, an encrypted value set with a linear regression value sent by a main participant is obtained by a secondary participant, and secondary encrypted data is calculated according to the encrypted value set; the secondary encryption data are sent to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model; and receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, updating local model parameters in the auxiliary participants based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participants acquire the encryption value set with the linear regression value sent by the main participants until the longitudinal federal model corresponding to the coordinator converges. After the secondary participant obtains the encryption value set of the main participant, the loss function value and the secondary encryption data are calculated and sent to the coordinator, so that the coordinator can determine whether the longitudinal federal model is converged according to the loss function value, if not, the secondary encryption data are updated according to the second derivative matrix, the target secondary gradient value is calculated according to the updated second derivative matrix, and then the local model parameters of the secondary participant are updated according to the target secondary gradient value, thereby avoiding the phenomenon that the convergence speed is slower and a large number of rounds of data interaction are required to occur due to the adoption of a first-order algorithm in the longitudinal federal learning in the prior art, reducing the communication quantity of the longitudinal federal learning, and improving the convergence speed when the longitudinal federal logistic regression model is trained.
Further, based on the first embodiment of the inter-enterprise data interaction method of the present invention, a second embodiment of the inter-enterprise data interaction method of the present invention is provided. This embodiment is a refinement of the step S10 of the first embodiment of the present invention, in which the secondary participant obtains the encrypted value set with the linear regression value sent by the primary participant, including:
step a, detecting whether a longitudinal federal model meets preset judging conditions or not;
in this embodiment, when the primary participant sends data to the secondary participant, it is further required to detect whether the longitudinal federal model meets a preset determination condition, for example, whether the number of new iterations of the longitudinal federal model meets a preset number of conditions (for example, whether the number of new iterations is an integer multiple of the number of iteration steps interval, and whether the number of new iterations is greater than two times greater than the preset number of iterations is determined). And executing different operations according to different judging results. And different operations are performed according to different detection results.
And b, if yes, the auxiliary participant obtains the main encryption value and the new encryption value sent by the main participant, and takes the main encryption value and the new encryption value as an encryption value set with a linear regression value sent by the main participant.
In the master participant, a small batch of data is acquired first and according to the formula mentioned in the above embodiment
Figure GDA0003848097100000111
Calculating to obtain each logistic regression score, encrypting the logistic regression scores by using homomorphic encryption technology to obtain a main encryption value, acquiring a small batch of data when the longitudinal federal model is judged to meet the preset judgment condition, and judging whether the longitudinal federal model meets the preset judgment condition according to the formula->
Figure GDA0003848097100000112
To calculate each logistic regression score and encrypt the logistic regression scores by homomorphic encryption technology to obtain new encryption numbersThe value, and the encrypted data and the new encrypted data together as a set of encrypted values with linear regression values. It should be noted that the encrypted data and the new encrypted data are different and sent to the secondary participant, that is, the secondary participant will obtain the primary encrypted value and the new encrypted value sent by the primary participant. However, if the longitudinal federal model does not meet the preset determination condition, the primary participant only transmits the primary encrypted value to the secondary participant, that is, the primary encrypted value is the encrypted value set with the linear regression value.
In this embodiment, when it is determined that the longitudinal federal model meets the preset determination condition, the secondary participant obtains the primary encryption value and the secondary encryption value sent by the primary participant, and uses the primary encryption value and the secondary encryption value as the encryption value set with the linear regression value, so that the training speed of the longitudinal linear regression model is improved.
Further, the step of calculating the secondary encrypted data from the encrypted value set includes:
step c, determining whether the current iteration times corresponding to the auxiliary participants meet the preset time conditions,
after the secondary encryption value set sent by the primary participant is obtained from the secondary participant, it is further required to determine whether the current iteration number (i.e. the update number) of the secondary participant own model meets the preset number condition, and execute different operations according to different determination results.
And d, if the result is met, calculating an intermediate result value according to the encryption value set, and calculating auxiliary encryption data through the intermediate result value.
When the current iteration number is judged to meet the preset number condition, if the current iteration number k is an integer multiple of L, the iteration number k is larger than 2L: b-side update
Figure GDA0003848097100000121
And calculating +_f between the current time (t) and the last time (t-1)>
Figure GDA0003848097100000126
The difference, i.e
Figure GDA0003848097100000122
In addition, the end B calculates S H Upper->
Figure GDA0003848097100000123
Thereby calculating the intermediate result value +.>
Figure GDA0003848097100000124
And transmitted to the a-side, and the secondary encrypted data in the secondary participant is calculated according to the intermediate result value. That is, the two ends of A, B are respectively based on the intermediate result value [ [ h ]]]Calculating primary encryption data and secondary encryption data [ [ v ] A ]]=∑[[h]]x A ,[[v B ]]=∑[[h]]x B And transmitted to party C. However, if not satisfied, if the current iteration number k is an integer multiple of L, and the iteration number k is not greater than 2L: the B terminal only updates + >
Figure GDA0003848097100000125
In this embodiment, when it is determined that the current iteration number corresponding to the secondary participant meets the preset number condition, an intermediate result value is calculated according to the encryption value set, and secondary encrypted data is calculated according to the intermediate result value, so that accuracy of obtaining the secondary encrypted data is ensured.
Specifically, the step of calculating an intermediate result value from the encrypted value set and calculating secondary encrypted data from the intermediate result value includes:
step e, acquiring a current average value of local model parameters in the auxiliary participants based on the encryption value set, and acquiring a historical average value of a preset step number interval before the current average value;
after the secondary participant obtains the encrypted value set sent by the primary participant, the secondary participant also obtains the current average value of the local model parameters in the secondary participant
Figure GDA0003848097100000127
And also requires a historical average of the preset step interval before the current average is obtained in the secondary participant.
And f, calculating a difference value between the current average value and the historical average value, calculating an intermediate result value according to the difference value, and calculating auxiliary encrypted data through the intermediate result value.
When the current average value and the historical average value are obtained, the difference between the current average value and the historical average value is calculated, namely the current time (t) and the last time (t-1) are calculated
Figure GDA0003848097100000128
The difference, i.e.)>
Figure GDA0003848097100000129
In addition, the end B calculates S H Upper part of the cylinder
Figure GDA00038480971000001210
Thereby calculating the intermediate result value +.>
Figure GDA00038480971000001211
And transmitted to the a-side, and the secondary encrypted data in the secondary participant is calculated according to the intermediate result value. That is, the two ends of A, B are respectively based on the intermediate result value [ [ h ]]]Calculating primary encryption data and secondary encryption data [ [ v ] A ]]=∑[[h]]x A ,[[v B ]=∑[[h]]x B
In this embodiment, the secondary encrypted data is calculated by driving the difference between the current average value and the historical average value in the secondary participant, and calculating the intermediate result value according to the difference, thereby ensuring the accuracy of obtaining the secondary encrypted data.
Further, based on any one of the first to second embodiments of the inter-enterprise data interaction method of the present invention, a third embodiment of the inter-enterprise data interaction method of the present invention is provided. This embodiment is a refinement of step S30 of the first embodiment of the present invention, where the step of receiving the target secondary gradient value sent by the coordinator based on the secondary encrypted data includes:
and g, receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, wherein the target auxiliary gradient value is obtained by the coordinator according to a second derivative matrix updated by the 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 unconvergence of a longitudinal logistic regression model and the satisfaction of a preset judgment condition.
When the secondary participant receives a target secondary gradient value fed back by the coordinator, the local model parameter of the secondary participant can be updated according to the target secondary gradient value, wherein the target secondary gradient value is obtained by updating the second derivative matrix according to target data when the coordinator determines that the longitudinal logistic regression model is not converged and a preset judgment 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 secondary encryption data sent by the secondary participant when the longitudinal logistic regression model is not converged and the preset judgment condition is met. And determining whether the longitudinal logistic regression model satisfies the preset determination condition may be, for example, determining whether the new iteration count of the longitudinal logistic regression model satisfies the preset count condition (e.g., determining whether the new iteration count is an integer multiple of the iteration step count interval, and whether the new iteration count is greater than twice or greater than the preset count). And executing different operations according to different judging results.
In this embodiment, the target secondary gradient value is obtained according to the target data and the updated second derivative matrix, and the target data is obtained by combining the primary encrypted data and the secondary encrypted data, so that the accuracy of the obtained target secondary gradient value is ensured.
Further, the step of receiving the target secondary gradient value fed back by the coordinator includes:
and h, receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary 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 a main gradient value sent by the main participant and an auxiliary gradient value sent by the auxiliary participant, and a preset step length.
When the auxiliary participant receives the target auxiliary gradient value fed back by the coordinator, the local model parameter of the auxiliary participant can be updated according to the target auxiliary gradient value, wherein the target auxiliary 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 secondary gradient value is determined to be obtained 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 secondary gradient value is ensured.
Further, the step of receiving the target secondary gradient value fed back by the coordinator includes:
and step k, receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary gradient value is a second target product, and the second target product is the product between the auxiliary gradient value sent by the auxiliary participant and a preset step length, which is calculated by the coordinator in response to that the longitudinal logistic regression model is not converged and a preset judging condition is not met.
When the auxiliary participant receives the target auxiliary gradient value fed back by the coordinator, the local model parameter of the auxiliary participant can be updated according to the target auxiliary gradient value, wherein the target auxiliary gradient value is a second product, and the second product is obtained by calculating 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 not met by the coordinator, so that the product is the second product, namely the target auxiliary gradient value.
In this embodiment, when the target auxiliary 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 preset step length and the auxiliary gradient value is calculated, so that the accuracy of the obtained target main gradient value is ensured.
Further, referring to fig. 3, fig. 3 is a flow chart of another embodiment of the method for data interaction between enterprises according to the present invention, which includes:
step S100, receiving primary encrypted data sent by a primary participant and secondary encrypted data sent by a secondary participant, wherein the secondary encrypted data is calculated according to an intermediate result value in the secondary participant, the intermediate result value is calculated by the secondary participant according to a primary participant sending encrypted value set, and the encrypted value set comprises a primary encrypted value and a new encrypted value;
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 secondary encryption data are 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, and sends the secondary encryption data to the coordinator. The encryption value set may include a main encryption value corresponding to data and a new encryption value corresponding to new data, that is, whether the current iteration number corresponding to the main participant meets a preset condition (for example, whether the current iteration number passes through the preset number), if not, the main encryption value may be used as the target value set, and if yes, the main encryption value and the new encryption value may be used as the encryption 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 secondary 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 GDA0003848097100000151
H←ρ[m]I, 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 GDA0003848097100000152
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 GDA0003848097100000153
The respective products are respectively sent to the A side and the B side corresponding to each other, then the A side updates the local model parameters of the A side according to the obtained products (namely the target main gradient value) 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, carries out the next model training until the new loss function value is obtained, and transmits the new loss function value to the C side (coordinator) for judgment, namely, the longitudinal logic return is determined And if the model is converged, sending an iteration stop signal to the A side and the B side, and stopping training of the longitudinal logistic regression model. If not, execute ++again>
Figure GDA0003848097100000162
Until the longitudinal logistic regression model converges. And when k is greater than 2L, two gradients are combined into a long vector G, the product of the step length, H and G is calculated, and the long vector G is split 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 transmitted to A and B respectively, namely:
Figure GDA0003848097100000161
step S300, the target secondary gradient value is sent to the secondary participant, and the secondary participant is configured to update a local model parameter in the secondary participant based on the target secondary gradient value, and continue to execute the step that the secondary participant obtains the encrypted value set with the linear regression value sent by the primary participant until the longitudinal federal model corresponding to the coordinator converges.
After the coordinator calculates a target auxiliary gradient value, the target auxiliary gradient value is sent to the auxiliary participants, the auxiliary participants update local model parameters in the auxiliary participants according to the target auxiliary gradient value, the auxiliary participants continue to execute the auxiliary participants to acquire the encrypted value set with the linear regression value sent by the main participants until the longitudinal logistic regression model corresponding to the coordinator converges, and an iteration stop signal is sent to the main participants and the auxiliary participants. The same principal participant also receives the target principal gradient value corresponding to the principal participant fed back by the coordinator to update the local model parameters in the principal 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 secondary gradient value according to the updated second derivative matrix, and sends the target secondary gradient value to the secondary participant so as to update the local model parameters in the secondary participant, thereby avoiding the phenomenon that the convergence speed is slower and a large number of rounds of data interaction are required due to the adoption of a first-order algorithm in the longitudinal federation learning in the prior art, and reducing the traffic for the longitudinal federation learning.
Further, the step of updating the second derivative matrix based on the primary encrypted data and the secondary encrypted data includes:
m, 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.
Step n, if yes, decrypting and combining the main encryption data and the auxiliary encryption data to obtain target data;
when the longitudinal logistic regression model is judged to meet the preset judgment condition, the coordinator receives the primary encrypted data sent by the primary participant and the secondary encrypted data sent by the secondary participant, and then decrypts and combines the primary encrypted data and the secondary encrypted data to obtain target data, namely the encrypted data [ [ vA ]]],[[vB]]Decrypting and combining to obtain target data
Figure GDA0003848097100000171
And step p, 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 GDA0003848097100000174
The difference, i.e.)>
Figure GDA0003848097100000172
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 upsilons and s are placed 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 GDA0003848097100000173
H←ρ[m]I, 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 x, if the primary gradient value is not satisfied, the coordinator acquires a first product between the secondary gradient value sent by the secondary participant and a preset step length, and sends the first product to the secondary participant as a target secondary 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 secondary gradient value selected in advance and a third product of the primary gradient value corresponding to the primary participant in the preset step length, the first product is used as a target secondary gradient value to be sent to the secondary participant to update local model parameters in the secondary participant, the third product is sent to the primary participant to update the local model parameters in the primary participant, model training is conducted again according to the updated model parameters, so that new loss function values are obtained, and the third product is 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 secondary gradient value and the preset step length is calculated, and the first product is used as the target secondary gradient value, so that accuracy of the obtained target primary gradient value is ensured.
The embodiment of the invention also provides an inter-enterprise data interaction device, referring to fig. 4, the inter-enterprise data interaction device includes:
the acquisition module is used for the secondary participant to acquire an encrypted value set with a linear regression value sent by the primary participant and calculate secondary encrypted data according to the encrypted value set;
the sending module is used for sending the secondary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model;
the first receiving module is configured to receive a target secondary gradient value sent by the coordinator based on the secondary encrypted data, update a local model parameter in the secondary participant based on the target secondary gradient value, and continue to execute a step that the secondary participant obtains an encrypted value set with a linear regression value sent by the primary participant until a longitudinal federal model corresponding to the coordinator converges.
Optionally, the acquiring module is further configured to:
detecting whether the longitudinal federal model meets a preset judging condition or not;
if yes, the auxiliary participant obtains the main encryption value and the new encryption value sent by the main participant, and takes the main encryption value and the new encryption value as an encryption value set with a linear regression value sent by the main participant.
Optionally, the acquiring module is further configured to:
determining whether the current iteration number corresponding to the secondary participant meets a preset number of times condition,
if yes, calculating an intermediate result value according to the encryption value set, and calculating auxiliary encryption data through the intermediate result value.
Optionally, the acquiring module is further configured to:
acquiring a current average value of local model parameters in the auxiliary participants based on the encryption value set, and acquiring a historical average value of a preset step number interval before the current average value;
and calculating a difference value between the current average value and the historical average value, calculating an intermediate result value according to the difference value, and calculating auxiliary encryption data through the intermediate result value.
Optionally, the first receiving module is further configured to:
and receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, wherein the target auxiliary gradient value is obtained by the coordinator according to a second derivative matrix updated by the 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.
Optionally, the first receiving module is further configured to:
and receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary 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 a main gradient value sent by the main participant and an auxiliary gradient value sent by the auxiliary participant, and a preset step length.
Optionally, the step of receiving the target secondary gradient value fed back by the coordinator includes:
and receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary 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 inter-enterprise data interaction device further includes:
the second receiving module is used for receiving primary encrypted data sent by a primary participant and secondary encrypted data sent by a secondary participant, wherein the secondary encrypted data is calculated according to an intermediate result value in the secondary participant, the intermediate result value is calculated by the secondary participant according to a primary participant sending encrypted value set, and the encrypted value set comprises a primary encrypted value and a new encrypted value;
The updating 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 secondary gradient value according to the updated second derivative matrix;
and the convergence module is used for sending the target auxiliary gradient value to the auxiliary participant, wherein the auxiliary participant is used for updating local model parameters in the auxiliary participant based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participant obtains the encrypted value set with the linear regression value sent by the main participant until the longitudinal federal model corresponding to the coordinator is converged.
Optionally, the updating module is further configured to:
judging whether the longitudinal logistic regression model meets the preset judging condition or not;
if yes, decrypting and combining the main encryption data and the auxiliary encryption 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 updating module is further configured to:
if the primary gradient value is not met, the coordinator acquires a first product between the primary gradient value sent by the secondary participant and a preset step length, and sends the first product to the secondary participant as a target secondary gradient value.
The method executed by each program module may refer to each embodiment of the inter-enterprise data interaction method of the present invention, and will not be described herein.
The invention also provides a storage medium.
The storage medium of the present invention stores an inter-enterprise data interaction program, which when executed by a processor, implements the steps of the inter-enterprise data interaction method as described above.
The method implemented when the inter-enterprise data interaction program running on the processor is executed may refer to various embodiments of the inter-enterprise data interaction method of the present invention, which are not described herein again.
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 (11)

1. An inter-enterprise data interaction method based on longitudinal federal learning, for inter-enterprise interaction data for federal learning, wherein the enterprise comprises at least a primary participant and a secondary participant, the primary participant has a partial characteristic of data, and the secondary participant has a partial and completely different data characteristic from the primary participant, the method comprising the steps of:
the auxiliary participant obtains an encrypted value set with a linear regression value sent by the main participant, and calculates auxiliary encrypted data according to the encrypted value set;
the secondary participant sends the secondary encryption data to a coordinator, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model;
the auxiliary participant receives a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, updates local model parameters in the auxiliary participant based on the target auxiliary gradient value, and continues to execute the step that the auxiliary participant obtains an encryption value set with a linear regression value sent by a main participant until a longitudinal federal model corresponding to the coordinator converges;
The step of obtaining, by the secondary participant, an encrypted value set with a linear regression value sent by the primary participant includes:
detecting whether the longitudinal federal model meets a preset judging condition or not;
if yes, the auxiliary participant obtains a main encryption value and a new encryption value sent by the main participant, and takes the main encryption value and the new encryption value as an encryption value set with a linear regression value sent by the main participant, wherein the values are data IDs;
if the longitudinal federal model does not meet the preset judging condition, the auxiliary participant acquires a main encryption value sent by the main participant, and takes the main encryption value as an encryption value set with a linear regression value sent by the main participant;
the main encryption value is obtained by acquiring a small batch of data from a main participant and encrypting the small batch of data; the new encrypted value is obtained by acquiring a small batch of data from the master participant and encrypting the small batch of data; and the primary encrypted value is different from the new encrypted value.
2. The method of inter-enterprise data interaction of claim 1, wherein the step of computing secondary encrypted data from the set of encrypted values comprises:
Determining whether the current iteration number corresponding to the secondary participant meets a preset number of times condition,
if yes, calculating an intermediate result value according to the encryption value set, and calculating auxiliary encryption data through the intermediate result value.
3. The method for data interaction between enterprises according to claim 2, wherein the step of calculating an intermediate result value from the set of encrypted values and calculating sub-encrypted data from the intermediate result value comprises:
acquiring a current average value of local model parameters in the auxiliary participants based on the encryption value set, and acquiring a historical average value of a preset step number interval before the current average value;
and calculating a difference value between the current average value and the historical average value, calculating an intermediate result value according to the difference value, and calculating auxiliary encryption data through the intermediate result value.
4. The method of inter-enterprise data interaction of claim 1, wherein the step of receiving the target secondary gradient value sent by the coordinator based on the secondary encrypted data comprises:
and receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, wherein the target auxiliary gradient value is obtained by the coordinator according to a second derivative matrix updated by the target data, the target data is obtained by decrypting and combining the main encryption data sent by the main participant and the auxiliary encryption data sent by the auxiliary participant in response to the unconvergence of a longitudinal logistic regression model and the satisfaction of a preset judgment condition.
5. The method of inter-enterprise data interaction of claim 1, wherein the step of receiving the coordinator-fed-back target secondary gradient value comprises:
and receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary 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 a longitudinal logistic regression model meets a preset judgment condition, a long vector formed by combining a main gradient value sent by the main participant and an auxiliary gradient value sent by the auxiliary participant, and a preset step length.
6. The method of inter-enterprise data interaction of claim 1, wherein the step of receiving the coordinator-fed-back target secondary gradient value comprises:
and receiving a target auxiliary gradient value fed back by the coordinator, wherein the target auxiliary 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.
7. An inter-enterprise data interaction method based on longitudinal federation learning, for inter-enterprise interaction data to perform federation learning, wherein the enterprise at least includes a main participant and a sub-participant, the main participant has a part of characteristics of data, the sub-participant has a part of data characteristics completely different from the main participant, the inter-enterprise data interaction method includes the following steps:
Receiving primary encrypted data sent by a primary participant and secondary encrypted data sent by a secondary participant, wherein the secondary encrypted data is calculated according to an intermediate result value in the secondary participant, the intermediate result value is calculated by the secondary participant according to a primary participant sending encrypted value set, the encrypted value set comprises a primary encrypted value and a new encrypted value, the values are data IDs, and the primary encrypted value is obtained by acquiring a small batch of data in the primary participant and encrypting the small batch of data; the new encryption value is obtained by acquiring a small batch of data from a master participant and encrypting the small batch of data, and the master encryption value is different from the new encryption value;
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 secondary gradient value according to the updated second derivative matrix;
the target auxiliary gradient value is sent to the auxiliary participant, the auxiliary participant is used for updating local model parameters in the auxiliary participant based on the target auxiliary gradient value, and the auxiliary participant continues to execute the step of acquiring an encrypted value set with a linear regression value sent by a main participant until a longitudinal federal model corresponding to a coordinator converges;
Wherein the step of updating the second derivative matrix based on the primary encrypted data and the secondary encrypted data comprises:
judging whether the longitudinal logistic regression model meets a preset judging condition or not;
if yes, decrypting and combining the main encryption data and the auxiliary encryption 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;
if the primary gradient value is not met, the coordinator acquires a first product between the primary gradient value sent by the secondary participant and a preset step length, and sends the first product to the secondary participant as a target secondary gradient value.
8. An inter-enterprise data interaction device based on longitudinal federal learning for inter-enterprise interaction data for federal learning, wherein the enterprise comprises at least a primary participant and a secondary participant, and the primary participant has partial characteristics of data, and the secondary participant has data characteristics that are partially and completely different from the primary participant, the device comprising:
the acquisition module is used for the secondary participant to acquire an encrypted value set with a linear regression value sent by the primary participant and calculate secondary encrypted data according to the encrypted value set;
The sending module is used for sending the secondary encryption data to a coordinator by the secondary participant, wherein the coordinator is used for updating a second derivative matrix in the coordinator according to the secondary encryption data and calculating a target secondary gradient value according to the updated second derivative matrix in response to the non-convergence of the longitudinal federal model;
the first receiving module is used for receiving a target auxiliary gradient value sent by the coordinator based on the auxiliary encryption data, updating local model parameters in the auxiliary participant based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participant obtains an encryption value set with a linear regression value sent by the main participant until a longitudinal federal model corresponding to the coordinator converges;
the acquisition module is specifically configured to detect whether a longitudinal federal model meets a preset determination condition, where the preset determination condition includes determining whether a new iteration number is an integer multiple of an iteration step interval and is greater than a preset number; if yes, the auxiliary participant obtains a main encryption value and a new encryption value sent by the main participant, and takes the main encryption value and the new encryption value as an encryption value set with a linear regression value sent by the main participant, wherein the values are data IDs; if the longitudinal federal model does not meet the preset judging condition, the auxiliary participant acquires a main encryption value sent by the main participant, and takes the main encryption value as an encryption value set with a linear regression value sent by the main participant; the main encryption value is obtained by acquiring a small batch of data from a main participant and encrypting the small batch of data; the new encrypted value is obtained by acquiring a small batch of data from the master participant and encrypting the small batch of data; and the primary encrypted value is different from the new encrypted value.
9. An inter-enterprise data interaction device based on longitudinal federal learning, for inter-enterprise interaction data for federal learning, wherein the enterprise comprises at least a primary participant and a secondary participant, and the primary participant has a partial characteristic of data, and the secondary participant has a partial and completely different data characteristic from the primary participant, the device further comprising:
the second receiving module is used for receiving main encryption data sent by a main participant and auxiliary encryption data sent by an auxiliary participant, wherein the auxiliary encryption data is calculated according to an intermediate result value in the auxiliary participant, the intermediate result value is calculated by the auxiliary participant according to an encryption value set sent by the main participant, the encryption value set comprises a main encryption value and a new encryption value, the value is a data ID, and the main encryption value is obtained by acquiring a small batch of data from the main participant and encrypting the small batch of data; the new encryption value is obtained by acquiring a small batch of data from a master participant and encrypting the small batch of data, and the master encryption value is different from the new encryption value;
the updating 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 secondary gradient value according to the updated second derivative matrix, wherein the second derivative matrix is updated in a mode of initializing by utilizing the value at the tail of a memory queue and then performing iterative calculation from the head of the queue to the tail of the queue;
The convergence module is used for sending the target auxiliary gradient value to the auxiliary participant, wherein the auxiliary participant is used for updating local model parameters in the auxiliary participant based on the target auxiliary gradient value, and continuing to execute the step that the auxiliary participant obtains an encryption value set with a linear regression value sent by a main participant until a longitudinal federal model corresponding to a coordinator converges;
the updating module is specifically configured to determine whether the longitudinal logistic regression model meets a preset determination condition, where the preset determination condition includes determining whether a new iteration number is an integer multiple of an iteration step interval and is greater than a preset number; if yes, decrypting and combining the main encryption data and the auxiliary encryption 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; if the primary gradient value is not met, the coordinator acquires a first product between the primary gradient value sent by the secondary participant and a preset step length, and sends the first product to the secondary participant as a target secondary gradient value.
10. Inter-enterprise data interaction device based on longitudinal federal learning, wherein the inter-enterprise data interaction device comprises: a memory, a processor and an inter-enterprise data interaction program stored on the memory and executable on the processor, the inter-enterprise data interaction program when executed by the processor implementing the steps of the inter-enterprise data interaction method of any of claims 1 to 7.
11. A storage medium having stored thereon an inter-enterprise data interaction program, which when executed by a processor, implements the steps of the inter-enterprise data interaction method of any of claims 1 to 7.
CN201911124702.XA 2019-11-14 2019-11-14 Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning Active CN110851786B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911124702.XA CN110851786B (en) 2019-11-14 2019-11-14 Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning
PCT/CN2019/119418 WO2021092980A1 (en) 2019-11-14 2019-11-19 Longitudinal federated learning optimization method, apparatus and device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911124702.XA CN110851786B (en) 2019-11-14 2019-11-14 Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning

Publications (2)

Publication Number Publication Date
CN110851786A CN110851786A (en) 2020-02-28
CN110851786B true CN110851786B (en) 2023-06-06

Family

ID=69601691

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911124702.XA Active CN110851786B (en) 2019-11-14 2019-11-14 Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning

Country Status (2)

Country Link
CN (1) CN110851786B (en)
WO (1) WO2021092980A1 (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113449872B (en) * 2020-03-25 2023-08-08 百度在线网络技术(北京)有限公司 Parameter processing method, device and system based on federal learning
CN111160573B (en) * 2020-04-01 2020-06-30 支付宝(杭州)信息技术有限公司 Method and device for protecting business prediction model of data privacy joint training by two parties
CN112182649B (en) * 2020-09-22 2024-02-02 上海海洋大学 Data privacy protection system based on safe two-party calculation linear regression algorithm
WO2022094888A1 (en) * 2020-11-05 2022-05-12 浙江大学 Decision tree-oriented longitudinal federation learning method
CN112508199A (en) * 2020-11-30 2021-03-16 同盾控股有限公司 Feature selection method, device and related equipment for cross-feature federated learning
CN113742673B (en) * 2021-09-07 2024-05-10 石硕 Cloud edge cooperative control integrated platform based on federal learning
CN113934983A (en) * 2021-10-27 2022-01-14 平安科技(深圳)有限公司 Characteristic variable analysis method and device, computer equipment and storage medium
CN114003939B (en) * 2021-11-16 2024-03-15 蓝象智联(杭州)科技有限公司 Multiple collinearity analysis method for longitudinal federal scene
CN114547643B (en) * 2022-01-20 2024-04-19 华东师范大学 Linear regression longitudinal federal learning method based on homomorphic encryption
CN114429223B (en) * 2022-01-26 2023-11-07 上海富数科技有限公司 Heterogeneous model building method and device
CN114841373B (en) * 2022-05-24 2024-05-10 中国电信股份有限公司 Parameter processing method, device, system and product applied to mixed federal scene

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263936A (en) * 2019-06-14 2019-09-20 深圳前海微众银行股份有限公司 Laterally federation's learning method, device, equipment and computer storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN109034398B (en) * 2018-08-10 2023-09-12 深圳前海微众银行股份有限公司 Gradient lifting tree model construction method and device based on federal training and storage medium
CN109299728B (en) * 2018-08-10 2023-06-27 深圳前海微众银行股份有限公司 Sample joint prediction method, system and medium based on construction of gradient tree model
CN109635422B (en) * 2018-12-07 2023-08-25 深圳前海微众银行股份有限公司 Joint modeling method, device, equipment and computer readable storage medium
CN110189192B (en) * 2019-05-10 2021-04-13 深圳前海微众银行股份有限公司 Information recommendation model generation method and device
CN110197084B (en) * 2019-06-12 2021-07-30 上海联息生物科技有限公司 Medical data joint learning system and method based on trusted computing and privacy protection
KR20190103090A (en) * 2019-08-15 2019-09-04 엘지전자 주식회사 Method and apparatus for learning a model to generate poi data using federated learning
CN112732297B (en) * 2020-12-31 2022-09-27 平安科技(深圳)有限公司 Method and device for updating federal learning model, electronic equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263936A (en) * 2019-06-14 2019-09-20 深圳前海微众银行股份有限公司 Laterally federation's learning method, device, equipment and computer storage medium

Also Published As

Publication number Publication date
WO2021092980A1 (en) 2021-05-20
CN110851786A (en) 2020-02-28

Similar Documents

Publication Publication Date Title
CN110851786B (en) Inter-enterprise data interaction method, device, equipment and storage medium based on longitudinal federal learning
CN110851785B (en) Longitudinal federal learning optimization method, device, equipment and storage medium
CN110709863B (en) Logistic regression modeling method, storage medium, and system using secret sharing
CN111898137A (en) Private data processing method, equipment and system for federated learning
CN113239404A (en) Federal learning method based on differential privacy and chaotic encryption
WO2020156004A1 (en) Model training method, apparatus and system
JPWO2015155896A1 (en) Support vector machine learning system and support vector machine learning method
CN111340247A (en) Longitudinal federated learning system optimization method, device and readable storage medium
CN114696990A (en) Multi-party computing method, system and related equipment based on fully homomorphic encryption
CN114186256B (en) Training method, device, equipment and storage medium of neural network model
CN111325352A (en) Model updating method, device, equipment and medium based on longitudinal federal learning
WO2021227959A1 (en) Data privacy protected multi-party joint training of object recommendation model
CN111275358A (en) Dispatch matching method, device, equipment and storage medium
CN111523556A (en) Model training method, device and system
CN114492850A (en) Model training method, device, medium, and program product based on federal learning
CN112000988A (en) Factorization machine regression model construction method and device and readable storage medium
CN113449872A (en) Parameter processing method, device and system based on federal learning
CN114330673A (en) Method and device for performing multi-party joint training on business prediction model
CN104994179B (en) A kind of data processing method and server
CN111737756B (en) XGB model prediction method, device and system performed through two data owners
CN113361618A (en) Industrial data joint modeling method and system based on federal learning
CN112183759B (en) Model training method, device and system
CN112948883A (en) Multi-party combined modeling method, device and system for protecting private data
CN112598127A (en) Federal learning model training method and device, electronic equipment, medium and product
US20240119368A1 (en) Model training method, related system, and storage medium

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