A secure calculation method for activation functions and a secure calculation method for Tanh functions

By using the method of random parameter set allocation and exchange additive sharding in deep learning algorithms, the problem of performance deterioration in the prior art resulting in replacement of Sigmoid functions is solved, and safe calculation is realized without changing the original algorithm structure.

CN114386566BActive Publication Date: 2025-02-11PENG CHENG LAB
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111479964.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-06
Publication Date
2025-02-11
Estimated Expiration
2041-12-06

AI Technical Summary

Technical Problem

The prior art changes the original algorithm structure when replacing the Sigmoid function in the privacy protection deep learning algorithm with a cryptographically friendly function for security calculations, resulting in poor performance.

Method used

By allocating a random parameter set between the first server and the second server, the input data of the Sigmoid function is split into two data fragments, and the target Sigmoid function value is calculated by exchanging additive fragments, retaining the original algorithm structure.

Benefits of technology

It realizes safe calculations on the basis of retaining the original algorithm structure, and solves the problem of poor performance of deep learning algorithms for privacy protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114386566B_ABST
    Figure CN114386566B_ABST
Patent Text Reader

Abstract

The present invention discloses a secure calculation method for an activation function and a secure calculation method for a Tanh function. In order to retain the original Sigmoid function algorithm structure, the present invention adopts a random parameter method to achieve secure calculation, thereby solving the problem in the prior art that the Sigmoid function in a privacy-preserving deep learning algorithm is replaced with a corresponding cryptography-friendly function for secure calculation, which changes the original algorithm structure and causes the performance of the privacy-preserving deep learning algorithm to deteriorate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to an activation function security calculation method and a Tanh function security calculation method. Background Art

[0002] As the most frequently used Sigmoid function in the early stage of deep learning, Sigmoid plays an important role in deep learning. Since the structure of the Sigmoid function itself is relatively complex and contains exponential and division operations, it is difficult to use cryptographic technology to achieve secure computing. In order to complete the training and prediction process under privacy protection, the existing privacy-preserving deep learning algorithm constructed based on cryptographic technology needs to replace the Sigmoid function in the algorithm with a corresponding cryptographic-friendly function for secure computing while ensuring that the privacy-preserving deep learning algorithm is available. Since this method changes the original algorithm structure, it will cause the performance of the trained model to deteriorate.

[0003] Therefore, the existing technology still needs to be improved and developed. Summary of the invention

[0004] The technical problem to be solved by the present invention is that, in view of the above-mentioned defects of the prior art, an activation function security calculation method and a Tanh function security calculation method are provided, aiming to solve the problem in the prior art that the Sigmoid function in the privacy-preserving deep learning algorithm is replaced with a corresponding cryptography-friendly function for security calculation, which changes the original algorithm structure and causes the performance of the privacy-preserving deep learning algorithm to deteriorate.

[0005] The technical solution adopted by the present invention to solve the problem is as follows:

[0006] In a first aspect, an embodiment of the present invention provides a method for securely calculating an activation function, wherein the method comprises:

[0007] The first server obtains a first data shard and a first random parameter set, and the second server obtains a second data shard and a second random parameter set, wherein the first data shard and the second data shard are two data shards split from the input data of the Sigmoid function, and the first random parameter set and the second random parameter set satisfy a preset operation relationship;

[0008] The first server obtains a first additive slice based on the first data slice and a plurality of first exchange data, and the second server obtains a second additive slice based on the second data slice and a plurality of second exchange data, wherein each first exchange data is obtained by the second server obfuscating local computing data according to the second random parameter set, the first server uses each first exchange data according to the first random parameter set, each second exchange data is obtained by the first server obfuscating local computing data according to the first random parameter set, and the second server uses each second exchange data according to the second random parameter set;

[0009] The first additive slice and the second additive slice are added together to obtain a target Sigmoid function value corresponding to the input data.

[0010] In one implementation, the first server obtains a first additive slice based on the first data slice and a plurality of first exchanged data, and the second server obtains a second additive slice based on the second data slice and a plurality of second exchanged data, including:

[0011] The first server performs an exponential function operation according to the first data slice to obtain a first exponential function value, encrypts the first exponential function value according to the first random parameter set to obtain the first second exchange data, and sends the first second exchange data to the second server;

[0012] The second server performs an exponential function operation according to the second data slice to obtain a second exponential function value, encrypts the second exponential function value according to the second random parameter set to obtain the first first exchange data, and sends the first first exchange data to the first server;

[0013] The first server performs a decryption operation on the first first exchange data according to the first random parameter set to obtain a first initial additive slice, encrypts the first initial additive slice according to the first random parameter set to obtain a second second exchange data, and sends the second second exchange data to the second server;

[0014] The second server performs a decryption operation on the first second exchange data according to the second random parameter set and the first first exchange data to obtain a second initial additive slice, randomly obtains a second multiplicative slice, obtains a first exchange slice according to the second random parameter set, the second second exchange data, the second initial additive slice and the second multiplicative slice, encrypts the second multiplicative slice according to the second random parameter set to obtain a second exchange slice, obtains a second first exchange data according to the first exchange slice and the second exchange slice, and sends the second first exchange data to the first server;

[0015] The first server performs a decryption operation on the second first exchange data according to the first random parameter set to obtain a first multiplicative slice, encrypts the inverse of the first multiplicative slice according to the first random parameter set to obtain a third second exchange data, and sends the third second exchange data to the second server;

[0016] The second server encrypts the inverse of the second multiplicative slice according to the second random parameter set to obtain a third first exchange data, and sends the third first exchange data to the first server;

[0017] The first server performs a decryption operation on the third first exchanged data according to the first random parameter set to obtain the first additive slice, and the second server performs a decryption operation on the third second exchanged data according to the second random parameter set and the third first exchanged data to obtain the second additive slice.

[0018] In one embodiment, the first random parameter set includes two random parameter groups a j and c j,1 The second random parameter set includes two random parameter groups b j and c j,2 , the operation relationship is: a j b j =c j,1 +c j,2 , where j represents the order bit in the random parameter group, and j includes 1, 2, and 3.

[0019] In one embodiment, the first exponential function value is The first of the second exchanged data is d1, and the first exponential function value is encrypted according to the first random parameter set to obtain the first of the second exchanged data, including:

[0020] Obtaining a1 in the first random parameter set;

[0021] according to and a1 to obtain d1, where

[0022] In one embodiment, the first first exchange data is d2, and the second exponential function value is The step of encrypting the second exponential function value according to the second random parameter set to obtain the first first exchange data includes:

[0023] Obtain b1 in the second random parameter set;

[0024] according to and b1 to obtain d2, where

[0025] In one implementation, the first initial additive fragment is [f]1, and the first server performs a decryption operation on the first exchanged data according to the first random parameter set to obtain the first initial additive fragment, including:

[0026] Get c in the first random parameter set 1,1 ;

[0027] According to a1, c 1,1 and d2 to obtain [f]1, where [f]1=1+a1·d2+c 1,1 .

[0028] In one implementation, the second second exchanged data is m1, and encrypting the first initial additive slice according to the first random parameter set to obtain the second second exchanged data includes:

[0029] Obtaining a2 in the first random parameter set;

