A dynamic federated learning method for privacy protection of a mobile recommendation system

By combining dynamic data partitioning and the Generative Adversarial Network (DynGAN) with the Particle Swarm Optimization (PSO) algorithm, the performance degradation problem of federated learning in dynamic scenarios is solved, achieving efficient privacy protection and performance optimization in mobile recommendation systems.

CN117592554BActive Publication Date: 2026-11-03CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311554840.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-21
Publication Date
2026-11-03
Estimated Expiration
2043-11-21

AI Technical Summary

Technical Problem

Existing federated learning methods cannot effectively simulate actual changes in customer data in dynamic scenarios, leading to performance degradation and increased heterogeneity, which affects the aggregation efficiency and quality of the model.

Method used

A dynamic data partitioning strategy and a generative adversarial network DynGAN combined with the particle swarm optimization (PSO) algorithm are adopted. Personalized auxiliary data is generated by pre-training DynGAN, and the weight strategy is optimized using the PSO algorithm to dynamically adjust the model aggregation process.

Benefits of technology

It improves the quality of local model training, alleviates the problem of heterogeneous customer data distribution, enhances the model's generalization ability and privacy protection, and is suitable for mobile recommendation systems and other fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117592554B_ABST
    Figure CN117592554B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of dynamic federated learning methods for mobile recommendation system privacy protection, including dynamic data strategy simulation real dynamic environment, and in order to enhance the performance of federated model in dynamic environment, the present application also proposes adaptive aggregation method of adversarial generative network and particle swarm optimization, the problem of large-scale local data coefficient and distribution heterogeneity on the client in dynamic federated scenario is solved by adversarial generative network, the interference problem of low-quality model parameters in the aggregation process of server caused by the client drift problem faced by dynamic scenario is solved by adaptive aggregation method of particle swarm optimization.Combining the two optimization methods in dynamic environment, the performance of federated model is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mobile recommendation technology, and in particular to a dynamic federated learning method for privacy protection in mobile recommendation systems. Background Technology

[0002] Mobile recommendation systems have become essential tools for people's commuting, shopping, and travel. Protecting user privacy and security has become a consensus. Federated learning, as a distributed learning mechanism, does not upload raw data, making it highly helpful in protecting user privacy. It has attracted widespread attention in fields such as healthcare, education, and recommendation systems.

[0003] Federated learning is a distributed learning architecture that incorporates participant privacy. It enables collaboration while ensuring user privacy and security. Federated learning effectively achieves privacy protection, thus attracting widespread interest and application in various fields such as healthcare, intelligent transportation, and recommender systems. Due to the distributed nature of mobile recommender systems, applying federated learning to protect user privacy and security is particularly suitable. Works like FedRec and FedRec++ have begun exploring the application of federated learning in recommender systems, and related research has flourished since then. uni-FedRec attempts to leverage federated learning to enhance privacy and security in news recommender systems. FedAttack studied malicious customers and attacks in federated recommendations and provided corresponding defense mechanisms. Currently, federated recommendations are attracting more attention, but research in the field of mobile recommender systems remains lacking. Due to the large number of customers and their frequent movement in mobile recommender systems, the need for privacy protection is even more urgent.

[0004] Most existing federated learning architectures maintain a constant amount of customer data during iterations to mitigate excessive heterogeneity. However, this approach is ill-suited to the real-time nature of online deployments in mobile recommender systems, frequent cross-domain mobility, and large customer bases. Therefore, dynamic datasets are needed to effectively simulate real-world changes in customer data.

[0005] like Figure 1 As shown, the user's trajectory changes rapidly over time. In the 28 minutes from 12:25 PM to 12:53 PM, the user visited 8 locations and recorded 9 check-in points (the 6th point was repeated twice). If this customer communicated with the server every minute and performed local training, their local dataset should change as shown in the gray area of ​​the figure. However, traditional federated learning ignores this pattern and simply artificially sets the amount of customer data. Therefore, a more reasonable dynamic data partitioning strategy is needed to simulate the changes in customer data in real-world scenarios.

[0006] Experiments have demonstrated that, in dynamic scenarios, the federated model faces a more severe performance degradation problem, such as... Figure 2 As shown. This is because in dynamic scenarios, data differences between clients become more significant, leading to a more pronounced performance degradation of the federated model. Increased data heterogeneity reduces the server's aggregation efficiency, and the quality of the global model on the server is compromised by the lower-quality local models. Summary of the Invention

[0007] In view of the above-mentioned problems in the existing technology, the technical problem to be solved by the present invention is: how to further improve the performance of federated models in dynamic scenarios.

[0008] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: a dynamic federated learning method for privacy protection in mobile recommendation systems, comprising the following steps:

[0009] S1: A new dataset conforming to the dynamic environment is obtained through dynamic data partitioning, and an adversarial generative network DynGAN is constructed. DynGAN replaces LSTM in the existing seqGAN model with GRU. DynGAN is pre-trained using an unencrypted public dataset, and the parameters of the pre-trained DynGAN model are broadcast to all clients.

[0010] S2: Each client fine-tunes the DynGAN using its new dataset to obtain a fine-tuned DynGAN. The client can then use the generator G from the fine-tuned DynGAN. θ Generate the synthetic trajectory, represented as Enhanced trajectories are obtained by concatenating with a real local dataset on the client. use All clients perform local training, and all clients upload the locally trained model parameters to the server.

[0011] S3: The server aggregates the received model parameters and updates the global model, then broadcasts the updated global model back to all clients. Particle Swarm Optimization (PSO) is used as the dynamic optimal weighting strategy. Particles are initialized in PSO, with each particle representing a weighting strategy. Through iterations of the PSO algorithm, the resulting optimal particle swarm represents the best aggregated weight allocation for that round.

