Anti-quantum federated learning method based on lattice password and computer equipment

By employing a quantum-resistant federated learning method based on lattice cryptography, the problems of insufficient resistance to quantum attacks and excessively large key ciphertext size in existing technologies are solved, enabling secure and efficient federated learning training, which is applicable to sensitive data fields such as healthcare and finance.

CN121787518APending Publication Date: 2026-04-03中电信量子信息科技集团有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing encryption methods are not resistant to quantum attacks, and the large size of keys and ciphertexts leads to a sharp increase in storage and transmission overhead, making them difficult to deploy in real-world networks.

Method used

A quantum-resistant federated learning method based on lattice cryptography is adopted. By obtaining public parameters and user keys, local model parameters are processed and encrypted, and lattice cryptography algorithms are used for secure transmission and decryption, thus avoiding data leakage and resisting quantum attacks.

Benefits of technology

It achieves secure, efficient, and scalable federated learning training, avoiding data leaks and quantum attack threats, and reducing storage and transmission overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121787518A_ABST
    Figure CN121787518A_ABST
Patent Text Reader

Abstract

The invention provides an anti-quantum federated learning method based on a lattice password and computer equipment, and the method comprises the steps: obtaining a public parameter and a user key, carrying out the model training of a local model according to a local data set, obtaining a current model parameter of the local model, and obtaining a current model parameter of the local model; the current model parameter is used for indicating the parameter update amount of the local model in the current training round, processing the current model parameter to obtain a target parameter value, encrypting the target parameter value by adopting a lattice cryptographic algorithm according to the number of the plurality of federated learning participants, an aggregation constant, a master key and a preset label value to obtain a current encrypted ciphertext, and sending the current encrypted ciphertext to the local model. And sending the current encrypted ciphertext to a server, so that the server performs federated learning. A lattice cryptographic algorithm is adopted to avoid data leakage, quantum attacks can be resisted, the overhead is small, and safe, efficient and extensible federal learning training is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of game technology, and more specifically, to a quantum-resistant federated learning method and computer device based on lattice cryptography. Background Technology

[0002] Federated learning (FL) is a distributed machine learning paradigm that allows multiple participants to collaboratively train a global model without sharing their local raw data. Each participant trains the model using local data and only uploads intermediate results such as gradients or weights to a central server for aggregation.

[0003] In related technologies, a privacy protection scheme based on functional encryption is adopted to protect the security of model parameters. This scheme allows the central server to directly calculate the model aggregate parameters from the encrypted model parameter ciphertext uploaded by the participants, provided that it holds a specific functional key, without being able to decrypt and obtain the model parameters of the participants.

[0004] However, the above methods are not resistant to quantum attacks, and the large size of the keys and ciphertexts leads to a sharp increase in storage and transmission overhead, making them difficult to deploy in real-world networks. Summary of the Invention

[0005] In view of this, embodiments of this application provide a quantum-resistant federated learning method and computer device based on lattice cryptography to solve the problems that existing encryption methods do not have the ability to resist quantum attacks, and that the large size of keys and ciphertexts leads to a sharp increase in storage and transmission overhead, making them difficult to deploy in practical networks.

[0006] In a first aspect, embodiments of this application provide a quantum-resistant federated learning method based on lattice cryptography, applicable to various federated learning participants in a multi-party federated learning process. The method includes: Obtain public parameters and user keys, wherein the public parameters include: an aggregation constant and the number of multiple federated learning participants, and the user keys include: the master key of each federated learning participant; Based on the local dataset, the local model is trained to obtain the current model parameters of the local model. The current model parameters are used to indicate the amount of parameter updates of the local model in the current training round. The current model parameters are processed to obtain the target parameter values; Based on the number of multiple federated learning participants, the aggregation constant, the master key, and the preset tag value, the target parameter value is encrypted using a lattice cryptography algorithm to obtain the current encrypted ciphertext; The current encrypted ciphertext is sent to the server so that the server can perform federated learning.

[0007] In an optional implementation, the user key further includes: a session key for each of the federated learning participants; the processing of the current model parameters to obtain the target parameter value includes: The mask parameters are determined based on the current training round and the preset total training rounds; Based on the session key and the masking parameters, the current model parameters are masked to obtain the model parameter mask value as the target parameter value.

[0008] In an optional implementation, processing the current model parameters to obtain the target parameter values ​​includes: Quantize a set of gradient values ​​corresponding to the current model parameters; The quantized set of gradient values ​​are concatenated to obtain the concatenated gradient value, which is used as the target parameter value.

[0009] In an optional implementation, the step of encrypting the target parameter value using a lattice cryptography algorithm based on the number of multiple federated learning participants, the aggregation constant, the master key, and a preset label value to obtain the current encrypted ciphertext includes: The preset tag value is hashed using a public hash function to obtain a hash value; The scaling factor is obtained by rounding down the ratio of the number of multiple federated learning participants to the aggregation constant. Calculate the first product of the hash value and the master key, and the second product of the scaling factor and the target parameter value; The current encrypted ciphertext is determined based on the sum of the first product and the second product.

[0010] In an optional implementation, determining the mask parameters based on the current training round and the preset total training rounds includes: If the current training round is less than the preset total training rounds, then the mask parameter is determined to be 1; If the current training round is equal to the preset total training round, then the mask parameter is determined to be 0.