[0030] Based on [f]1 and a2, m1 is obtained, where m1 = [f]1-a2.

[0031] In one implementation, the second initial additive fragment is [f]2, and the second server performs a decryption operation on the first second exchange data according to the second random parameter set and the first first exchange data to obtain the second initial additive fragment, including:

[0032] Get c in the second random parameter set 1,2 ;

[0033] According to b1, d1, d2 and c 1,2 We get [f]2, where [f]2 = b1·d1+d1·d2+c 1,2 .

[0034] In one embodiment, the second multiplicative slice is2, the first exchange slice is m2, the second exchange slice is m2′, the second first exchange data is (m2, m2′), the first exchange slice is obtained according to the second random parameter set, the second second exchange data, the second initial additive slice and the second multiplicative slice, the second exchange slice is encrypted according to the second random parameter set to obtain the second exchange slice, and the second first exchange data is obtained according to the first exchange slice and the second exchange slice, including:

[0035] Get b2 and c in the second random parameter set 2,2 ;

[0036] According to c 2,2 、m1、 2 and [f]2 to obtain m2, where

[0037] According to b2 and 2 to obtain m2′, where

[0038] Based on m2 and m2′, we get (m2, m2′).

[0039] In one embodiment, the first multiplicative slice is 1. The first server performs a decryption operation on the second first exchanged data according to the first random parameter set to obtain a first multiplicative slice, including:

[0040] Get a2 and c in the first random parameter set 2,1 ;

[0041] According to a2, c 2,1 And (m2, m2′) we get 1, where 1=m2+a2·m2′-c 2,1 .

[0042] In one implementation, the third second exchange data is w1, and the encrypting the inverse of the first multiplicative slice according to the first random parameter set to obtain the third second exchange data includes:

[0043] Obtaining a3 in the first random parameter set;

[0044] According to a3 and 1 to get w1, where

[0045] In one implementation, the third first exchange data is w2, and the second server encrypts the inverse of the second multiplicative slice according to the second random parameter set to obtain the third first exchange data, including:

[0046] Obtain b3 from the second random parameter set;

[0047] According to b3 and 2 to get w2, where

[0048] In one embodiment, the first additive slice is [S(x)]1, and the first server performs a decryption operation on the third first exchanged data according to the first random parameter set to obtain the first additive slice, including

[0049] Get c in the first random parameter set 3,1 ;

[0050] According to a3, c 3,1 and w2 to obtain [S(x)]1, where [S(x)]1=a3·w2+c 3,1 .

[0051] In one implementation, the second additive slice is [S(x)]2, and the second server performs a decryption operation on the third second exchanged data according to the second random parameter set and the third first exchanged data to obtain the second additive slice, including:

[0052] Get c in the second random parameter set 3,2 ;

[0053] According to b3, c 3,2 , w1 and w2 to obtain [S(x)]2, where [S(x)]2 = b3·w1+w1·w2+c 3,2 .

[0054] In a second aspect, an embodiment of the present invention further provides a Tanh function security calculation method, wherein the method is implemented based on any of the activation function security calculation methods described above, and the method includes:

[0055] The first server obtains a third data slice, and the second server obtains a fourth data slice, wherein the third data slice and the fourth data slice are two data slices split from a value twice the input data;

[0056] The first server executes the activation function security calculation method according to the third data slice to obtain a third Sigmoid function score, and obtains a first Tanh function score according to a difference between twice the third Sigmoid function score and 1;

[0057] The second server executes the activation function security calculation method according to the fourth data slice to obtain a fourth Sigmoid function score, and obtains the first Tanh function score according to the second Sigmoid function score, wherein the sum of the third Sigmoid function score and the fourth Sigmoid function score is equal to the Sigmoid function value corresponding to the double value of the input data;

[0058] A target Tanh function value corresponding to the input data is obtained according to the first Tanh function score and the second Tanh function score.

[0059] In a third aspect, an embodiment of the present invention further provides an activation function secure calculation system, wherein the system comprises a first server and a second server, and the first server and the second server are used to execute relevant steps in the activation function secure calculation method as described in any one of the above items.

[0060] In a fourth aspect, an embodiment of the present invention further provides a Tanh function secure computing system, wherein the system comprises a first server and a second server, and the first server and the second server are used to execute relevant steps in any of the above-mentioned Tanh function secure computing methods.

[0061] Beneficial effects of the present invention: In order to retain the original Sigmoid function algorithm structure, the present invention adopts a random parameter method to achieve secure computing, which solves the problem in the prior art that the Sigmoid function in the privacy-preserving deep learning algorithm is replaced with a corresponding cryptography-friendly function for secure computing, which changes the original algorithm structure and causes the performance of the privacy-preserving deep learning algorithm to deteriorate. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0063] Figure 1 This is an activation function security calculation method provided by an embodiment of the present invention.

[0064] Figure 2 This is a Tanh function security calculation method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0065] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0066] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0067] As the most frequently used Sigmoid function in the early stage of deep learning, Sigmoid plays an important role in deep learning. Since the structure of the Sigmoid function itself is relatively complex and contains exponential and division operations, it is difficult to use cryptographic technology to achieve secure computing. In order to complete the training and prediction process under privacy protection, the existing privacy-preserving deep learning algorithm constructed based on cryptographic technology needs to replace the Sigmoid function in the algorithm with a corresponding cryptographic-friendly function for secure computing while ensuring that the privacy-preserving deep learning algorithm is available. Since this method changes the original algorithm structure, it will cause the performance of the trained model to deteriorate.

[0068] In view of the above-mentioned defects of the prior art, the present invention provides a method for secure calculation of an activation function, wherein the method obtains a first data slice and a first random parameter set by a first server, and obtains a second data slice and a second random parameter set by a second server, wherein the first data slice and the second data slice are two data slices split from the input data of the Sigmoid function, and the first random parameter set and the second random parameter set satisfy a preset operation relationship; the first server obtains a first additive slice based on the first data slice and a number of first exchange data, and the second server obtains a second additive slice based on the second data slice and a number of second exchange data, wherein each of the first exchange data is obtained by the second server obfuscating local operation data according to the second random parameter set, the first server uses each of the first exchange data according to the first random parameter set, each of the second exchange data is obtained by the first server obfuscating local operation data according to the first random parameter set, and the second server uses each of the second exchange data according to the second random parameter set; the first additive slice and the second additive slice are added to obtain the target Sigmoid function value corresponding to the input data. In order to retain the original Sigmoid function algorithm structure, the present invention adopts a random parameter method to achieve secure computing, which solves the problem in the prior art that the Sigmoid function in the privacy-preserving deep learning algorithm is replaced with a corresponding cryptography-friendly function for secure computing, which changes the original algorithm structure and causes the performance of the privacy-preserving deep learning algorithm to deteriorate.

[0069] like Figure 1 As shown, the method includes:

[0070] Step S100, the first server obtains a first data shard and a first random parameter set, and the second server obtains a second data shard and a second random parameter set, wherein the first data shard and the second data shard are two data shards split from the input data of the Sigmoid function, and the first random parameter set and the second random parameter set satisfy a preset operation relationship.

