Federal data privacy protection method based on adaptive sparse homomorphic encryption
By employing adaptive sparse homomorphic encryption technology for selective encryption on the client side and ciphertext aggregation on the server side, this approach addresses the issues of insufficient privacy protection and high computational complexity in traditional methods. It achieves a balance between privacy protection and communication efficiency in federated learning, making it suitable for data security protection in fields such as finance and healthcare.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KUNMING UNIV OF SCI & TECH
- Filing Date
- 2025-12-24
- Publication Date
- 2026-05-15
AI Technical Summary
Existing data security protection methods have limited privacy protection capabilities in multi-party collaborative computing and cross-institutional sharing scenarios. Traditional cryptographic systems have high computational complexity and high communication costs, while sparsification methods lack adaptability and are difficult to balance privacy protection and efficiency optimization while ensuring accuracy.
Adaptive sparse homomorphic encryption technology is adopted, which selectively encrypts and compresses the transmission on the client side, and performs ciphertext aggregation on the server side based on contribution evaluation. By adjusting the adaptive sparsity ratio, random projection dimensionality reduction and CKKS homomorphic encryption, a balance between privacy protection and communication efficiency is achieved.
It implements a multi-layered protection architecture, which significantly improves the system's ability to resist gradient inference attacks, reduces communication overhead, and ensures model accuracy and security. It is suitable for distributed modeling of sensitive data in fields such as healthcare and finance.
Smart Images