[0011] In an optional implementation, the user key further includes: a decryption key component of the plurality of federated learning participants; after sending the current encrypted ciphertext to the server, the method further includes: Receive the aggregation parameter value sent by the server; Based on the decryption key components, the aggregation constant, and the number of multiple federated learning participants, the aggregation parameter value is decrypted using the lattice cryptography algorithm to obtain the global model parameters; Based on the global model parameters, the local model is updated to obtain the updated local model.

[0012] In an optional implementation, the method further includes: Based on the local dataset, the updated local model is trained to obtain the next model parameters of the local model, until a preset total number of training rounds is reached. The next model parameters are used to indicate the amount of parameter updates of the updated local model in the next training round. The target encrypted ciphertext, representing the number of training rounds reached, is sent to the server so that the server can obtain the global model corresponding to the local model based on the target encrypted ciphertext.

[0013] Secondly, embodiments of this application also provide a quantum-resistant federated learning method applied to a server, the method comprising: Receive current encrypted ciphertext sent by multiple federated learning participants, wherein the current encrypted ciphertext is obtained by the method described in any of the first aspects; If the number of multiple federated learning participants is greater than or equal to a preset number, then based on the preset function vector, aggregation key, preset tag value and public parameters, the current encrypted ciphertext sent by all federated learning participants is decrypted using a lattice cryptography algorithm to obtain the aggregated decryption result. The public parameters include: a preset modulus. Based on the aggregated decryption result, obtain the aggregated parameter value; The aggregate parameter value is sent to each of the federated learning participants so that each of the federated learning participants can decrypt the aggregate parameter value and update their local model.

[0014] In an optional implementation, the public parameter further includes: an aggregation constant; obtaining the aggregation parameter value based on the aggregation decryption result includes: Based on the aggregation constant, the target search range is obtained; The scaling factor is obtained by rounding down the ratio of the number of multiple federated learning participants to the aggregation constant. Construct an objective function based on the scaling factor, the aggregated decryption result, and the aggregated parameter variables; Within the target search range, the objective function is minimized to obtain the parameter value corresponding to the aggregate parameter variable, which is then used as the aggregate parameter value.

[0015] Thirdly, embodiments of this application also provide a computer device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the method described in any of the first aspects.

[0016] This application provides a quantum-resistant federated learning method and computer device based on lattice cryptography. The method includes: acquiring public parameters and a user key; the public parameters including an aggregation constant and the number of all federated learning participants; training a local model using a local dataset to obtain the current model parameters, which indicate the parameter update amount in the current training epoch; masking the current model parameters to obtain a model parameter mask value; encrypting the model parameter mask value using a lattice cryptography algorithm based on the number of federated learning participants, the aggregation constant, the master key, and preset label values ​​to obtain the current encrypted ciphertext; and sending the current encrypted ciphertext to the server to enable the server to perform federated learning. The use of lattice cryptography avoids data leakage, resists quantum attacks, has low overhead, and achieves secure, efficient, and scalable federated learning training. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 1 ; Figure 2 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 2 ; Figure 3 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 3 ; Figure 4 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 4 ; Figure 5 A system architecture diagram of quantum-resistant federated learning based on lattice cryptography is provided for embodiments of this application; Figure 6A schematic diagram of the structure of the lattice-based quantum-resistant federated learning device provided in this application embodiment. Figure 1 ; Figure 7 A schematic diagram of the structure of the lattice-based quantum-resistant federated learning device provided in this application embodiment. Figure 2 ; Figure 8 A schematic diagram of the structure of the computer device provided for the implementation of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0020] First, let's explain the technical terms used in this application: Federated Learning (FL) is a distributed machine learning paradigm that allows multiple participants to collaboratively train a global model without sharing their local raw data. Each participant trains its model using its local data, only uploading model updates (such as gradients or weights) to a central server for aggregation. The aggregation results are then distributed to each participant, allowing them to update their local models. This iterative process continues until a global model is obtained. This technology effectively solves the problems of data silos and privacy leaks, and is widely used in sensitive data fields such as healthcare and finance, achieving secure collaborative modeling where data is "usable but not visible."

[0021] Post-Quantum Cryptography (PQC) refers to a class of cryptographic algorithms capable of withstanding quantum computing attacks. Traditional public-key cryptosystems (such as RSA and ECC) are vulnerable to being broken by quantum computers, while PQC algorithms, designed based on mathematical problems (such as lattices, encoding, and multivariables), maintain security even in quantum computing environments. PQC is an important technological direction for ensuring future information security and has been incorporated into the recommended algorithm systems of international standards organizations.

[0022] Lattice-based cryptography is a class of cryptographic schemes built upon mathematical problems in lattice theory. Its security relies on difficult problems such as the shortest vector problem and the nearest vector problem within a lattice, which remain unsolvable even in quantum computing environments. Compared to traditional cryptosystems, lattice cryptography offers advantages such as resistance to quantum attacks, flexible structure, and support for homomorphic computation. It has become an important branch of quantum-resistant cryptography and is widely used in security protocols for encryption, signatures, and key exchange.