[0012] S4: Determine if the preset number of training iterations has been reached. If not, return to S1; otherwise, all clients have completed training.

[0013] As an improvement, the step in S1 of obtaining a new dataset that conforms to the dynamic environment through dynamic data partitioning includes:

[0014] Definition: T represents the total number of iterations, n represents the number of clients, and Nd i Nt represents the number of data values ​​on the i-th client. i Np represents the number of trajectories on the i-th client. i N(μ, σ) represents the number of trajectory points on the i-th client. 2 ) represents a mean of μ and a variance of σ. 2 It follows a normal distribution.

[0015] In the initial phase, the initial dataset is distributed to each client, i.e., Nd i (0) =Nd init Nt i (0) =Nt init Np i (0) =NP init For each iteration from t=1 to T, perform the following steps:

[0016] Incremental data generation: i = 1 to n, the incremental amount of data generated. Track number increment Increment of trajectory points in and These represent the mean number of data values, the mean number of trajectories, and the mean number of trajectory points for each client that are normally distributed. and The variance parameters represent the number of data values ​​per client, the number of trajectories, and the number of trajectory points.

[0017] Data merging: The newly generated data is concatenated with the original data on each client to obtain a new dataset for each client, i.e., Nd. i (t) =Nd i (t-1) +ΔNd i (t) Nt i (t) =Nt i (t-1) +ΔNt i (t) Np i (t) =Np i (t-1) +ΔNp i (t) .

[0018] As an improvement, the steps of using DynGAN pre-training in S1 include:

[0019] The server pre-trains DynGAN using an unencrypted public dataset. The pre-training of DynGAN includes a pre-trained generator G. θ and pre-trained discriminator D φ .

[0020] The sequence generation problem is described as follows: Given a dataset containing real-world trajectory sequences, train a G parameterized by θ. θ G θ Generate a sequence Y 1:T =(y1, ..., y t , ..., y T ), where y t ∈Y, where Y is the vocabulary of candidate labels. Train a D parameterized by φ. φ D φ To identify G θ The authenticity of the generated forged sequence, D φ (Y 1:T ) is a representation of sequence Y 1:T The probability of whether it comes from real sequence data.

[0021] D φ By using positive examples from a dataset that includes real-world trajectory sequences, and to G θ The negative examples of the generated synthetic sequences are used for training. During the adversarial training process between the generator and the discriminator, G... θ Continuously maximize expected reward, as shown in formula (2).

[0022]

[0023]

[0024]

[0025] Where J(θ) is the objective function, E[R] T [s0, θ] represents the reward R obtained after completing a sequence given an initial state s0 and parameters θ. T The expected value of G. θ (y1|s0) represents the generator G defined by parameter θ given the initial state s0. θ The probability of producing output y1. 1:T-1 This represents the sequence from the beginning to time T-1. This represents N sequences from 1 to N, where each sequence runs from time 1 to T. It is the action-value function of the sequence, that is, starting from state s, taking action a. The estimate was obtained using the Reinforce algorithm.

[0026] Using the rolling strategy G β A Monte Carlo search is performed to sample the last Tt unknown labels. The N Monte Carlo searches are represented as (4), D φ The training objective is shown in formula (5):

[0027]

[0028] As the probability of determining the true data increases It will decrease. Similarly, as the probability of generating data decreases, It will also decrease. Then, D φ Inverse training is performed based on the loss function.

[0029] When the predetermined number of training sessions is reached, G θ and D φ After pre-training, the pre-trained DynGAN is obtained.

[0030] As an improvement, the steps of the dynamic optimal weight strategy in S3 include:

[0031] Data distribution is measured by the distance between two vector sequences, i.e., the sample entropy. A series of vector sequences X are constructed using indices. m , ..., X m (N-m+1), each vector X m (i) = x(i), x(i+1), ..., x(i+m-1), where 1≤i≤N-m+1, representing a sequence of m consecutive x values ​​starting from the i-th point. Then, define vector X. m (i) and X m The distance d[X] between (j) m (i), X m [j] is the absolute value of the maximum difference between corresponding elements of two vectors, as shown in equation (6).

[0032]

[0033]

[0034]

[0035] For a given X m (i), calculate X m The quantity B of (j) i , where j (1≤j≤Nm, j≠i) such that X m (i) and X m The distance between (j) is less than or equal to r, and for 1 ≤ J ≤ Nm, the definition is... and B (mm) (r), see formulas (7) and (8), then increase the dimension to m+1. Calculate X m+1 (i) and X m+1 The number A of (j)(1≤j≤Nm, j≠i) whose distance is less than or equal to r is . i .

[0036] definition and A m (r), see formulas (9) and (10):

[0037]

[0038]

[0039]

[0040]

[0041] Thus, B (m) (r) represents the probability that m points in two sequences match at a similarity threshold r, A (m) This represents the probability of matching m+1 points in two sequences. For a single sequence i, considering m consecutive points, it is the ratio of the number of similarity matches at a threshold r to Nm-1. It is the probability of similarity matching under the threshold r when an additional trajectory point is added, considering m+1 points. The definition of sample entropy is as shown in formula (11).

[0042] The server will use formula (13) to take into account the overall results and obtain an indicator for measuring the effectiveness of client training in this round.

[0043] quality i =ω acc ·acc i +ω en ·en i +ω num ·hum i +ω loss loss i (13)

[0044] In equation (13), quality i Let ω represent the quality metric for the i-th client, and ω represent the quality metric for the i-th client. acc ω en ω num and ω loss This represents the weights assigned to the i-th client for validation accuracy, sample entropy, data volume, and loss, respectively. i eni ,num i and loss i Let represent the verification accuracy, sample entropy, data volume, and loss of the i-th client, respectively.

