Data processing methods, apparatus, equipment and storage media

By using polynomial encryption and homomorphic accumulation, the training overhead of the federated learning model is reduced, training efficiency and accuracy are improved, and the problem of low efficiency caused by high-dimensional operations during the training process of the federated learning model is solved.

CN116976462BActive Publication Date: 2026-11-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310809617.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2026-11-17
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

Federated learning models have high training overhead and low efficiency, mainly due to the high-dimensional operations caused by the large number of matrix calculations required during training.

Method used

By using multinomial encryption and homomorphic accumulation, the training overhead of the federated learning model is reduced, and the training efficiency is improved. The specific steps include: a first device encrypts the gradient values ​​using a first public-key multinomial to generate gradient ciphertext, and processes it using an automorphic public key and a transformation public key to reduce the amount of histogram ciphertext and the number of transformations; a second device then decrypts and trains the model.

Benefits of technology

This reduces the computational load during the training process of federated learning models, improves training efficiency, and provides more information while ensuring data privacy and improving training accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116976462B_ABST
    Figure CN116976462B_ABST
Patent Text Reader

Abstract

This application discloses a data processing method, apparatus, device, and storage medium applied to artificial intelligence technology. The method includes: obtaining gradient ciphertext, K automorphic public keys, and a transformation public key from a first device; performing homomorphic accumulation processing on the gradient ciphertext according to m index sets to obtain m candidate gradient histogram ciphertexts of a federated learning model; merging every two candidate gradient histogram ciphertexts in the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts; transforming the m / 2 merged gradient histogram ciphertexts according to the K automorphic public keys and the transformation public key to obtain the target gradient histogram ciphertext of the federated learning model; and sending the target gradient histogram ciphertext to the first device. This application can reduce the training overhead of the federated learning model and improve its training efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to fields such as artificial intelligence technology, and in particular to a data processing method, apparatus, device, and storage medium. Background Technology

[0002] Artificial intelligence software technologies mainly include computer vision, speech recognition, natural language processing, and machine learning / deep learning. Among these, machine learning models require a large amount of training data to meet user needs. However, this training data is often distributed across different institutions or departments within the same institution, making data sharing impossible due to privacy restrictions. To avoid privacy breaches, federated learning models, based on multi-party training, have emerged. Participants can share encrypted intermediate results with other participants, who then determine training parameters and train the model accordingly. However, implementation has revealed that the training process of federated learning models involves numerous high-dimensional operations such as matrix calculations, resulting in high training overhead and low efficiency. Summary of the Invention

[0003] This application provides a data processing method, apparatus, device, and storage medium to reduce the training overhead of federated learning models and improve their training efficiency.

[0004] One embodiment of this application provides a data processing method, including:

[0005] The gradient ciphertext, K automorphic public keys, and a transformation public key are obtained from the first device. The gradient ciphertext is obtained by encrypting n gradient values ​​based on the first public key polynomial of the first device. The K automorphic public keys and the transformation public key are determined based on the first private key polynomial and the second private key polynomial corresponding to the first public key polynomial. n and K are integers greater than 1.

[0006] Based on m index sets, the gradient ciphertext is homomorphically accumulated to obtain m candidate gradient histogram ciphertexts for the federated learning model; the m index sets are obtained by binning the n training samples based on the sample features of the n training samples; m is an integer greater than 1.

[0007] Merge every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts;

[0008] Based on the K automorphic public keys and the transformation public key, the m / 2 merged gradient histogram ciphertexts are transformed to obtain the target gradient histogram ciphertext of the federated learning model, and the target gradient histogram ciphertext is sent to the first device; the first device is used to train the federated learning model based on the target gradient histogram plaintext, where the target gradient histogram plaintext is obtained by decrypting the target gradient histogram ciphertext based on the second private key polynomial.

[0009] One embodiment of this application provides a data processing method, including:

[0010] Obtain the first public key polynomial, the second private key polynomial, the transformation public key, and K automorphic public keys corresponding to the first private key polynomial of the first device; the transformation public key and the K automorphic public keys are generated based on the first private key polynomial and the second private key polynomial, where K is an integer greater than 1;

[0011] Based on the first public key polynomial, the n gradient values ​​are encrypted to obtain the gradient ciphertext; n is an integer greater than 1.

[0012] The gradient ciphertext, the exchange public key, and the K isomorphic mapping public keys are sent to the second device. The second device is used to transform the m / 2 merged gradient histogram ciphertexts according to the K isomorphic public keys and the transformation public key to obtain the target gradient histogram ciphertext of the federated learning model. The m / 2 merged gradient histogram ciphertexts are obtained by merging every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts. The m candidate gradient histogram ciphertexts are obtained by homomorphically accumulating the gradient ciphertexts according to the m index sets. The m index sets are obtained by binning the n training samples based on the second sample features of the n training samples. m is an integer greater than 1.

[0013] The system receives the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypts the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram.

[0014] The federated learning model is trained based on the plaintext of the target gradient histogram.

[0015] One embodiment of this application provides a data processing apparatus, including:

[0016] The acquisition module is used to acquire gradient ciphertext, K automorphic public keys, and a transformation public key from the first device; the gradient ciphertext is obtained by encrypting n gradient values ​​based on the first public key polynomial of the first device, and the K automorphic public keys and the transformation public key are determined based on the first private key polynomial and the second private key polynomial corresponding to the first public key polynomial; n and K are integers greater than 1.

[0017] The processing module is used to perform homomorphic accumulation processing on the gradient ciphertext based on m index sets to obtain m candidate gradient histogram ciphertexts of the federated learning model; the m index sets are obtained by binning the n training samples based on the sample features of the n training samples; m is an integer greater than 1.

[0018] The merging module is used to merge every two candidate gradient histogram ciphertexts in the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts;

[0019] The conversion module is used to convert the m / 2 merged gradient histogram ciphertexts according to the K automorphic public keys and the conversion public key to obtain the target gradient histogram ciphertext of the federated learning model, and send the target gradient histogram ciphertext to the first device; the first device is used to train the federated learning model according to the target gradient histogram plaintext, wherein the target gradient histogram plaintext is obtained by decrypting the target gradient histogram ciphertext based on the second private key polynomial.

[0020] One embodiment of this application provides a data processing apparatus, including:

[0021] The acquisition module is used to acquire the first public key polynomial, the second private key polynomial, the transformation public key, and K automorphic public keys corresponding to the first private key polynomial of the first device; the transformation public key and the K automorphic public keys are generated based on the first private key polynomial and the second private key polynomial, where K is an integer greater than 1;

[0022] The encryption module is used to encrypt n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext; n is an integer greater than 1.

[0023] A sending module is used to send the gradient ciphertext, the exchange public key, and the K isomorphic mapping public keys to a second device; the second device is used to transform m / 2 merged gradient histogram ciphertexts according to the K isomorphic public keys and the transformation public key to obtain the target gradient histogram ciphertext of the federated learning model. The m / 2 merged gradient histogram ciphertexts are obtained by merging every two candidate gradient histogram ciphertexts from m candidate gradient histogram ciphertexts. The m candidate gradient histogram ciphertexts are obtained by homomorphically accumulating the gradient ciphertexts according to m index sets. The m index sets are obtained by binning the n training samples based on the second sample features of the n training samples; m is an integer greater than 1.

[0024] The receiving module is used to receive the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypt the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram.

[0025] The training module is used to train the federated learning model based on the plaintext of the target gradient histogram.

[0026] One embodiment of this application provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the method described above.

[0027] One embodiment of this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.

[0028] One embodiment of this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method.

[0029] In this application, during the training of the federated learning model, firstly, the first device directly encrypts n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext. That is, it encrypts the gradient polynomials corresponding to the n gradient values ​​according to the first public key polynomial. In the process of encrypting the gradient values ​​of the federated learning model, only polynomial operations are required, eliminating the need for high-dimensional vector operations, thus reducing the computational load and training overhead of the federated learning model, and improving its training efficiency. Then, after the first device sends the gradient ciphertext to the second device, it merges every two candidate histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, significantly reducing the number of candidate histogram ciphertexts. This, in turn, reduces the number of transformations required for the histogram ciphertexts (merged gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, further reduces the computational load during the training of the federated learning model, and improves its training efficiency. Furthermore, during the training of the federated learning model, the first sample features and label data of the first device and the second sample features of the second device are linked by calculating the gradient histogram ciphertext. This ensures that the training data of the first device (i.e., the first sample features and label data) and the training data of the second device (i.e., the second sample features) are not leaked, thereby enabling joint training of the federated learning model. This provides more information for the training process of the federated learning model and improves the training accuracy of the federated learning model. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 This is a schematic diagram of a data processing system provided in this application;

[0032] Figure 2 This is a flowchart illustrating a data processing method provided in this application;

[0033] Figure 3 This is a schematic diagram illustrating a scenario for obtaining gradient ciphertext provided in this application;

[0034] Figure 4 This is a flowchart illustrating a data processing method provided in this application;

[0035] Figure 5This is a schematic diagram of a binning scenario for obtaining second sample features of training samples, as provided in this application.

[0036] Figure 6 This is a schematic diagram of an interactive scenario of a data processing method provided in this application;

[0037] Figure 7 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;

[0038] Figure 8 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;

[0039] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0040] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0041] This application's embodiments may relate to artificial intelligence (AI) technology, as well as fields such as autonomous driving and intelligent transportation. AI refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine capable of reacting in a manner similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.

[0042] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0043] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory, among others. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, and inductive learning.

[0044] For example, in this application, the first device can input the first sample features corresponding to n training samples into a federated learning model created based on machine learning technology. The federated learning model identifies the first sample features to obtain the prediction data corresponding to the n training samples. The device directly determines n gradient values ​​based on the prediction data and label data of the n training samples. The device then encrypts the n gradient values ​​using a first public key polynomial to obtain gradient ciphertext. In the process of encrypting the gradient values ​​of the federated learning model, only polynomial operations are required, without high-dimensional vector operations. This reduces the computational load and training overhead of the federated learning model, and improves the training efficiency of the federated learning model. Furthermore, the first device sends the gradient ciphertext, the exchanged public key, and K self-similar public keys to the second device. The second device can perform homomorphic accumulation processing on the gradient ciphertext based on a set of m indices to obtain m candidate gradient histogram ciphertexts for the federated learning model. These m indices are obtained by binning the n training samples based on the second sample features of the n training samples. Every two candidate histogram ciphertexts in the m candidate gradient histogram ciphertexts are merged to obtain m / 2 merged gradient histogram ciphertexts, significantly reducing the number of candidate histogram ciphertexts. This reduces the number of transformations required for the histogram ciphertext (merged gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, reduces the computational load during the training process of the federated learning model, and improves the training efficiency of the federated learning model. Meanwhile, during the training of the federated learning model, the first sample features and label data of the first device and the second sample features of the second device are linked by calculating the gradient histogram ciphertext. This ensures that the training data of the first device (i.e., the first sample features and label data) and the training data of the second device (i.e., the second sample features) are not leaked, thereby enabling joint training of the federated learning model. This provides more information for the training process of the federated learning model and improves the training accuracy of the federated learning model.

[0045] First, the terms used in this application will be explained.

[0046] 1. Federated Learning is a privacy-preserving distributed machine learning algorithm that addresses the problem of how to jointly train a global model on virtually "aggregated" data when sensitive training data is held by multiple independent institutions, groups, and individuals, while protecting the privacy of the training data.

[0047] 2. Secret Sharding: If the true values ​​are secretly shared using XOR, the random number obtained by the computer is called Boolean sharding; if they are secretly shared using arithmetic addition, the random number obtained by the computer is called arithmetic sharding. In this application, arithmetic addition refers to... Addition modulo q (i.e., addition modulo q) uses the "+" or "-" operation to refer to... Addition or subtraction. <x> A This represents an arithmetic partition of x, where each participant has a random value, and these two random values ​​are... The addition on the top is x. <x> B This represents a Boolean partition of x, where each of the two participating parties has a random bit, and the XOR of these two random bits is x.

[0048] 3. Calculation of gradient histograms for both sides: One side has a set of gradient vectors G = {g0, g1, ..., g...} n-1 The gradient vector contains the gradient values ​​corresponding to n samples, and the other side has m indices for summing the gradient values, i.e. Both parties need to calculate The corresponding arithmetic partitioning. These m indices can be viewed as an n×m bit matrix B, where the j-th column is composed of the indices. j Composition, that is, in the j-th column of B, appearing at index j Those actions 1 (i.e., the j0, j1, ..., j) s If the row vector is 1 and the rest are 0, then the gradient histogram can be calculated as a row vector (g0, g1, ..., g...). n-1 The product of B and B.

[0049] 4. Two participants: Guest and Host. Assume Guest possesses several indices for aggregating gradient values, and Host possesses a set of gradient vectors. That is, Host has the label data and first-order features of the training samples, and Guest has the second-order features of the training samples. In this application, Host can be referred to as the first device party, and Guest as the second device party. This application can be applied to scenarios such as multimedia recommendation, image recognition, text recognition, and speech recognition. Taking video recommendation as an example, the training samples can refer to users, the first-order features can refer to basic user information such as age, the second-order features can refer to the attribute information of video data viewed by the user within a historical time period, such as the style and playback duration of the video data, and the label data can refer to the user's video preference tags, which reflect the categories of video data the user likes.

[0050] 5. Fully Homomorphic Encryption: Encryption algorithms possess the homomorphic property, meaning that the homomorphic addition of two ciphertexts Enc(x) and Enc(y) yields Enc(x+y), which can be expressed as: Enc(x) + Enc(y) = Enc(x+y), where Enc(x+y) represents the ciphertext corresponding to the plaintext (x+y). The homomorphic multiplication of two ciphertexts Enc(x) and Enc(y) yields Enc(x*y), which can be expressed as: Enc(x)*Enc(y) = Enc(x*y), where Enc(x*y) represents the ciphertext corresponding to the plaintext (x*y). Fully homomorphic encryption algorithms based on the Learning With Errors over Rings (RLWE) assumption are defined on polynomial residue class rings. At this point, the plaintext is a polynomial with an algebraic degree less than N, where N is a power of 2. For floating-point encryption and decryption, a method is needed to convert between floating-point numbers and elements in R.

[0051] Floating-point encoding: This involves encoding the elements of a floating-point vector into the coefficients of a polynomial. For example, if the input floating-point vector is (x0, x1, ..., x...), then... l-1 ) and stretching factor Δ, calculate The polynomial corresponding to this floating-point vector can be represented by the following formula (1):