[0023] Currently, the privacy protection technologies employed by federated learning systems to safeguard model parameters suffer from four main limitations: homomorphic encryption schemes, while enabling ciphertext computation, suffer from high computational overhead and long training times, and are vulnerable to collusion attacks; differential privacy technologies protect privacy by adding noise, but inevitably reduce model performance and usability; multi-party secure computation, while offering high security, incurs significant communication overhead and is difficult to scale in real-world distributed environments; and trusted execution environments are limited by specific hardware configurations, with limited computing resources and high hardware costs. These technical bottlenecks severely restrict the application of federated learning in resource-constrained environments and large-scale scenarios.

[0024] Based on this, functional encryption privacy protection schemes provide a new approach for federated learning, but there are still three major technical pain points: the intermediate aggregation results (model aggregation parameters) are at risk of leakage, which may allow the aggregator to obtain sensitive user information (model parameters); there is a lack of resistance to quantum attacks; and the large size of keys and ciphertexts leads to a sharp increase in storage and transmission overhead, making it difficult to deploy in real networks.

[0025] To address the aforementioned issues, this application provides a quantum-resistant federated learning method based on lattice cryptography. By introducing a multi-participant encryption scheme in federated learning, it avoids data leakage, achieves resistance to quantum attacks, and solves key problems such as intermediate result leakage, quantum attack threats, and low communication efficiency. This provides an innovative solution for building a next-generation secure and efficient federated learning framework.

[0026] Figure 1 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 1 In this embodiment, the executing entity can be any of the multiple federated learning participants.

[0027] like Figure 1 As shown, the method may include: S101. Obtain public parameters and user key.

[0028] The public parameters include: aggregation constant and the number of multiple federated learning participants. The user keys include: the master key of each federated learning participant.

[0029] The user key can be sent to each participant in the federated learning process by a trusted third-party device. The trusted third-party device is based on preset security parameters. And the number of multiple federated learning participants (number of users). Generate common parameters and master key ,in, For matrix dimensions, For modulus, For error distribution parameters, The polymerization constant, and These are quantization parameters.

[0030] For the first The master key for each participant in the federated learning process is derived from a secret vector. and error vector The component, whose function is to generate unique key material for each user, ensures the randomness and security of the key. Error vector. It is noise in fault tolerance, and its existence ensures the randomness, security, and anti-collusion of the key. In other words, a trusted third-party device builds a key system resistant to quantum attacks based on the fault-tolerant learning assumption, and centrally manages key distribution through the trusted third-party device to prevent collusion among users.

[0031] The aggregation constant is used to control the scaling ratio of the plaintext message during encryption to adapt to the modular operation space under the lattice cryptosystem, and also affects the precision recovery of the aggregation result during decryption.

[0032] Once the system initialization is complete and the public parameters are broadcast by a trusted third-party device to all federated learning participants and servers, the system initialization is complete and the system enters the training-ready state.

[0033] S102. Based on the local dataset, train the local model to obtain the current model parameters.

[0034] Using a pre-set training algorithm According to the local dataset Train the local model to obtain the current model parameters. ,in, This indicates the current training epoch and the current model parameters. Used to indicate the amount of parameter updates of the local model in the current training round, that is, the amount of change between the parameters after training and the parameters before training.

[0035] In this context, the local model is the initial model used by each participant in the federated learning process, such as a machine learning model. The local dataset is the training dataset used to train the local model. The specific content of the local dataset can be determined according to actual business needs. For example, if each hospital is a participant in the federated learning process, the local dataset can be the patient data of that hospital, ultimately used to train a high-precision diagnostic model (global model). Similarly, if each bank is a participant in the federated learning process, the local dataset can be the user data of that bank, ultimately used to train an anti-fraud model (global model). The specific details can be determined according to actual business needs, and this embodiment does not impose any particular limitations.

[0036] S103. Process the current model parameters to obtain the target parameter values.

[0037] The target parameter values ​​can be obtained by masking the current model parameters or by concatenating a set of gradient values ​​corresponding to the current model parameters.

[0038] In an optional implementation, the user key may also include: session keys of each federated learning participant.

[0039] Step S103 above, which processes the current model parameters to obtain the target parameter values, may include: Based on the current training round and the preset total training round, determine the mask parameters; based on the session key and the mask parameters, mask the current model parameters to obtain the model parameter mask values ​​as the target parameter values.

[0040] in, Its purpose is to control the visibility of intermediate results and prevent aggregators deployed on the server from obtaining sensitive information during the training process.

[0041] If the current training round is less than the preset total training round, the mask parameter is set to 1; if the current training round is equal to the preset total training round, the mask parameter is set to 0.

[0042] The current training round is The preset total number of training rounds is The mask parameters are ,like < ,but This indicates that the intermediate results are masked using the session key (i.e., the current model parameters are obfuscated using the session key). = ,but , indicates that no masking is used to output the final result (i.e., the current model parameters).

[0043] Calculate the product of the session key and the mask parameters, and use the sum of this product and the current model parameters as the model parameter mask value. The model parameter mask value is represented as:

[0044] in, For the first The model parameter mask values ​​of each participant in the federated learning process. For the first The current model parameters of each federated learning participant. For mask parameters, For the first Session keys for each participant in the federated learning process.