[0045] Initialize a particle swarm, where each particle represents a weighting strategy.

[0046] Suppose there are m particles representing m solutions in an H-dimensional search space, and the position of the i-th particle is denoted as... The velocity of the i-th particle is expressed as: The optimal position found by the i-th particle is denoted as The optimal position found by the particle swarm is represented as The fitness value of the optimal position found by the i-th particle is represented by f. p →The fitness value of an individual's historical best position, and the fitness value of the best position found by the particle swarm, are represented as f. g →The best fitness value in the history of the group.

[0047] In each iteration, the particle updates its velocity according to formula (14), which represents the particle's velocity in the next iteration.

[0048]

[0049]

[0050] Equations (14) and (15) contain the following parameters: i represents the particle index, i = 1, 2, ..., m. k represents the iteration count, ω is the inertia weight, c1 is the individual learning factor, and c2 is the group learning factor. r1 and r2 are random numbers in the interval [0, 1], intended to introduce randomness in the search. and Let these represent the velocities of particle i in the h-th dimension during the k-th and (k+1)-th iterations, respectively. and Let represent the positions of particle i in the h-th dimension during the k-th and k+1-th iterations, respectively. Let represent the historical best position of particle i in the h-th dimension during the k-th iteration, i.e., the optimal particle. The optimal particle swarm represents the best historical position in the h-th dimension of the particle swarm during the k-th iteration.

[0051] Compared with the prior art, the present invention has at least the following advantages:

[0052] 1. After pre-training on a public dataset, the fine-tuned DynGAN can generate more personalized auxiliary data for each client, thereby greatly improving the training quality of the local model.

[0053] 2. Pre-training on public datasets helps DynGAN generate more similar data, in terms of consistent data volume and distribution, which helps alleviate problems associated with heterogeneous customer data distribution.

[0054] 3. The dynamic aggregation strategy uses particle swarm optimization to provide a more reasonable weighting strategy for each round of aggregation. This further enhances the positive effects of high-quality customers while reducing the negative impact of low-quality customers.

[0055] 4. DynFL demonstrates strong generalization ability, not only applicable to mobile recommendation systems, but also extendable to other fields such as computer vision (CV) and natural language processing (NLP).

[0056] 5. DynFL adheres to the principle of not uploading local data, only transmitting model parameters and some intermediate values. Furthermore, communication between the client and server is encrypted, effectively protecting user privacy.

[0057] 6. In the dynamic data distribution strategy, the pre-training process of the GAN on the server uses a public dataset that does not contain sensitive attributes. Furthermore, more auxiliary datasets make each client's dataset more robust and harder to infer, further enhancing privacy and security.

[0058] 7. In dynamic aggregation strategies, the calculation of model parameters and uploaded intermediate values ​​(such as sample entropy, loss values, etc.) on the client side is irreversible. Even if an attacker intercepts this information, it is difficult to infer the sensitive attributes of the real data from these intermediate values. Attached Figure Description

[0059] Figure 1 Federated learning deployed online typically faces dynamic and incremental data change patterns.

[0060] Figure 2 Performance comparison of federated models under centralized, static, and dynamic settings.

[0061] Figure 3 This is a schematic diagram of the structure of DynFL.

[0062] Figure 4 The main architecture for dynamic trajectory optimization.

[0063] Figure 5 This is a schematic diagram for dynamic aggregation optimization.

[0064] Figure 6The graph shows the global model performance improvement curves of different federated learning algorithms when using SASREC and SSEPT models on the NYC, TKY, and GoWALLA datasets, respectively. (a), (b), and (c) represent the performance change curves of each algorithm when SASREC is trained on the NYC, TKY, and GoWALLA datasets, respectively, and (d), (e), and (f) represent the performance change curves of each algorithm when SSEPT is trained on the NYC, TKY, and GoWALLA datasets, respectively.

[0065] Figure 7 The performance of the local model on all clients is calculated when using different federated learning algorithms for the SASREC and SSEPT models on the NYC, TKY, and GOWALLA datasets, respectively. (a), (b), and (c) represent the client performance of SASREC on the NYC, TKY, and GOWALLA datasets, respectively, and (d), (e), and (f) represent the client performance of SSEPT on the NYC, TKY, and GOWALLA datasets, respectively. Detailed Implementation

[0066] The present invention will now be described in further detail.

[0067] See Figure 1-7 To better distinguish between static and dynamic data partitioning, this invention first provides definitions for dynamic and static scenarios.

[0068] Static means that when the server initializes the client, model, and data on the client, it assigns a fixed amount of data to each client. The data on the client remains unchanged in subsequent iterations. Local training on the client will continue to use this unchanged dataset.

[0069] "Dynamic" refers to continuously adding data based on a dynamic data partitioning strategy to simulate user behavior patterns as closely as possible. During the iteration process, the client will dynamically add data according to the strategy, and local training will use the updated local dataset.

[0070] Then, the performance of the federated model under centralized, static, and dynamic settings was experimentally compared, and the results showed that... Figure 2 The experiments were conducted using the NYc dataset from FedAvg. In the figure, "centralized" represents a centralized training method without federated learning, "static" represents federated learning using fixed client data, and "Dynamic" represents federated learning using a data partitioning strategy described by a normal distribution. Figure 2As can be seen, federated models in dynamic environments face the most severe performance degradation. Insufficient performance can degrade user experience and system deployment. This contradiction can only be resolved by ensuring user privacy while limiting model performance degradation to an acceptable level. Therefore, the main focus of this invention is how to optimize a multi-objective function consisting of privacy protection and performance optimization in dynamic scenarios to achieve overall optimality.