[0071] Specifically, in this embodiment, the first server and the second server are required to jointly complete the activation function security calculation. In order to ensure that the input data of the Sigmoid function is not leaked, this embodiment splits the input data into two data slices, namely the first data slice and the second data slice. The first data slice is distributed to the first server, and the second data slice is distributed to the second server. At the same time, the first random parameter set is respectively assigned to the first server, and the second random parameter set is assigned to the second server, wherein the first random parameter set and the second random parameter set satisfy the preset operation relationship, but the first server and the second server do not know each other's random parameter set. In one implementation method, the steps of assigning the first random parameter set to the first server and the second random parameter set to the second server can be implemented by an assisting server, for example, the assisting server generates the first random parameter set and the second random parameter set from the real number field R.

[0072] In one implementation, the operation relationship is specifically:

[0073] The first random parameter set includes two random parameter groups a j and c j,1 The second random parameter set includes two random parameter groups b j and c j,2 , the operation relationship is: a j b j =c j,1 +c j,2 , where j represents the order bit in the random parameter group, and j includes 1, 2, and 3.

[0074] Specifically, the first server and the second server each have two random parameter groups, wherein the first server has a j and c j,1 Two random parameter groups, the second server has b j and c j,2 Two random parameter groups, and these four random parameter groups satisfy a j b j =c j,1 +c j,2 For example, a1·b1=c 1,1 +c 1,2 , a2·b2=c 2,1 +c 2,2 , a3·b3=c 3,1 +c 3,2 .

[0075] like Figure 1 As shown, the method also includes:

[0076] Step S200, the first server obtains a first additive slice based on the first data slice and a plurality of first exchange data, and the second server obtains a second additive slice based on the second data slice and a plurality of second exchange data, wherein each first exchange data is obtained by the second server obfuscating local computing data according to the second random parameter set, the first server uses each first exchange data according to the first random parameter set, each second exchange data is obtained by the first server obfuscating local computing data according to the first random parameter set, and the second server uses each second exchange data according to the second random parameter set.

[0077] In short, the goal of this embodiment is that the first server calculates the first additive slice based on the first data slice assigned, and the second server calculates the second additive slice based on the second data slice assigned, wherein the first additive slice and the second additive slice are added to obtain the target Sigmoid function value corresponding to the input data. However, it is difficult for the first server to calculate the first additive slice based only on the first data slice assigned, and it is also difficult for the second server to calculate the second additive slice based only on the second data slice assigned. Therefore, the two need to exchange some local operation data with each other to assist each other in calculating the corresponding additive slice. In order to ensure that the input data is not leaked, the data to be exchanged needs to be confused by the random parameter groups owned by each of the two servers before they can be exchanged with each other. It is understandable that due to the presence of random parameters in the exchanged data after confusion, the two servers cannot know the true operation data of the other party, thereby ensuring that the two servers can only complete the current operation steps based on the exchanged data after confusion, and avoiding the two servers from deriving the complete input data. Specifically, in this embodiment, the operation data exchanged by the second server to the first server is defined as the first exchange data, wherein the first exchange data is obtained by the second server obfuscating the local operation data through the second random parameter set assigned to itself, and the first server needs to use the first random parameter set assigned to itself to complete the current operation step using the first exchange data. This is because the first random parameter set and the second random parameter set meet the preset operation relationship. Therefore, when the first server uses the first exchange data through the first random parameter set, the first random parameter set can be used to correct the influence of the random parameters contained in the first exchange data, so that the first server can avoid knowing the real local operation data of the second server and assist the first server to complete the current operation step. Similarly, in this embodiment, the operation data exchanged by the first server to the second server is defined as the second exchange data, wherein the second exchange data is obtained by the first server obfuscating the local budget data through the first random parameter set assigned to itself, and the second server needs to use the second random parameter set assigned to itself to complete the current operation step using the second exchange data.

[0078] In one implementation, step S200 specifically includes:

[0079] Step S201: the first server performs an exponential function operation according to the first data slice to obtain a first exponential function value, encrypts the first exponential function value according to the first random parameter set to obtain the first second exchange data, and sends the first second exchange data to the second server;

[0080] Step S202: the second server performs an exponential function operation according to the second data slice to obtain a second exponential function value, encrypts the second exponential function value according to the second random parameter set to obtain the first first exchange data, and sends the first first exchange data to the first server;

[0081] Step S203: the first server performs a decryption operation on the first first exchanged data according to the first random parameter set to obtain a first initial additive slice, encrypts the first initial additive slice according to the first random parameter set to obtain a second second exchanged data, and sends the second second exchanged data to the second server;

[0082] Step S204: the second server performs a decryption operation on the first second exchange data according to the second random parameter set and the first first exchange data to obtain a second initial additive slice, randomly obtains a second multiplicative slice, obtains a first exchange slice according to the second random parameter set, the second second exchange data, the second initial additive slice and the second multiplicative slice, encrypts the second multiplicative slice according to the second random parameter set to obtain a second exchange slice, obtains a second first exchange data according to the first exchange slice and the second exchange slice, and sends the second first exchange data to the first server;

[0083] Step S205: the first server performs a decryption operation on the second first exchanged data according to the first random parameter set to obtain a first multiplicative slice, encrypts the inverse of the first multiplicative slice according to the first random parameter set to obtain a third second exchanged data, and sends the third second exchanged data to the second server;

[0084] Step S206: the second server encrypts the inverse of the second multiplicative slice according to the second random parameter set to obtain the third first exchange data, and sends the third first exchange data to the first server;

[0085] Step S207: The first server performs a decryption operation on the third first exchanged data according to the first random parameter set to obtain the first additive slice, and the second server performs a decryption operation on the third second exchanged data according to the second random parameter set and the third first exchanged data to obtain the second additive slice.

[0086] Specifically, the first server will perform an exponential function operation based on the obtained first data slice to obtain a first exponential function value. In order to prevent the second server from directly obtaining the first exponential function value and deriving the first data slice, the first server needs to confuse and encrypt the first exponential function value based on the assigned first random parameter set to obtain the first second exchange data, and send it to the second server. Since the second exchange data is mixed with random parameters in the first random parameter set, the second server cannot know the specific value of the first exponential function value. Similarly, the second server will perform an exponential function operation based on the obtained second data slice to obtain a second exponential function value. In order to prevent the first server from directly obtaining the second exponential function value and deriving the second data slice, the second server needs to confuse and encrypt the second exponential function value based on the assigned second random parameter set to obtain the first first exchange data, and send it to the first server. Since the first exchange data is mixed with random parameters in the second random parameter set, the first server cannot know the specific value of the second exponential function value.

[0087] Then, the first server needs to calculate the first initial additive slice according to the first first exchange data obtained, and the second server needs to calculate the second initial additive slice according to the first second exchange data obtained, wherein the first initial additive slice and the second initial additive slice are two additive slices of a linear function. However, the Sigmoid function in this embodiment is a nonlinear function, so the first initial additive slice and the second initial additive slice cannot be output as two additive slices of the Sigmoid function in this embodiment, but can only be used as intermediate operation data. Since there are random parameters in both the first exchange data and the second exchange data, in order to correctly calculate the first initial additive slice based on the first first exchange data, the first server needs to use the first first exchange data in combination with the first random parameter set assigned to it, and after obtaining the first initial additive slice, confuse and encrypt the first initial additive slice based on the first random parameter set to obtain the second second exchange data, and send it to the second server.