[0045] It should be noted that trusted third-party devices can generate session keys for each federated learning participant based on the master key, public parameters, and preset function vectors.

[0046] In this embodiment, the current model parameters are masked using the session key and mask parameters to obtain the model parameter mask value. This mask is applied to the current model parameters in the current training round to ensure that the aggregator cannot directly obtain the plaintext of the current model parameters.

[0047] In another optional implementation, step S103 above, which involves masking the current model parameters to obtain model parameter mask values, may include: Quantize a set of gradient values ​​corresponding to the current model parameters; concatenate the quantized gradient values ​​to obtain the concatenated gradient value as the target parameter value.

[0048] The set of gradient values ​​corresponding to the current model parameters refers to a set of gradient values ​​obtained through backpropagation during the local training process from the parameters before training to the parameters after training for the current training round.

[0049] The current model parameters are determined by the cumulative sum of a set of gradient values ​​calculated during training and the learning rate. For example, the number of gradient values ​​in a set can be seven, but this embodiment does not impose any particular limitation on this.

[0050] The gradient values ​​corresponding to the current model parameters are quantized into 16-bit integers, with a range of... The role of 16-bit quantization is to balance accuracy and computational efficiency, while preserving gradient information almost without loss.

[0051] The quantized set of gradient values ​​is concatenated bit by bit into a long integer plaintext block. The gradient concatenation value is used as the target parameter value; for example, seven 16-bit gradient values ​​can be concatenated into a 112-bit integer. Its purpose is to reduce the number of encryption operations and improve overall efficiency.

[0052] In some embodiments, a reserved bit can be added to the end of the plaintext block to prevent overflow during the operation. The padding length can be determined according to the preset security parameters and modulus. For details, please refer to the existing relevant descriptions, which will not be repeated here.

[0053] In this embodiment, a set of gradient values ​​is used to obtain the model parameter mask values, thereby masking the current model parameters once in the current training round to ensure that the aggregator cannot directly obtain the plaintext of the current model parameters.

[0054] In some embodiments, the current model parameters can also be converted from floating-point numbers to integers, for example, by multiplying the current model parameters by a magnification factor. And truncate the decimal part, map to The interval. Wherein, For the number of quantization bits, for example Its function is to standardize data length and simplify calculations.

[0055] S104. Based on the number of multiple federated learning participants, the aggregation constant, the master key, and the preset tag value, the target parameter value is encrypted using a lattice cryptography algorithm to obtain the current encrypted ciphertext.

[0056] After processing the model parameter updates, each federated learning participant must securely transmit the obtained target parameter values ​​to the server. To prevent eavesdropping or tampering during transmission, a lattice cryptography algorithm is used to encrypt the target parameter values ​​based on the number of federated learning participants, the aggregation constant, the master key, and the preset tag value, resulting in the current encrypted ciphertext. This provides high-strength privacy protection for the target parameter values ​​and can resist quantum attacks.

[0057] Among them, the preset label value is used to identify the identity of each federated learning participant and the current training round.

[0058] S105. Send the current encrypted ciphertext to the server so that the server can perform federated learning.

[0059] The current encrypted ciphertext is sent to the server so that the server can aggregate and decrypt the current encrypted ciphertext of all federated learning participants, thereby obtaining the global model through federated learning.

[0060] In some embodiments, each federated learning participant will identify itself. And the current encrypted ciphertext is uploaded to the server through a secure channel by an aggregator, with the aim of participating in global model aggregation while ensuring that parameters are not leaked during transmission.

[0061] In this embodiment, local training and parameter encryption are used to train the model using a local dataset. The current model parameters are encrypted and then uploaded, thereby introducing masked intermediate results. Quantization and encoding techniques are used to convert floating-point gradients into integer format for easy subsequent encryption. Furthermore, a lattice cryptography algorithm is used to prevent data leakage, which can resist quantum attacks, has low overhead, and achieves secure, efficient, and scalable federated learning training.

[0062] Figure 2 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 2 ,like Figure 2 As shown, in an optional implementation, step S104 above, which involves encrypting the target parameter value using a lattice cryptography algorithm based on the number of multiple federated learning participants, the aggregation constant, the master key, and the preset tag value to obtain the current encrypted ciphertext, may include: S201. Use a common hash function to hash the preset tag value to obtain the hash value.

[0063] Among them, a public hash function is defined. The default tag value is A public hash function is used to hash the preset label value to obtain the hash value, which is represented as: .

[0064] S202. Round down the ratio of the number of multiple federated learning participants to the aggregation constant to obtain the scaling factor.

[0065] If the number of participants in the federated learning is n, and the aggregation constant is K, then the scaling factor is expressed as: The scaling factor is used to adjust the numerical range to accommodate error control during decryption.

[0066] S203, calculate the first product of the hash value and the master key, and the second product of the scaling factor and the target parameter value.

[0067] If the target parameter value is the model parameter mask value The master key is Then the first product is expressed as Then the second product is expressed as: .

[0068] If the target parameter value is the gradient concatenation value Then the second product is expressed as .

[0069] S204. Determine the current encrypted ciphertext based on the sum of the first and second products.

[0070] If the target parameter value is the model parameter mask value Then the current encrypted ciphertext Represented as: .