[0071] Define the trajectory dataset for the mobile recommendation system as D = D1, D2, ..., D n D i =(u i p i , t i , l i ) represents the trajectory data of the i-th user. Here, u i Represents user ID, p i Represents the access location ID, t i It's a timestamp, l i This represents the geographical location of the trajectory points. Given the trajectory dataset D, the sequence recommendation model θ will learn from this data and predict the user u. i Possible next access location p i To optimize the overall objectives of the federated recommendation model in dynamic scenarios, namely privacy protection and performance improvement, a multi-objective function F(D) is defined as shown in (1).

[0072]

[0073] Here, f prv (D) represents the privacy protection goal, primarily achieved through the principles of not uploading raw data in federated learning and encryption methods. pfm(D) The goal of improving the performance of federated models is primarily achieved through optimization techniques proposed in DynFL. In summary, the main objective of this invention is to enhance the performance of federated models in dynamic scenarios, thereby achieving both privacy protection and performance improvement within DynFL.

[0074] In dynamic scenarios, a more severe performance degradation was observed under the federated framework. To achieve an optimal balance between protecting user privacy and considering the performance of the federated recommendation model, thus achieving a trade-off between privacy and accuracy, this invention further proposes a "Dynamic Federated Learning Method," DynFL. Figure 3 The paper demonstrates the main processes of DynFL, including a client- and server-based federated architecture and proposed improvements, including adaptive optimization aggregation strategies and prior knowledge-based data optimization strategies.

[0075] from Figure 3As can be observed, DynFL's basic architecture remains client-server based. The tasks in DynFL are similar to other federated learning methods. Clients are typically various mobile devices, such as cars, phones, or watches, while the server acts as a central server. In this framework, the client receives the updated model from the server and trains it locally. Subsequently, the encrypted parameters of the local model are uploaded to the server. The server then uses the client's model parameters to aggregate and update the global model, and broadcasts the updated global model back to all clients. It is important to note that communication between the client and server is encrypted using homomorphic encryption.

[0076] To better validate real-world data changes in dynamic scenarios, a distribution-based dynamic data partitioning strategy was designed for DynFL. Under dynamic settings, the performance of the federated model was optimized using two main methods: trajectory distribution optimization based on Generative Adversarial Networks (GANs) and a dynamic aggregation strategy based on Particle Swarm Optimization (PSO).

[0077] A dynamic federated learning method for privacy protection in mobile recommendation systems includes the following steps:

[0078] S1: A new dataset conforming to the dynamic environment is obtained through dynamic data partitioning, and an adversarial generative network (DynGAN) is constructed. DynGAN replaces the LSTM in the existing seqGAN model with a GRU, a change that improves the pre-training speed of the GAN. The GAN consists of a generator model and a discriminator model. The generator model is responsible for generating trajectory data, while the discriminator model is used to judge the quality of the generated trajectories. The two interact, continuously iterating to produce a better generator, thereby generating better trajectories. The DynGAN is pre-trained using an unencrypted public dataset, and the parameters of the pre-trained DynGAN model are broadcast to all clients.

[0079] This invention proposes a dynamic data partitioning strategy to simulate the dynamic data change process in real-world scenarios. A significant characteristic of online recommendation systems is that data continuously grows over time, rather than remaining constant. Furthermore, from a macroscopic perspective, the increment of user data follows a normal distribution, including the number of trajectories and the number of trajectory points. Therefore, a dynamic data partitioning strategy based on normal distribution simulation is designed to simulate the real-world data changes in online deployments. Additionally, considering computational performance, a data cap is set for each client.

[0080] S2: Each client fine-tunes the DynGAN using its new dataset to obtain a fine-tuned DynGAN. The client can then use the generator G from the fine-tuned DynGAN. θ Generate the synthetic trajectory, represented as Enhanced trajectories are obtained by concatenating with a real local dataset on the client. This augmented data can provide more learning samples for local training on the client side, helping the local model learn deeper information. All clients perform local training, and all clients upload the locally trained model parameters to the server.

[0081] First, DynGAN is pre-trained on the server using a publicly available dataset without privacy attributes, as shown in the training process above. Then, during the initialization phase, the pre-trained DynGAN model parameters are broadcast to all clients. In the subsequent federated learning process, each client can fine-tune DynGAN using its local data. After completing the pre-training and fine-tuning steps, the clients can use the generator G in DynGAN. θ Generate more synthetic trajectories, represented as These trajectories are then concatenated with real local datasets to form... Enhanced trajectory This will provide more and deeper trajectory information for training the local model.

[0082] S3: The server receives the model parameters, aggregates and updates the global model, and broadcasts the updated global model back to all clients.

[0083] Please refer to the section on using Particle Swarm Optimization (PSO) as the dynamic optimal weighting strategy. Figure 5 In the Particle Swarm Optimization (PSO) algorithm, particles are initialized, with each particle representing a weighting strategy. Through iterations of the PSO algorithm, the resulting optimal particle swarm represents the best aggregation weight allocation for that round. The dynamic optimal weighting strategy adaptively provides the server with the best weighting scheme for each iteration, maximizing the performance of high-performing client models and minimizing the performance of low-performing client models during aggregation.

[0084] S4: Determine if the preset number of training iterations has been reached. If not, return to S1; otherwise, all clients have completed training.

[0085] Specifically, the step in S1 of obtaining a new dataset that conforms to the dynamic environment through dynamic data partitioning includes:

[0086] Definition: T represents the total number of iterations, n represents the number of clients, and Nd i Nt represents the number of data values ​​on the i-th client. i Np represents the number of trajectories on the i-th client. iN(μ, σ) represents the number of trajectory points on the i-th client. 2 ) represents a mean of μ and a variance of σ. 2 It follows a normal distribution.

[0087] In the initial phase, the initial dataset is distributed to each client, i.e., Nd i (0) =Nd init Nt i (0) =Nt init Np i (0) =Np init For each iteration from t=1 to T, perform the following steps:

[0088] Incremental data generation: i = 1 to n, the incremental amount of data generated. Track number increment Increment of trajectory points in and These represent the mean number of data values, the mean number of trajectories, and the mean number of trajectory points for each client that are normally distributed. and The variance parameters represent the number of data values ​​per client, the number of trajectories, and the number of trajectory points.

[0089] Data merging: The newly generated data is concatenated with the original data on each client to obtain a new dataset for each client, i.e., Nd. i (t) =Nd i (t-1) +ΔNd i (t) Nt i (t) =Nt i (t-1) +ΔNt i (t) Np i (t) =Np i (t-1) +ΔNp i (t) .

[0090] After the dynamic data is partitioned, the client and server begin learning under this dynamic setup. Specifically, each client uses its dynamic local data for distributed training, and then the server collects the model parameters of all participating clients, aggregates them to obtain the global model, and broadcasts it back to all clients for the next iteration.

[0091] Specifically, the steps of using DynGAN pre-training in S1 include:

[0092] In federated learning, clients are independent entities, and their data is not shared to ensure user privacy and security. However, the distributed nature of data islands results in limited data on each client. Furthermore, in the dynamic scenarios of federated learning, the amount and quality of data obtained by each client in each iteration differ, further exacerbating the heterogeneity of client data distribution.

[0093] This invention addresses the challenges of large-scale local data coefficients and heterogeneous distribution on clients in dynamic federated learning scenarios. It proposes an adversarial generative network suitable for dynamic federated learning, named DynGAN, which is an improvement upon seqGAN proposed by Yu et al. The invention integrates the improvements of seqGAN and proposes a pre-training and fine-tuning mechanism to help optimize data from different clients while ensuring privacy.

[0094] The server pre-trains DynGAN using an unencrypted public dataset. The pre-training of DynGAN includes a pre-trained generator G. θ and pre-trained discriminator D φ .

