Adaptive aggregation federated learning method and device based on interlayer difference
By adopting an adaptive aggregation federated learning method based on inter-layer differences in the Internet of Vehicles, dynamically adjusting the aggregation weight of the client, the problems of unstable model performance and low computational efficiency in the Internet of Vehicles scenarios are solved, and the cross-domain generalization ability and training efficiency of the global model are improved.
Patent Information
- Application Number
- CN202510400785.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-04-01
AI Technical Summary
In the Internet of Vehicles scenario, traditional federated learning methods are difficult to build a global model with strong generalization capabilities, especially in unknown fields, which leads to unstable model performance, low computing efficiency, low resource utilization efficiency, and insufficient training delay and insufficient generalization of the model.
Adaptive aggregation federated learning method based on inter-layer differences is adopted to disassemble the model into a layer, and dynamically adjust the aggregation weights of each client by calculating the L2 norm difference value between the global and local model layers to improve the cross-domain generalization ability of the global model.
It improves the cross-domain generalization ability of the global model, reduces the risk of model overfitting, improves training efficiency, and adapts to the problems of data heterogeneity and computing resource heterogeneity in the Internet of Vehicles.
Smart Images

Figure CN119918620A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine learning for Internet of Vehicles, and in particular to an adaptive aggregation federated learning method and device based on inter-layer differences. Background Art
[0002] In the application scenarios of the Internet of Vehicles, the processing of multi-source heterogeneous data faces severe challenges. The data collected by vehicle terminals comes from complex dynamic environments such as urban roads, highways, and rural roads, which makes it difficult for the model to maintain stable performance between different domains. Especially when the model is migrated to an unknown field, traditional federated learning methods are difficult to build a global model with strong generalization capabilities, which seriously affects the actual deployment effect.
[0003] Although the federated domain generalization method can improve the adaptability of the model, it still has significant defects: (1) Computational efficiency bottleneck: Existing solutions mostly use implicit distribution alignment, reinforcement learning strategies or pseudo-label generation mechanisms. Although such methods can improve the generalization of the model, they consume a lot of computing resources and cannot meet the real-time requirements of the Internet of Vehicles scenario; (2) Insufficient adaptability to heterogeneous environments: Some methods reduce communication overhead through gradient transmission or fairness regularization, but do not fully consider the differences in client data distribution and sample size heterogeneity. The non-independent and identically distributed (Non-IID) characteristics of terminal devices in the Internet of Vehicles are particularly prominent; (3) Lack of dynamic resource adaptation: Although existing dynamic weight aggregation schemes can adjust client weights through model difference evaluation, they generally ignore the differences in computing power of terminal devices. The devices participating in the Internet of Vehicles generally have significant heterogeneity in computing power and hardware resources.
[0004] For example, the invention patent with announcement number: CN113313264B announces an efficient federated learning method in the vehicle networking scenario, including: step 1: the roadside unit obtains a set of alternative learning tasks; step 2: selects a training task; step 3: establishes initial model parameters, and sends the training task and its network address to vehicles within the coverage area; step 4: each vehicle parses the task information of the training task, and then decides whether to participate in the training process; if participating, it establishes a communication connection with the roadside unit through the network address; step 5: sends the initial model parameters to each vehicle; step 6: each vehicle uses local data to perform local training on the current model parameters, and uploads them to the roadside unit; step 7: once a local training model uploaded by a vehicle is received, its weight is calculated in real time, and it is weighted and aggregated into the global model in real time, and the current model parameters are generated and returned to each vehicle in real time; step 8: iteratively execute steps 6 to 7 until the set number of iterations is met.
[0005] For example, the invention patent with announcement number: CN113657606B announces a local federated learning method of pressure distribution aggregation in a vehicle networking scenario, including: step 1: establishing communication between multiple roadside units to form a local area network, and selecting a roadside unit from the multiple roadside units as an agent leader; step 2: the agent leader selects a training task, establishes an initial model state of the training task, and broadcasts the training task to vehicles in a dense area; step 3: vehicles participating in the training task use local data to perform local training on the current model state of the received training task, and upload the local training model to the nearest roadside unit; step 4: each roadside unit receives the local training model of the vehicle respectively and averages and aggregates it, and feeds back the aggregated current model state to the corresponding vehicle; step 5: iteratively execute steps 3 to 4 until the aggregated current model state meets the requirements.
[0006] However, in the process of implementing the technical solution of the invention in the embodiments of the present application, the present application found that the above technology has at least the following technical problems: This method is applied in the Internet of Vehicles. Differences in vehicle trajectories and sensor types lead to multimodal data distribution. For example, urban road vehicle emergency braking data is dense, and high-speed vehicle uniform speed data is dominant. Traditional regularization forces the model to align global parameters and ignores the importance weights of local data features, causing the model to favor high-frequency data patterns such as urban vehicles and sacrifice the generalization of edge scenarios such as vehicles in mountainous areas. The static aggregation weights are disconnected from the dynamic computing power, and a dynamic adaptation mechanism with the computing power of the device has not been established. This can easily lead to increased training delays and inefficient resource utilization in Internet of Vehicles scenarios. Vehicle mobility leads to unstable connections. When vehicles enter and exit the coverage of base stations, traditional synchronous federated learning requires vehicles to repeatedly wait for timeouts due to dropped nodes such as 5G signal loss. This leads to insufficient versatility of the adaptive aggregation federated learning method model. Summary of the invention
[0007] The embodiments of the present application provide an adaptive aggregation federated learning method and device based on inter-layer differences, thereby solving the problem of insufficient versatility of the adaptive aggregation federated learning method model in the prior art and improving the cross-domain generalization capability of the global model.
[0008] The embodiment of the present application provides an adaptive aggregation federated learning method based on inter-layer differences, comprising the following steps: collecting and processing vehicle terminal data; each client receives a global model sent from a server, uses the vehicle terminal data to perform local model training, and obtains new local model parameters by iterative optimization and minimization of the loss function; collects new local model parameters, decomposes the local model and the global model into a multi-layer structure, and stores them by layer classification; calculates the L2 norm difference value between each client model layer and the corresponding layer of the global model, and quantifies the inter-layer difference; based on the training sample size of each client and the calculated inter-layer difference value, obtains the weight of each client model parameter in the aggregation process through a weight iterative calculation method including a linear attenuation hyperparameter; independently aggregates the model parameters of each client by layer, and splices the aggregated parameters of each layer to form a new global model, and performs a federated learning training cycle.
[0009] Furthermore, the specific steps of collecting and processing vehicle terminal data are: collecting vehicle terminal raw data through vehicle networking terminal equipment; cleaning and denoising the vehicle terminal raw data to obtain vehicle terminal data.
[0010] Furthermore, the specific steps for obtaining new parameters of the local model are: the client uses the vehicle terminal data to train the global model to obtain local model parameters; the client adjusts the local model parameters through an iterative optimization algorithm, calculates the loss function according to the vehicle terminal data, and uses the gradient of the loss function to update the local model parameters to obtain new local model parameters; the client uploads the new local model parameters to the server for updating the global model.
[0011] Furthermore, the specific steps of decomposing the local model and the global model into a multi-layer structure and storing them by layer classification are as follows: the server collects new local model parameters from each client, decomposes the collected new local model parameters and global model parameters into multiple levels respectively; collects the same-level parameters of different clients into the same set, decomposes the global model into the same hierarchical structure as the local model, and adds each level to the corresponding set.
[0012] Furthermore, the specific steps of calculating the L2 norm difference value between each client model layer and the corresponding layer of the global model and quantifying the difference between layers are as follows: the server obtains a parameter set corresponding to each layer from the model parameters stored by layer classification; each set contains the corresponding layer parameters of all clients and the corresponding layer parameters of the global model; for each layer, the L2 norm difference value between the global model layer parameters and the model layer parameters of each client is calculated, and the L2 norm difference value is an indicator to measure the distance between vectors, which quantifies the degree of difference between two vectors.
[0013] Furthermore, the specific steps of obtaining the weight of each client model parameter in the aggregation process are: obtaining the initial weight based on the ratio of the number of training samples of each client to the total number of samples; averaging the initial weight and the L2 norm difference value to obtain the weight of each client model parameter in the aggregation process.
[0014] Furthermore, the specific steps of independently aggregating the model parameters of each client by layer and concatenating the aggregated parameters of each layer to form a new global model are: selecting the model parameters of the corresponding layers of all clients; for the model parameters of the corresponding layers of each client, averaging the weights of the model parameters of each client in the aggregation process to obtain the model parameters of each client independently aggregated by layer; and concatenating all the model parameters of each client independently aggregated by layer to form a global model.
[0015] Furthermore, the specific steps of the method for performing a federated learning training cycle are: the server sends the global model to the client for local training; the client uploads the trained model to the server; the server splices the models to form a new global model; the server sends the new global model to the client for the next round of training.
[0016] Furthermore, the method for performing a federated learning training cycle also includes: if the global model performs federated learning training and reaches a preset convergence condition, the server will send a convergence signal to the client, instructing the client to stop the current training round; if the global model performs federated learning training and does not reach the preset convergence condition, the server will send a non-convergence signal to the client, instructing the client to continue with the next round of training.
[0017] An embodiment of the present application provides a terminal device, characterized in that it includes: one or more processors, and the multiple processors include: a local client, used to perform model training when local resources are sufficient, and upload the trained local model to the server; a central cloud server, used to receive client models and send the trained models to each client; a memory, on which one or more programs are stored, when the one or more programs are executed by the one or more processors, the one or more processors implement the adaptive aggregation federated learning method and device based on inter-layer differences.
[0018] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By breaking down the model into layers and incorporating the differences between global and local model layers into the calculation of aggregation weights, the contribution of different clients in high data heterogeneity scenarios is measured. At the same time, a regularization term based on inter-layer differences is introduced to dynamically adjust the aggregation weight of each client in each round according to the inter-layer differences, thereby improving the cross-domain generalization ability of the global model; 2. By incorporating the differences between the global and local model layers into the calculation process of the aggregation weights, the federated learning training cycle can prevent the model parameters of some clients from having too much influence on the global model, thereby reducing the risk of model overfitting and allocating more computing resources to clients that differ greatly from the global model, thereby improving training efficiency; 3. By introducing regularization terms based on inter-layer differences during the aggregation process, the aggregation weights of each domain are dynamically adjusted, thereby enabling the global model to learn more universal features. The global model is decomposed into multiple levels, and aggregation is performed separately at each level. Inter-layer differences are introduced in the weight calculation process to solve the problem of data heterogeneity in the Internet of Vehicles. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flow chart of an adaptive aggregation federated learning method based on inter-layer differences provided in an embodiment of the present application; Figure 2 A schematic diagram of a federated learning framework based on inter-layer differences provided in an embodiment of the present application; Figure 3 A schematic diagram showing visual differences between client data sets provided in an embodiment of the present application; Figure 4 A schematic diagram showing heterogeneous data distribution between client data sets provided in an embodiment of the present application; Figure 5 A schematic diagram showing the comparison of feature distributions learned on a PACS dataset using different methods provided in the embodiments of the present application; Figure 6 A schematic diagram of the comparison results of combining FLLG with the domain generalization method provided in the embodiment of the present application; Figure 7 A schematic diagram of the comparison results of combining FLLG with the federated learning algorithm provided in the embodiment of the present application; Figure 8 A schematic diagram showing the effect of the number of clients on the FLLG module provided in the embodiment of the present application; Fig. 9 A schematic diagram showing the effect of heterogeneity of different data sets on the FLLG module provided in the embodiments of the present application; Fig.10 A schematic diagram of the impact of different local round numbers on the FLLG module provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The embodiment of the present application solves the problem of insufficient versatility of the adaptive aggregated federated learning method model in the prior art by providing an adaptive aggregated federated learning method and device based on inter-layer differences. The model is decomposed into layers, and the differences between the global and local model layers are included in the calculation process of the aggregation weight to measure the contribution of different clients in high data heterogeneity scenarios. At the same time, a regularization term based on inter-layer differences is introduced to dynamically adjust the aggregation weight of each client in each round according to the inter-layer differences, thereby improving the cross-domain generalization ability of the global model.
[0021] The technical solution in the embodiment of the present application is to solve the above-mentioned problem that the adaptive aggregation federated learning method model is not versatile enough. The overall idea is as follows: By breaking down the model into layers and incorporating the differences between global and local model layers into the calculation of aggregation weights, we can measure the contributions of different clients in scenarios with high data heterogeneity. At the same time, we introduce regularization terms based on inter-layer differences to dynamically adjust the aggregation weights of each client in each round according to the inter-layer differences, thereby improving the cross-domain generalization capability of the global model.
[0022] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0023] like Figure 1 As shown, it is a flow chart of an adaptive aggregation federated learning method based on inter-layer differences provided in an embodiment of the present application, and the method includes the following steps: collecting and processing vehicle terminal data; each client receives the global model sent from the server, uses the vehicle terminal data to perform local model training, and obtains new local model parameters by iterative optimization and minimizing the loss function; collects new local model parameters, decomposes the local model and the global model into a multi-layer structure, and stores them by layer classification; calculates the L2 norm difference value between each client model layer and the corresponding layer of the global model, and quantifies the inter-layer difference; based on the training sample size of each client and the calculated inter-layer difference value, obtains the weight of each client model parameter in the aggregation process through a weight iterative calculation method including a linear attenuation hyperparameter; independently aggregates the model parameters of each client by layer, and splices the aggregated parameters of each layer to form a new global model, and performs a federated learning training cycle.
[0024] In this embodiment, by refining the aggregation process of the global model, it is extended from a single model aggregation to the aggregation of a single model layer or a neural network layer. Through the independent aggregation method based on the model layer, it can be adjusted more flexibly according to the performance and importance of each layer. At the same time, in the aggregation process, the difference between the global model layer and the client model layer is included in the weight calculation to effectively deal with the high heterogeneity of the client data set. At the same time, a dynamic weight adjustment mechanism based on inter-layer differences is proposed. By measuring the inter-layer differences between each client and the global model, the weight is dynamically adjusted according to the size of the difference based on the amount of client training data, thereby solving the problem of cross-domain generalization of models in federated learning of Internet of Vehicles; Figure 2 As shown in the figure, a federated learning framework is shown, which consists of a central server and multiple local models. Global model optimization is achieved through collaborative training. The server side (central coordination node) is responsible for global model aggregation and integrates parameter updates from local models through weighted summation. On the local model side (edge device), each device (such as mobile phones, sensors) uses local data to train independent models, uploads the trained model parameters (rather than the original data) to the server, obtains the updated global model parameters from the server, and the device performs local training (such as gradient descent) based on the current global model, uploads the local model parameters to the server, and the server calculates the new global model after weighted averaging. The updated model is distributed to each device to start the next round of training. The global model is a unified model maintained by the server, which is used to coordinate the training direction of each local model. The local model is an independent model on the edge device, which adapts to the local data distribution (such as device heterogeneity). , , are the weight coefficients of different local models.
[0025] Furthermore, the specific steps of collecting and processing vehicle terminal data are: collecting vehicle terminal raw data through the Internet of Vehicles terminal device; cleaning and denoising the vehicle terminal raw data to obtain vehicle terminal data.
[0026] In this embodiment, the Internet of Vehicles terminal device includes real-time collection of road images, location information and environmental data through on-board cameras, LiDAR, GPS and other sensors. The collected vehicle terminal raw data includes structured data such as vehicle speed, GPS coordinates and unstructured data such as images and point clouds.
[0027] Furthermore, the specific steps for obtaining new parameters of the local model are: the client uses the vehicle terminal data to train the global model to obtain local model parameters; the client adjusts the local model parameters through an iterative optimization algorithm, calculates the loss function according to the vehicle terminal data, and uses the gradient of the loss function to update the local model parameters to obtain new local model parameters; the client uploads the new local model parameters to the server for updating the global model.
[0028] In this embodiment, the client receives the latest global model parameters issued by the server. These parameters are model parameters obtained by training all clients together, and represent the best fit of the current model to the overall data. The client uses vehicle terminal data to train the local model. The vehicle terminal data reflects the characteristics of the environment in which the client is located, such as road conditions, traffic signs, etc. The client continuously adjusts the model parameters through an iterative optimization algorithm, such as a gradient descent algorithm. Each iteration calculates the loss function based on the local data and uses the gradient of the loss function to update the model parameters. The goal of the client is to find a set of model parameters that minimizes the loss function of the model on the local data, which means that the model can better predict local data and more accurately reflect the characteristics of the environment in which the client is located. After multiple iterative optimizations, a set of new local model parameters are obtained. These parameters reflect the contribution of the client to the global model and include information about the environment in which the client is located. The new local model parameters are uploaded to the server for updating the global model.
[0029] Specifically, in federated learning, To refer to each client, where represents the training sample of each client, where Represents the number of clients selected for training, Represents the training samples of all clients. There are many sample pairs in represents a sample pair, where represents the characteristics of the sample, Represents the label value of the sample. Each client uses the dataset to train a local model ,in .
[0030] First, let different clients train the model based on the vehicle terminal data. During the local training phase, the client When receiving a new round of global models, use the vehicle terminal data Train a local model, The optimization goal is: ; in, represents the optimization goal of the client, is the loss function of the sample, used to measure the model predict and The error between represents the parameters of the model, Indicated in the dataset In local training, each client performs optimization independently, making the local model optimal for its specific data distribution.
[0031] Furthermore, the local model and the global model are decomposed into a multi-layer structure. The specific steps of storing them by layer classification are as follows: the server collects new local model parameters from each client, decomposes the collected new local model parameters and global model parameters into multiple levels respectively; collects the same-level parameters of different clients into the same set, decomposes the global model into the same hierarchical structure as the local model, and adds each level to the corresponding set.
[0032] In this embodiment, the server decomposes the collected local model parameters and global model parameters into multiple levels, each of which represents a module or layer in the model, such as a convolutional layer, a fully connected layer, etc., and collects the same-level parameters of different clients into the same set. To facilitate subsequent inter-layer difference calculation and inter-layer aggregation, the server creates multiple sets, each of which corresponds to a level in the model, and the server adds the corresponding level parameters of each client to the corresponding set.
[0033] Specifically, the collected local models Disassembled into I layer, expressed as , and collect the same model layer of different clients into the same collection, represented as Then the global model Disassembled into , and add each layer of the global model to the corresponding set.
[0034] Furthermore, the L2 norm difference value between each client model layer and the corresponding layer of the global model is calculated. The specific steps for quantifying the difference between layers are as follows: the server obtains the parameter set corresponding to each layer from the model parameters stored by layer classification; each set contains the corresponding layer parameters of all clients and the corresponding layer parameters of the global model; for each layer, the L2 norm difference value between the global model layer parameters and the model layer parameters of each client is calculated. The L2 norm difference value is an indicator to measure the distance between vectors, which quantifies the degree of difference between two vectors.
[0035] In this embodiment, the steps of calculating the L2 norm difference value between the global model layer parameters and each client model layer parameters are: ; in, Indicates Client Model The difference between the layer and the corresponding layer of the global model, Represents the global model layer, Indicates Client Model layer, Representing a difference metric function such as the L2 norm, the L2 norm is selected as the difference metric function. The inter-layer difference reflects the feature difference between the client model layer and the corresponding layer of the global model. The larger the difference, the smaller the contribution of the client model layer to the global model.
[0036] Furthermore, the specific steps for obtaining the weight of each client model parameter in the aggregation process are: obtaining the initial weight according to the ratio of the number of training samples of each client to the total number of samples; averaging the initial weight and the L2 norm difference value to obtain the weight of each client model parameter in the aggregation process.
[0037] In this embodiment, the initial weight is calculated using the ratio of the number of client training samples to the total number of samples, that is: ;in, Indicates Round Client Model The initial weights of the layers, Represents the client The number of training samples, Represents the total number of training samples of all clients; like Figure 3 As shown in Figure 2, the training data comes from different domains, such as highlight, blur, dim, etc., while the test data comes from the blank domain. Due to the large visual differences between domains, it is difficult for a single model to perform well on all domains. Specifically, according to Figure 4This is a feature distribution diagram of four clients divided from the German traffic sign recognition dataset GTSRB, where points of different colors represent different data categories contained in the client. By observation, it can be found that the data categories of each client are obviously different. Not only are the data categories different, but the number of samples in each category is also unbalanced. This phenomenon clearly shows that there are significant distribution differences between client data, that is, high heterogeneity, which leads to model offset between the trained local model and the global model. This offset makes the local model of each client and the global model significantly different. When aggregating these models, it is difficult for the global model to achieve good accuracy on each client. Traditional federated learning only considers the proportion of the training data set in the calculation process of aggregation weights. This calculation method is difficult to maintain good accuracy when the data set is highly heterogeneous. How to improve the performance of the overall system by changing the aggregation strategy is the second problem we want to solve. To this end, a regularization term based on inter-layer differences is introduced to dynamically adjust the aggregation weights of each client according to the differences, guiding the global model to better capture the same features in each domain. Through this method, the model can effectively reduce inter-domain deviations when dealing with different data distributions and improve the generalization ability of the global model.
[0038] For general federated learning, the global optimization goal is: ; in represents the global model, Represents the client The optimization goal is , represents the aggregate weight calculated by the number of training samples of each client. Relying on the data size of each client's training samples to allocate weights will ignore the differences in data distribution between clients, which will have an adverse effect on the accuracy and generalization ability of the model. Therefore, based on the inter-layer differences calculated above and the number of client training samples, a new global optimization goal is proposed for FedAvg: ; in is the aggregation weight obtained by combining the inter-layer differences and the number of training samples. In the first round, since the global model has not been trained, the inter-layer differences are not considered, and the aggregation weight ; Starting from the second round, global aggregation takes into account the differences between the client model layer and the global model layer, and implements dynamic weight aggregation. Each model layer has its own aggregation weight, which is expressed as: ; ; in, represents the current training round, represents the expected difference between the parameters of each layer, Indicates Round The first client model The layer calculates the intermediate value of the aggregation weight, express The aggregate weight of the round, is a hyperparameter. It becomes stable as the number of training rounds increases, due to the fixed The size of will cause the model loss to continue to oscillate in the later stage of training and make it difficult to converge. Therefore, a linear attenuation strategy is used to stabilize the training. The value range is limited to In addition, add a The index of It should decrease as the number of training rounds increases.
[0039] Furthermore, the specific steps of independently aggregating the model parameters of each client by layer and concatenating the aggregated parameters of each layer to form a new global model are: selecting the model parameters of the corresponding layers of all clients; for the model parameters of the corresponding layers of each client, averaging the weights of the model parameters of each client in the aggregation process to obtain the model parameters of each client independently aggregated by layer; concatenating all the model parameters of each client independently aggregated by layer to form a global model.
[0040] In this embodiment, the formula for obtaining the model parameters for independently aggregating each client by layer is: ; in, Represents the first Layer model parameters, Indicates the number of clients. Indicates The first client model The aggregate weights of the layer model parameters, Indicates The first client model Layer model parameters; then perform global model aggregation , Indicates the operation of model concatenation. After the model aggregation is completed, the server sends the global model to each client to start a new round of training.
[0041] Furthermore, the specific steps of the method for performing a federated learning training cycle are: the server sends the global model to the client for local training; the client uploads the trained model to the server; the server splices the models to form a new global model; the server sends the new global model to the client for the next round of training.
[0042] Furthermore, the method for performing a federated learning training cycle also includes: if the global model performs federated learning training and reaches a preset convergence condition, the server will send a convergence signal to the client, instructing the client to stop the current training round; if the global model performs federated learning training and does not reach the preset convergence condition, the server will send a non-convergence signal to the client, instructing the client to continue with the next round of training.
[0043] An embodiment of the present application provides a terminal device, characterized in that it includes: one or more processors, and the multiple processors include: a local client, used to perform model training when local resources are sufficient, and upload the trained local model to the server; a central cloud server, used to receive client models and send the trained models to each client; a memory, on which one or more programs are stored, when the one or more programs are executed by the one or more processors, the one or more processors implement an adaptive aggregation federated learning method based on inter-layer differences.
[0044] In this embodiment, in the scenario of heterogeneous federated learning data, in the cross-domain generalization scenario, a leave-one-domain evaluation is performed on all benchmark datasets, that is, one domain is selected as the unseen client in turn, and the remaining domains are used as the source clients for training. The learning rate of each client is 0.001, the batch size is 16, the number of epochs for local training is 5, and a total of 40 rounds of training are used. A variant of ResNet
[52] , ResNet-18, is used as the training model for cross-domain generalization. The model consists of a convolutional layer, a fully connected layer, and 4 residual blocks composed of 2 basic residual units.
[0045] FLLG is compared with the most advanced algorithms in two scenarios, demonstrating the performance and modularity of FLLG and exploring the broader application scope of FLLG.
[0046] Table 1 Accuracy and loss of different federated learning methods on three datasets:
[0047] Table 1 shows the accuracy and loss performance of different federated learning methods on three datasets in the scenario of heterogeneous federated learning data. The performance of each method on different datasets is quantified into two indicators: the accuracy represents the classification performance of the model, and the loss reflects the convergence of the model. Table 1 shows that FLLG outperforms other federated learning methods on the three datasets, showing excellent generalization and robustness. On the MNIST dataset, FLLG's accuracy reaches 94.09%, which is 1.43% higher than FedAvg, and the loss value is significantly reduced. On the F-MNIST and GTSRB datasets, FLLG also maintains its lead, especially on GTSRB, with an accuracy of 95.38%, which verifies its robustness and efficiency in scenarios with high data heterogeneity. The experimental results clearly show that FLLG has obvious advantages in processing heterogeneous distribution data, which not only improves the classification accuracy, but also significantly reduces the loss value, which is better than the current mainstream federated learning methods, and verifies the effectiveness of FLLG's modular design and inter-layer difference perception strategy.
[0048] Table 2 shows the performance comparison of FLLG in the cross-domain generalization scenario with the relatively new algorithm FedDG and the more commonly used algorithms AM and RSC in the field of domain generalization. The evaluation criteria are the accuracy of the trained model in the unknown domain. The four columns in the table (such as P, A, C, R or S) represent different fields, and the last column (Avg) is the average performance of the method in each field.
[0049] Table 2 Performance comparison of FLLG and other domain generalization methods:
[0050] The P domain is uniformly selected as the test domain. From the table, it can be seen that the test accuracy of FLLG on the test domain of the two datasets is 1.75% higher than the accuracy of the other three methods on average, indicating that FLLG has stronger performance in cross-domain generalization tasks. The average accuracy of FLLG on both datasets is 1.4% higher than that of the other three methods, indicating that FLLG has stronger robustness and cross-domain adaptability. Figure 5 Comparison of feature distributions learned by different methods on the PACS dataset. FLLG is more discriminative than other methods and generates semantic feature representations with clear classes and compact domains.
[0051] Since FLLG only improves the aggregation strategy of the model and does not intervene in the training process, this design gives FLLG strong modularity and adaptability, allowing it to be flexibly embedded in the existing federated learning framework, thereby further improving the performance of the algorithm. To verify its effectiveness, FLLG was combined with a variety of federated learning algorithms (such as FedProx, FedBN, Ditto, and FedDBE) and commonly used domain generalization methods (AM and RSC), and the performance differences with and without the addition of the FLLG module were compared. Figure 6 is the comparison result of FLLG combined with domain generalization method, Figure 7 The comparison results of FLLG combined with the federated learning algorithm. In an environment with highly heterogeneous data, FLLG significantly improves the performance of existing algorithms. The accuracy of the model after adding FLLG is generally improved by 3%-8% compared with the model without adding FLLG.
[0052] Figure 8 shows the percentage of accuracy improvement brought by the FLLG module on the four federated learning methods when the number of clients is 10, 30, and 50 on the three datasets. The average accuracy improvement brought by FLLG on the three datasets is 1.22%, 2%, and 0.7%. When the number of clients is small, the accuracy improvement brought by the FLLG module is the best on the FMNIST dataset. As the number of clients increases to 30, the performance gain of the FLLG module on the MNIST and GTSRB datasets reaches its peak. When the number of clients further increases to 50, although it can still bring gains, the accuracy improvement is reduced, which may be because the increase in clients causes more noise interference when the global model is aggregated. The FLLG module can adapt well to changes in the number of clients, especially when the number of clients is medium.
[0053] Fig. 9 The impact of different data set heterogeneity levels on the performance improvement brought by the FLLG module is discussed. From the figure, it can be seen that the smaller the heterogeneity level is on the three data sets, the higher the heterogeneity is, and the higher the accuracy improvement brought by FLLG is, and the average accuracy improvement on the three data sets is 0.5%, 4.05%, and 1.08%. This is because FLLG adopts a hierarchical aggregation method, and the high-level model is more sensitive to data features. The separate allocation of aggregation weights can help the global model perceive the common characteristics of each non-independent and identically distributed data set; at the same time, FLLG performs adaptive weight adjustment according to the differences between layers, which improves the generalization ability of the model while reducing the impact of non-independent and identically distributed data.
[0054] Fig.10The effect of different local training rounds on the performance gain of FLLG is shown. The average accuracy improvement of the four methods plus FLLG on the three data sets is calculated to be 1.21%, 3.82%, and 0.45%. As can be seen from the cross-domain graph, as the number of local rounds increases, the performance gain brought by FLLG first increases and then decreases, but it can still bring stable performance gain. This is because as the number of local training rounds increases, the trained local model is more likely to overfit, which will reduce the performance of each method.
[0055] Table 3 Effect of different number of domains on the performance gain of FLLG:
[0056] Table 3 shows the effect of different numbers of domains on the performance gain of FLLG under two datasets. Since FLLG is a federated domain generalization method, when the number of domains in the dataset is small, FLLG fails to significantly improve performance compared to traditional methods. This is because when the number of domains is small, the training and aggregation processes of the model can be relatively balanced, and the model differences between each client are small, so the traditional method can already achieve good performance. However, as the number of domains gradually increases, the advantages of FLLG gradually emerge, and it can effectively cope with the differences between different domains, thereby significantly improving the performance of the global model. This shows that the FLLG method can better play its advantages and enhance the generalization ability of the model when facing scenarios with higher heterogeneity.
[0057] Table 4 Ablation experiment:
[0058] Table 4 shows the ablation experiment, where FLLG-2 means that the regularization term based on inter-layer differences is removed and inter-layer differences are not considered when calculating the aggregate weights, and FLLG-1 means that the regularization term based on inter-layer differences is removed. Since the inter-layer differences are the calculation conditions of the regularization term, the regularization term is not considered, and the inter-layer differences are not considered when calculating the weights. As can be seen from the table, whether in the scenario of federated learning or domain generalization, the complete FLLG method shows the best performance, indicating that inter-layer differences play a key role in the calculation of aggregate weights and regularization, and effectively improve the performance of the model in heterogeneous data and cross-domain environments.
[0059] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0060] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0061] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0062] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0063] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0064] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. An adaptive aggregation federated learning method based on inter-layer differences, characterized in that: The following steps are involved: Collect and process vehicle terminal data; Each client receives the global model sent from the server, uses the vehicle terminal data to train the local model, and obtains new parameters of the local model by iteratively optimizing and minimizing the loss function; Collect new parameters of the local model, decompose the local model and the global model into a multi-layer structure, and store them by layer; Calculate the L2 norm difference between each client model layer and the corresponding layer of the global model to quantify the difference between layers; Based on the training sample size of each client and the calculated inter-layer difference value, the weight of each client model parameter in the aggregation process is obtained through a weight iterative calculation method including a linear decay hyperparameter; The model parameters of each client are aggregated independently by layer, and the aggregated parameters of each layer are spliced to form a new global model for a federated learning training cycle.
2. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The specific steps of collecting and processing vehicle terminal data are as follows: Collect vehicle terminal raw data through Internet of Vehicles terminal equipment; The original data of the vehicle terminal is cleaned and denoised to obtain the vehicle terminal data.
3. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The specific steps of obtaining the new parameters of the local model are: The client uses the vehicle terminal data to train the global model and obtain the local model parameters; The client adjusts the local model parameters through an iterative optimization algorithm, calculates the loss function based on the vehicle terminal data, and uses the gradient of the loss function to update the local model parameters to obtain new local model parameters; The client uploads the new parameters of the local model to the server to update the global model.
4. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The specific steps of decomposing the local model and the global model into a multi-layer structure and storing them by layer are as follows: The server collects new local model parameters from each client, and decomposes the collected new local model parameters and global model parameters into multiple levels. Collect the same-level parameters of different clients into the same set, decompose the global model into the same hierarchical structure as the local model, and add each level to the corresponding set.
5. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The specific steps of calculating the L2 norm difference value between each client model layer and the corresponding layer of the global model and quantifying the difference between layers are: The server obtains the parameter set corresponding to each layer from the model parameters stored by layer classification; Each set contains the corresponding level parameters of all clients and the corresponding level parameters of the global model; For each level, the L2 norm difference value between the global model layer parameters and each client model layer parameters is calculated. The L2 norm difference value is an indicator to measure the distance between vectors, quantifying the degree of difference between two vectors.
6. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The specific steps of obtaining the weight of each client model parameter in the aggregation process are: The initial weight is obtained based on the ratio of the number of training samples of each client to the total number of samples; The initial weight and the L2 norm difference value are averaged to obtain the weight of each client model parameter in the aggregation process.
7. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The specific steps of independently aggregating the model parameters of each client layer by layer and splicing the aggregated parameters of each layer to form a new global model are: Select the model parameters of the corresponding layers of all clients; For the model parameters of the corresponding layer of each client, average processing is performed according to the weight of each client model parameter in the aggregation process to obtain the model parameters of each client that are independently aggregated by layer; All model parameters of each client that are independently aggregated by layer are concatenated to form a global model.
8. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The specific steps of the method for performing a federated learning training cycle are: The server sends the global model to the client for local training; The client uploads the trained model to the server; The server performs model splicing to form a new global model; The server sends the new global model to the client for the next round of training.
9. The method for adaptive aggregation federated learning based on inter-layer differences as claimed in claim 1, characterized in that: The method for performing a federated learning training cycle further includes: If the global model reaches the preset convergence condition during federated learning training, the server will send a convergence signal to the client, instructing the client to stop the current training round; If the global model does not reach the preset convergence condition during federated learning training, the server will send a non-convergence signal to the client, instructing the client to continue with the next round of training.
10. A terminal device, characterized in that: include: One or more processors, the multiple processors include: a local client, used to perform model training when local resources are sufficient, and upload the trained local model to the server; a central cloud server, used to receive the client model, and send the trained model to each client; a memory, on which one or more programs are stored, when the one or more programs are executed by the one or more processors, the one or more processors implement an adaptive aggregation federated learning method based on inter-layer differences as described in any one of claims 1-9.
Citation Information
Patent Citations
Efficient Federated Learning Methods in the Internet of Vehicles Scenarios
CN113313264B
A local federated learning method with pressure distribution and aggregation in the Internet of Vehicles scenario
CN113657606B
Narrow-sense asynchronous personalized federated learning adaptive aggregation method
CN115796274A
Fair privacy calculation method based on federated node contribution
CN116306910A
Heterogeneous scene-oriented privacy protection personalized federal learning method and device
CN116579439A
Cited By
Federal learning-based model optimization method and device, and medium
CN121257783A
Global training method and local training method based on federal learning
CN121413711A