[0071] If the target parameter value is the gradient concatenation value Then the current encrypted ciphertext Represented as: ,in, Used to protect multiple gradient values ​​in a single encryption.

[0072] In this embodiment, by introducing plaintext packing technology, the encryption efficiency is improved by batch processing multiple gradient values. Multiple quantized gradient values ​​are packed into a plaintext block for encryption, which significantly reduces the number of encryption operations and communication load. Thus, a balance between security and efficiency is achieved through efficient communication optimization.

[0073] Figure 3 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 3 ,like Figure 3 As shown, in an optional implementation, the user key further includes: decryption key components of multiple federated learning participants.

[0074] In this process, a trusted third-party device generates a decryption key component based on the session key and a preset vector. This decryption key component is used to restore intermediate results and protect user privacy.

[0075] The decryption key component is the product and sum of the session keys of each federated learning participant and the preset function vector, expressed as:

[0076] in, To decrypt the key components, For the first Session keys for each participant in the federated learning process. For the first Preset function vectors for each participant in the federated learning process.

[0077] Trusted third-party devices can generate user keys The purpose of sending the encryption via a secure channel to each federated learning participant is to ensure that each participant can use their unique key for encryption, while preventing the key from being stolen or tampered with during transmission.

[0078] After sending the current encrypted ciphertext to the server in step S105 above, the method may further include: S301, Receive the aggregation parameter value sent by the server.

[0079] The aggregation parameter value is either the aggregated model parameter mask value or the aggregated gradient concatenation value.

[0080] S302. Based on the decryption key components, aggregation constants, and the number of multiple federated learning participants, the aggregation parameter values ​​are decrypted using a lattice cryptography algorithm to obtain the global model parameters.

[0081] The global model parameters are the parameter update amounts determined through aggregation, and their purpose is to be used for updating the user's local model.

[0082] If the aggregation parameter value is the aggregated model parameter mask value, the aggregation constant is K, and the number of multiple federated learning participants is n, the global model parameters are obtained by decrypting the model parameter mask value using a lattice cryptography algorithm, and are represented as follows:

[0083] in, These are global model parameters. This is the aggregation parameter value, used for local model updates. For aggregation parameter values, To decrypt the key component.

[0084] If the aggregated parameter value is the concatenated gradient value, then a lattice cryptography algorithm is used to decrypt the concatenated gradient value to obtain the global gradient value. The global model parameters are then obtained based on this global gradient value. The global gradient value is the parameter gradient value determined through aggregation.

[0085] In some embodiments, it can also be verified whether the global model parameters are within a reasonable range. If they are not, it indicates an anomaly and training is stopped. The purpose is to prevent malicious data or operations from causing model pollution.

[0086] S303. Update the parameters of the local model based on the global model parameters to obtain the updated local model.

[0087] The average model parameters are calculated based on the global model parameters, and the local model is updated based on the average model parameters to obtain the updated local model.

[0088] Average model parameters Represented as: ,in, For the number of participants in the federated learning, n, the average model parameters Its role is to serve as the initial model for a new round of training, promoting model convergence.

[0089] In an alternative implementation, the method may further include: S304. Based on the local dataset, train the updated local model to obtain the next model parameters of the local model, until the preset total number of training rounds is reached.

[0090] S305. Send the target encrypted ciphertext when the preset total number of training rounds is reached to the server, so that the server can obtain the global model corresponding to the local model based on the target encrypted ciphertext.

[0091] The model training algorithm is used to train the updated local model based on the local dataset to obtain the next model parameters of the local model. The next model parameters are used to indicate the amount of parameter update of the updated local model in the next training round, that is, the amount of change between the parameters after training and the parameters before training.

[0092] Iteratively execute model training until the preset total number of training rounds is reached; that is, if If so, continue model training. Then set And upload the target encrypted ciphertext for the preset total training rounds.

[0093] After receiving the target encrypted ciphertext for the preset total training rounds, the server uses a lattice cryptography algorithm to decrypt the target encrypted ciphertext sent by all federated learning participants, based on the pre-acquired preset function vector, aggregation key, preset label value, and common parameters. This decryption yields the target aggregation decryption result. Based on this result, the server obtains the target aggregation parameter values, and then uses the lattice cryptography algorithm to decrypt these values ​​again, obtaining the final global model parameters for model updating and thus the global model corresponding to the local model. .

[0094] In some embodiments, the trained global model can be applied to local tasks, and temporary data such as session keys can be cleared. This aims to protect user privacy and free up resources. Alternatively, the server can also publish the global model. All participants in the federated learning process update their models synchronously, thus completing the federated learning task.

[0095] In this embodiment, the decryption process is divided into two stages: server decryption and user decryption. A session key mechanism prevents the aggregator from accessing the intermediate model, thereby aggregating all user ciphertexts and decrypting them to obtain the global model, while protecting intermediate results. Furthermore, the local model is repeatedly trained until convergence. Through multiple iterations and the intermediate result protection mechanism, both model accuracy and privacy are ensured.

[0096] Figure 4 A flowchart illustrating the quantum-resistant federated learning method for lattice cryptography provided in this application embodiment. Figure 4In this embodiment, the execution entity can be a server, and an aggregator is deployed on the server.