[0095] First, G is trained using a real dataset. θ and using G θ Generate a fake sequence Y 1:T =(y1, ..., y t , ..., y T This sequence will be as close as possible to the real input dataset. Then, D is used. φ To identify G θ The authenticity of the generated forged sequence is used to determine G. θ The strength of its generation ability.

[0096] When G θ The generated fake sequence can fool D φ Then we assume G θ It's good enough, that is, G. θ The generated fake sequence D φ When the result is true or the probability is greater than a preset value, the generator G... θ The generated data is also considered to be sufficiently good fake data, at which point training of DynGAN is stopped, and G is... θ The generated data serves as augmented data.

[0097] The sequence generation problem is described as follows: Given a dataset containing real-world trajectory sequences, train a G parameterized by θ. θ Gθ Generate a sequence Y 1:T = (y1, ..., y t , ..., y T ), where y t ∈Y, where Y is the vocabulary of candidate labels. Train a D parameterized by φ. φ D φ To identify G θ The authenticity of the generated forged sequence, D φ (Y 1:T ) is a representation of sequence Y 1:T The probability of whether it comes from real sequence data.

[0098] D φ By using positive examples from a dataset that includes real-world trajectory sequences, and to G θ The negative examples of the generated synthetic sequences are used for training. G θ Training parameters are based on D φ The feedback is used, and updates are performed using Monte Carlo (MC) and gradient descent. θ From D φ Receiving a reward is D φ The feedback is used to understand whether its generation capabilities have met the standards. This D φ Feedback based on D φ The policy gradient of the expected final reward received is calculated, and G is obtained after the feedback. θ The learning continues using Monte Carlo (MC) search until the value of the objective function no longer changes and reaches a preset value, at which point the training ends.

[0099] During the adversarial training process between the generator and the discriminator, G θ Continuously maximize expected reward, as shown in formula (2).

[0100]

[0101]

[0102]

[0103] Where J(θ) is the objective function, used in machine learning to measure the effect of a specific policy (parameterized by θ). E[R] T [s0, θ] represents the reward R obtained after completing a sequence, given an initial state s0 and parameters θ. T The expected value of G. θ (y1|s0) represents the generator G defined by parameter θ given the initial state s0. θ The probability of producing output y1. 1:T-1 This represents the sequence from the beginning to time T-1. This represents N sequences from 1 to N, where each sequence runs from time 1 to T. It is the action-value function of the sequence, that is, starting from state s, taking action a. The estimate was obtained using the Reinforce algorithm.

[0104] To evaluate the action values ​​of intermediate states, a rolling strategy G is used. β A Monte Carlo search is performed to sample the last Tt unknown labels. The N Monte Carlo searches are represented as (4), D φ The training objective is shown in formula (5).

[0105]

[0106] As the probability of determining the true data increases It will decrease. Similarly, as the probability of generating data decreases, It will also decrease. Then, D φ Inverse training is performed based on the loss function.

[0107] When the predetermined number of training sessions is reached, G θ and D φ After pre-training, the pre-trained DynGAN is obtained.

[0108] Specifically, the steps of the dynamic optimal weight strategy in S3 include:

[0109] Subsequently, based on these multi-dimensional constraints, particles are initialized in the Particle Swarm Optimization (PSO) algorithm, where each particle represents a weighting strategy. Through iterations of the PSO algorithm, the optimal particle represents the best aggregate weight allocation for that round. Specifically, the client-side training quality is measured based on validation accuracy, loss variable, data distribution, and data volume during local training. Considering multiple factors allows for more comprehensive results. Among these, test accuracy, loss variable, and data volume are additional information acquired during each round of client-side training without significantly increasing computational overhead.

[0110] In the Particle Swarm Optimization (PSO) algorithm, particles are initialized, with each particle representing a weighting strategy. Through iterations of the PSO algorithm, the optimal particle represents the best aggregate weight allocation for that round. The client-side training quality is measured based on validation accuracy, loss, data distribution, and data volume during local training. Considering multiple factors allows for more comprehensive results. Test accuracy, loss variables, and data volume are additional information acquired during each round of client-side training without significantly increasing computational overhead.

[0111] Data distribution is measured by the distance between two vector sequences, i.e., the sample entropy. A series of vector sequences X are constructed using indices. m , ..., X m (N-m+1), each vector X m (i) = x(i), x(i+1), ..., x(i+m-1), where 1≤i≤N-m+1, representing a sequence of m consecutive x values ​​starting from the i-th point. Then, define a vector X. m (i) and X m The distance d[X] between (j) m (i), X m [j] is the absolute value of the maximum difference between corresponding elements of two vectors, as shown in equation (6).

[0112]

[0113]

[0114]

[0115] For a given X m (i), calculate X m The quantity B of (j) i , where j (1≤j≤Nm, j≠i) such that X m (i) and X m The distance between (j) is less than or equal to r, and for 1 ≤ j ≤ Nm, the following definition is given. and B (m) (r), see formulas (7) and (8), then increase the dimension to m+1. Calculate X m+1 (i) and X m+1 The number A of (j)(1≤j≤Nm, j≠i) whose distance is less than or equal to r is . i .

[0116] definition and A m (r), see formulas (9) and (10):

[0117]

[0118]

[0119]

[0120]

[0121] Thus, B (m) (r) represents the probability that m points in two sequences match at a similarity threshold r, A (m)This represents the probability of matching m+1 points in two sequences. For a single sequence i, considering m consecutive points, it is the ratio of the number of similarity matches at threshold r to Nm-1. It is the probability of similarity matching under the threshold r when an additional trajectory point is added, considering m+1 points. The definition of sample entropy is as shown in formula (11).

[0122] When the client calculates metrics such as validation accuracy, loss, and distribution during local training, these metrics, along with the model parameters, are encrypted and then uploaded to the server. The server uses formula (13) to comprehensively consider these metrics to obtain an indicator for measuring the effectiveness of the client's training in that round.

[0123] quality i =ω acc ·acc i +ω en ·en i +ω num ·num i +ω loss loss i (13)

[0124] In equation (13), quality i Let ω represent the quality metric for the i-th client, and ω represent the quality metric for the i-th client. acc ω en ω num and ω loss This represents the weights assigned to the i-th client for validation accuracy, sample entropy, data volume, and loss, respectively. i en i ,num i and loss i Let represent the verification accuracy, sample entropy, data volume, and loss of the i-th client, respectively.

[0125] The constraints include higher overall client accuracy, lower overall loss, and the lowest overall cross-entropy on the client, as well as a weighting based on the number of trajectories. Simply put, a client with high accuracy, low loss, low cross-entropy, and a large number of trajectories is considered to be of higher quality. Conversely, a client lacking these characteristics is considered to be of lower quality.

[0126] Initialize a particle swarm, where each particle represents a weighting strategy.

[0127] Suppose there are m particles representing m solutions in an H-dimensional search space, and the position of the i-th particle is denoted as... The velocity of the i-th particle (the distance and direction of its movement) is expressed as: The optimal position found by the i-th particle (individual optimal) is denoted as: The optimal position found by the particle swarm (global best) is represented as: The fitness value (the value of the optimization objective function) of the optimal position found by the i-th particle is denoted as f. p →The fitness value of an individual's historical best position, and the fitness value of the best position found by the particle swarm, are represented as f. g →The best fitness value in the history of the group.

[0128] In each iteration, the particle updates its velocity according to formula (14), which represents the particle's velocity in the next iteration.

[0129]

[0130]

[0131] Equations (14) and (15) contain the following parameters: i represents the particle index, i = 1, 2, ..., m. k represents the iteration count, ω is the inertia weight, c1 is the individual learning factor, and c2 is the group learning factor. r1 and r2 are random numbers in the interval [0, 1], intended to introduce randomness in the search. and Let these represent the velocities of particle i in the h-th dimension during the k-th and (k+1)-th iterations, respectively. and Let represent the positions of particle i in the h-th dimension during the k-th and k+1-th iterations, respectively. Let represent the historical best position of particle i in the h-th dimension during the k-th iteration, i.e., the optimal particle. The optimal particle swarm represents the best historical position in the h-th dimension of the particle swarm during the k-th iteration.

[0132] Experimental evaluation

[0133] A. Dynamic settings

[0134] To compare the performance differences between the proposed DynFL model and various federated learning methods in dynamic scenarios, a dynamic data setting for subsequent experiments was established based on the aforementioned dynamic data partitioning strategy. Specifically, random trajectory points or new trajectories are generated for each client during each global iteration according to a normal distribution. These generated points are then appended to the old dataset to form the updated dataset for that client's training epoch. For specific parameters, please refer to Table 1.

[0135] B. Baseline

[0136] Traditional federated learning methods FedSGD, AVG, FedAvgM, FedAdam, FedYogi, and FedAvg are collectively referred to as baselines. DynFL is the dynamic federated learning method proposed in this invention.

[0137] C. Models and Datasets

[0138] To comprehensively evaluate the proposed DynFL and baselines, the sequential recommendation model SASERC based on the self-attention mechanism and the stochastic shared embedding model SSEPT were used for training and testing.

[0139] The datasets used for training and testing in this invention are NYC, TKY, and GOWALLA, which are common public datasets in the mobile recommendation field. NYC and TKY are two Foursquare-based datasets containing check-in records of users in New York and Tokyo. The NYC dataset contains 1,083 users, 38,333 Points of Interest (POIs), and 227,428 check-in records. The TKY dataset contains 2,296 users, 57,339 POIs, and 573,703 check-in records. GOWALLA contains check-in records of users worldwide, including 4,807 users, 5,937,917 POIs, and 1,048,577 check-in records.

[0140] D. Evaluation indicators and parameters

[0141] The evaluation metrics used include NDCG@k and HR@k, where k values ​​include 5, 10, and 20. In the mobile recommendation field, NDCG@k and HR@k are commonly used evaluation metrics for assessing the performance of recommendation systems. NDCG, short for Standardized Discount Cumulative Gain, is a metric used to evaluate ranking results, measuring the difference between the ranked list and the user's actual interests. HR, short for Hit Rate, is a metric used to evaluate whether the recommended results contain items that the user actually interacted with. The specific hyperparameters of the experiment are shown in Table 1.

[0142] Table 1. Key hyperparameters in the experiment

[0143]

[0144] E. Global Model Results

[0145] Under the above experimental settings and hyperparameters, the performance of the global model on the central server is recorded in Table 2, where "Centralized" indicates a centralized model training method. The NYC, TKY, and GOWALLA datasets were used sequentially, and performance comparison experiments were conducted under six different settings, including SASREC and SSEPT. The results are shown in Table 2. Confidence scores were calculated for the DynFL dataset. The experimental results in Table 2 show that the model performance is highest across all datasets and model settings under the centralized training setting. This is because the centralized method allows the model to access datasets from all clients, naturally leading to optimal performance. However, centralized data processing inevitably involves significant privacy risks. Traditional federated learning frameworks, such as FedSGD, FedAvg, and FedAdam, exhibit significant performance degradation. This is because clients are independent, and local training can only be performed on very limited local data, which restricts the performance of local models.

[0146] Table 2. Global results for SASREC and SSEPT on the NYC, TKY, and GOWALLA datasets. NG@K is an abbreviation for NDCG@K, and HR@K is an abbreviation for HIT RATE@K.

[0147]

[0148] In DynFL, the performance of the global model is significantly improved. On the NYC and TKY datasets, DynFL's performance improvement ranges from 7% to 12% compared to traditional federated learning methods. On the GOWALLA dataset, DynFL's performance improvement is even more significant, in some cases even surpassing centralized training. One possible reason is the relatively poor quality of the GOWALLA dataset itself; the GAN introduced in DynFL optimizes the quantity and quality of trajectories, helping the federated model achieve results exceeding those of centralized training.

[0149] F. Speed ​​of performance improvement

[0150] Faster model performance means faster update times. Therefore, when a federated model can achieve higher model performance in a shorter time, it undoubtedly helps in applying federated learning in scenarios requiring faster responses. Thus, the performance improvement speed of different federated models is tested by evaluating the global model after each global aggregation, such as... Figure 6 As shown.

[0151] Figure 6The experimental results clearly demonstrate that, under dynamic data partitioning, the traditional federated learning framework achieves slower and lower performance improvement rates compared to DynFL, the model proposed in this invention. Particularly on the GOWALLA dataset, the baseline performance plateaus early on, entering a period of slow growth after 600 iterations. In contrast, DynFL reaches its peak performance after 200 iterations and consistently outperforms all baselines throughout the process. This indicates that, when rapid updates are required, DynFL can reduce the necessary number of iterations while ensuring high model accuracy.

[0152] G. Client Results

[0153] Before performing the final global aggregation, each client model was tested, and the performance of all clients under different federated learning settings was visualized using box plots. See [link to relevant documentation]. Figure 7 These box plots reflect the robustness of client performance under different federated learning settings. The box plots include 95% confidence intervals, outliers, and statistical metrics such as the mean and median. Smaller boxes, fewer outliers, and higher mean values ​​indicate more robust client performance. As can be seen, DynFL's client performance is more robust, as evidenced by its narrower boxes, fewer outliers, and larger extreme values, mean, and median.

[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A dynamic federated learning method for privacy protection in mobile recommendation systems, characterized in that: Includes the following steps: S1: A new dataset that conforms to the dynamic environment is obtained by dynamically partitioning the data, and an adversarial generative network DynGAN is constructed. DynGAN replaces LSTM in the existing seqGAN model with GRU. DynGAN is pre-trained using an unencrypted public dataset to obtain the pre-trained DynGAN, and the parameters of the pre-trained DynGAN model are broadcast to all clients. S2: Each client fine-tunes the DynGAN using its new dataset to obtain a fine-tuned DynGAN. Clients can then use the generator in the fine-tuned DynGAN. Generate the synthetic trajectory, represented as , Enhanced trajectories are obtained by concatenating with a real local dataset on the client. , = ; use All clients perform local training, and all clients upload the locally trained model parameters to the server. Define the trajectory dataset for the mobile recommendation system as follows: ,in Representing the Trajectory data of individual users; among which... Represents user ID, Represents the access location ID. It's a timestamp. Represent the geographical location of the trajectory points; define a multi-objective function. As shown in (1), (1) Here, Representing the goal of privacy protection, This represents the goal of improving the performance of the federated model; S3: The server receives the model parameters, aggregates and updates the global model, and broadcasts the updated global model back to all clients; The Particle Swarm Optimization (PSO) algorithm is used as the dynamic optimal weight strategy. Particles are initialized in the PSO algorithm, where each particle represents a weight strategy. After iteration of the PSO algorithm, the optimal particle swarm obtained represents the best aggregate weight allocation in each iteration. The server will use formula (13) to obtain a metric that measures the training performance of the client in each iteration. In formula (13), Representing the Quality metrics for each client, and , , and Indicates to be assigned to the first The weights for client-side validation accuracy, sample entropy, data volume, and loss are: , , and They represent the first Validation accuracy, sample entropy, data volume, and loss for each client; Initialize a particle swarm, where each particle represents a weighting strategy; Assume there is Each particle represents In the dimensional search space The first solution, the... The position of each particle is represented as , No. The velocity of each particle is expressed as ;No. The optimal position found by each particle is represented as The optimal position found by the particle swarm is represented as ;No. The fitness value of the optimal position found by a particle is represented as " "Individual historical best fitness value", the fitness value of the best position found by the particle swarm is represented as " "Population's historical best fitness value"; In each iteration, the particle updates its velocity according to formula (14), which represents the particle's velocity in the next iteration; Formulas (14) and (15) contain the following parameters: Indicates particle index, Represents iteration count, It is inertial weight. It is an individual learning factor. It is a group learning factor; and It is a random number within the interval [0,1], designed to introduce randomness into the search; and They represent the first Second and third In the next iteration, particles In the Dimensional speed, and They represent the first Second and third In the next iteration, particles In the The position of the dimension; Represents particles In the In the nth iteration The best position in the history of a particle is the optimal particle, and Indicates the particle swarm in the th In the nth iteration The historical best position of a dimension is the optimal particle swarm. S4: Determine if the preset number of training iterations has been reached. If not, return to S1; otherwise, all clients have completed training.

2. The dynamic federated learning method for privacy protection in mobile recommendation systems as described in claim 1, characterized in that: The step in S1 to obtain a new dataset that conforms to the dynamic environment through dynamic data partitioning includes: definition: Indicates the total number of iterations. Indicates the number of clients. Indicates the first The number of data values ​​on each client. This represents the number of trajectories on the i-th client. Indicates the first Number of trajectory points on each client ) indicates that the mean is µ and the variance is µ. The normal distribution; In the initial phase, the initial dataset is distributed to each client, i.e. = , = , = For each iteration round Upon reaching T, perform the following steps: Incremental data generation: Up to n, the increase in the amount of data generated Increment in the number of trajectories Increment of trajectory points ,in , and These represent the mean number of data values, the mean number of trajectories, and the mean number of trajectory points for each client that are normally distributed. , and The variance parameters represent the number of data values ​​per client, the number of trajectories, and the number of trajectory points; Data merging: This involves concatenating the newly generated data with the original data on each client to obtain a new dataset for each client. , , + .

3. The dynamic federated learning method for privacy protection in mobile recommendation systems as described in claim 2, characterized in that: The steps of using DynGAN pre-training in S1 include: The server pre-trains DynGAN using an unencrypted public dataset. This pre-training includes a pre-trained generator. and pre-trained discriminator ; The sequence generation problem is described as follows: Given a dataset containing real-world trajectory sequences, train a sequence generator parameterized by θ. , Generate a sequence ,in ,in It is a vocabulary of candidate tags; training a... Parameterized , To identify The authenticity of the generated forged sequence, ( ) is a representation of a sequence The probability of whether it comes from real sequence data; By using positive examples from a dataset that includes real-world trajectory sequences and The negative examples of the generated synthetic sequences are used for training, during the adversarial training process between the generator and the discriminator. Continuously maximize expected reward, as shown in formula (2); in It is the objective function. Represents a given initial state and parameters The reward received after completing a sequence Expected value Represents a given initial state , by parameters Defined generator Generate output The probability of; This represents the sequence from the beginning to time T-1. This represents N sequences from 1 to N, where each sequence runs from time 1 to T. ( , ) is the action-value function of the sequence. The estimate of (s,a) is obtained using the Reinforce algorithm, which starts from state s and takes actions... ; Use a rolling strategy Conduct a Monte Carlo search to explore the unknown final... Sample each marker; The Monte Carlo search is represented as (4), The training objective is shown in formula (5): As the probability of determining the true data increases It will decrease; similarly, as the probability of generating data decreases, It will also decrease; then, Backward training is performed based on the loss function; When the predetermined number of training sessions is reached, and After pre-training, the pre-trained DynGAN is obtained.

4. The dynamic federated learning method for privacy protection in mobile recommendation systems as described in claim 3, characterized in that: The steps of the dynamic optimal weight strategy in S3 include: Data distribution is measured by the distance between two vector sequences, i.e., the sample entropy. A series of vector sequences are constructed using indices. Each vector ,in , indicating from the first Starting from a point, a continuous indivual A sequence of values; then, define a vector. and Distance between Let be the absolute value of the maximum difference between corresponding elements of the two vectors, as shown in equation (6); For a given ,calculate quantity ,in , making and The distance between them is less than or equal to r, for ,definition and See formulas (7) and (8), then increase the dimension to m+1; calculate and (1 ≤ ≤ N − m, The number of pairs of numbers whose distance is less than or equal to r ; definition and See formulas (9) and (10): so, Indicates the similarity threshold Below, matching in the two sequences The probability of a point, This indicates a match between two sequences. The probability of a point; For a single Sequence, when considering At a consecutive number of points, at the threshold The ratio of the number of similarity matches to Nm-1. When adding an additional trajectory point, consider At a certain point, at the threshold The probability of similarity matching; the definition of sample entropy is as shown in formula (11).