[0052] m(X) = m0 + m1X + m2X 2 +…+m l-1 X l-1 ∈R (1)

[0053] In formula (1), Then m(X)∈R is the output plaintext polynomial, l≤N.

[0054] Floating-point decoding: Input plaintext polynomial m(X) = y0 + y1X + y2X 2 +…+y l-1 X l-1 Given the stretching factor Δ, the plaintext of each element in the floating-point vector can be calculated using the following formula (2):

[0055]

[0056] In formula (2) This is to output a vector of floating-point numbers.

[0057] The fully homomorphic encryption algorithm based on the RLWE assumption also provides a key exchange component KeySwitch, a modulo exchange component modSwitch, and an automorphic mapping component Automorphism. KeySwitch will... That is, ciphertext that can only be decrypted by private key sk1 is transformed into ciphertext that can only be decrypted by private key sk2; modSwitch will R q The ciphertext on becomes R Q The ciphertext on; Automorphism will Enc sk (m(X))→Enc sk (m(X τ That is, transforming the plaintext polynomial m(X) into m(X) τ Since it is an automorphism transformation, there are requirements for the choice of τ. For example, when N is a power of 2, τ is an odd number.

[0058] 6. RLWE Ciphertext: Private key sk = s0 + s1X + s2X 2 +…+s N -1X N-1 s i ∈{-1, 0, 1}, the RLWE ciphertext is: The condition is satisfied that c0(X)*sk+c1(X)=m(X)+e(X), where each coefficient of e(X) follows a discrete Gaussian distribution. N is called the dimension of the RLWE ciphertext, and q is called the modulus of the RLWE ciphertext.

[0059] LWE Ciphertext: Private Key LWE ciphertext satisfy Here, e follows a discrete Gaussian distribution. n is called the dimension of the LWE ciphertext, and q is called the modulus of the LWE ciphertext.

[0060] An RLWE ciphertext can be viewed as N LWE ciphertexts of dimension N, and these N LWE ciphertexts correspond to the same private key. Let c0(X) = c of the two parts of the RLWE ciphertext. 0,0 +c 0,1 X+…+c 0,N-1 X N-1 c1(X) = c 1,0 +c 1,1 X+…+c 1,N -1X N-1 According to ring R q Multiplication on the top can easily yield the two parts of the i-th LWE ciphertext.

[0061] 7. Polynomial Residue Class Ring (N is a power of 2) has the following properties:

[0062] ① Addition / Subtraction: Let a(X), b(X)∈R q Then a(X)+b(X) represents the coefficient modulo q plus; a(X)-b(X) represents the coefficient modulo q minus.

[0063] ② Multiplication: Let a(X), b(X)∈R q Let a(X) = a0 + a1X + ... + a N-1 X N-1 b(X) = b0 + b1X + ... + b N-1 X N-1 Then a(X)·b(X)=∑ i+j<N a i b j -∑ i+j≥N a i b j .

[0064] ③ Automorphism: Let a(X)∈R q a(Xτ)=a0+a1X τ +a2X 2τ +…+a N-1 X (N-1)τ X here i·τ =-X (i·τ)mod N ,when hour, It can be seen as but After performing this automorphism mapping, a(X) τ ) in k·2 i The coefficient at the point becomes At this time, a(X) + a(X) τ (2·k+1)·2 i The coefficient becomes zero, and 2.k·2 i The coefficient is doubled. This type of automorphic mapping is used to aggregate multiple LWE ciphertexts into a single RLWE ciphertext.

[0065] ④ Special multiplication: Let a(X) = a0 + a1X + a2X 2 +…+a N / 2-1 X N / 2-1 b(X) = b0 + b1X + b2X 2 +…+b N / 2-1 X N / 2-1 Let s(X) = s0 - s N / 2-1 X N / 2+1 -s N / 2-2 X N / 2+2 -…-s1X N-1 Construct c(X) = a(X) + b(X)·X N / 2 Then the 0th coefficient of c(X)·s(X) is exactly... The N / 2th coefficient is exactly... here and

[0066] To facilitate a clearer understanding of this application, the data processing system implementing this application will be introduced first, such as... Figure 1 As shown, this data processing system includes a server 10 and a terminal cluster. The terminal cluster can include one or more terminals; the number of terminals is not limited here. Figure 1 As shown, the terminal cluster may specifically include terminal 1, terminal 2, ..., terminal n; it can be understood that terminal 1, terminal 2, terminal 3, ..., terminal n can all connect to server 10 via the network so that each terminal can interact with server 10 through the network connection.

[0067] The terminal has one or more target applications installed. These target applications can be used to train the federated learning model and call the model to process target tasks. Target applications can include standalone applications, web applications, or mini-programs within a host application. The target tasks can be multimedia recommendation tasks, image recognition tasks (such as image classification), speech recognition tasks (such as speech-to-text translation), or text recognition tasks (such as text-to-speech and text translation). Server 10 refers to a device that provides backend services to the target applications in the terminal. For example, server 10 can be used to optimize and update the target applications in the terminal.

[0068] Understandably, a server can be a single physical server, a server cluster or distributed system consisting of at least two physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. A terminal can specifically refer to in-vehicle terminals, smartphones, tablets, laptops, desktop computers, smart speakers, speakers with screens, smartwatches, etc., but is not limited to these. Various terminals and servers can be directly or indirectly connected via wired or wireless communication. Furthermore, the number of terminals and servers can be one or at least two; this application does not impose any restrictions.

[0069] Further, please see Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application. Figure 2 As shown, this method can be derived from... Figure 1 It can be executed by any terminal in the terminal cluster, or by... Figure 1 The server in the middle can be used to execute it, or it can be executed by... Figure 1 The terminal cluster in the application uses terminals and servers to collaboratively execute the data processing method. The device used to execute this data processing method in this application can be referred to as a second device. The method may include the following steps:

[0070] S101. Obtain the first public key polynomial, the second private key polynomial, the transformation public key, and K automorphic public keys corresponding to the first private key polynomial of the first device; the first public key polynomial is generated based on the first private key polynomial, and the transformation public key and the K automorphic public keys are generated based on the first private key polynomial and the second private key polynomial, where K is an integer greater than 1.

[0071] In this application, the first public key polynomial is generated based on the first private key polynomial. The first public key polynomial is used to encrypt plaintext data (such as gradient values), and the first private key polynomial can decrypt the encrypted data obtained by the first public key polynomial to obtain ciphertext data. The second private key polynomial is used to decrypt the ciphertext data (such as gradient histogram ciphertext). The conversion public key and K self-similar public keys are used to convert the ciphertext data that the first private key polynomial can decrypt into ciphertext data that the second private key polynomial can decrypt.

[0072] Optionally, the first device can generate a first random number and a second random number, which are respectively used as the dimension N0 and modulus q0 of the first private key polynomial, and generate the first private key polynomial based on the dimension N0 and modulus q0 of the first private key polynomial; the first private key polynomial is used to determine the private key polynomial belonging to... The first private key polynomial is used to decrypt ciphertext of dimension N0 modulo q0. Then, based on the dimension N0 of the first private key polynomial, a second private key polynomial of dimension N1 is generated. A third random number is generated as the modulo q1 of the second private key polynomial, where N1 is twice N0. q0 and q1 can be randomly generated, with q0 greater than q1. q0 can be a 60-bit prime number, and q1 can be a 49-bit prime number. The second private key polynomial is then generated based on N1 and q1. This second private key polynomial is used to decrypt ciphertext belonging to… The second private key polynomial is used to decrypt ciphertext of dimension N1 modulo q1. A third private key polynomial is constructed based on the second private key polynomial; this third private key polynomial is used to decrypt ciphertext belonging to... The ciphertext is decrypted; that is, the third private key polynomial is used to decrypt ciphertext of dimension N0 modulo q1. Further, the key exchange component is invoked to generate an exchange public key and K automorphic public keys based on the third and second private key polynomials. The exchange public key is used to convert ciphertext decryptable by the third private key polynomial into ciphertext decryptable by the second private key polynomial, which can be represented as: sk * →sk1, sk * Let sk1 represent the third private key polynomial, and sk1 represent the second private key polynomial. K automorphic public keys refer to... That is, the ciphertext of m(X) is decrypted using the second private key polynomial, and then converted into the ciphertext of m(X) using the second private key polynomial. τ The ciphertext of the gradient histogram is decrypted, where m(X) can refer to the plaintext polynomial corresponding to the gradient histogram. Specifically, the dimension of the polynomial refers to the number of terms in the polynomial.

[0073] For example, the first device can generate N0 = 4096 and q0, generating the first private key polynomial: Then, generate N1 = 8192 and q1, and generate the second private key polynomial. Construct the third private key polynomial based on sk0. Generate sk * →The corresponding public key for sk1, such as the KeySwitch public key, is generated simultaneously. An automorphic public key, such as an Automorphism public key, where τ i =1+N1 / 2 i , i = 0, 1, ..., log2N1-2, and K = log2N1-1 above.

[0074] S102. Based on the first public key polynomial, encrypt the n gradient values ​​to obtain gradient ciphertext; the n gradient values ​​are determined based on the label data and prediction data of the n training samples, and the n prediction data are obtained by the federated learning model from the first sample features of the n training samples, where n is an integer greater than 1.

[0075] In this application, when training a federated learning model, a first device can obtain sample features and label data corresponding to n training samples. These sample features can be referred to as first sample features. The first sample features are input into the federated learning model, which identifies them to obtain prediction data corresponding to the n first training samples. Based on the label data and prediction data corresponding to the n training samples, n gradient values ​​of the federated learning model are determined. These n gradient values ​​are then encrypted using the first private key polynomial of the first device to obtain gradient ciphertext. These n gradient values ​​reflect the impact of the first sample features corresponding to the n training samples on the prediction accuracy of the federated learning model. If all n gradient values ​​are large, it indicates that the first sample features corresponding to the n training samples have a significant impact on the prediction accuracy of the federated learning model; conversely, if all n gradient values ​​are small, it indicates that the first sample features corresponding to the n training samples have a small impact on the prediction accuracy of the federated learning model.

[0076] For example, taking a video recommendation scenario, the training samples can refer to users, the first sample features can refer to user basic information, and the label data can refer to user-annotated video preference tags. These tags can be manually annotated, and the video preference tags reflect the categories of video data that the user actually likes. A first device can input the user basic information of n users into the federated learning model. The federated learning model identifies the user basic information of these n users and obtains prediction data corresponding to each of the n users. This prediction data reflects the predicted video preference tags of the n users, and these predicted video preference tags reflect the categories of video data predicted to be liked by the users. The first device can differentiate the loss function of the federated learning model to obtain its derivative. This derivative of the loss function is a function of the label data and the prediction data. Substituting the n label data and the prediction data into the derivative of the loss function yields the n gradient values ​​of the federated learning model. Optionally, the federated learning model can refer to a model used to identify user video preference tags, specifically an XGB or decision tree model, etc. The loss function of a federated learning model is a function used to measure the prediction accuracy of the federated learning model for training samples. This loss function can be the exponential loss function, logistic regression loss function, cross-entropy cost function, etc.

[0077] Optionally, after the first device obtains the first private key polynomial, it can generate a first public key polynomial corresponding to the first private key polynomial, and encrypt the n gradient values ​​according to the first public key polynomial to obtain the gradient ciphertext. Since the first private key polynomial belongs to... The first private key polynomial can be used to encrypt data with a dimension less than or equal to N0. Therefore, if the dimension of the first private key polynomial is greater than or equal to n, it means that only n gradient values ​​need to be encrypted once. The first device can then encrypt the n gradient values ​​according to the first public key polynomial to obtain a gradient ciphertext. If the dimension of the first private key polynomial is less than n, the n training samples are divided into Q training sample sets. According to the first public key polynomial, the gradient values ​​corresponding to the training samples in the g-th training sample set of the Q training sample sets are encrypted to obtain the gradient ciphertext corresponding to the g-th training sample set. The above steps are repeated until the gradient ciphertexts corresponding to the Q training sample sets are obtained, thus obtaining Q gradient ciphertexts.

[0078] It should be noted that, since this first private key polynomial belongs to That is, the first private key polynomial can be used to encrypt data with a dimension less than or equal to N0. Therefore, the number of training samples in the Q training sample sets is less than or equal to the dimension of the first private key polynomial. Thus, the number (dimension) of gradient values ​​corresponding to each training sample set in the Q training sample sets is less than or equal to the dimension of the first private key polynomial, and one training sample in the training sample set corresponds to one gradient value. For example, the gradient vector corresponding to n gradient values ​​is: (g0, g1, ..., g... n-1 In this gradient vector, each element represents a gradient value, g1 represents the gradient value corresponding to training sample 1, and the first public-key polynomial can be expressed as: pk1: {pk0=-a1*sk0+e0,pk1=a1}, where e0 and a1 are random polynomials, and pk0 and pk1 both refer to the first public-key polynomial. Figure 4 As shown, when the dimension (i.e., N0) of the first private key polynomial is greater than or equal to n, the n gradient values ​​are treated as floating-point numbers. The first device can encode the n gradient values ​​using floating-point numbers according to the above formula (1) to obtain the gradient polynomial m0(X) corresponding to the n gradient values. The gradient polynomial is then encrypted using the following formula (3) to obtain the gradient ciphertext 0:

[0079] c: (c0(X)=pk0*u+e1+δ*m(X), c1(X)=pk0*u+e2) (3)

[0080] In formula (3), c represents the gradient ciphertext. Each gradient ciphertext includes two variables, c0(X) and c1(X). u, e1, and e2 are all random polynomials. The coefficients of e0, e1, and e2 satisfy a Gaussian distribution. The coefficients of sk0 and u belong to [-1, 1]. δ is used to multiply the coefficients of the gradient polynomial by a factor of δ. That is, m0(X) is used to replace m(X) in formula (3) to obtain the gradient ciphertext 0, where m(X) represents the gradient polynomial.

[0081] Similarly, when the dimension (i.e., N0) of the first private key polynomial is greater than or equal to n, the first device can divide the n training samples into Q training sample sets, and generate the gradient polynomial corresponding to each training sample set according to the above formula (1) and the gradient value corresponding to the training sample in each training sample set, until the gradient polynomials corresponding to the Q training sample sets are obtained respectively. Figure 3 In this context, the Q training sample sets include training sample set 1, training sample set 2, ..., training sample set Q. The first device can generate the gradient polynomial m1(X) corresponding to training sample set 1 based on formula (1) and the gradient values ​​corresponding to the training samples in training sample set 1. Based on formula (1) and the gradient values ​​corresponding to the training samples in training sample set 2, it can generate the gradient polynomial m2(X) corresponding to training sample set 2, ..., based on formula (1) and the gradient values ​​corresponding to the training samples in training sample set Q, it can generate the gradient polynomial m1(X) corresponding to training sample set Q. Q (X). Further, according to formula (3), the gradient polynomial m1(X) is encrypted using the first private key polynomial pk to obtain the gradient ciphertext 1 corresponding to the training sample set 1. According to formula (3), the gradient polynomial m2(X) is encrypted using the first private key polynomial pk to obtain the gradient ciphertext 2 corresponding to the training sample set 2, ..., according to formula (3), the gradient polynomial m1 .... Q (X) is encrypted to obtain the gradient ciphertext Q corresponding to the training sample set Q.

[0082] It should be noted that the first device can randomly divide the n training samples to obtain Q training sample sets; or, it can divide the n training samples according to their numbers to obtain Q training sample sets. For example, training samples numbered 0 to 9 can be assigned to training sample set 1, and training samples numbered 10 to 20 can be assigned to training sample set 2. The number of training samples in each training sample set can be the same or different. Q is... This indicates rounding up, such as when n is less than or equal to the nearest integer. Then Q takes the value 1; if n is greater than N0, Q is the floor of n / N0, such as n is 80 and N0 is 30, then Q is 3.

[0083] S103. The gradient ciphertext, the exchange public key, and the K isomorphic mapping public keys are sent to the second device. The second device is used to transform the m / 2 merged gradient histogram ciphertexts according to the K isomorphic public keys and the transformation public key to obtain the target gradient histogram ciphertext of the federated learning model. The m / 2 merged gradient histogram ciphertexts are obtained by merging every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts. The m candidate gradient histogram ciphertexts are obtained by homomorphically accumulating the gradient ciphertexts according to the m index sets. The m index sets are obtained by binning the n training samples based on the second sample features of the n training samples. m is an integer greater than 1.

[0084] In this application, the first device can send the gradient ciphertext, the exchange public key, and the K isomorphic mapping public keys to the second device so that the second device can generate the target gradient histogram ciphertext of the federated learning model. The target gradient histogram ciphertext is used to reflect the influence of the first sample features in the first device and the second sample features in the second device on the prediction accuracy of the federated learning model in the ciphertext space. The generation process of the target gradient histogram ciphertext can refer to the following step S202.

[0085] S104. Receive the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypt the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram. Here, the ciphertext of the target gradient histogram refers to the ciphertext of the gradient histogram, and the plaintext of the target gradient histogram refers to the plaintext of the target gradient histogram. For ease of description, this application uses "ciphertext of the target gradient histogram" and "plaintext of the target gradient histogram" to represent these terms.

[0086] In this application, the first device can receive the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypt the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram. The target gradient histogram is used to reflect the influence of the first sample feature and the second sample feature on the prediction accuracy of the federated learning model in the plaintext space. The first sample feature is stored in the first device, and the second sample feature is stored in the second device.

[0087] In one embodiment, such as during the training of a longitudinal federated XGBoost model for multi-party secure computation (MPC), i.e., when the federated learning model mentioned above is a longitudinal federated XGBoost model for MPC, the target gradient histogram ciphertext is obtained by blinding the initial gradient histogram ciphertext using a stochastic multinomial. That is, the target gradient histogram ciphertext can also be called a ring. The secret fragment is then processed. Correspondingly, the first device can use a random polynomial to deblind the target gradient histogram ciphertext, obtaining the initial gradient histogram ciphertext; then, based on the second private key polynomial, it decrypts the initial gradient histogram ciphertext to obtain the target gradient histogram plaintext. Here, deblinding refers to removing the influence of the random polynomial from the target gradient histogram ciphertext. This random polynomial is agreed upon by the first and second devices. Deblinding is equivalent to the reverse of blinding, which involves adding the influence of the random polynomial to the initial gradient histogram ciphertext to obtain the target gradient histogram ciphertext, thereby increasing the security of data transmission. In other words, even if an unauthorized user obtains the target gradient histogram ciphertext, they cannot reconstruct the initial gradient histogram ciphertext because they do not possess the random polynomial. Specifically, blinding involves adding or subtracting the initial gradient histogram ciphertext from the random polynomial to obtain the target gradient histogram ciphertext. Conversely, deblinding refers to subtracting or adding the target gradient histogram ciphertext to the random polynomial to obtain the initial gradient histogram ciphertext.

[0088] For example, when the target gradient histogram ciphertext is obtained by adding the initial gradient histogram ciphertext to a random polynomial, the first device can subtract the random polynomial from the target gradient histogram ciphertext to obtain the initial gradient histogram ciphertext, such as subtracting the random polynomial from the target gradient histogram ciphertext. Similarly, when the target gradient histogram ciphertext is obtained by subtracting the initial gradient histogram ciphertext from a random polynomial, the first device can add the random polynomial to the target gradient histogram ciphertext to obtain the initial gradient histogram ciphertext.

[0089] It should be noted that during the training of the stealthy longitudinal federated XGBoost model, or during the longitudinal federated feature engineering (IV binning) process, such as when the federated learning model mentioned above is a stealthy longitudinal federated XGBoost model, the target gradient histogram ciphertext here is the initial gradient histogram ciphertext mentioned above. In this case, the first device can use the second private key polynomial to directly decrypt the target gradient histogram ciphertext to obtain the target gradient histogram plaintext.

[0090] S105. Train the federated learning model based on the plaintext of the target gradient histogram.

[0091] In this application, the first device can train the federated learning model based on the target gradient histogram plaintext. The target gradient histogram plaintext includes m gradient histogram plaintexts. Each gradient histogram plaintext corresponds to an index set, and each index set corresponds to a bin. For example, gradient histogram plaintext i is equivalent to the result of accumulating the gradient values ​​of the training samples in the i-th index set.

[0092] Optionally, the federated learning model may include multiple nodes, including multiple root nodes and leaf nodes for each root node. Each root node is connected to two leaf nodes, and each root node corresponds to a sample feature. The training process of the federated learning model refers to: mapping n training samples to the leaf nodes of the federated learning model, and adjusting the weights of the leaf nodes in the federated learning model using the gradient values ​​corresponding to the training samples with mapping relationships, so as to converge the prediction error of the federated learning model and obtain the trained federated learning model.

[0093] Specifically, the first device can use the gain calculation formula of the federated learning model to determine the gain value corresponding to each gradient histogram plaintext based on m gradient histogram plaintexts; the maximum gain value among the gain values ​​corresponding to each gradient histogram plaintext is determined as the gain value corresponding to the second sample feature; based on the gain value of the second sample feature and n gradient values, n training samples are mapped to the leaf nodes of the root node corresponding to the second sample feature, such as mapping training samples with gradient values ​​greater than the gain value to the left leaf node of the root node corresponding to the second sample feature, and mapping training samples with gradient values ​​less than or equal to the gain value to the right leaf node of the root node corresponding to the second sample feature; then, the weights of the left leaf nodes are adjusted based on the gradient values ​​of the training samples that have a mapping relationship with the left leaf node, and the weights of the right leaf nodes are adjusted based on the gradient values ​​of the training samples that have a mapping relationship with the right leaf node, until the prediction error of the federated learning model is in a convergent state.

[0094] In this application, during the training of the federated learning model, firstly, the first device directly encrypts n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext. That is, it encrypts the gradient polynomials corresponding to the n gradient values ​​according to the first public key polynomial. In the process of encrypting the gradient values ​​of the federated learning model, only polynomial operations are required, eliminating the need for high-dimensional vector operations, thus reducing the computational load and training overhead of the federated learning model, and improving its training efficiency. Then, after the first device sends the gradient ciphertext to the second device, it merges every two candidate histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, significantly reducing the number of candidate histogram ciphertexts. This, in turn, reduces the number of transformations required for the histogram ciphertexts (merged gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, further reduces the computational load during the training of the federated learning model, and improves its training efficiency. Furthermore, during the training of the federated learning model, the first sample features and label data of the first device and the second sample features of the second device are linked by calculating the gradient histogram ciphertext. This ensures that the training data of the first device (i.e., the first sample features and label data) and the training data of the second device (i.e., the second sample features) are not leaked, thereby enabling joint training of the federated learning model. This provides more information for the training process of the federated learning model and improves the training accuracy of the federated learning model.

[0095] Further, please see Figure 4 This is a flowchart illustrating a data processing method provided in an embodiment of this application. Figure 4 As shown, this method can be derived from... Figure 1 It can be executed by any terminal in the terminal cluster, or by... Figure 1 The server in the middle can be used to execute it, or it can be executed by... Figure 1 The terminal cluster in the application uses terminals and servers to collaboratively execute the data processing method. The device used to execute this data processing method in this application can be referred to as a second device. The method may include the following steps:

[0096] S201. Obtain gradient ciphertext, K automorphic public keys, and a transformation public key from the first device; the gradient ciphertext is obtained by encrypting n gradient values ​​based on the first public key polynomial of the first device, the n gradient values ​​are determined based on the label data and prediction data of n training samples, the n prediction data are obtained by the federated learning model by identifying the first sample features of the n training samples, and the K automorphic public keys and the transformation public key are determined based on the first private key polynomial and the second private key polynomial corresponding to the first public key polynomial; n and K are integers greater than 1.

[0097] In this application, the second device can receive gradient ciphertext, K automorphic public keys, and transformation public keys sent by the first device.

[0098] S202. Based on the m index sets, perform homomorphic accumulation processing on the gradient ciphertext to obtain the m candidate gradient histogram ciphertexts of the federated learning model; the m index sets are obtained by binning the n training samples based on the second sample features of the n training samples; m is an integer greater than 1.

[0099] In this application, the m index sets are obtained by binning the n training samples using the second sample features of the n training samples. The m index sets reflect the bins to which the second sample features of the n training samples belong, that is, the m index sets reflect the magnitude of the second sample features (i.e., feature values) of the n training samples. In order to train the federated learning model by combining the first sample features and the second sample features, the second device can perform homomorphic accumulation processing on the gradient ciphertext according to the m index sets to obtain m candidate gradient histogram ciphertexts of the federated learning model. The homomorphic accumulation processing here can refer to performing a product processing on the gradient ciphertext and the m index sets in the ciphertext space. The candidate gradient histogram ciphertexts can refer to the ciphertext of the gradient histogram of the federated learning model. The gradient histogram is used to reflect the influence of the first sample features and the second sample features on the prediction accuracy of the federated learning model.

[0100] It should be noted that the set of m indices can be viewed as an n×m bit matrix B, where the j-th column of this matrix is ​​composed of indices. j The structure, that is, the j-th column of B represents the j-th index set, that is, the index that appears in the index. j Those actions 1 (i.e., the j0, j1, ..., j) s Behavior 1), and 0 for the rest; The second sample features belonging to the j-th bin are found in the second sample features of the j-th index set and the n training samples. For example... Figure 5 Taking 10 training samples as an example, the second sample features of training samples 1 to 10 are 0.8, 0.5, 1, 0.4, 0.2, 0.6, 0.7, 0.1, 0.9, and 0.3, respectively. There are four bins: bin 1, bin 2, bin 3, and bin 4, with each bin corresponding to a second sample feature interval. For example, the second sample feature interval corresponding to bin 1 is (0, 0.3], bin 2 is (0.3, 0.55], bin 3 is (0.55, 0.7], and bin 4 is (0.7, 1). The second sample features of training samples 5, 8, and 10 all belong to the second sample feature interval corresponding to bin 1, meaning the index set corresponding to bin 1 can be represented as the transpose of [0, 0, 0, 0, 1, 0, 0, 1, 0, 1]. The second sample features of training samples 2 and 4 all belong to the second sample feature interval corresponding to bin 2. The second sample feature interval, i.e., the index set corresponding to bin 2, can be represented as the transpose of [0, 1, 0, 1, 0, 0, 0, 0, 0, 0]. The second sample features of training samples 6 and 7 both belong to the second sample feature interval corresponding to bin 3, i.e., the index set corresponding to bin 3 can be represented as the transpose of [0, 0, 0, 0, 0, 1, 1, 0, 0, 0]. The second sample features of training samples 1, 3, and 9 all belong to the second sample feature interval corresponding to bin 4, i.e., the index set corresponding to bin 4 can be represented as the transpose of [1, 0, 1, 0, 0, 0, 0, 0, 1].

[0101] Optionally, the number of gradient ciphertexts is one. The second device can obtain the m candidate gradient histogram ciphertexts of the federated learning model using the following method one; when the number of gradient ciphertexts is multiple, the second device can obtain the m candidate gradient histogram ciphertexts of the federated learning model using the following method two:

[0102] Method 1: The second device can construct index polynomials corresponding to the m index sets based on the dimension of the first private key polynomial. These index polynomials belong to... That is, the index polynomial is a modulo q0 polynomial with dimension N0. This index polynomial reflects the distribution characteristics of the second sample features of the n training samples (e.g., which second feature interval they belong to). Further, the gradient ciphertext is multiplied by the index polynomials corresponding to the m index sets to obtain m gradient histogram polynomials. The constant terms of these m gradient histogram polynomials are the ciphertext summed from the gradient values ​​of the training samples within their respective bins. In other words, by multiplying the gradient ciphertext by the index polynomials corresponding to the m index sets, meaningful data is distributed across the constant terms of the gradient histogram polynomials. Therefore, the second device can extract the constant terms from these m gradient histogram polynomials to obtain m candidate gradient histogram ciphertexts for the federated learning model. These candidate gradient histogram ciphertexts can also be called LWE ciphertexts, meaning that subsequent processing only requires handling the constant terms of the gradient histogram polynomials, reducing computational load and improving the training efficiency of the federated learning model.

[0103] For example, the gradient ciphertext is (c0(X), c0(X)), assuming the j-th index j ={j1, j2, ..., j s The index polynomial corresponding to the j-th index set is constructed as follows (4):

[0104]

[0105] In formula (4), J(X) is the index polynomial corresponding to the j-th index set. The coefficient of the polynomial term corresponding to the training sample in the j-th index set is -1, and the coefficient of the polynomial term corresponding to the training sample not located in the j-th index set is 0. The second device can determine (J(X)·c0(X), J(X)·c0(X)) as the m candidate gradient histogram ciphertext of the federated learning model. The constant term of the plaintext polynomial corresponding to (J(X)·c0(X), J(X)·c0(X)) is the result of the sum of the gradient values ​​corresponding to the training sample in the j-th index set, i.e.

[0106] Method 2: The n training samples are distributed across Q training sample sets. The number of gradient ciphertexts is Q. The i-th gradient ciphertext among the Q gradient ciphertexts is obtained by encrypting the gradient value corresponding to the training sample in the i-th training sample set. Q is an integer greater than 1, and i is a positive integer less than or equal to Q. The a-th index set among the m index sets includes the training samples belonging to the a-th bin among the n training samples, where a is a positive integer less than or equal to m. The second device can obtain the intersection between the a-th index set and the Q training sample sets corresponding to the Q gradient ciphertexts, thus obtaining the Q updated index sets corresponding to the a-th index set. The Q updated index sets corresponding to the a-th index set reflect the overlapping (inclusive) training samples between the a-th index set and the Q training sample sets. Furthermore, the second device can perform homomorphic accumulation processing on the Q gradient ciphertexts based on the Q update index sets corresponding to the a-th index set to obtain the gradient histogram ciphertext corresponding to the a-th index set. The above steps are repeated until the gradient histogram ciphertexts corresponding to the m index sets are obtained respectively. The gradient histogram ciphertexts corresponding to the m index sets are determined as the m candidate gradient histogram ciphertexts of the federated learning model.

[0107] Optionally, the above-mentioned homomorphic accumulation processing of the Q gradient ciphertexts based on the Q update index sets corresponding to the a-th index set to obtain the gradient histogram ciphertext corresponding to the a-th index set includes: the second device can construct Q update index polynomials reflecting the Q update index sets corresponding to the a-th index set according to the dimension of the first public key polynomial, thereby obtaining the Q update index polynomials corresponding to the a-th index set; the update index polynomials belong to That is, the update index polynomial is a polynomial with dimension N0 modulo q0. Further, the second device can multiply the s-th update index polynomial corresponding to the a-th index set with the s-th gradient ciphertext in the Q gradient ciphertexts to obtain the s-th gradient histogram polynomial of the a-th index set; the update index set corresponding to the s-th update index polynomial is the intersection of the sample set corresponding to the s-th gradient ciphertext and the a-th index set, where s is a positive integer less than or equal to Q. The above steps are repeated until the Q gradient histogram polynomials corresponding to the a-th index set are obtained. The constant terms in the Q gradient histogram polynomials corresponding to the a-th index set are then accumulated to obtain the gradient histogram ciphertext corresponding to the a-th index set.

[0108] S203. Merge every two candidate gradient histogram ciphertexts in the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, which are the ciphertexts of the m / 2 merged gradient histograms.

[0109] In this application, the second device can merge any two candidate gradient histogram ciphertexts from m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts. That is, two LWE ciphertexts (i.e. candidate gradient histogram ciphertexts) are merged into one RLWE ciphertext (i.e. merged gradient histogram ciphertext), which directly halves the number of candidate gradient histogram ciphertexts. This is beneficial for reducing the number of transformations of the gradient histogram ciphertexts in the subsequent process, reducing the amount of computation in the training process of the federated learning model, and improving the training efficiency of the federated learning model.

[0110] Optionally, the above-mentioned merging of every two candidate gradient histogram ciphertexts in the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts includes: the second device can divide the m candidate gradient histogram ciphertexts to obtain m / 2 ciphertext pairs, where each ciphertext pair includes two candidate gradient histogram ciphertexts. For example, the second device can divide adjacent candidate gradient histogram ciphertexts in the m candidate gradient histogram ciphertexts into a ciphertext pair, obtaining m / 2 ciphertext pairs. The adjacent candidate gradient histogram ciphertexts are determined according to the numbers of m index sets. The numbers of the m index sets can be determined according to the second sample feature intervals corresponding to the index sets. For example, the numbers of the m index sets are obtained by sorting the values ​​in the second sample feature intervals corresponding to the m index sets from smallest to largest. Further, the second device can generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext, and generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the second candidate gradient histogram ciphertext. The first candidate gradient histogram ciphertext and the second candidate gradient histogram ciphertext belong to the f-th ciphertext pair among the m / 2 ciphertext pairs. The N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext and the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext are both N0-term polynomials in terms of X, where X refers to the variable used to carry the coefficients and has no specific value. The coefficients on each term of the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext are used to reflect the first candidate gradient histogram ciphertext; the coefficients on each term of the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext are used to reflect the second candidate gradient histogram ciphertext. The power of the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext is different from that of the N0-dimensional gradient histogram ciphertext of the first candidate gradient histogram ciphertext. Specifically, the power of variable X in the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext is different from that in the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext. Then, the second device can sum the N0-dimensional gradient histogram ciphertext polynomials of the first and second candidate gradient histogram ciphertexts to obtain the N1-dimensional merged gradient histogram ciphertext of the f-th ciphertext pair. The N1-dimensional merged gradient histogram ciphertext of the f-th ciphertext pair is an N1-dimensional polynomial, where N1 is twice N0.Since the power of the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext is the same as the power of the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext, these two polynomials will be summed to obtain the N1-dimensional combined gradient histogram ciphertext of the f-th ciphertext pair, which includes the N0-dimensional gradient histogram ciphertext polynomial and the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext. That is, the N1-dimensional combined gradient histogram ciphertext of the f-th ciphertext pair can reflect both the first and second candidate gradient histogram ciphertexts. Repeat the above steps until the N1-dimensional combined gradient histogram ciphertexts corresponding to each of the m / 2 ciphertext pairs are obtained. The N1-dimensional combined gradient histogram ciphertexts corresponding to each of the m / 2 ciphertext pairs are then identified as the m / 2 combined gradient histogram ciphertexts. By generating gradient histogram ciphertext polynomials with different powers, the ciphertexts of every two candidate gradient histograms are merged, directly halving the number of ciphertexts in the candidate gradient histograms. This helps to reduce the number of transformations of the gradient histogram ciphertexts in the subsequent process, reduce the amount of computation in the training process of the federated learning model, and improve the training efficiency of the federated learning model.

[0111] Optionally, generating an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext and generating an N0-dimensional gradient histogram ciphertext reflecting the second candidate gradient histogram ciphertext include: the second device can generate an N0-dimensional gradient histogram ciphertext reflecting the first candidate gradient histogram ciphertext based on the dimension of the first private key polynomial; the dimension of the first public key polynomial is N0; based on the N0-dimensional gradient histogram ciphertext of the first candidate gradient histogram ciphertext, performing an automorphic mapping process on the second candidate gradient histogram ciphertext in the f-th ciphertext pair among the m / 2 ciphertext pairs to obtain the N0-dimensional gradient histogram ciphertext of the second candidate gradient histogram ciphertext, that is, the automorphic mapping process here refers to generating a polynomial with the same dimension but different power as the N0-dimensional gradient histogram ciphertext of the first candidate gradient histogram ciphertext. By merging different candidate gradient histogram ciphertexts into the same polynomial, it is beneficial to reduce the number of transformations of the gradient histogram ciphertexts in the subsequent process, reduce the amount of computation in the training process of the federated learning model, and improve the training efficiency of the federated learning model.

[0112] For example, the first candidate gradient histogram ciphertext in the f-th ciphertext pair is The second candidate gradient histogram ciphertext is according to and Construct polynomial here For the first candidate gradient histogram ciphertext The N0-dimensional gradient histogram ciphertext polynomial, For the second candidate gradient histogram ciphertext The N0-dimensional gradient histogram ciphertext polynomial. Similarly, construct the polynomial. b1 is the N0-dimensional gradient histogram ciphertext polynomial of b1 in the first candidate gradient histogram ciphertext, that is, the degree of all terms except the power of X is 0. Let b2 be the N0-dimensional gradient histogram ciphertext polynomial in the second candidate gradient histogram ciphertext, meaning that all terms except those with a power of 0 for X have a degree of 0. Further, (a(X), b(X)) can be determined as the N1-dimensional merged gradient histogram ciphertext of the f-th ciphertext pair. The N1-dimensional merged gradient histogram ciphertext belongs to... The dimension of the N1-dimensional merged gradient histogram ciphertext is N1, and the modulus is q0.

[0113] S204. Based on the K automorphic public keys and the transformation public key, the m / 2 merged gradient histogram ciphertexts are transformed to obtain the target gradient histogram ciphertext of the federated learning model, and the target gradient histogram ciphertext is sent to the first device; the first device is used to train the federated learning model based on the target gradient histogram plaintext, which is obtained by decrypting the target gradient histogram ciphertext based on the second private key polynomial.

[0114] In this application, all m candidate gradient histogram ciphertexts belong to Merging m candidate gradient histogram ciphertexts is equivalent to merging two N0-dimensional candidate gradient histograms into a single 2*N0-dimensional (i.e., N1-dimensional) merged gradient histogram ciphertext; therefore, merged gradient histogram ciphertext belongs to... Therefore, the merged gradient histogram ciphertext can only belong to Decryption of the private key polynomial on the first private key polynomial belongs to The second private key polynomial belongs to Therefore, neither the first nor the second private key polynomial can decrypt the merged gradient histogram ciphertext. To convert the merged gradient histogram ciphertext into ciphertext that the second private key polynomial can decrypt, the second device can use the K automorphic public keys and the transformation public key to transform the m / 2 merged gradient histogram ciphertexts, obtaining the target gradient histogram ciphertext of the federated learning model. This target gradient histogram ciphertext is then sent to the first device; that is, the target gradient histogram ciphertext here refers to the ciphertext that the second private key polynomial can decrypt. After receiving the target gradient histogram, the first device can train the federated learning model based on it.

[0115] Optionally, the aforementioned m / 2 merged gradient histogram ciphertexts belong to the modulus q0 corresponding to the first private key polynomial; the aforementioned transformation processing of the m / 2 merged gradient histogram ciphertexts according to the K self-similar public keys and the transformation public key to obtain the target gradient histogram ciphertext of the federated learning model includes: the second device can perform modulus transformation processing on the m / 2 merged gradient histogram ciphertexts according to the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1. Further, a key exchange component is invoked to perform key exchange processing on the m / 2 gradient histogram ciphertexts belonging to the modulus q1 according to the exchange public key to obtain m / 2 gradient histogram ciphertexts associated with the second private key polynomial; the key exchange component is a component used to transform a certain ciphertext into ciphertext that can be decrypted by the target private key polynomial, such as the target private key polynomial being the second private key polynomial. Furthermore, the second device can invoke the ciphertext aggregation component to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, thereby obtaining the target gradient histogram ciphertext of the federated learning model. The ciphertext aggregation component is a component that aggregates multiple ciphertexts into a single ciphertext. By aggregating multiple gradient histogram ciphertexts into a single target gradient histogram ciphertext, only the single target gradient histogram ciphertext needs to be sent to the first device, reducing the number of interactions between the first and second devices and improving the training efficiency of the federated learning model.

[0116] Optionally, the above-mentioned modulo transformation processing of the m / 2 merged gradient histogram ciphertexts based on the modulo q1 corresponding to the second private key polynomial and the modulo q0 corresponding to the first private key polynomial to obtain m / 2 gradient histogram ciphertexts belonging to the modulo q1 includes: the second device can multiply the coefficients in the m / 2 merged gradient histogram ciphertexts by the modulo q0 corresponding to the first private key polynomial to obtain the multiplied m / 2 merged gradient histogram ciphertexts; and divide the coefficients in the multiplied m / 2 merged gradient histogram ciphertexts by the modulo q1 corresponding to the second private key polynomial to obtain the m / 2 gradient histogram ciphertexts belonging to the modulo q1. In other words, the second device can multiply the coefficient of each term in the m / 2 merged gradient histogram ciphertexts by q0 and divide by q1 to obtain the m / 2 gradient histogram ciphertexts belonging to the modulo q1.

[0117] For example, the modulus q1 of the ciphertext pair merged gradient histogram ciphertext is (a * (X), b * (X)), at this time the merged gradient histogram ciphertext satisfies a * (X)*sk * (X)+b * (X)=m * (X)+e * (X), that is, the ciphertext of the merged gradient histogram is the third private key sk. * (X) represents the ciphertext data that can be decrypted, where m is the ciphertext data that can be decrypted. * The constant term of (X) is the LWE ciphertext (i.e., the first candidate gradient histogram ciphertext of the first f ciphertext pair). The corresponding plaintext. The coefficient of the N0th term is the LWE ciphertext (i.e., the second candidate gradient histogram ciphertext of the first f ciphertext pair). The corresponding plaintext, m * The remaining terms of (X) are meaningless. The modulo q1 of the ciphertext pair, combined with the gradient histogram ciphertext and the exchanged public key, is input into the key exchange component. This component performs key exchange processing on the modulo q1 of the ciphertext pair, obtaining the gradient histogram ciphertext associated with the second private key polynomial. This results in the new RLWE ciphertext corresponding to the ciphertext pair, i.e., satisfy Here, the constant term of m(X) is the LWE ciphertext. The corresponding plaintext, the coefficient of the N0th term is the LWE ciphertext. The corresponding plaintext. The remaining terms of m(X) have no practical meaning. Further, the new RLWE ciphertext corresponding to the K automorphic public keys and m / 2 ciphertext pairs is input into the ciphertext aggregation component. The ciphertext aggregation component aggregates the new RLWE ciphertext corresponding to the K automorphic public key pairs and m / 2 ciphertext pairs to obtain a single RLWE ciphertext.

[0118] Optionally, during the training process of a longitudinal federated XGBoost model in multi-party secure computation (MPC), the aforementioned invocation of the ciphertext aggregation component, based on the K automorphic public keys, performs ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial to obtain the target gradient histogram ciphertext of the federated learning model. This includes: the second device can invoke the ciphertext aggregation component to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys to obtain the initial gradient histogram ciphertext of the federated learning model; blinding the initial gradient histogram ciphertext using a random polynomial to obtain the target gradient histogram ciphertext of the federated learning model. For example, the second device can perform summation or subtraction between the random polynomial and the initial gradient histogram ciphertext to obtain the target gradient histogram ciphertext of the federated learning model. The random polynomial belongs to... By blinding the initial gradient histogram ciphertext, the true information corresponding to the initial gradient histogram ciphertext can be prevented from being leaked, thus improving the security of data interaction.

[0119] For example, the second device can generate random polynomials. The target gradient histogram ciphertext of the federated learning model is obtained by subtracting the random polynomial from the initial gradient histogram ciphertext. Alternatively, the second device can add the random polynomial to the initial gradient histogram ciphertext to obtain the target gradient histogram ciphertext of the federated learning model.

[0120] It should be noted that during the training of the stealthy longitudinal federated XGBoost model, or during the longitudinal federated feature engineering (IV binning) process, when the federated learning model mentioned above is a stealthy longitudinal federated XGBoost model, the second device can determine the initial gradient histogram ciphertext as the target gradient histogram ciphertext, that is, there is no need to blind the initial gradient histogram ciphertext. For a description of the blinding process, please refer to the above.

[0121] In this application, during the training of the federated learning model, firstly, the first device directly encrypts n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext. That is, it encrypts the gradient polynomials corresponding to the n gradient values ​​according to the first public key polynomial. In the process of encrypting the gradient values ​​of the federated learning model, only polynomial operations are required, eliminating the need for high-dimensional vector operations, thus reducing the computational load and training overhead of the federated learning model, and improving its training efficiency. Then, after the first device sends the gradient ciphertext to the second device, it merges every two candidate histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, significantly reducing the number of candidate histogram ciphertexts. This, in turn, reduces the number of transformations required for the histogram ciphertexts (merged gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, further reduces the computational load during the training of the federated learning model, and improves its training efficiency. Furthermore, during the training of the federated learning model, the first sample features and label data of the first device and the second sample features of the second device are linked by calculating the gradient histogram ciphertext. This ensures that the training data of the first device (i.e., the first sample features and label data) and the training data of the second device (i.e., the second sample features) are not leaked, thereby enabling joint training of the federated learning model. This provides more information for the training process of the federated learning model and improves the training accuracy of the federated learning model.

[0122] In one application scenario, the first device is a participant with labeled data containing training samples, while the second device is a participant without labeled data containing training samples. The participant with labeled data can be called the Host, and the participant without labeled data can be called the Guest. For example... Figure 6 As shown, the process of obtaining the gradient histogram of the federated learning model through the interaction between the Host and Guest sides includes the following steps S1-S7:

[0123] S1. The host generates the first private key polynomial and exchanges the public key, as well as K self-similar public keys. Specifically, the host can choose N0 = 4096 and q0 to generate the first private key polynomial. Then select N1 = 8192 and q1 to generate the second private key polynomial sk1.

[0124] Based on sk0 construction Generate sk * →The public key for exchanging KeySwitch corresponding to sk1. Simultaneously generate... The automorphism public key, where τ i =1+N1 / 2 i , i=0, 1,..., log2N1-2, K is log2N1-1.

[0125] S2. The Host encrypts the gradient vector (g0, g1, ..., g0) according to the first private key polynomial sk0. n-1 The host generates the first public key polynomial based on the first private key polynomial sk0, and then uses the first public key polynomial to process the gradient vector (g0, g1, ..., g...). n-1 Encrypt to obtain Each RLWE ciphertext (dimensional N0, modulus q0) is... The RLWE ciphertext is a gradient ciphertext. The Host exchanges the gradient ciphertext with the KeySwitch public key and log2N1-1 automorphism public keys and sends them to the Guest.

[0126] S3, Guest received this After encrypting the j-th RLWE data, homomorphic accumulation is performed based on the m index sets to obtain the m candidate gradient histogram ciphertexts of the federated learning model. Let the j-th index set be... j ={j1, j2, ..., j s When n≤N0, the number of RLWE ciphertexts is 1, and this RLWE ciphertext is denoted as (c0(X), c1(X)). Construct the index polynomial of the j-th index set. Then the constant term of the plaintext polynomial in the gradient histogram polynomial (J(X)·c0(X), J(X)·c1(X)) corresponding to the j-th index set is: (That is, the result of accumulating the gradient values ​​of the training samples in the j-th index set. Therefore, the constant term of (J(X)·c0(X), J(X)·c1(X)) can be determined as the m candidate gradient histogram ciphertexts of the federated learning model. If n>N0, then there are [n / N0]>1 (i.e., Q) received RLWE ciphertexts. For the i-th RLWE ciphertext, the index of the j-th index set (i.e., any index set) is...) j ={j1, j2, ..., j s Find the intersection of the interval [(i-1)·N0, i·N0] to obtain a new index set (i.e., update the index set). Construct the index polynomial corresponding to the updated index set according to the above method, and perform homomorphic multiplication to obtain the RLWE ciphertext. Homomorphically sum the RLWE ciphertexts (Q gradient histogram polynomials) corresponding to the same index set to obtain the final RLWE ciphertext corresponding to the index set. Extract the constant term from the final RLWE ciphertext corresponding to the index set to obtain the LWE ciphertext (gradient histogram ciphertext corresponding to the index set), which is the output LWE ciphertext (dimension N0, modulus q0).

[0127] S4. The Guest side, based on the m LWE ciphertexts, merges each pair of LWE ciphertexts into a single RLWE ciphertext, resulting in m / 2 RLWE ciphertexts, which are essentially m / 2 merged gradient histogram ciphertexts. Specifically, the two LWE ciphertexts (the f-th ciphertext pair) include the first candidate histogram ciphertext. Second candidate histogram ciphertext according to and Construct polynomial here Construct polynomial Let (a(X), b(X)) be the RLWE ciphertext corresponding to the f-th ciphertext pair (i.e., the merged histogram ciphertext), with dimension N1 and modulus q0. Then, call the ModSwitch component to transform the merged histogram ciphertext into... The ciphertext on (a * (X), b * (X)). At this time, the RLWE ciphertext satisfies a * (X)*sk * (X)+b * (X)=m * (X)+e * (X), where m * The constant term of (X) is the LWE ciphertext. The corresponding plaintext, the coefficient of the N0th term is the LWE ciphertext. The corresponding plaintext. * The remaining terms of (X) have no practical significance.

[0128] S5. The Guest party uses m / 2 RLWE ciphertexts and the exchanged KeySwitch public key as input to call the key exchange component, obtaining gradient histogram ciphertexts associated with the second private key polynomial, i.e., m / 2 new RLWE ciphertexts. If the key exchange component performs key exchange processing on the gradient histogram ciphertexts of the f-th ciphertext pair based on the exchanged public key and modulo q1, it obtains gradient histogram ciphertexts associated with the second private key polynomial, i.e., the new RLWE ciphertexts corresponding to the f-th ciphertext pair. satisfy Here, the constant term of m(X) is the LWE ciphertext. The corresponding plaintext, the coefficient of the N0th term is the LWE ciphertext. The corresponding plaintext. The remaining terms of m(X) have no practical significance.

[0129] S6. The Guest takes m / 2 new RLWE ciphertexts and log2N1-1 automorphism public keys as input, calls the ciphertext aggregation component (LWE ciphertext aggregation), and finally obtains a single RLWE ciphertext (i.e., the target gradient histogram ciphertext of the federated learning model), and sends the RLWE ciphertext to the Host.

[0130] S7. The Host uses the second private key polynomial sk1 to decrypt the ciphertext of the target gradient histogram of the federated learning model, resulting in m plaintext values ​​(m gradient histogram plaintexts).

[0131] In summary, in steps S4 and S5, every two LWE ciphertexts are converted into one RLWE ciphertext through a key switch, saving half of the key switch operation (i.e., key exchange processing). Ciphertext aggregation is then performed on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial. This is equivalent to performing an automorphism on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial. When m is large compared to log2N1, the number of automorphisms is approximately m / 2, meaning half of the automorphism operations (i.e., ciphertext aggregation) are eliminated. Because Automorphism can be achieved by converting meaningless coefficients in a plaintext polynomial to zero, thereby generating random numbers, blinding these meaningless coefficients, and thus avoiding... An Automorphism, at which point the plaintext coefficient is only amplified. The number of candidate histogram ciphertexts is reduced by a factor of 1, rather than 1 / 2. This application significantly reduces the number of transformations of the histogram ciphertexts (merging gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, reduces the computational load during the training process of the federated learning model, and improves the training efficiency of the federated learning model.

[0132] Please see Figure 7 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. Figure 7 As shown, the data processing apparatus may include:

[0133] The acquisition module 711 is used to acquire gradient ciphertext, K automorphic public keys, and a transformation public key from the first device; the gradient ciphertext is obtained by encrypting n gradient values ​​based on the first public key polynomial of the first device, and the K automorphic public keys and the transformation public key are determined based on the first private key polynomial and the second private key polynomial corresponding to the first public key polynomial; n and K are integers greater than 1;

[0134] Processing module 712 is used to perform homomorphic accumulation processing on the gradient ciphertext according to m index sets to obtain m candidate gradient histogram ciphertexts of the federated learning model; the m index sets are obtained by binning the n training samples based on the sample features of the n training samples; m is an integer greater than 1.

[0135] The merging module 713 is used to merge every two candidate gradient histogram ciphertexts in the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts;

[0136] The conversion module 714 is used to convert the m / 2 merged gradient histogram ciphertexts according to the K automorphic public keys and the conversion public key to obtain the target gradient histogram ciphertext of the federated learning model, and send the target gradient histogram ciphertext to the first device; the first device is used to train the federated learning model according to the target gradient histogram plaintext, wherein the target gradient histogram plaintext is obtained by decrypting the target gradient histogram ciphertext based on the second private key polynomial.

[0137] Optionally, the number of gradient ciphertexts is one. The processing module 712 performs homomorphic accumulation processing on the gradient ciphertexts based on m index sets to obtain m candidate gradient histogram ciphertexts of the federated learning model, including:

[0138] Based on the dimension of the first private key polynomial, construct the index polynomials corresponding to the m index sets respectively;

[0139] Multiply the gradient ciphertext with the index polynomials corresponding to the m index sets to obtain m gradient histogram polynomials.

[0140] The constant terms in the m gradient histogram polynomials are extracted respectively to obtain the m candidate gradient histogram ciphertexts of the federated learning model.

[0141] Optionally, the n training samples are distributed across Q training sample sets, and the processing module 712 has Q gradient ciphertexts. The i-th gradient ciphertext among the Q gradient ciphertexts is obtained by encrypting the gradient value corresponding to the training sample in the i-th training sample set, where Q is an integer greater than 1 and i is a positive integer less than or equal to Q. The a-th index set among the m index sets includes the training samples belonging to the a-th bin among the n training samples, where a is a positive integer less than or equal to m.

[0142] The gradient ciphertext is homomorphically accumulated based on m index sets to obtain m candidate gradient histogram ciphertexts for the federated learning model, including...

[0143] Obtain the intersection between the a-th index set and the Q training sample sets corresponding to the Q gradient ciphertexts, and obtain the Q update index sets corresponding to the a-th index set;

[0144] Based on the Q update index sets corresponding to the a-th index set, homomorphic accumulation processing is performed on the Q gradient ciphertexts to obtain the gradient histogram ciphertext corresponding to the a-th index set;

[0145] Until the gradient histogram ciphertexts corresponding to the m index sets are obtained, the gradient histogram ciphertexts corresponding to the m index sets are determined as the m candidate gradient histogram ciphertexts of the federated learning model.

[0146] Optionally, the processing module performs homomorphic accumulation processing on the Q gradient ciphertexts according to the Q update index sets corresponding to the a-th index set to obtain the gradient histogram ciphertext corresponding to the a-th index set, including:

[0147] Based on the dimension of the first private key polynomial and the Q update index sets corresponding to the a-th index set, construct the Q update index polynomials corresponding to the a-th index set; one update index set corresponds to one update index polynomial.

[0148] The s-th update index polynomial corresponding to the a-th index set is multiplied with the s-th gradient ciphertext in the Q gradient ciphertexts to obtain the s-th gradient histogram polynomial of the a-th index set; the update index set corresponding to the s-th update index polynomial is the intersection between the sample set corresponding to the s-th gradient ciphertext and the a-th index set, where s is a positive integer less than or equal to Q;

[0149] Until the Q gradient histogram polynomials corresponding to the a-th index set are obtained, the constant terms in the Q gradient histogram polynomials corresponding to the a-th index set are accumulated to obtain the gradient histogram ciphertext corresponding to the a-th index set.

[0150] Optionally, the merging module 713 merges every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, including:

[0151] Generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext, and generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the second candidate gradient histogram ciphertext; the first candidate gradient histogram ciphertext and the second candidate gradient histogram ciphertext belong to the f-th ciphertext pair among the m / 2 ciphertext pairs;

[0152] The N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext and the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext are summed to obtain the N1-dimensional merged gradient histogram ciphertext of the f-th ciphertext pair; N1 is twice N0.

[0153] Until the N1-dimensional merged gradient histogram ciphertexts corresponding to the m / 2 ciphertext pairs are obtained, the N1-dimensional merged gradient histogram ciphertexts corresponding to the m / 2 ciphertext pairs are determined as the m / 2 merged gradient histogram ciphertexts.

[0154] Optionally, the merging module 713 generates an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext in the f-th ciphertext pair among the m / 2 ciphertext pairs, and an N0-dimensional gradient histogram ciphertext polynomial reflecting the second candidate gradient histogram ciphertext in the f-th ciphertext pair among the m / 2 ciphertext pairs, including:

[0155] Based on the dimension of the first private key polynomial, an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext is generated.

[0156] Based on the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext, an automorphic mapping process is performed on the second candidate gradient histogram ciphertext to obtain the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext; the power of the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext is different from the power of the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext.

[0157] Optionally, the m / 2 merged gradient histogram ciphertexts belong to the modulus q0 corresponding to the first private key polynomial;

[0158] The conversion module 714 converts the m / 2 merged gradient histogram ciphertexts according to the K automorphic public keys and the conversion public key to obtain the target gradient histogram ciphertext of the federated learning model, including:

[0159] Based on the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, the m / 2 merged gradient histogram ciphertexts are subjected to modulus transformation to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1.

[0160] The key exchange component is invoked to perform key exchange processing on the m / 2 gradient histogram ciphertexts belonging to the modulus q1 according to the exchange public key, so as to obtain the m / 2 gradient histogram ciphertexts associated with the second private key polynomial.

[0161] The ciphertext aggregation component is invoked to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, thereby obtaining the target gradient histogram ciphertext of the federated learning model.

[0162] Optionally, the conversion module 714 performs a modulus transformation on the m / 2 merged gradient histogram ciphertexts based on the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1, including:

[0163] The coefficients in the m / 2 merged gradient histogram ciphertexts are multiplied by the modulus q0 corresponding to the first private key polynomial to obtain the m / 2 merged gradient histogram ciphertexts after multiplication.

[0164] The coefficients in the m / 2 merged gradient histogram ciphertexts after multiplication are divided by the modulus q1 corresponding to the second private key polynomial to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1.

[0165] Optionally, the conversion module 714 calls the ciphertext aggregation component to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, to obtain the target gradient histogram ciphertext of the federated learning model, including:

[0166] The ciphertext aggregation component is invoked to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, thereby obtaining the initial gradient histogram ciphertext of the federated learning model.

[0167] The initial gradient histogram ciphertext is blinded using a stochastic multinomial to obtain the target gradient histogram ciphertext of the federated learning model.

[0168] Optionally, the transformation module 714 performs blinding processing on the initial gradient histogram ciphertext using a stochastic multinomial to obtain the target gradient histogram ciphertext of the federated learning model, including:

[0169] The random polynomial is added to the initial gradient histogram ciphertext to obtain the target gradient histogram ciphertext of the federated learning model; or...

[0170] The target gradient histogram ciphertext of the federated learning model is obtained by subtracting the random polynomial from the initial gradient histogram ciphertext.

[0171] In this application, during the training of the federated learning model, firstly, the first device directly encrypts n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext. That is, it encrypts the gradient polynomials corresponding to the n gradient values ​​according to the first public key polynomial. In the process of encrypting the gradient values ​​of the federated learning model, only polynomial operations are required, eliminating the need for high-dimensional vector operations, thus reducing the computational load and training overhead of the federated learning model, and improving its training efficiency. Then, after the first device sends the gradient ciphertext to the second device, it merges every two candidate histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, significantly reducing the number of candidate histogram ciphertexts. This, in turn, reduces the number of transformations required for the histogram ciphertexts (merged gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, further reduces the computational load during the training of the federated learning model, and improves its training efficiency. Furthermore, during the training of the federated learning model, the first sample features and label data of the first device and the second sample features of the second device are linked by calculating the gradient histogram ciphertext. This ensures that the training data of the first device (i.e., the first sample features and label data) and the training data of the second device (i.e., the second sample features) are not leaked, thereby enabling joint training of the federated learning model. This provides more information for the training process of the federated learning model and improves the training accuracy of the federated learning model.

[0172] Please see Figure 8 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. Figure 8 As shown, the data processing apparatus may include:

[0173] The acquisition module 811 is used to acquire the first public key polynomial, the second private key polynomial, the transformation public key, and K automorphic public keys corresponding to the first private key polynomial of the first device; the transformation public key and the K automorphic public keys are generated based on the first private key polynomial and the second private key polynomial, where K is an integer greater than 1;

[0174] The encryption module 812 is used to encrypt n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext; n is an integer greater than 1.

[0175] The sending module 813 is used to send the gradient ciphertext, the exchange public key, and the K isomorphic mapping public keys to the second device; the second device is used to transform m / 2 merged gradient histogram ciphertexts according to the K isomorphic public keys and the transformation public key to obtain the target gradient histogram ciphertext of the federated learning model. The m / 2 merged gradient histogram ciphertexts are obtained by merging every two candidate gradient histogram ciphertexts from m candidate gradient histogram ciphertexts. The m candidate gradient histogram ciphertexts are obtained by homomorphically accumulating the gradient ciphertexts according to m index sets. The m index sets are obtained by binning the n training samples based on the second sample features of the n training samples; m is an integer greater than 1.

[0176] The receiving module 814 is used to receive the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypt the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram.

[0177] Training module 815 is used to train the federated learning model based on the plaintext of the target gradient histogram.

[0178] Optionally, the encryption module 812 encrypts n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext, including:

[0179] If the dimension of the first private key polynomial is greater than or equal to n, then the n gradient values ​​are encrypted according to the first public key polynomial to obtain a gradient ciphertext.

[0180] If the dimension of the first private key polynomial is less than n, then the n training samples are divided into Q training sample sets. According to the first public key polynomial, the gradient value corresponding to the training sample in the g-th training sample set in the Q training sample sets is encrypted to obtain the gradient ciphertext corresponding to the g-th training sample set. This process continues until the gradient ciphertexts corresponding to the Q training sample sets are obtained. The number of training samples in the Q training sample sets is less than or equal to the dimension of the first private key polynomial.

[0181] Optionally, the receiving module 814 decrypts the target gradient histogram ciphertext according to the second private key polynomial to obtain the target gradient histogram plaintext, including:

[0182] The target gradient histogram ciphertext is deblinded using a random multinomial to obtain the initial gradient histogram ciphertext.

[0183] The initial gradient histogram ciphertext is decrypted according to the second private key polynomial to obtain the target gradient histogram plaintext.

[0184] Optionally, the receiving module 814 uses a random polynomial to perform deblinding processing on the target gradient histogram ciphertext to obtain the initial gradient histogram ciphertext, including:

[0185] Subtracting the random polynomial from the target gradient histogram ciphertext yields the initial gradient histogram ciphertext; or,

[0186] The random polynomial is added to the initial gradient histogram ciphertext to obtain the initial gradient histogram ciphertext.

[0187] Training module 815 is also used for:

[0188] Obtain sample features and label data for n training samples from the first device;

[0189] The federated learning model is invoked to identify the sample features of the n training samples, thereby obtaining the prediction data of the n training samples;

[0190] Based on the predicted data of the n training samples and the label data, determine the n gradient values ​​of the federated learning model.

[0191] In this application, during the training of the federated learning model, firstly, the first device directly encrypts n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext. That is, it encrypts the gradient polynomials corresponding to the n gradient values ​​according to the first public key polynomial. In the process of encrypting the gradient values ​​of the federated learning model, only polynomial operations are required, eliminating the need for high-dimensional vector operations, thus reducing the computational load and training overhead of the federated learning model, and improving its training efficiency. Then, after the first device sends the gradient ciphertext to the second device, it merges every two candidate histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, significantly reducing the number of candidate histogram ciphertexts. This, in turn, reduces the number of transformations required for the histogram ciphertexts (merged gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, further reduces the computational load during the training of the federated learning model, and improves its training efficiency. Furthermore, during the training of the federated learning model, the first sample features and label data of the first device and the second sample features of the second device are linked by calculating the gradient histogram ciphertext. This ensures that the training data of the first device (i.e., the first sample features and label data) and the training data of the second device (i.e., the second sample features) are not leaked, thereby enabling joint training of the federated learning model. This provides more information for the training process of the federated learning model and improves the training accuracy of the federated learning model.

[0192] Please see Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 9 As shown, the computer device 1000 described above can be the first device in the above method, specifically a terminal or server, including: a processor 1001, a network interface 1004, and a memory 1005. Furthermore, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to implement communication between these components. In some embodiments, the user interface 1003 may include a display screen and a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. The memory 1005 may also optionally be at least one storage device located remotely from the aforementioned processor 1001. Figure 9 As shown, the memory 1005, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and computer applications.

[0193] exist Figure 9 In the computer device 1000 shown, the network interface 1004 provides network communication functionality; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call computer applications stored in the memory 1005 to achieve:

[0194] The gradient ciphertext, K automorphic public keys, and a transformation public key are obtained from the first device. The gradient ciphertext is obtained by encrypting n gradient values ​​based on the first public key polynomial of the first device. The K automorphic public keys and the transformation public key are determined based on the first private key polynomial and the second private key polynomial corresponding to the first public key polynomial. n and K are integers greater than 1.

[0195] Based on m index sets, the gradient ciphertext is homomorphically accumulated to obtain m candidate gradient histogram ciphertexts for the federated learning model; the m index sets are obtained by binning the n training samples based on the sample features of the n training samples; m is an integer greater than 1.

[0196] Merge every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts;

[0197] Based on the K automorphic public keys and the transformation public key, the m / 2 merged gradient histogram ciphertexts are transformed to obtain the target gradient histogram ciphertext of the federated learning model, and the target gradient histogram ciphertext is sent to the first device; the first device is used to train the federated learning model based on the target gradient histogram plaintext, where the target gradient histogram plaintext is obtained by decrypting the target gradient histogram ciphertext based on the second private key polynomial.

[0198] Optionally, the number of gradient ciphertexts is one. The processor 1001 can be used to call a computer application stored in the memory 1005 to perform homomorphic accumulation processing on the gradient ciphertexts according to m index sets, to obtain m candidate gradient histogram ciphertexts of the federated learning model, including:

[0199] Based on the dimension of the first private key polynomial, construct the index polynomials corresponding to the m index sets respectively;

[0200] Multiply the gradient ciphertext with the index polynomials corresponding to the m index sets to obtain m gradient histogram polynomials.

[0201] The constant terms in the m gradient histogram polynomials are extracted respectively to obtain the m candidate gradient histogram ciphertexts of the federated learning model.

[0202] Optionally, the n training samples are distributed in Q training sample sets, and the number of gradient ciphertexts is Q. The i-th gradient ciphertext among the Q gradient ciphertexts is obtained by encrypting the gradient value corresponding to the training sample in the i-th training sample set, where Q is an integer greater than 1 and i is a positive integer less than or equal to Q; the a-th index set among the m index sets includes the training samples belonging to the a-th bin among the n training samples, where a is a positive integer less than or equal to m;

[0203] Processor 1001 can be used to call computer applications stored in memory 1005 to perform homomorphic accumulation processing on the gradient ciphertext according to m index sets, to obtain m candidate gradient histogram ciphertexts of the federated learning model, including

[0204] Obtain the intersection between the a-th index set and the Q training sample sets corresponding to the Q gradient ciphertexts, and obtain the Q update index sets corresponding to the a-th index set;

[0205] Based on the Q update index sets corresponding to the a-th index set, homomorphic accumulation processing is performed on the Q gradient ciphertexts to obtain the gradient histogram ciphertext corresponding to the a-th index set;

[0206] Until the gradient histogram ciphertexts corresponding to the m index sets are obtained respectively, the gradient histogram ciphertexts corresponding to the m index sets are determined as the m candidate gradient histogram ciphertexts of the federated learning model.

[0207] Processor 1001 can be used to call a computer application stored in memory 1005 to perform homomorphic accumulation processing on the Q gradient ciphertexts according to the Q update index sets corresponding to the a-th index set, to obtain the gradient histogram ciphertext corresponding to the a-th index set, including:

[0208] Based on the dimension of the first private key polynomial and the Q update index sets corresponding to the a-th index set, construct the Q update index polynomials corresponding to the a-th index set; one update index set corresponds to one update index polynomial.

[0209] The s-th update index polynomial corresponding to the a-th index set is multiplied with the s-th gradient ciphertext in the Q gradient ciphertexts to obtain the s-th gradient histogram polynomial of the a-th index set; the update index set corresponding to the s-th update index polynomial is the intersection between the sample set corresponding to the s-th gradient ciphertext and the a-th index set, where s is a positive integer less than or equal to Q;

[0210] Until the Q gradient histogram polynomials corresponding to the a-th index set are obtained, the constant terms in the Q gradient histogram polynomials corresponding to the a-th index set are accumulated to obtain the gradient histogram ciphertext corresponding to the a-th index set.

[0211] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to merge every two candidate gradient histogram ciphertexts among the m candidate gradient histogram ciphertexts, obtaining m / 2 merged gradient histogram ciphertexts, including:

[0212] The m candidate gradient histogram ciphertexts are divided into m / 2 ciphertext pairs, and each ciphertext pair includes two candidate gradient histogram ciphertexts.

[0213] Generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext, and generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the second candidate gradient histogram ciphertext; the first candidate gradient histogram ciphertext and the second candidate gradient histogram ciphertext belong to the f-th ciphertext pair among the m / 2 ciphertext pairs;

[0214] The N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext and the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext are summed to obtain the N1-dimensional merged gradient histogram ciphertext of the f-th ciphertext pair; N1 is twice N0.

[0215] Until the N1-dimensional merged gradient histogram ciphertexts corresponding to the m / 2 ciphertext pairs are obtained, the N1-dimensional merged gradient histogram ciphertexts corresponding to the m / 2 ciphertext pairs are determined as the m / 2 merged gradient histogram ciphertexts.

[0216] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext in the f-th ciphertext pair of the m / 2 ciphertext pairs, and an N0-dimensional gradient histogram ciphertext polynomial reflecting the second candidate gradient histogram ciphertext in the f-th ciphertext pair of the m / 2 ciphertext pairs, including:

[0217] Based on the dimension of the first private key polynomial, an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext is generated.

[0218] Based on the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext, an automorphic mapping process is performed on the second candidate gradient histogram ciphertext to obtain the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext; the power of the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext is different from the power of the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext.

[0219] Optionally, the m / 2 merged gradient histogram ciphertexts belong to the modulus q0 corresponding to the first private key polynomial;

[0220] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to perform transformation processing on the m / 2 merged gradient histogram ciphertexts according to the K automorphic public keys and the transformation public key, to obtain the target gradient histogram ciphertext of the federated learning model, including:

[0221] Based on the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, the m / 2 merged gradient histogram ciphertexts are subjected to modulus transformation to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1.

[0222] The key exchange component is invoked to perform key exchange processing on the m / 2 gradient histogram ciphertexts belonging to the modulus q1 according to the exchange public key, so as to obtain the m / 2 gradient histogram ciphertexts associated with the second private key polynomial.

[0223] The ciphertext aggregation component is invoked to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, thereby obtaining the target gradient histogram ciphertext of the federated learning model.

[0224] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to perform a modulus transformation on the m / 2 merged gradient histogram ciphertexts according to the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1, including:

[0225] The coefficients in the m / 2 merged gradient histogram ciphertexts are multiplied by the modulus q0 corresponding to the first private key polynomial to obtain the m / 2 merged gradient histogram ciphertexts after multiplication.

[0226] The coefficients in the m / 2 merged gradient histogram ciphertexts after multiplication are divided by the modulus q1 corresponding to the second private key polynomial to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1.

[0227] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to invoke a ciphertext aggregation component, which, based on the K automorphic public keys, performs ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial to obtain the target gradient histogram ciphertext of the federated learning model, including:

[0228] The ciphertext aggregation component is invoked to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, thereby obtaining the initial gradient histogram ciphertext of the federated learning model.

[0229] The initial gradient histogram ciphertext is blinded using a stochastic multinomial to obtain the target gradient histogram ciphertext of the federated learning model.

[0230] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to: perform blinding processing on the initial gradient histogram ciphertext using a random polynomial to obtain the target gradient histogram ciphertext of the federated learning model, including:

[0231] The random polynomial is added to the initial gradient histogram ciphertext to obtain the target gradient histogram ciphertext of the federated learning model; or...

[0232] The target gradient histogram ciphertext of the federated learning model is obtained by subtracting the random polynomial from the initial gradient histogram ciphertext.

[0233] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to: obtain a first public key polynomial, a second private key polynomial, a transformation public key, and K automorphic public keys corresponding to the first private key polynomial of the first device; the transformation public key and the K automorphic public keys are generated based on the first private key polynomial and the second private key polynomial, where K is an integer greater than 1;

[0234] Based on the first public key polynomial, the n gradient values ​​are encrypted to obtain the gradient ciphertext; n is an integer greater than 1.

[0235] The gradient ciphertext, the exchange public key, and the K isomorphic mapping public keys are sent to the second device. The second device is used to transform the m / 2 merged gradient histogram ciphertexts according to the K isomorphic public keys and the transformation public key to obtain the target gradient histogram ciphertext of the federated learning model. The m / 2 merged gradient histogram ciphertexts are obtained by merging every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts. The m candidate gradient histogram ciphertexts are obtained by homomorphically accumulating the gradient ciphertexts according to the m index sets. The m index sets are obtained by binning the n training samples based on the second sample features of the n training samples. m is an integer greater than 1.

[0236] The system receives the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypts the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram.

[0237] The federated learning model is trained based on the plaintext of the target gradient histogram.

[0238] Optionally, the processor 1001 can be used to invoke a computer application stored in the memory 1005 to encrypt n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext, including:

[0239] If the dimension of the first private key polynomial is greater than or equal to n, then the n gradient values ​​are encrypted according to the first public key polynomial to obtain a gradient ciphertext.

[0240] If the dimension of the first private key polynomial is less than n, then the n training samples are divided into Q training sample sets. According to the first public key polynomial, the gradient value corresponding to the training sample in the g-th training sample set in the Q training sample sets is encrypted to obtain the gradient ciphertext corresponding to the g-th training sample set. This process continues until the gradient ciphertexts corresponding to the Q training sample sets are obtained. The number of training samples in the Q training sample sets is less than or equal to the dimension of the first private key polynomial.

[0241] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to decrypt the target gradient histogram ciphertext according to the second private key polynomial to obtain the target gradient histogram plaintext, including:

[0242] The target gradient histogram ciphertext is deblinded using a random multinomial to obtain the initial gradient histogram ciphertext.

[0243] The initial gradient histogram ciphertext is decrypted according to the second private key polynomial to obtain the target gradient histogram plaintext.

[0244] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to perform deblinding processing on the target gradient histogram ciphertext using a random polynomial, to obtain an initial gradient histogram ciphertext, including...

[0245] Subtracting the random polynomial from the target gradient histogram ciphertext yields the initial gradient histogram ciphertext; or,

[0246] The random polynomial is added to the initial gradient histogram ciphertext to obtain the initial gradient histogram ciphertext.

[0247] Optionally, the processor 1001 can be used to call a computer application stored in the memory 1005 to: acquire sample feature and label data of n training samples from the first device;

[0248] The federated learning model is invoked to identify the sample features of the n training samples, thereby obtaining the prediction data of the n training samples;

[0249] Based on the predicted data of the n training samples and the label data, determine the n gradient values ​​of the federated learning model.

[0250] In this application, during the training of the federated learning model, firstly, the first device directly encrypts n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext. That is, it encrypts the gradient polynomials corresponding to the n gradient values ​​according to the first public key polynomial. In the process of encrypting the gradient values ​​of the federated learning model, only polynomial operations are required, eliminating the need for high-dimensional vector operations, thus reducing the computational load and training overhead of the federated learning model, and improving its training efficiency. Then, after the first device sends the gradient ciphertext to the second device, it merges every two candidate histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts, significantly reducing the number of candidate histogram ciphertexts. This, in turn, reduces the number of transformations required for the histogram ciphertexts (merged gradient histogram ciphertexts), reduces the resource overhead required for histogram ciphertext transformation, further reduces the computational load during the training of the federated learning model, and improves its training efficiency. Furthermore, during the training of the federated learning model, the first sample features and label data of the first device and the second sample features of the second device are linked by calculating the gradient histogram ciphertext. This ensures that the training data of the first device (i.e., the first sample features and label data) and the training data of the second device (i.e., the second sample features) are not leaked, thereby enabling joint training of the federated learning model. This provides more information for the training process of the federated learning model and improves the training accuracy of the federated learning model.

[0251] It should be understood that the computer device described in the embodiments of this application can execute the data processing method described in the corresponding embodiments above, or it can execute the data processing apparatus described in the corresponding embodiments above, and will not be repeated here. In addition, the beneficial effects of using the same method will not be repeated here.

[0252] Furthermore, it should be noted that this application also provides a computer-readable storage medium storing a computer program executed by the aforementioned data processing apparatus. This computer program includes program instructions, which, when executed by the processor, enable the execution of the data processing method described in the corresponding embodiments above. Therefore, further details will not be repeated here. Additionally, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application.

[0253] As an example, the above program instructions can be deployed and executed on a computer device, or deployed and executed on at least two computer devices in one location, or executed on at least two computer devices distributed in at least two locations and interconnected by a communication network. At least two computer devices distributed in at least two locations and interconnected by a communication network can form a blockchain network.

[0254] The aforementioned computer-readable storage medium may be a data processing apparatus provided in any of the foregoing embodiments or a central storage unit of the aforementioned computer device, such as a hard disk or central storage of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, smart memory card (SMC), secure digital (SD) card, flash memory card, etc., provided on the computer device. Furthermore, the computer-readable storage medium may include both the central storage unit and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0255] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish content in different media, rather than to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0256] In practice, the collection and processing of data in this application should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the data subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the data subject.

[0257] This application also provides a computer program product, including a computer program / instructions. When executed by a processor, the computer program / instructions implement the data processing method and decoding method described in the preceding embodiments; therefore, they will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer program product involved in this application, please refer to the description of the method embodiments of this application.

[0258] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0259] The methods and related apparatus provided in this application are described with reference to the method flowcharts and / or structural diagrams provided in this application. Specifically, each block of the method flowchart and / or structural diagram, as well as combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable network-connected device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable network-connected device, generate instructions for implementing the process. Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable network-connected device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable network-connected device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or structures illustrate the steps of the functions specified in one or more boxes.

[0260] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.< / x> < / x>

Claims

1. A data processing method, characterized in that, include: Obtain the gradient ciphertext, K automorphic public keys, and the transformed public key from the first device; The gradient ciphertext is obtained by encrypting n gradient values ​​based on the first public key polynomial of the first device. The K self-similar public keys and the transformation public key are determined based on the first private key polynomial and the second private key polynomial corresponding to the first public key polynomial; n and K are integers greater than 1. Based on m index sets, the gradient ciphertext is homomorphically accumulated to obtain m candidate gradient histogram ciphertexts for the federated learning model; the m index sets are obtained by binning the n training samples based on the sample features of the n training samples. m is an integer greater than 1; The candidate gradient histogram ciphertexts are merged into m / 2 merged gradient histogram ciphertexts; the m / 2 merged gradient histogram ciphertexts belong to the modulus q0 corresponding to the first private key polynomial. Based on the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, the m / 2 merged gradient histogram ciphertexts are subjected to modulus transformation to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1. The key exchange component is invoked to perform key exchange processing on the m / 2 gradient histogram ciphertexts belonging to the modulus q1 according to the conversion public key, so as to obtain m / 2 gradient histogram ciphertexts associated with the second private key polynomial. The ciphertext aggregation component is invoked to perform ciphertext aggregation on the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, thereby obtaining the initial gradient histogram ciphertext of the federated learning model. The initial gradient histogram ciphertext is blinded using a random multinomial to obtain the target gradient histogram ciphertext of the federated learning model, and the target gradient histogram ciphertext is sent to the first device. The first device is used to train the federated learning model based on the plaintext of the target gradient histogram, wherein the plaintext of the target gradient histogram is obtained by decrypting the ciphertext of the target gradient histogram based on the second private key polynomial.

2. The method as described in claim 1, characterized in that, The number of gradient ciphertexts is one. Based on m index sets, the gradient ciphertexts are homomorphically accumulated to obtain m candidate gradient histogram ciphertexts for the federated learning model, including: Based on the dimension of the first private key polynomial, construct the index polynomials corresponding to the m index sets respectively; Multiply the gradient ciphertext with the index polynomials corresponding to the m index sets to obtain m gradient histogram polynomials. The constant terms in the m gradient histogram polynomials are extracted respectively to obtain the m candidate gradient histogram ciphertexts of the federated learning model.

3. The method as described in claim 1, characterized in that, The n training samples are distributed across Q training sample sets. The number of gradient ciphertexts is Q. The i-th gradient ciphertext among the Q gradient ciphertexts is obtained by encrypting the gradient value corresponding to the training sample in the i-th training sample set. Q is an integer greater than 1, and i is a positive integer less than or equal to Q. The a-th index set among the m index sets includes the training samples belonging to the a-th bin among the n training samples. a is a positive integer less than or equal to m. The gradient ciphertext is homomorphically accumulated based on m index sets to obtain m candidate gradient histogram ciphertexts for the federated learning model, including: Obtain the intersection between the a-th index set and the Q training sample sets corresponding to the Q gradient ciphertexts, and obtain the Q update index sets corresponding to the a-th index set; Based on the Q update index sets corresponding to the a-th index set, homomorphic accumulation processing is performed on the Q gradient ciphertexts to obtain the gradient histogram ciphertext corresponding to the a-th index set; Until the gradient histogram ciphertexts corresponding to the m index sets are obtained, the gradient histogram ciphertexts corresponding to the m index sets are determined as the m candidate gradient histogram ciphertexts of the federated learning model.

4. The method as described in claim 3, characterized in that, The step of performing homomorphic accumulation processing on the Q gradient ciphertexts based on the Q update index sets corresponding to the a-th index set to obtain the gradient histogram ciphertext corresponding to the a-th index set includes: Based on the dimension of the first private key polynomial and the Q update index sets corresponding to the a-th index set, construct the Q update index polynomials corresponding to the a-th index set; one update index set corresponds to one update index polynomial. The s-th update index polynomial corresponding to the a-th index set is multiplied with the s-th gradient ciphertext in the Q gradient ciphertexts to obtain the s-th gradient histogram polynomial of the a-th index set; the update index set corresponding to the s-th update index polynomial is the intersection between the sample set corresponding to the s-th gradient ciphertext and the a-th index set, where s is a positive integer less than or equal to Q; Until the Q gradient histogram polynomials corresponding to the a-th index set are obtained, the constant terms in the Q gradient histogram polynomials corresponding to the a-th index set are accumulated to obtain the gradient histogram ciphertext corresponding to the a-th index set.

5. The method as described in claim 1, characterized in that, The step of merging every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts includes: The m candidate gradient histogram ciphertexts are divided into m / 2 ciphertext pairs, and each ciphertext pair includes two candidate gradient histogram ciphertexts. Generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext, and generate an N0-dimensional gradient histogram ciphertext polynomial reflecting the second candidate gradient histogram ciphertext; the first candidate gradient histogram ciphertext and the second candidate gradient histogram ciphertext belong to the f-th ciphertext pair among the m / 2 ciphertext pairs; The N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext and the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext are summed to obtain the N1-dimensional merged gradient histogram ciphertext of the f-th ciphertext pair; N1 is twice N0. Until the N1-dimensional merged gradient histogram ciphertexts corresponding to the m / 2 ciphertext pairs are obtained, the N1-dimensional merged gradient histogram ciphertexts corresponding to the m / 2 ciphertext pairs are determined as the m / 2 merged gradient histogram ciphertexts.

6. The method as described in claim 5, characterized in that, The generation of the N0-dimensional gradient histogram ciphertext polynomial reflecting the first candidate gradient histogram ciphertext, and the generation of the N0-dimensional gradient histogram ciphertext reflecting the second candidate gradient histogram ciphertext, include: Based on the dimension of the first private key polynomial, generate an N0-dimensional gradient histogram ciphertext polynomial that reflects the first candidate gradient histogram ciphertext. Based on the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext, an automorphic mapping process is performed on the second candidate gradient histogram ciphertext to obtain the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext; the power of the N0-dimensional gradient histogram ciphertext polynomial of the first candidate gradient histogram ciphertext is different from the power of the N0-dimensional gradient histogram ciphertext polynomial of the second candidate gradient histogram ciphertext.

7. The method as described in claim 1, characterized in that, The step of performing a modulus transformation on the m / 2 merged gradient histogram ciphertexts based on the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1 includes: The coefficients in the m / 2 merged gradient histogram ciphertexts are multiplied by the modulus q0 corresponding to the first private key polynomial to obtain the m / 2 merged gradient histogram ciphertexts after multiplication. The coefficients in the m / 2 merged gradient histogram ciphertexts after multiplication are divided by the modulus q1 corresponding to the second private key polynomial to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1.

8. The method as described in claim 1, characterized in that, The initial gradient histogram ciphertext is blinded using a random multinomial to obtain the target gradient histogram ciphertext of the federated learning model, including: The target gradient histogram ciphertext of the federated learning model is obtained by adding the random polynomial to the initial gradient histogram ciphertext; or... The target gradient histogram ciphertext of the federated learning model is obtained by subtracting the random polynomial from the initial gradient histogram ciphertext.

9. A data processing method, characterized in that, include: Obtain the first public key polynomial, the second private key polynomial, the transformation public key, and K automorphic public keys corresponding to the first private key polynomial of the first device; The transformation public key and the K self-similar public keys are generated based on the first private key polynomial and the second private key polynomial, where K is an integer greater than 1; Based on the first public key polynomial, the n gradient values ​​are encrypted to obtain the gradient ciphertext; n is an integer greater than 1. The gradient ciphertext, the transformation public key, and the K automorphic public keys are sent to the second device; the second device is used to perform a modulus transformation on the m / 2 merged gradient histogram ciphertexts according to the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1; The key exchange component is invoked to perform key exchange processing on the m / 2 gradient histogram ciphertexts belonging to the modulus q1 according to the conversion public key, so as to obtain m / 2 gradient histogram ciphertexts associated with the second private key polynomial. The ciphertext aggregation component is invoked to aggregate the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K self-similar public keys, thereby obtaining the initial gradient histogram ciphertext of the federated learning model. A random polynomial is then used to blind the initial gradient histogram ciphertext to obtain the target gradient histogram ciphertext of the federated learning model. The m / 2 merged gradient histogram ciphertexts are obtained by merging every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts. The m candidate gradient histogram ciphertexts are obtained by homomorphically accumulating the gradient ciphertexts based on m index sets. The m index sets are obtained by binning the n training samples based on the second sample features of the n training samples; m is an integer greater than 1; the m / 2 merged gradient histogram ciphertexts belong to the modulus q0 corresponding to the first private key polynomial. The system receives the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypts the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram. The federated learning model is trained based on the plaintext of the target gradient histogram.

10. The method as described in claim 9, characterized in that, The step of encrypting n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext includes: If the dimension of the first private key polynomial is greater than or equal to n, then the n gradient values ​​are encrypted according to the first public key polynomial to obtain a gradient ciphertext. If the dimension of the first private key polynomial is less than n, then the n training samples are divided into Q training sample sets. According to the first public key polynomial, the gradient value corresponding to the training sample in the g-th training sample set in the Q training sample sets is encrypted to obtain the gradient ciphertext corresponding to the g-th training sample set. This process continues until the gradient ciphertexts corresponding to the Q training sample sets are obtained. The number of training samples in the Q training sample sets is less than or equal to the dimension of the first private key polynomial.

11. The method as described in claim 9, characterized in that, The step of decrypting the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram includes: The target gradient histogram ciphertext is deblinded using a random multinomial to obtain the initial gradient histogram ciphertext. The initial gradient histogram ciphertext is decrypted based on the second private key polynomial to obtain the target gradient histogram plaintext.

12. The method as described in claim 11, characterized in that, The target gradient histogram ciphertext is deblinded using a random multinomial to obtain an initial gradient histogram ciphertext, including... Subtracting the random polynomial from the target gradient histogram ciphertext yields the initial gradient histogram ciphertext; or, The random polynomial is added to the target gradient histogram ciphertext to obtain the initial gradient histogram ciphertext.

13. The method as described in claim 9, characterized in that, The method further includes: Obtain sample feature and label data for n training samples from the first device; The federated learning model is invoked to identify the sample features of the n training samples, thereby obtaining the prediction data of the n training samples; Based on the predicted data of the n training samples and the label data, determine the n gradient values ​​of the federated learning model.

14. A data processing apparatus, characterized in that, include: The acquisition module is used to acquire gradient ciphertext, K automorphic public keys, and the transformation public key from the first device; The gradient ciphertext is obtained by encrypting n gradient values ​​based on the first public key polynomial of the first device. The K self-similar public keys and the transformation public key are determined based on the first private key polynomial and the second private key polynomial corresponding to the first public key polynomial; n and K are integers greater than 1. The processing module is used to perform homomorphic accumulation processing on the gradient ciphertext according to m index sets to obtain m candidate gradient histogram ciphertexts of the federated learning model; the m index sets are obtained by binning the n training samples based on the sample features of the n training samples. m is an integer greater than 1; The merging module is used to merge every two candidate gradient histogram ciphertexts in the m candidate gradient histogram ciphertexts to obtain m / 2 merged gradient histogram ciphertexts; the m / 2 merged gradient histogram ciphertexts belong to the modulus q0 corresponding to the first private key polynomial; The conversion module is used to perform a modulus conversion on the m / 2 merged gradient histogram ciphertexts according to the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, so as to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1. The key exchange component is invoked to perform key exchange processing on the m / 2 gradient histogram ciphertexts belonging to the modulus q1 according to the conversion public key, so as to obtain the m / 2 gradient histogram ciphertexts associated with the second private key polynomial. The ciphertext aggregation component is invoked to perform ciphertext aggregation on m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K automorphic public keys, thereby obtaining the initial gradient histogram ciphertext of the federated learning model; the initial gradient histogram ciphertext is then blinded using a random polynomial to obtain the target gradient histogram ciphertext of the federated learning model, and the target gradient histogram ciphertext is sent to the first device; The first device is used to train the federated learning model based on the plaintext of the target gradient histogram, wherein the plaintext of the target gradient histogram is obtained by decrypting the ciphertext of the target gradient histogram based on the second private key polynomial.

15. A data processing apparatus, characterized in that, include: The acquisition module is used to acquire the first public key polynomial, the second private key polynomial, the transformation public key, and K automorphic public keys corresponding to the first private key polynomial of the first device. The transformation public key and the K self-similar public keys are generated based on the first private key polynomial and the second private key polynomial, where K is an integer greater than 1; The encryption module is used to encrypt n gradient values ​​according to the first public key polynomial to obtain gradient ciphertext; n is an integer greater than 1. The sending module is used to send the gradient ciphertext, the transformation public key, and the K automorphic public keys to the second device; the second device is used to perform a modulus transformation on the m / 2 merged gradient histogram ciphertexts according to the modulus q1 corresponding to the second private key polynomial and the modulus q0 corresponding to the first private key polynomial, to obtain m / 2 gradient histogram ciphertexts belonging to the modulus q1; The key exchange component is invoked to perform key exchange processing on the m / 2 gradient histogram ciphertexts belonging to the modulus q1 according to the conversion public key, so as to obtain m / 2 gradient histogram ciphertexts associated with the second private key polynomial. The ciphertext aggregation component is invoked to aggregate the m / 2 gradient histogram ciphertexts associated with the second private key polynomial based on the K self-similar public keys, thereby obtaining the initial gradient histogram ciphertext of the federated learning model. A random polynomial is then used to blind the initial gradient histogram ciphertext to obtain the target gradient histogram ciphertext of the federated learning model. The m / 2 merged gradient histogram ciphertexts are obtained by merging every two candidate gradient histogram ciphertexts from the m candidate gradient histogram ciphertexts. The m candidate gradient histogram ciphertexts are obtained by homomorphically accumulating the gradient ciphertexts based on m index sets. The m index sets are obtained by binning the n training samples based on the second sample features of the n training samples; m is an integer greater than 1; the m / 2 merged gradient histogram ciphertexts belong to the modulus q0 corresponding to the first private key polynomial. The receiving module is used to receive the ciphertext of the target gradient histogram of the federated learning model sent by the second device, and decrypt the ciphertext of the target gradient histogram according to the second private key polynomial to obtain the plaintext of the target gradient histogram. The training module is used to train the federated learning model based on the plaintext of the target gradient histogram.

16. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 13.

17. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.

18. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.