[0097] like Figure 4 As shown, the method may include: S401: Receive the current encrypted ciphertext sent by multiple federated learning participants.

[0098] The current encrypted ciphertext was obtained by each participant in the federated learning process using the aforementioned method.

[0099] In other words, the aggregator collects the ciphertext sets of all users. and user identifier set ,in, Its purpose is to record the users participating in the current training round, ensuring that the aggregation operation is based on legitimate user data.

[0100] S402. If the number of multiple federated learning participants is greater than or equal to the preset number, then based on the preset function vector, aggregation key, preset tag value and common parameters obtained in advance, the lattice cryptography algorithm is used to decrypt the current encrypted ciphertext sent by all federated learning participants to obtain the aggregated decryption result.

[0101] Obtain the number of participants in multiple federated learning programs And verify whether the quantity is greater than or equal to the preset quantity, i.e. , If the preset number is met, the aggregation key can be obtained from a trusted third-party device to prevent aggregation deviations or security risks caused by too few users.

[0102] In some embodiments, the trusted third-party device is based on the master keys of each federated learning participant. Preset function vector Generate aggregate key , is represented as:

[0103] The aggregation key allows the aggregator to perform function computations on multiple user ciphertexts (encrypted ciphertexts sent by multiple federated learning participants) without accessing the plaintext of a single user. For the first Preset function vectors for each participant in the federated learning process.

[0104] Trusted third-party devices will aggregate keys Send to the aggregator, aggregation key Its function is to authorize aggregators to perform secure aggregation operations while restricting them to obtaining only the aggregation results rather than individual data.

[0105] Among them, the common parameters include: preset modulus.

[0106] The preset tag value is hashed using a public hash function to obtain a hash value. Then, a modulo operation is performed on the preset modulus. The modulo operation result, the hash value, and the aggregation key are multiplied together. The product of the preset function vectors of each federated learning participant and the current encrypted ciphertext is added together. The aggregation decryption result is obtained by subtracting the multiplication result from the addition result.

[0107] The default function vector is The aggregation key is The preset tag value is The preset modulus is Based on the current encrypted ciphertext For example, aggregate decryption results Represented as:

[0108] Among them, the aggregated decryption results Its function is to initially aggregate user ciphertext and remove the randomness introduced by the hash function.

[0109] Based on the current encrypted ciphertext For example, aggregate decryption results Represented as:

[0110] S403. Obtain the aggregation parameter value based on the aggregation decryption result.

[0111] The server reconstructs the aggregated value based on the aggregated decryption result, obtaining the aggregated parameter value. The aggregated parameter value is either the aggregated model parameter mask value or the aggregated gradient concatenation value.

[0112] In an optional implementation, the common parameters further include: an aggregation constant. Step S603 above, obtaining the aggregation parameter value based on the aggregation decryption result, includes: Based on the aggregation constant, obtain the target search range; The scaling factor is obtained by rounding down the ratio of the number of participants in the federated learning to the aggregation constant. Construct an objective function based on the scaling factor, aggregated decryption results, and aggregated parameter variables; Within the target search range, the objective function is minimized, and the parameter values ​​corresponding to the aggregate parameter variables are used as aggregate parameter values.

[0113] Where the aggregation constant is K, and the target search range is expressed as... The scaling factor is expressed as to aggregate decryption results For example, the objective function can be expressed as:

[0114] in, For aggregation parameter variables, search within the target search range. The corresponding parameter values ​​are chosen to minimize the objective function, where, This is the aggregate parameter value, and its function is to hide the real model parameters in intermediate rounds.

[0115] S404. Send the aggregate parameter value to each federated learning participant so that each federated learning participant can decrypt the aggregate parameter value and update the local model.

[0116] The aggregation parameter value is either the aggregated model parameter mask value or the aggregated gradient concatenation value.

[0117] The aggregated parameter values ​​are sent to each federated learning participant. Each participant decrypts the aggregated parameter values ​​and updates the model parameters of its local model based on the decryption results.

[0118] In this embodiment, all user ciphertexts are aggregated and decrypted to obtain a global model, while protecting intermediate results. The decryption process is divided into two stages: server decryption and user decryption, and a session key mechanism is used to prevent the aggregator from accessing the intermediate model.

[0119] Figure 5 The system architecture diagram of quantum-resistant federated learning based on lattice cryptography provided in the embodiments of this application is as follows: Figure 5 As shown, it includes: System initialization and key management module: including parameter generation interface, key distribution software and trusted execution environment component, responsible for generating public parameters, master key and user keys, and securely distributing them to each federated learning participant.

[0120] Local training and parameter encryption module: includes local model training interface, quantization encoding software and mask encryption component, used to implement local model training, gradient quantization, session key mask and lattice-based encryption (lattice cipher) functions.

[0121] The security aggregation and decryption module includes a ciphertext aggregation interface, some decryption software, and a session key management component. It is responsible for aggregating user ciphertext, performing partial decryption on the server side, and coordinating with the user to complete the final decryption.

[0122] Model update and iterative optimization module: Includes model update interface, round control software and plaintext packaging component, supports multiple rounds of training iteration, model parameter update and gradient batch encryption optimization, and improves overall training efficiency.