[0088] Similarly, in order to correctly calculate the second initial additive slice based on the first second exchange data, the second server needs to use the first second exchange data in combination with the second random parameter set assigned to itself and the calculated first first exchange data. At the same time, in order to calculate the nonlinear function, that is, the two additive slices of the Sigmoid function, the strategy of this embodiment is to first calculate the two multiplicative slices of the Sigmoid function, that is, the product of the first multiplicative slice and the second multiplicative slice is equal to the Sigmoid function value, wherein the second multiplicative slice is obtained in a random manner, and the first multiplicative slice is then calculated based on the second multiplicative slice. The specific value. Specifically, the second server randomly obtains a second multiplicative slice, and then uses the second second exchange data in combination with the random parameters in the second random parameter set, the calculated second initial additive slice, and the obtained second multiplicative slice to obtain the first exchange slice. The second multiplicative slice is then encrypted by the random parameters in the second random parameter set to obtain the second exchange slice, and the second first exchange data is generated based on the two exchange slices, and sent to the first server. It is understandable that, since both exchange slices have random parameters in the second random parameter set, the first server that receives the second first exchange data cannot obtain the specific value of the second multiplicative slice, thereby ensuring the security of the input data.

[0089] Then, the first server obtains the first multiplicative slice by combining the random parameters in the first random parameter set obtained by the distribution with the second first exchange data, and then encrypts the inverse of the first multiplicative slice by the random parameters in the first random parameter set to obtain the third second exchange data, and sends it to the second server. Since the third second exchange data contains the random parameters in the first random parameter set, the second server cannot deduce the specific value of the first multiplicative slice through the third second exchange data, thereby ensuring the security of the input data.

[0090] Afterwards, the second server encrypts the inverse of the second multiplicative slice using the random parameters in the second random parameter set obtained by the allocation to obtain the third first exchange data, and sends it to the first server. Since the third first exchange data contains the random parameters in the second random parameter set, the first server cannot deduce the specific value of the second multiplicative slice through the third first exchange data, thereby ensuring the security of the input data.

[0091] Finally, the first server combines the random parameters in the first random parameter set and the third first exchange data to calculate the first additive slice. Since the random parameters in the first random parameter set can offset the influence of the random parameters used for obfuscation in the third first exchange data, the first server can correctly calculate the first additive slice. Similarly, the second server combines the random parameters in the second random parameter set, the third first exchange data, and the third second exchange data to correctly calculate the second additive slice.

[0092] In one implementation, the first exponential function value is The first of the second exchanged data is d1, and the first exponential function value is encrypted according to the first random parameter set to obtain the first of the second exchanged data, including:

[0093] Step S2011, obtaining a1 in the first random parameter set;

[0094] Step S2012: and a1 to obtain d1, where

[0095] Specifically, the first data slice included in the first server is [x]1, so the first exponential function value obtained by the first server based on the first data slice by performing an exponential function operation is The first random parameter set allocated to the first service group includes two groups of random parameters, one of which is a j , the other group is c j,1 In order to To confuse, the first server will use a j The first random parameter a1 in the group Encryption, to obtain the first second exchange data d1, where d1 is Since the second server cannot know the specific value of a1, it cannot deduce the difference between d1 and a1 after obtaining d1. Therefore, [x]1 cannot be derived, thus ensuring the security of the input data.

[0096] In one implementation, the first first exchange data is d2, and the second exponential function value is The step of encrypting the second exponential function value according to the second random parameter set to obtain the first first exchange data includes:

[0097] Step S2021, obtaining b1 in the second random parameter set;

[0098] Step S2022: and b1 to obtain d2, where

[0099] Specifically, the second data slice included in the second server is [x]2, so the second exponential function value obtained by the second server based on the second data slice by performing the exponential function operation is The second random parameter set allocated to the second service group includes two groups of random parameters, one of which is b j , the other group is c j,2 In order to To confuse, the second server will use b j The first random parameter b1 in the group Encryption, to obtain the first exchange data d2, where d2 is Since the first server cannot know the specific value of b1, it cannot deduce the difference between d2 and b1 after obtaining d2. Therefore, [x]2 cannot be derived, thus ensuring the security of the input data.

[0100] In one implementation, the first initial additive fragment is [f]1, and the first server performs a decryption operation on the first exchanged data according to the first random parameter set to obtain the first initial additive fragment, including:

[0101] Step S2031: Obtain c in the first random parameter set 1,1 ;

[0102] Step S2032: According to a1, c 1,1 and d2 to obtain [f]1, where [f]1=1+a1·d2+c1,1

[0103] Specifically, the first server needs to use the second exponential function value The first initial additive slice [f]1 is calculated, wherein the first initial additive slice [f]1 is an additive slice of the linear function. However, the first exchange data d2 obtained by the first server contains not only the second exponential function value b1 in the second random parameter set is also mixed in. Therefore, in order to correctly calculate the first initial additive fragment [f]1, the first server needs to use a1 and c1 in the first random parameter set assigned to it. 1,1 To correct the interference value b1, where [f]1 is equal to the product of a1 and d2, c 1,1 And the combination of 1.

[0104] In one implementation, the second second exchanged data is m1, and the encrypting the first initial additive slice according to the first random parameter set to obtain the second second exchanged data includes:

[0105] Step S2033, obtaining a2 in the first random parameter set;

[0106] Step S2034, obtain m1 according to [f]1 and a2, where m1=[f]1-a2.

[0107] Specifically, the first server also needs to send the first initial additive slice [f]1 to the second server to assist the second server in the next step of calculation. In order to ensure the security of the input data, it is necessary to prevent the second server from directly knowing the specific value of the first initial additive slice [f]1. ​​Therefore, the first server needs to confuse the first initial additive slice [f]1 based on a2 in the assigned first random parameter set to obtain the second second exchange data m1, where m1 = [f]1-a2. After the second server obtains the second second exchange data m1, since the second second exchange data m1 not only contains the first initial additive slice [f]1 but also contains the random parameter a2, the second server cannot know the specific value of the first initial additive slice [f]1, thereby ensuring the security of the input data.

[0108] In one implementation, the second initial additive fragment is [f]2, and the second server performs a decryption operation on the first second exchange data according to the second random parameter set and the first first exchange data to obtain the second initial additive fragment, including:

[0109] Step S2041: Obtain c in the second random parameter set 1,2 ;

[0110] Step S2042: According to b1, d1, d2 and c 1,2 We get [f]2, where [f]2 = b1·d1+d1·d2+c 1,2

[0111] Specifically, after the second server obtains the first second exchange data, it needs to calculate the second initial additive fragment [f]2 corresponding to the first initial additive fragment [f]1 based on the first second exchange data, wherein the linear function value corresponding to the input data is obtained by superimposing the first initial additive fragment [f]1 and the second initial additive fragment [f]2. Since the first second exchange data contains the random parameter a1, in order to eliminate the influence of a1 on the calculation result, the second server needs to use b1 and c1 in the second random parameter set assigned to it. 1,2 To eliminate the influence of a1 on the calculation result, we can get the accurate second initial additive fragment [f]2, where [f]2 = b1·d1+d1·d2+c 1,2 .