Figure CN122046401A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, specifically to a federated data privacy protection method based on adaptive sparse homomorphic encryption. Background Technology
[0002] With the development of big data and artificial intelligence, data has become an important factor of production, demonstrating enormous value in fields such as finance, healthcare, government affairs, and transportation. However, due to privacy, trade secrets, and public safety concerns, directly centralizing or transmitting raw data can easily lead to leakage risks and compliance issues.
[0003] Existing data security protection methods mainly rely on traditional cryptographic systems, such as symmetric and asymmetric encryption. While these methods can guarantee data storage and transmission security to a certain extent, their privacy protection capabilities are limited in multi-party collaborative computing and cross-institutional sharing scenarios. Furthermore, they suffer from high computational complexity and communication costs in large-scale distributed computing. Federated learning, as a distributed modeling framework where data does not leave the domain, effectively mitigates the privacy risks associated with centralization. However, research shows that attackers can still recover some sensitive information through parameter or gradient inference, and privacy leakage remains a concern. To improve privacy protection, homomorphic encryption is gradually being introduced into federated learning. It supports computation in ciphertext, avoiding plaintext exposure. However, it is inefficient and incurs huge communication and computational overhead in complex models and large-scale data scenarios. Meanwhile, sparsity methods can reduce redundant information and improve communication and computational efficiency. However, most existing methods are statically designed and lack adaptability, making it difficult to balance accuracy with privacy protection and efficiency optimization.
[0004] In summary, existing technologies have shortcomings in terms of autonomy and controllability, privacy protection, and efficiency balance. There is an urgent need to propose data privacy protection methods to break through the bottlenecks of traditional cryptography and achieve the trustworthy, efficient, and secure use of data elements. Summary of the Invention
[0005] The purpose of this invention is to provide a federated data privacy protection method based on adaptive sparse homomorphic encryption. By using adaptive sparsity, homomorphic encryption and random projection techniques, selective parameter encryption and compression transmission are performed on the client side, and ciphertext aggregation is performed on the server side based on contribution evaluation, so as to achieve a balance between privacy protection and communication efficiency.
[0006] To achieve the above-mentioned technical objectives and effects, the present invention is implemented through the following technical solution:
[0007] A federated data privacy protection method based on adaptive sparse homomorphic encryption includes the following steps:
[0008] S1: Model Training: The server initializes the global model and broadcasts it to each client; after receiving the global model, each client uses its local private data to perform localized training on the global model to obtain an updated local model, and calculates the difference in weight parameters between the local model and the global model.
[0009] S2: Adaptive sparsity: The client calculates a threshold based on the dynamic sparsity ratio, packages the weight parameter differences into multiple parameter blocks, and calculates the average absolute value of each parameter block; the average absolute value is compared with the threshold to generate a binary mask vector, where a mask value of 1 indicates that the corresponding parameter block is retained, and a mask value of 0 indicates that the corresponding parameter block is discarded.
[0010] S3: Homomorphic encryption: The client uses the CKKS homomorphic encryption algorithm to encrypt only the parameter blocks that are indicated as reserved by the mask vector to obtain encrypted parameter packets. Parameter blocks with a mask of 0 are neither encrypted nor transmitted.
[0011] S4: Random Projection: The client performs random projection to reduce the dimensionality of the weight parameter differences, generating low-dimensional projected weights for subsequent contribution evaluation;
[0012] S5: Global Model Aggregation: The server receives the mask vector, the encrypted parameter packet, and the projection weight uploaded by each client; the server calculates the average weight based on the projection weights of all clients, and calculates the cosine similarity between the projection weight of each client and the average weight; the server dynamically calculates the contribution weight of each client based on the cosine similarity and the changing trend of the historical global model accuracy; the server uses the mask vector to align the encrypted parameter packets of each client, and performs weighted homomorphic aggregation in the ciphertext domain based on the contribution weight to obtain the encrypted global model;
[0013] S6: Decryption and Iteration: The client decrypts the encrypted global model returned by the server, obtains the updated global model parameters, and uses them for the next round of local model training.
[0014] Furthermore, in S2, the dynamic sparsity ratio is adaptively adjusted according to the change in the global model loss value: when the change in the loss value exceeds the first threshold, the model is determined to be in the exploration phase, and the sparsity ratio is reduced to retain more parameters; when the change in the loss value is lower than the second threshold, the model is determined to be in the convergence phase, and the sparsity ratio is increased to reduce communication overhead.
[0015] Furthermore, the specific steps for generating the mask vector in S2 include:
[0016] S2.1: Sort all parameters in the weight parameter difference in descending order of absolute value, and determine the threshold σ according to the current sparsity ratio s%, where the threshold σ is the critical value of the absolute value of the first s% of parameters after sorting;
[0017] S2.2: Divide the weight parameter differences into n parameter blocks, denoted as... Each parameter block Pn contains B parameters, that is... ,in, It's the client's weight. These are the parameters divided into each packet, with each packet consisting of B parameters. .
[0018] S2.3: For each parameter block P n Calculate its average absolute value:
[0019]
[0020] S2.4: Calculate the average absolute value μ of each parameter block. n Compared with the threshold σ, if μ n If σ > 1, then the mask corresponding to the parameter block is set to 1; otherwise, it is set to 0, thereby generating the mask vector Mask = [m1, m2, ..., m n ], where m n ∈ {0, 1}.
[0021] Furthermore, the specific steps for homomorphically encrypting the reserved parameter block in S3 include:
[0022] S3.1: Based on the mask vector Mask, filter the weight parameters, retaining only the parameter blocks with a mask value of 1, to form a sparse parameter package:
[0023]
[0024] S3.2: Use the CKKS encoding scheme to convert the sparsity parameter packet P sparse Mapped to polynomial plaintext messages A scaling factor Δ is introduced during the encoding process to improve computational accuracy;
[0025] S3.3: Encrypt the polynomial plaintext message m using the homomorphic encryption public key pk to obtain the ciphertext. .
[0026] Furthermore, the specific steps for generating projection weights in S4 include:
[0027] S4.1: Differences in the original weight parameters of the client Flattened into a one-dimensional vector , where d is the total number of parameters;
[0028] S4.2: Generate a random projection matrix Where k is the dimension after dimensionality reduction, and The elements of matrix R are independent and identically distributed.
[0029] S4.3: Perform random projection calculation on the one-dimensional vector w:
[0030]
[0031] The projection weight z' is obtained, where the projection operation preserves the similarity features of the original weights; finally, the mask and ciphertext obtained in the above steps are combined. and projection weights Transmitted to the server.
[0032] Furthermore, the specific steps in S5 for calculating contribution weights and performing weighted aggregation include:
[0033] S5.1: Project weight set for all clients Calculate the average weight:
[0034]
[0035] Where N is the total number of clients;
[0036] S5.2: Calculate the projection weight z' for each client. i Cosine similarity with average weight z:
[0037]
[0038] S5.3: Based on the historical global model accuracy trend, the contribution weight q of client i is calculated using the following formula. i :
[0039]
[0040] in It is the global model accuracy from the previous round. It is the global model accuracy from the previous training round. If the accuracy of the previous training round decreases, it means that the update direction of clients with low similarity is correct, and the contribution of clients with low similarity should be increased. If the accuracy of the previous training round increases, it means that the update direction of clients with high similarity is correct, and the contribution of clients with high similarity should be increased.
[0041] S5.4: The server aligns the encrypted parameter packets based on the mask vectors uploaded by each client, including padding or omitting operations to ensure consistent packet structure; then, it calculates q using homomorphic scalar multiplication. i·C i And aggregate the weighted ciphertext from all clients using homomorphic addition:
[0042]
[0043] Where C t This is the aggregated global encryption model.
[0044] Furthermore, the specific steps for training the local model in S1 include:
[0045] Gradient descent is used as the optimizer to minimize the cross-entropy loss function and update the local model parameters; specifically, the formula for updating the local model parameters is:
[0046]
[0047] in Let η represent the local model of client i in the t-th training round, and η be the learning rate. Let cross-entropy be the loss function. For the previous round of global model, k i This is the local dataset for client i.
[0048] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.
[0049] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0050] The beneficial effects of this invention are:
[0051] This invention implements a multi-layered protection architecture at the privacy level. By deeply coupling adaptive sparsity with homomorphic encryption, a gradient-level fine-grained protection mechanism is constructed. The client first filters the weight parameter differences by block based on the dynamic sparsity ratio, applying CKKS homomorphic encryption only to key parameter blocks with a mask identifier of 1. This selective encryption strategy avoids the computational burden of full-parameter encryption and ensures that the original parameters remain in ciphertext during transmission and aggregation. Simultaneously, this invention introduces random projection, mapping high-dimensional weights to a low-dimensional space using independent and identically distributed random matrices. The resulting projected weights retain the similarity characteristics between parameters while fundamentally severing the direct correlation between parameter values and the original data. This prevents sensitive information from being reconstructed through reverse deduction even if the server or other malicious parties intercept the transmitted data. This achieves differential privacy, significantly improving the system's ability to resist gradient inference attacks.
[0052] This invention achieves a dynamic balance between communication efficiency and model accuracy. An adaptive sparsity mechanism based on the model training state intelligently adjusts the sparsity ratio by monitoring the changing trend of the global model loss value: when the loss changes significantly, the system automatically reduces the sparsity ratio to retain more parameter update directions, ensuring that the model does not lose key features during the exploration phase; when the loss changes more slowly, the sparsity ratio is increased to significantly reduce the amount of data transmitted. The importance distribution of parameter updates changes during model convergence, requiring extensive exploration in the early stages and becoming more concentrated in the later stages. A mask vector is generated by comparing the average absolute value of parameter blocks with an adaptive threshold, ensuring priority transmission of important parameters while reducing computational overhead through block-level processing. In practical applications, this significantly reduces network transmission load, and because key gradient information is accurately preserved, the final model accuracy loss is controlled within an acceptable range.
[0053] This invention implements a secure and efficient contribution evaluation system during the model aggregation phase. First, it utilizes the cosine similarity of projected weights to quantify the consistency between the update direction of each client and the overall trend. Then, it dynamically adjusts the contribution weight allocation strategy based on historical global accuracy trends. When model performance improves, the weights of highly similar clients are increased; when performance declines, the influence of low-similarity clients is increased, effectively addressing model bias issues caused by non-independent and identically distributed data. At the ciphertext processing level, the server aligns the sparse parameter packets using a mask vector and directly performs weighted aggregation operations in the homomorphic ciphertext domain, completing the global model update without decryption. This not only eliminates the risk of privacy leakage but also maintains the mathematical integrity of parameter updates through homomorphic scalar multiplication and addition operations, ensuring the entire federated learning process guarantees security without sacrificing model convergence capability.
[0054] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0055] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1 This is the overall flowchart of the present invention;
[0057] Figure 2 This is a schematic diagram of the packing sparsity;
[0058] Figure 3 This is a flowchart of CKKS homomorphic encryption and decryption. Detailed Implementation
[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0060] Example 1
[0061] In this embodiment, N clients are configured, forming a client group. Each client has a local dataset. .
[0062] like Figure 1 As shown, the specific steps of the federated data privacy protection method based on adaptive sparse homomorphic encryption are as follows:
[0063] S1: Model Training: Server initializes the global model The initialized global model is broadcast to the client, and the client uses the global model and local data to train a local model. Obtain the weight parameters ;
[0064] S2: Adaptive sparsification; A threshold is calculated based on the sparsification ratio. The client divides the weight parameters into several blocks, packages them into blocks, generates an index for each block, and compares it with the threshold. If the index is greater than the threshold, the block is kept; otherwise, the block is discarded. At the same time, a mask vector containing 1s and 0s is obtained.
[0065] S3: Homomorphic Encryption: Encrypts the sparsed weighted packets using the CKKS algorithm. Only packets with a mask of 1 are encrypted; packets with a mask of 0 are neither encrypted nor transmitted.
[0066] S4: Random Projection: Each client performs a random projection on the original weights to obtain the projected weights. The original weights refer to the weights trained in S1 without sparsification. Then, the encrypted packet, mask, and projected weights are transmitted to the server.
[0067] S5: Global Model Aggregation: The server receives the encrypted packets, mask, and projection weights from the client. The server first calculates the contribution weight of each encrypted packet based on the cosine similarity of the projection weights, aligns the encrypted packets according to the mask, and performs weighted aggregation to obtain the encrypted global model. The server then returns the global model to the client.
[0068] S6: Client decryption: The client decrypts the encrypted global model returned by the server and begins the next round of training.
[0069] In this embodiment, S1 specifically includes:
[0070] The client trains a local model using the global model and the local dataset:
[0071]
[0072] in Indicates the first Client during round training The local model, It's the learning rate. It is the cross-entropy loss function. It is a client Local dataset, It is the global model from the previous training round.
[0073] Calculate local model weights ,
[0074]
[0075] In this embodiment, the sparsity ratio in S2 is not fixed; it is dynamically adjusted based on the global model's loss value. When the loss value changes significantly, the model is in an exploratory phase, and the sparsity ratio is reduced to prevent discarding crucial update directions. When the loss value changes less, the model gradually converges, and the sparsity ratio is increased to reduce communication overhead. (See Appendix) Figure 2 As shown, the specific sparsification steps include:
[0076] (1) Sort all parameters in the weights by absolute value, and then sort them according to the sparsity ratio. Before selection boundary values as thresholds .
[0077] (2) Divide the parameters in the weights into several blocks, each block being a packet.
[0078]
[0079]
[0080] in, It's the client's weight. These are the parameters divided into each packet, with each packet consisting of B parameters. .
[0081] (3) First calculate the average absolute value of each package.
[0082]
[0083] Compare and ,if If the condition is met, the packet is kept with a mask of 1; otherwise, the packet is discarded with a mask of 0.
[0084] Finally, the mask vector is obtained. ,like .
[0085] like Figure 3 As shown, the specific steps of S3 are as follows:
[0086] (1) Because only the weight packets with a mask of 1 are encrypted, only packets with a mask of 1 are retained in the weight packets.
[0087]
[0088] Then Mapped to polynomial coefficients,
[0089]
[0090] in It is the scaling factor.
[0091] (2) Using public keys Encrypt the encoded plaintext using CKKS.
[0092]
[0093] Obtain the ciphertext .
[0094] Furthermore, the specific steps of S4 are as follows:
[0095] (1) The client's original weight can be expressed as Flatten and concatenate all parameters into a one-dimensional vector. d is the total number of parameters.
[0096] (2) Generate a random projection matrix , where k is the target dimension after dimensionality reduction;
[0097] (3) To Perform random projection.
[0098]
[0099] Because R is random, the similarity of the original vectors is preserved after projection.
[0100] Finally, the mask obtained from the above steps... ciphertext and projection weights Transmitted to the server.
[0101] The specific steps for S5 are as follows:
[0102] (1) First, set the projection weights for all clients. Calculate the average weight.
[0103]
[0104] Where N is the number of clients.
[0105] Then, for each client, the cosine similarity between the projected weights and the average weights is calculated.
[0106]
[0107] This yields the cosine similarity for each client.
[0108] (2) Then calculate the contribution weight. The formula for calculating the contribution weight is defined as follows:
[0109]
[0110] in It is the global model accuracy from the previous round. It is the global model accuracy from the previous training round. If the accuracy of the previous training round decreases, it means that the update direction of clients with low similarity is correct, and the contribution of clients with low similarity should be increased. If the accuracy of the previous training round increases, it means that the update direction of clients with high similarity is correct, and the contribution of clients with high similarity should be increased.
[0111] (3) Since there are missing packets uploaded by different clients after sparsification, the server uses the mask vector to encrypt the ciphertext. Perform uniform alignment, and then perform weighted homomorphic addition according to contribution weights.
[0112]
[0113] in This is achieved through homomorphic scalar multiplication.
[0114] Finally, the obtained encrypted global model is sent to the client for decryption.
[0115] To verify the comprehensive advantages of this technical solution in terms of privacy protection, communication efficiency, and computational overhead, this embodiment uses theoretical derivation and analysis to quantitatively compare the differences between this solution and traditional homomorphic encrypted federated learning and traditional federated learning, so as to empirically demonstrate the effectiveness of this solution.
[0116] Quantitative Analysis of Communication Overhead Theory
[0117] Assume the total dimension of the model parameters is d. Traditional homomorphic encryption methods require encrypting all parameters during transmission. The CKKS ciphertext inflation rate is set to... (generally ), communication volume is The method of this invention introduces adaptive sparsity, where the sparsity ratio is set to... That is, to retain One parameter, only for those that are reserved. Each parameter is encrypted. The communication cost of this scheme is equal to the sum of the mask vector overhead, the sparse ciphertext overhead, and the projection weight overhead, and the approximate communication cost is... Since s can typically be reduced to 10%–30% during the convergence period, and the projection dimension k is much smaller than d, this scheme theoretically reduces communication overhead compared to the full homomorphic encryption method. The communication optimization effect increases exponentially as s decreases in the later stages of model convergence.
[0118] Privacy Protection Strength Analysis
[0119] This invention constructs a triple defense system of "sparsening-encryption-projection," which offers higher security than single-layer protection. Regarding encryption security, based on the RLWE (Ring Learning With Errors) intractability assumption, the CKKS algorithm guarantees... Semantic security within the framework of computational complexity theory. Regarding resistance to inference attacks, even if an attacker possesses the private key and decrypts the code... Due to sparsification operations Attackers can only obtain partial gradient information. According to compressed sensing theory, reconstructing the original training data from partial sparse gradients when the original data distribution is unknown is an NP-hard problem. Furthermore, regarding the security of contribution evaluation, projected weights... Using the Johnson-Lindenstrauss lemma, since the projection matrix R follows independent and identically distributed... This mapping is an irreversible compression. The server can only know the directional similarity of the gradients, but cannot reverse-engineer the original gradients. This allows for the evaluation of contributions in plaintext while simultaneously protecting the privacy of the gradient.
[0120] It should be noted that the global model and local model appear multiple times in this invention and are continuously updated descriptions. Except for the first appearance which is the initial state, each subsequent mention is the latest updated state.
[0121] In summary, this invention proposes a federated data privacy protection method based on adaptive sparse homomorphic encryption. First, the model is trained locally on the client side, and the differences in weight parameters are calculated. A mask vector is generated by dynamically sparsening parameters and filtering them into blocks. Then, the CKKS homomorphic encryption algorithm is used to encrypt only the retained parameter blocks, while low-dimensional weights are generated through random projection for contribution evaluation. On the server side, contribution weights are calculated based on the cosine similarity of the projected weights and historical accuracy, and weighted aggregation is completed in the encrypted state. This invention, through a triple protection mechanism of sparsity, encryption, and projection, significantly reduces communication overhead while ensuring model accuracy and effectively prevents gradient leakage risks, making it suitable for distributed modeling scenarios involving sensitive data such as medical and financial data.
[0122] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A federated data privacy protection method based on adaptive sparse homomorphic encryption, characterized in that, Includes the following steps: S1: The server initializes the global model and broadcasts it to each client; after receiving the global model, each client uses its local private data to perform localized training on the global model to obtain an updated local model, and calculates the difference in weight parameters between the local model and the global model. S2: The client calculates the threshold based on the dynamic sparsity ratio, packages the weight parameter differences into multiple parameter blocks, and calculates the average absolute value of each parameter block; the average absolute value is compared with the threshold to generate a binary mask vector, where a mask value of 1 indicates that the corresponding parameter block is retained, and a mask value of 0 indicates that the corresponding parameter block is discarded. S3: The client uses the CKKS homomorphic encryption algorithm to encrypt only the parameter blocks that are indicated as reserved by the mask vector to obtain encrypted parameter packets. Parameter blocks with a mask of 0 are neither encrypted nor transmitted. S4: The client performs random projection dimensionality reduction on the weight parameter differences to generate low-dimensional projected weights for subsequent contribution evaluation; S5: The server receives the mask vector, the encrypted parameter packet, and the projection weight uploaded by each client; The server calculates the average weight based on the projected weights of all clients, and then calculates the cosine similarity between the projected weights of each client and the average weight. The server dynamically calculates the contribution weight of each client based on the cosine similarity and the changing trend of the historical global model accuracy; the server uses the mask vector to align the encrypted parameter packets of each client, and performs weighted homomorphic aggregation in the ciphertext domain based on the contribution weight to obtain the encrypted global model; S6: The client decrypts the encrypted global model returned by the server, obtains the updated global model parameters, and uses them for the next round of local model training.
2. The federated data privacy protection method based on adaptive sparse homomorphic encryption as described in claim 1, characterized in that: In S2, the dynamic sparsity ratio is adaptively adjusted according to the change in the global model loss value: when the change in the loss value exceeds the first threshold, the model is determined to be in the exploration phase, and the sparsity ratio is reduced to retain more parameters; when the change in the loss value is lower than the second threshold, the model is determined to be in the convergence phase, and the sparsity ratio is increased to reduce communication overhead.
3. The federated data privacy protection method based on adaptive sparse homomorphic encryption as described in claim 1, characterized in that: The specific steps for generating the mask vector in S2 include: S2.1: Sort all parameters in the weight parameter difference in descending order of absolute value, and determine the threshold σ according to the current sparsity ratio s%, where the threshold σ is the critical value of the absolute value of the first s% of parameters after sorting; S2.2: Divide the weight parameter differences into n parameter blocks, denoted as... Each parameter block Pn contains B parameters, that is... ,in, It's the client's weight. These are the parameters divided into each packet, with each packet consisting of B parameters. ; S2.3: For each parameter block P n Calculate its average absolute value: ; S2.4: Calculate the average absolute value μ of each parameter block. n Compared with the threshold σ, if μ n If σ > 1, then the mask corresponding to the parameter block is set to 1; otherwise, it is set to 0, thereby generating the mask vector Mask = [m1, m2, ..., m n ], where m n ∈ {0, 1}.
4. The federated data privacy protection method based on adaptive sparse homomorphic encryption as described in claim 1, characterized in that: The specific steps for homomorphic encryption of the reserved parameter block in S3 include: S3.1: Based on the mask vector Mask, filter the weight parameters, retaining only the parameter blocks with a mask value of 1, to form a sparse parameter package: ; S3.2: Use the CKKS encoding scheme to convert the sparsity parameter packet P sparse Mapped to polynomial plaintext messages A scaling factor Δ is introduced during the encoding process to improve computational accuracy; S3.3: Encrypt the polynomial plaintext message m using the homomorphic encryption public key pk to obtain the ciphertext. .
5. The federated data privacy protection method based on adaptive sparse homomorphic encryption as described in claim 1, characterized in that: The specific steps for generating projection weights in S4 include: S4.1: Differences in the original weight parameters of the client Flattened into a one-dimensional vector , where d is the total number of parameters; S4.2: Generate a random projection matrix Where k is the dimension after dimensionality reduction, and The elements of matrix R are independent and identically distributed. S4.3: Perform random projection calculation on the one-dimensional vector w: ; The projection weight z' is obtained, where the projection operation preserves the similarity features of the original weights; finally, the mask and ciphertext obtained in the above steps are combined. and projection weights Transmitted to the server.
6. The federated data privacy protection method based on adaptive sparse homomorphic encryption as described in claim 1, characterized in that: The specific steps for calculating contribution weights and performing weighted aggregation in S5 include: S5.1: Project weight set for all clients Calculate the average weight: ; Where N is the total number of clients; S5.2: Calculate the projection weight z' for each client. i Cosine similarity with average weight z: ; S5.3: Based on the historical global model accuracy trend, the contribution weight q of client i is calculated using the following formula. i : ; in It is the global model accuracy from the previous round. It is the global model accuracy of the previous round. If the accuracy of the previous training round decreases, it means that the update direction of the clients with low similarity is correct, and the contribution of the clients with low similarity is increased. If the accuracy of the previous training round increases, it means that the update direction of the clients with high similarity is correct, and the contribution of the clients with high similarity is increased. S5.4: The server aligns the encrypted parameter packets based on the mask vectors uploaded by each client, including padding or omitting operations to ensure consistent packet structure; then, it calculates q using homomorphic scalar multiplication. i ·C i And aggregate the weighted ciphertext from all clients using homomorphic addition: ; Where C t This is the aggregated global encryption model.
7. The federated data privacy protection method based on adaptive sparse homomorphic encryption as described in claim 1, characterized in that: The specific steps for training the local model in S1 include: Gradient descent is used as the optimizer to minimize the cross-entropy loss function and update the local model parameters; specifically, the formula for updating the local model parameters is: ; in Let η represent the local model of client i in the t-th training round, and η be the learning rate. Let cross-entropy be the loss function. For the previous round of global model, k i This is the local dataset for client i.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-7.
9. 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 as described in any one of claims 1-7.