[0123] The system initialization and key management module is deployed on a trusted third-party device, the local training and parameter encryption module is integrated into the federated learning participants, the security aggregation and decryption module is integrated into the server, and the model update and iterative optimization module is integrated into the federated learning participants.

[0124] In summary, the system architecture involved in this solution comprises a trusted third-party device, a semi-honest aggregator (deployed on a server), and semi-honest users (participants in federated learning), responsible for system key management, model aggregation and decryption, and local model training and parameter encryption, respectively. Through lattice-based functional encryption technology and intermediate result protection mechanisms, the privacy leakage and quantum attack threats in federated learning are resolved, making it suitable for privacy-preserving model training in sensitive data scenarios such as healthcare and finance.

[0125] Furthermore, the dynamic masking mechanism for session keys and the segmentation and decryption process effectively prevent the aggregator from obtaining sensitive intermediate results during training, thus compensating for the shortcomings of existing functional encryption schemes in terms of privacy protection. Moreover, the optimized key management scheme and lightweight encryption operation make this invention particularly suitable for large-scale distributed environments and resource-constrained devices, solving the limitations of trusted execution environments and complex encryption schemes in actual deployment, and ensuring practicality and scalability.

[0126] Figure 6 A schematic diagram of the structure of the lattice-based quantum-resistant federated learning device provided in this application embodiment. Figure 1 The device is integrated into the computer equipment.

[0127] like Figure 6 As shown, the device may include: The acquisition module 601 is used to acquire public parameters and user keys. The public parameters include: aggregation constant and the number of multiple federated learning participants. The user keys include: the master key of each federated learning participant. The processing module 602 is used to train a local model based on a local dataset to obtain the current model parameters of the local model. The current model parameters are used to indicate the amount of parameter updates of the local model in the current training round. The processing module 602 is also used to process the current model parameters to obtain the target parameter values; The processing module 602 is also used to encrypt the target parameter value using a lattice cryptography algorithm based on the number of multiple federated learning participants, the aggregation constant, the master key and the preset label value, to obtain the current encrypted ciphertext; The sending module 603 is also used to send the current encrypted ciphertext to the server so that the server can perform federated learning.

[0128] Determine the mask parameters based on the current training round and the preset total training rounds; Based on the session key and mask parameters, the current model parameters are masked to obtain the model parameter mask value as the target parameter value.

[0129] In an optional implementation, the processing module 602 is further configured to: Quantize a set of gradient values ​​corresponding to the current model parameters; The quantized set of gradient values ​​is concatenated to obtain the concatenated gradient value, which is used as the target parameter value.

[0130] In an optional implementation, the processing module 602 is further configured to: A common hash function is used to hash the preset label value to obtain the hash value; The scaling factor is obtained by rounding down the ratio of the number of participants in the federated learning to the aggregation constant. Calculate the first product of the hash value and the master key, and the second product of the scaling factor and the target parameter value; The current encrypted ciphertext is determined based on the sum of the first and second products.

[0131] In an optional implementation, the processing module 602 is further configured to: If the current training round is less than the preset total training rounds, then the mask parameter is set to 1; If the current training round is equal to the preset total training rounds, then the mask parameter is set to 0.

[0132] In an optional embodiment, the device further includes: The receiving module 604 is used to receive the aggregation parameter values ​​sent by the server; The processing module 602 is also used to decrypt the aggregation parameter value using a lattice cryptography algorithm based on the decryption key component, the aggregation constant, and the number of multiple federated learning participants to obtain the global model parameters; The processing module 602 is also used to update the parameters of the local model based on the global model parameters to obtain the updated local model.

[0133] In an optional implementation, the processing module 602 is further configured to: Based on the local dataset, the updated local model is trained to obtain the next model parameters of the local model, until the preset total number of training rounds is reached. The next model parameters are used to indicate the amount of parameter updates of the updated local model in the next training round. The sending module 603 is also used to send the target encrypted ciphertext when the preset total number of training rounds is reached to the server, so that the server can obtain the global model corresponding to the local model based on the target encrypted ciphertext.

[0134] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0135] Figure 7 A schematic diagram of the structure of the lattice-based quantum-resistant federated learning device provided in this application embodiment. Figure 2 The device is integrated into the server.

[0136] like Figure 7 As shown, the device may include: The receiving module 701 is used to receive the current encrypted ciphertext sent by multiple federated learning participants respectively; The processing module 702 is used to decrypt the current encrypted ciphertext sent by all federated learning participants using a lattice cryptography algorithm based on a pre-acquired preset function vector, aggregation key, preset tag value and public parameters if the number of multiple federated learning participants is greater than or equal to a preset number, and obtain the aggregated decryption result. The public parameters include: preset modulus. The acquisition module 703 is used to obtain the aggregation parameter value based on the aggregation decryption result; The sending module 704 is used to send the aggregate parameter value to each federated learning participant, so that each federated learning participant can decrypt the aggregate parameter value and update the local model.

[0137] In an optional implementation, the acquisition module 703 is specifically used for: Based on the aggregation constant, obtain the target search range; The scaling factor is obtained by rounding down the ratio of the number of participants in the federated learning to the aggregation constant. Construct an objective function based on the scaling factor, aggregated decryption results, and aggregated parameter variables; Within the target search range, the objective function is minimized, and the parameter values ​​corresponding to the aggregate parameter variables are used as aggregate parameter values.