[0112] In one implementation, the second multiplicative slice is 2, the first exchange slice is m2, the second exchange slice is m2′, the second first exchange data is (m2, m2′), the first exchange slice is obtained according to the second random parameter set, the second second exchange data, the second initial additive slice and the second multiplicative slice, the second exchange slice is encrypted according to the second random parameter set to obtain the second exchange slice, and the second first exchange data is obtained according to the first exchange slice and the second exchange slice, including:

[0113] Step S2043: Obtain b2 and c in the second random parameter set. 2,2 ;

[0114] Step S2044: According to c 2,2 、m1、 2 and [f]2 to obtain m2, where

[0115] Step S2045: According to b2 and 2 to obtain m2′, where

[0116] Step S2046, obtain (m2, m2') according to m2 and m2'.

[0117] In simple terms, the second server obtains the second multiplicative fragment in a random manner on the real number field that does not contain 0. 2. In order to assist the first server in calculating the first multiplicative slice corresponding to the second multiplicative slice (the first multiplicative slice is multiplied by the second multiplicative slice to obtain the Sigmoid function value corresponding to the input data), the second server needs to convert the second initial additive slice [f]2 and the second multiplicative slice 2 is sent to the first server. In order to ensure the security of the input data, the first server cannot be informed of the second initial additive fragment [f]2 and the second multiplicative fragment 2, so the second server needs to use the random parameters in the second random parameter set and the second exchange data to obtain the second initial additive fragment [f]2 and the second multiplicative fragment 2 after obfuscation, the second first exchange data (m2, m2') is obtained, and then the second first exchange data (m2, m2') is sent to the first server. Specifically, the second first exchange data (m2, m2') includes two exchange slices, namely the first exchange slice m2 and the second exchange slice m2'. The second server selects b2 and c in the second random parameter set. 2,2 , according to c 2,2 、m1、 2 and [f]2 to obtain m2, according to b2 and 2 to obtain m2′, where the calculation formulas for m2 and m2′ are as follows:

[0118]

[0119]

[0120] After the first server obtains the second first exchange data (m2, m2′), since the second first exchange data (m2, m2′) is mixed with random parameters b2 and c 2,2 , so the first server cannot know the second initial additive fragment [f]2 and the second multiplicative fragment 2, thus ensuring the security of input data.

[0121] In one implementation, the first multiplicative slice is 1. The first server performs a decryption operation on the second first exchanged data according to the first random parameter set to obtain a first multiplicative slice, including:

[0122] Step S2051: Obtain a2 and c in the first random parameter set 2,1 ;

[0123] Step S2052: According to a2 and c 2,1 And (m2, m2′) we get 1, where 1=m2+a2·m2′-c 2,1 .

[0124] Specifically, the first server needs to calculate the first multiplicative fragment with the help of the second first exchange data obtained 1, however, since the second first exchange data (m2, m2′) contains random parameters b2 and c 2,2 , so the first server calculates the first multiplicative fragment through the second first exchange data 1, we also need to use a2 and c in the first random parameter set 2,1 To eliminate the random parameters b2 and c 2,2 The influence of , so as to correctly calculate the first multiplicative fragment 1, where 1=m2+a2·m2′-c 2,1 .

[0125] In one implementation, the third second exchange data is w1, and encrypting the inverse of the first multiplicative slice according to the first random parameter set to obtain the third second exchange data includes:

[0126] Step S2053, obtaining a3 in the first random parameter set;

[0127] Step S2054: According to a3 and 1 to get w1, where

[0128] Specifically, the first server calculates the first multiplicative fragment 1, the first multiplication needs to be sliced The reciprocal of 1 is sent to the second server to assist the second server in the next step of calculation. In order to ensure the security of the input data, the first server cannot directly send the first multiplicative slice 1 is sent to the second server, but the first multiplicative sharding is performed based on the random parameter a3 in the first random parameter set assigned to it. 1 is obfuscated to obtain the third second exchange data w1, and the third second exchange data w1 is sent to the second server, wherein, Since the third second exchange data is w1 mixed with random parameter a3, the second server cannot know the first multiplicative fragment The specific value of the reciprocal of 1 ensures the security of the input data.

[0129] In one implementation, the third first exchange data is w2, and the second server encrypts the inverse of the second multiplicative slice according to the second random parameter set to obtain the third first exchange data, including:

[0130] Step S2061, obtaining b3 in the second random parameter set;

[0131] Step S2062: According to b3 and 2 to get w2, where

[0132] Specifically, the second server needs to locally calculate the second multiplicative fragment The reciprocal of 2 is sent to the first server to assist the first server in the next step of calculation. In order to ensure the security of the input data, the second server cannot directly send the second multiplicative slice. 2, but needs to be assigned to the second random parameter set by the random parameter b3 for the second multiplicative sharding 2 to confuse the third first exchange data w2, where The third first exchange data w2 is then sent to the first server. Since the third first exchange data w2 also includes the random parameter b3, the first server cannot deduce the second multiplicative fragment from the third first exchange data w2. The reciprocal of 2 ensures the security of input data.

[0133] In one implementation, the first additive slice is [S(x)]1, and the first server performs a decryption operation on the third first exchanged data according to the first random parameter set to obtain the first additive slice, including

[0134] Step S2071: Obtain c in the first random parameter set 3,1 ;

[0135] Step S2072: According to a3, c 3,1 and w2 to obtain [S(x)]1, where [S(x)]1=a3·w2+c 3,1 .

[0136] Specifically, the first server needs to use the second multiplicative fragment in the third first exchange data w2 2 can calculate the first additive slice [S(x)]1, where the first additive slice is an additive slice of the Sigmoid function value corresponding to the input data. Since the third first exchange data w2 also contains the random parameter b3, in order to eliminate the influence of the random parameter b3 on the calculation result, the first server needs to use the random parameters a3 and c3 in the first random parameter set when calculating the first additive slice [S(x)]1. 3,1 , and the third first exchange data w2 together to obtain the first additive fragment [S(x)]1, through the random parameters a3, c 3,1 Offset the influence of random parameter b3 on the calculation result, where [S(x)]1=a3·w2+c 3,1 .

[0137] In one implementation, the second additive slice is [S(x)]2, and the second server performs a decryption operation on the third second exchanged data according to the second random parameter set and the third first exchanged data to obtain the second additive slice, including:

[0138] Step S2073: Obtain c in the second random parameter set. 3,2 ;

[0139] Step S2074: According to b3 and c 3,2 , w1 and w2 to obtain [S(x)]2, where [S(x)]2 = b3·w1+w1·w2+c 3,2 .

[0140] Specifically, the second server needs to use the first multiplicative fragment in the third second exchange data w1 1 can calculate the second additive slice [S(x)]2, where the first additive slice [S(x)]1 and the second additive slice [S(x)]2 are superimposed to obtain the Sigmoid function value corresponding to the input data. Since the third second exchange data w1 also contains random parameter a3, in order to eliminate the influence of random parameter a3 on the calculation result, the second server needs to combine the random parameters b3 and c3 in the second random parameter set. 3,2 , the third second exchange data w1 and the third first exchange data w2 are calculated together to obtain the second additive fragment [S(x)]2, and the random parameters a3 and c 3,1 Offset the influence of random parameter b3 on the calculation result, where [S(x)]2 = b3·w1+w1·w2+c 3,2 .

[0141] For reference, this embodiment provides an example process of a method for securely calculating an activation function:

[0142] In the secure Sigmoid function algorithm, server S1 has the first share [x]1 of the input data x, and S2 has the second share [x]2 of the input data x. With the help of the assisting server T, they can output the additive share of the function value S(x) of the Sigmoid function at x, f1 = [S(x)]1 and f2 = [S(x)]2, respectively. The specific construction of the algorithm is as follows:

[0143] Input: Server S1 inputs [x]1, server S2 inputs [x]2.

[0144] Output: Server S1 outputs f1 = [S(x)]1, and server S2 outputs f2 = [S(x)]2.

[0145] Offline stage:

[0146] Step 1: Assist server T to generate three sets of four-tuples from R (a j , b j , c j,1 , c j,2 ), where j = 1, 2, 3, satisfying a j b j =c j,1 +c j,2 .

[0147] Step 2: Assist server T to convert (a j , c j,1 ) is sent to server S1, (b j , c j,2 ) is sent to server S2.

[0148] Online stage:

[0149] Step 1: Servers S1 and S2 calculate and And send the calculation results to the other party;

[0150] Step 2: Server S2 calculates [f]2 = b1·d1+d1·d2+c 1,2 ;

[0151] Step 3: Server S1 calculates [f]1 = 1 + a1·d2 + c 1,1 ,m1=[f]1-a2, and send m1 to server S2;

[0152] Step 4: Server S2 randomly selects 2∈R * ,calculate And send (m2, m2′) to server S1;

[0153] Step 5: Server S1 calculation 1=m2+a2·m2′-c 2,1 ;

[0154] Step 6: Servers S1 and S2 calculate And send it to the other party;

[0155] Step 7: Servers S1 and S2 calculate [S(x)]1=a3·w2+c 3,1 and [S(x)]2 = b3·w1+w1·w2+c 3,2 , and output the calculation results.

[0156] Based on the above embodiments, the present invention also provides a Tanh function security calculation method, such as Figure 2 As shown, the method includes:

[0157] Step S10: The first server obtains a third data slice, and the second server obtains a fourth data slice, wherein the third data slice and the fourth data slice are two data slices split from a value twice the input data;

[0158] Step S20: The first server executes the activation function security calculation method according to the third data slice to obtain a third Sigmoid function score, and obtains a first Tanh function score according to a difference between twice the third Sigmoid function score and 1;

[0159] Step S30: the second server executes the activation function security calculation method according to the fourth data slice to obtain a fourth Sigmoid function score, and obtains the first Tanh function score according to twice the fourth Sigmoid function score, wherein the sum of the third Sigmoid function score and the fourth Sigmoid function score is equal to the Sigmoid function value corresponding to the double value of the input data;

[0160] Step S40: Obtain a target Tanh function value corresponding to the input data according to the first Tanh function score and the second Tanh function score.

[0161] In short, the goal of this embodiment is to input [x]1 to the first server and [x]2 to the second server, and then the first server outputs the first Tanh function score [T(x)]1, and the second server outputs the second Tanh function score [T(x)]2. Specifically, the first server performs the above-mentioned activation function security calculation method based on [2x]1 to obtain [S(2x)]1, and the second server performs the above-mentioned activation function security calculation method based on [2x]2 to obtain [S(2x)]2. Then the first server calculates the first Tanh function score [T(x)]1=2[S(2x)]1-1, and the second server calculates the second Tanh function score [T(x)]2=2[S(2x)]2, and outputs the calculation results respectively, and the first Tanh function score [T(x)]1 and the second Tanh function score [T(x)]2 are added to obtain the Tanh function value corresponding to the input data.

[0162] For reference, this embodiment provides an example process of a Tanh function security calculation method:

[0163] In the secure Tanh function algorithm, server S1 has the first share [x]1 of the input data x, and S2 has the second share [x]2 of the input data x. With the help of the assisting server T, they can output the additive share of the function value T(x) of the Sigmoid function at x, f1 = [T(x)]1 and f2 = [T(x)]2, respectively. The specific construction of the algorithm is as follows:

[0164] Input: Server S1 inputs [x]1, Server S2 inputs [x]1.

[0165] Output: Server S1 outputs f1 = [T(x)]1, and server S2 outputs f2 = [T(x)]2.

[0166] Offline stage:

[0167] Step 1: Assist server T to generate three sets of four-tuples from R (a j , b j , c j,1 , c j,2 ), where j = 1, 2, 3, satisfying a j b j =c j,1 +c j,2 .

[0168] Step 2: Assist server T to convert (a j , c j,1 ) is sent to server S1, (b j , c j,2 ) is sent to server S2.

[0169] Online stage:

[0170] Step 1: Servers S1 and S2 take [2x]1 and [2x]2 as input, execute the secure Sigmoid algorithm, and output [S(2x)]1 and [S(2x)]2 respectively.

[0171] Step 2: Servers S1 and S2 calculate [T(x)]1=2[S(2x)]1-1 and [T(x)]2=2[S(2x)]2 respectively, and output the calculation results.

[0172] In order to prove the correctness of the technical solution of the present invention, the inventors made the following inferences:

[0173] To prove the correctness of the Sigmoid function security calculation method, it is necessary to prove that the sum of the output values ​​[S(x)]1 and [S(x)]2 obtained by the computing server through the Sigmoid function security calculation method is equal to [S(x)].

[0174] According to the construction of the activation function security calculation method of the present invention, it can be proved that the following equation holds true:

[0175]

[0176] Therefore, it can be proved that the activation function security calculation method of the present invention meets the correctness requirements.

[0177] Based on the correctness of the activation function security calculation method of the present invention and the construction of the Tanh function security calculation of the present invention, it can be proved that the following equation holds:

[0178] [T(x)]1+[T(x)]2=2[S(2x)]1-1+2[S(2x)]2=2S(2x)-1=Tanh(x)

[0179] Therefore, it can be proved that the Tanh function security calculation method of the present invention meets the correctness requirements.

[0180] Safety Proof:

[0181] To prove the security of the algorithm designed by the present invention, it is necessary to prove that Theorem 1 holds.

[0182] Before proving Theorem 1, we first give the following lemma.

[0183] Lemma 1: If a is uniformly randomly distributed in the real number field R and is independent of b, then a+b is also uniformly randomly distributed in R and is independent of b.

[0184] Lemma 2: If all sub-algorithms that make up a secure algorithm are secure under the semi-honest model, then the algorithm itself is also secure under the semi-honest model.

[0185] Theorem 1: The algorithm designed by this invention is secure under the semi-honest model.

[0186] Proof: In the Sigmoid function secure computing method, assume that the semi-honest adversary A controls the computing second server S2. At this time, A can obtain all the information in the view of the second server S2. At this time, A will comply with the Sigmoid function secure computing method to operate, but A will try to obtain more information that the algorithm does not allow through the information it has. At this time, it only needs to prove that there is a simulator S with probabilistic polynomial time, which can simulate the views of the first server S1 and the assisting server T during the execution of the algorithm, so that the adversary A cannot distinguish between the simulated view and the real view.

[0187] First, the assisting server T only generates random numbers that meet the public conditions in the offline stage. Therefore, there exists a polynomial time simulator S that can simulate the view of the assisting server T by randomly generating random numbers that meet the public conditions, so that the semi-honest adversary A cannot distinguish between the simulated view and the real view.

[0188] Secondly, during the execution of the Sigmoid function security calculation method, the view of server S1 is:

[0189] {[x]1, d1, [f]1, m1, 1,w,1,[S(x)]1}

[0190] In steps 1 to 3, the information in the view of the first server S1 includes:

[0191] {[x]1, d1, [f]1, m1}, where [f]1=1+a1·d2+c 1,1 , m1=[f]1-a2

[0192] During the execution, the first server S1 only needs to send d1 and m1 to the second server S2, because the values ​​{a1, a2} are randomly and uniformly selected by the assisting server T on R according to the public conditions and then sent to the first server S1 in secret. Therefore, for the second server S2, they are randomly and uniformly distributed on R. According to Lemma 1, for the second server S2, {d1, m1} are also randomly and uniformly distributed on R. In steps 4 to 6, the information in the view of the first server S1 includes:

[0193]

[0194] in:

[0195] 1=m2+a2·m2′-c 2,1 ,

[0196] And during the execution of the algorithm, only w1 needs to be sent to the second server S2. Similarly, because a3 is randomly and uniformly distributed on R for the second server S2, it can be seen from Lemma 1 that the value of w1 is also randomly and uniformly distributed on R for the second server S2. From the above, it can be seen that during the execution of the algorithm, for the second server S2, the information it obtains from the first server S1 is randomly and uniformly distributed on R. Therefore, there is a probabilistic polynomial time simulator S. During the execution of the algorithm, the view of the first server S1 can be simulated by randomly and uniformly selecting random numbers that meet the public conditions on R, so that the second server S2 cannot distinguish between the simulated view and the real view. Therefore, the Sigmoid function security calculation method of the present invention is safe under the semi-honest model.

[0197] Because the Tanh function security calculation method designed by the present invention is constructed based on the Sigmoid function security calculation method, it can be seen from Lemma 2 that because the Sigmoid function security calculation method is secure under the semi-honest model, the Tanh function security calculation method is also secure under the semi-honest model. In summary, Theorem 1 is proved.

[0198] Technical effects of the present invention:

[0199] First, in terms of performance, the method designed by the present invention can realize the secure calculation of Sigmoid and Tanh functions. Therefore, when using the Sigmoid secure calculation method and Tanh secure calculation method designed by the present invention for training and prediction under privacy protection, there is no need to replace the Sigmoid and Tanh functions in the original deep learning algorithm, so that the performance of the model trained by the privacy-preserving deep learning algorithm is correspondingly improved compared with the algorithm in the prior art solution;

[0200] Secondly, as shown in Table 1 below, in terms of communication efficiency, the Sigmoid security calculation method and Tanh security calculation method designed by the present invention have greatly improved communication efficiency compared with the existing technical solutions. Specifically, the Sigmoid security calculation method and Tanh security calculation method designed by the present invention require a total of 4 rounds of communication, and the communication complexity is 71 bits, where l = 32 or 64. The optimal solution for the existing approximate calculation of the secure Sigmoid function is to replace the Sigmoid function with a piecewise function in BALZE. The algorithm requires 10 rounds of communication, and the communication volume is (6k+33)1 bits, where k is the value of the security parameter.

[0201] Table 1. Comparison of communication rounds and communication complexity

[0202] plan Calculation method Communication rounds Communication complexity BALZE Approximate calculation 10 (6k+33)l The present invention Precise calculation 4 7l

[0203] Finally, because the Sigmoid secure computing method and Tanh secure computing method designed by the present invention are constructed on the real number domain and support floating point type operations, they can theoretically directly support the use of GPU to accelerate the algorithm, while the current existing privacy-preserving deep learning algorithms cannot effectively support GPU for accelerated computing. Considering the extremely high computational complexity of the privacy-preserving deep learning algorithm, this advantage can effectively improve the practicality of the privacy-preserving deep learning algorithm.

[0204] Based on the above embodiments, the present invention also provides an activation function security calculation system, the system comprising a first server and a second server, the first server and the second server are used to execute relevant steps in the activation function security calculation method as described in any of the above items.

[0205] Based on the above embodiments, the present invention also provides a Tanh function secure computing system, the system comprising a first server and a second server, the first server and the second server being used to execute relevant steps in the Tanh function secure computing method as described in any one of the above items.

[0206] In summary, the present invention discloses a method for securely calculating an activation function and a method for securely calculating a Tanh function. The method obtains a first data slice and a first random parameter set by a first server, and obtains a second data slice and a second random parameter set by a second server, wherein the first data slice and the second data slice are two data slices split from the input data of the Sigmoid function, and the first random parameter set and the second random parameter set satisfy a preset operation relationship; the first server obtains a first additive slice based on the first data slice and a number of first exchange data, and the second server obtains a second additive slice based on the second data slice and a number of second exchange data, wherein each of the first exchange data is obtained by the second server obfuscating local operation data according to the second random parameter set, the first server uses each of the first exchange data according to the first random parameter set, each of the second exchange data is obtained by the first server obfuscating local operation data according to the first random parameter set, and the second server uses each of the second exchange data according to the second random parameter set; the first additive slice and the second additive slice are added to obtain the target Sigmoid function value corresponding to the input data. In order to retain the original Sigmoid function algorithm structure, the present invention adopts a random parameter method to achieve secure computing, which solves the problem in the prior art that the Sigmoid function in the privacy-preserving deep learning algorithm is replaced with a corresponding cryptography-friendly function for secure computing, which changes the original algorithm structure and causes the performance of the privacy-preserving deep learning algorithm to deteriorate.

[0207] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A method for secure calculation of an activation function, characterized in that: The method comprises: The first server obtains a first data shard and a first random parameter set, and the second server obtains a second data shard and a second random parameter set, wherein the first data shard and the second data shard are two data shards split from the input data of the Sigmoid function, and the first random parameter set and the second random parameter set satisfy a preset operation relationship; The first server obtains a first additive slice based on the first data slice and a plurality of first exchange data, and the second server obtains a second additive slice based on the second data slice and a plurality of second exchange data, wherein each first exchange data is obtained by the second server obfuscating local computing data according to the second random parameter set, the first server uses each first exchange data according to the first random parameter set, each second exchange data is obtained by the first server obfuscating local computing data according to the first random parameter set, and the second server uses each second exchange data according to the second random parameter set; Adding the first additive slice and the second additive slice to obtain a target Sigmoid function value corresponding to the input data; The first server obtains a first additive slice based on the first data slice and a plurality of first exchanged data, and the second server obtains a second additive slice based on the second data slice and a plurality of second exchanged data, including: The first server performs an exponential function operation according to the first data slice to obtain a first exponential function value, encrypts the first exponential function value according to the first random parameter set to obtain the first second exchange data, and sends the first second exchange data to the second server; The second server performs an exponential function operation according to the second data slice to obtain a second exponential function value, encrypts the second exponential function value according to the second random parameter set to obtain the first first exchange data, and sends the first first exchange data to the first server; The first server performs a decryption operation on the first first exchange data according to the first random parameter set to obtain a first initial additive slice, encrypts the first initial additive slice according to the first random parameter set to obtain a second second exchange data, and sends the second second exchange data to the second server; The second server performs a decryption operation on the first second exchange data according to the second random parameter set and the first first exchange data to obtain a second initial additive slice, randomly obtains a second multiplicative slice, obtains a first exchange slice according to the second random parameter set, the second second exchange data, the second initial additive slice and the second multiplicative slice, encrypts the second multiplicative slice according to the second random parameter set to obtain a second exchange slice, obtains a second first exchange data according to the first exchange slice and the second exchange slice, and sends the second first exchange data to the first server; The first server performs a decryption operation on the second first exchange data according to the first random parameter set to obtain a first multiplicative slice, encrypts the inverse of the first multiplicative slice according to the first random parameter set to obtain a third second exchange data, and sends the third second exchange data to the second server; The second server encrypts the inverse of the second multiplicative slice according to the second random parameter set to obtain a third first exchange data, and sends the third first exchange data to the first server; The first server performs a decryption operation on the third first exchanged data according to the first random parameter set to obtain the first additive slice, and the second server performs a decryption operation on the third second exchanged data according to the second random parameter set and the third first exchanged data to obtain the second additive slice.

2. The activation function security calculation method according to claim 1, characterized in that: The first random parameter set includes two random parameter groups a j and c j,1 The second random parameter set includes two random parameter groups b j and c j,2 , the operation relationship is: a j b j =c j,1 +c j,2 , where j represents the order bit in the random parameter group, and j includes 1, 2, and 3.

3. The activation function security calculation method according to claim 2, characterized in that: The first exponential function value is The first of the second exchanged data is d1, and the first exponential function value is encrypted according to the first random parameter set to obtain the first of the second exchanged data, including: Obtaining a1 in the first random parameter set; according to and a1 to obtain d1, where 4. The activation function security calculation method according to claim 3, characterized in that: The first exchange data is d2, and the second exponential function value is The step of encrypting the second exponential function value according to the second random parameter set to obtain the first first exchange data includes: Obtain b1 in the second random parameter set; according to and b1 to obtain d2, where 5. The activation function security calculation method according to claim 4, characterized in that: The first initial additive fragment is [f]1, and the first server performs a decryption operation on the first exchanged data according to the first random parameter set to obtain the first initial additive fragment, including: Get c in the first random parameter set 1,1 ; According to a1, c 1,1 and d2 to obtain [f]1, where [f]1=1+a1·d2+c 1,1 .

6. The activation function security calculation method according to claim 5, characterized in that: The second second exchanged data is m1, and the first initial additive slice is encrypted according to the first random parameter set to obtain the second second exchanged data, including: Obtaining a2 in the first random parameter set; Based on [f]1 and a2, m1 is obtained, where m1 = [f]1-a2.

7. The activation function security calculation method according to claim 6, characterized in that: The second initial additive fragment is [f]2, and the second server performs a decryption operation on the first second exchange data according to the second random parameter set and the first first exchange data to obtain the second initial additive fragment, including: Get c in the second random parameter set 1,2 ; According to b1, d1, d2 and c 1,2 We get [f]2, where [f]2 = b1·d1+d1·d2+c 1,2 .

8. The activation function security calculation method according to claim 7, characterized in that: The second multiplicative slice is 2, the first exchange slice is m2, the second exchange slice is m2′, the second first exchange data is (m2, m2′), the first exchange slice is obtained according to the second random parameter set, the second second exchange data, the second initial additive slice and the second multiplicative slice, the second exchange slice is encrypted according to the second random parameter set to obtain the second exchange slice, and the second first exchange data is obtained according to the first exchange slice and the second exchange slice, including: Get b2 and c in the second random parameter set 2,2 ; According to c 2,2 、m1、 2 and [f]2 to obtain m2, where According to b2 and 2 to obtain m2′, where Based on m2 and m2′, we get (m2, m2′).

9. The activation function security calculation method according to claim 8, characterized in that: The first multiplicative slice is 1. The first server performs a decryption operation on the second first exchanged data according to the first random parameter set to obtain a first multiplicative slice, including: Get a2 and c in the first random parameter set 2,1 ; According to a2, c 2,1 And (m2, m2′) we get 1, among which, <h2 style=";text-align:left;direction:ltr">1 = m2 + a2 m2′ - c<h2 style=";text-align:left;direction:ltr"> 2,1 <h2 style=";text-align:left;direction:ltr"> 。 10. The activation function security calculation method according to claim 9, characterized in that: The third second exchange data is w1, and the third second exchange data is obtained by encrypting the inverse of the first multiplicative slice according to the first random parameter set, including: Obtaining a3 in the first random parameter set; According to a3 and 1 to get w1, where 11. The activation function secure calculation method according to claim 10, characterized in that: The third first exchange data is w2, and the second server encrypts the inverse of the second multiplicative slice according to the second random parameter set to obtain the third first exchange data, including: Obtain b3 from the second random parameter set; According to b3 and 2 to get w2, where 12. The activation function secure calculation method according to claim 11, characterized in that: The first additive slice is [S(x)]1, and the first server performs a decryption operation on the third first exchanged data according to the first random parameter set to obtain the first additive slice, including Get c in the first random parameter set 3,1 ; According to a3, c 3,1 and w2 to obtain [S(x)]1, where [S(x)]1 = a3·w2+c 3,1 .

13. The activation function secure calculation method according to claim 12, characterized in that: The second additive slice is [S(x)]2, and the second server performs a decryption operation on the third second exchanged data according to the second random parameter set and the third first exchanged data to obtain the second additive slice, including: Get c in the second random parameter set 3,2 ; According to b3, c 3,2 , w1 and w2 to obtain [S(x)]2, where [S(x)]2 = b3·w1+w1·w2+c 3,2 .

14. A Tanh function secure calculation method, characterized in that: The method is implemented based on the activation function security calculation method according to any one of claims 1 to 13, and the method includes: The first server obtains a third data slice, and the second server obtains a fourth data slice, wherein the third data slice and the fourth data slice are two data slices split from a value twice the input data; The first server executes the activation function security calculation method according to the third data slice to obtain a third Sigmoid function score, and obtains a first Tanh function score according to a difference between twice the third Sigmoid function score and 1; The second server executes the activation function security calculation method according to the fourth data slice to obtain a fourth Sigmoid function score, and obtains the first Tanh function score according to the second Sigmoid function score, wherein the sum of the third Sigmoid function score and the fourth Sigmoid function score is equal to the Sigmoid function value corresponding to the double value of the input data; A target Tanh function value corresponding to the input data is obtained according to the first Tanh function score and the second Tanh function score.

15. An activation function secure computing system, characterized in that: The system includes a first server and a second server, and the first server and the second server are used to execute relevant steps in the activation function security calculation method as described in any one of claims 1-13.

16. A Tanh function secure computing system, characterized in that: The system includes a first server and a second server, and the first server and the second server are used to execute relevant steps in the Tanh function security calculation method as described in claim 14.

Citation Information

Patent Citations

  • Privacy protection data processing method, device and equipment and machine learning system

    CN112000990A