[0138] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0139] Figure 8 A schematic diagram of the computer device provided for the implementation of this application is shown below. Figure 8 As shown, the device may include a processor 801, a memory 802, and a bus 803. The memory 802 stores machine-readable instructions that can be executed by the processor 801. When the computer device is running, the processor 801 communicates with the memory 802 through the bus 803, and the processor 801 executes the machine-readable instructions to perform the above-described method.

[0140] This application also provides a computer-readable storage medium storing a computer program, which is executed by a processor to perform the above-described method.

[0141] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.

[0142] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0143] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0144] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0145] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0146] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0147] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A quantum-resistant federated learning method based on lattice cryptography, characterized in that, The method, applied to each of multiple federated learning participants, includes: Obtain public parameters and user keys, wherein the public parameters include: an aggregation constant and the number of multiple federated learning participants, and the user keys include: the master key of each federated learning participant; Based on the local dataset, the local model is trained to obtain the current model parameters of the local model. The current model parameters are used to indicate the amount of parameter updates of the local model in the current training round. The current model parameters are processed to obtain the target parameter values; Based on the number of multiple federated learning participants, the aggregation constant, the master key, and the preset tag value, the target parameter value is encrypted using a lattice cryptography algorithm to obtain the current encrypted ciphertext; The current encrypted ciphertext is sent to the server so that the server can perform federated learning.

2. The method according to claim 1, characterized in that, The user key further includes: the session key of each of the federated learning participants; the processing of the current model parameters to obtain the target parameter value includes: The mask parameters are determined based on the current training round and the preset total training rounds; Based on the session key and the masking parameters, the current model parameters are masked to obtain the model parameter mask value as the target parameter value.

3. The method according to claim 1, characterized in that, The process of processing the current model parameters to obtain the target parameter values ​​includes: Quantize a set of gradient values ​​corresponding to the current model parameters; The quantized set of gradient values ​​are concatenated to obtain the concatenated gradient value, which is used as the target parameter value.

4. The method according to claim 1, characterized in that, The step involves encrypting the target parameter value using a lattice cryptography algorithm based on the number of multiple federated learning participants, the aggregation constant, the master key, and a preset label value to obtain the current encrypted ciphertext, including: The preset tag value is hashed using a public hash function to obtain a hash value; The scaling factor is obtained by rounding down the ratio of the number of multiple federated learning participants to the aggregation constant. Calculate the first product of the hash value and the master key, and the second product of the scaling factor and the target parameter value; The current encrypted ciphertext is determined based on the sum of the first product and the second product.

5. The method according to claim 2, characterized in that, The step of determining the mask parameters based on the current training round and the preset total training rounds includes: If the current training round is less than the preset total training rounds, then the mask parameter is determined to be 1; If the current training round is equal to the preset total training round, then the mask parameter is determined to be 0.

6. The method according to claim 1, characterized in that, The user key further includes: decryption key components of multiple federated learning participants; after sending the current encrypted ciphertext to the server, the method further includes: Receive the aggregation parameter value sent by the server; Based on the decryption key components, the aggregation constant, and the number of multiple federated learning participants, the aggregation parameter value is decrypted using the lattice cryptography algorithm to obtain the global model parameters; Based on the global model parameters, the local model is updated to obtain the updated local model.

7. The method according to claim 6, characterized in that, The method further includes: Based on the local dataset, the updated local model is trained to obtain the next model parameters of the local model, until a preset total number of training rounds is reached. The next model parameters are used to indicate the amount of parameter updates of the updated local model in the next training round. The target encrypted ciphertext, representing the number of training rounds reached, is sent to the server so that the server can obtain the global model corresponding to the local model based on the target encrypted ciphertext.

8. A quantum-resistant federated learning method, characterized in that, Applied to a server, the method includes: Receive current encrypted ciphertext sent by multiple federated learning participants, wherein the current encrypted ciphertext is obtained by the method described in any one of claims 1-7; If the number of multiple federated learning participants is greater than or equal to a preset number, then based on the preset function vector, aggregation key, preset tag value and public parameters, the current encrypted ciphertext sent by all federated learning participants is decrypted using a lattice cryptography algorithm to obtain the aggregated decryption result. The public parameters include: a preset modulus. Based on the aggregated decryption result, obtain the aggregated parameter value; The aggregate parameter value is sent to each of the federated learning participants so that each of the federated learning participants can decrypt the aggregate parameter value and update their local model.

9. The method according to claim 8, characterized in that, The public parameters also include: an aggregation constant; obtaining the aggregation parameter value based on the aggregation decryption result includes: Based on the aggregation constant, the target search range is obtained; The scaling factor is obtained by rounding down the ratio of the number of multiple federated learning participants to the aggregation constant. Construct an objective function based on the scaling factor, the aggregated decryption result, and the aggregated parameter variables; Within the target search range, the objective function is minimized to obtain the parameter value corresponding to the aggregate parameter variable, which is then used as the aggregate parameter value.

10. A computer device, characterized in that, include: A processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the method according to any one of claims 1 to 9.