MEC system-oriented dynamic weighted sampling federated learning algorithm
Through the dynamic weighted sampling federated learning algorithm, the problems of data heterogeneity and device heterogeneity in the MEC system are solved, the model training efficiency and accuracy are improved, data transmission and calculation pressure are reduced, the system adaptability and scalability are enhanced, and real-time monitoring and optimization methods are provided.
Patent Information
- Application Number
- CN202510372563.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-07-25
AI Technical Summary
When MEC systems deal with data heterogeneity and equipment heterogeneity, existing centralized processing methods lead to difficult data integration, increased transmission delay and uneven resource allocation, which cannot meet the business needs of low latency and high reliability.
The dynamic weighted sampling federated learning algorithm for MEC systems is adopted to collect local data through IoT devices, preprocess and feature extraction, dynamically adjust the sampling strategy, use the federated learning framework for model training, and generate a global model through weighted average, dynamically adjust the number of iterations, analyze the global model parameters in real time and record the training process data.
It improves the efficiency and accuracy of model training, adapts to the needs of different scenarios, reduces data transmission bandwidth consumption and central server computing pressure, improves the scalability and robustness of the system, and provides comprehensive monitoring and optimization methods.
Smart Images

Figure CN120373494A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of edge computing, and particularly to a dynamic weighted sampling federated learning algorithm for MEC systems. Background Art
[0002] The MEC system, namely multi-access edge computing, is a cutting-edge network technology architecture that sinks computing, storage, and application service capabilities to the edge of the mobile network to provide ultra-low latency, high bandwidth, and localized services. In the MEC system, edge nodes are deployed close to users and can process and analyze data from terminals in real time, thus greatly reducing the latency of data transmission. At the same time, through efficient storage and computing capabilities, the MEC system can support diverse application scenarios, such as high-definition video live streaming, autonomous driving, and remote medical treatment, which have extremely high requirements for real-time performance and bandwidth. In addition, the MEC system also has high flexibility and scalability. Operators can deploy different applications and services on edge nodes according to actual needs to meet the diverse needs of users. At the same time, with the continuous evolution and popularization of 5G networks, the MEC system will further exert its advantages, promote the deep integration of the mobile Internet and the Internet of Things, and provide strong support for digital transformation.
[0003] To solve the problems of the MEC system in dealing with data heterogeneity and device heterogeneity, the existing technology mainly adopts the methods of centralized data processing and unified resource allocation. However, when facing heterogeneous data generated by large-scale and diverse edge devices, this method will also encounter problems such as difficult data integration, increased transmission latency, and uneven resource allocation. As a result, the system efficiency decreases and cannot meet the business requirements of low latency and high reliability. Specifically, data heterogeneity is reflected in the differences in data types, formats, and qualities, while device heterogeneity stems from the diversity of computing capabilities, storage spaces, and communication capabilities of different devices. These differences make it difficult for traditional centralized processing methods to effectively cope with them, and it is easy to cause problems such as data loss, processing delays, and resource waste. Therefore, in order to overcome these limitations, a dynamic weighted sampling federated learning algorithm for MEC systems is proposed. Summary of the Invention
[0004] The purpose of the present invention is to provide a dynamic weighted sampling federated learning algorithm for MEC systems to solve the problems mentioned in the above background art.
[0005] To solve the above technical problems, the technical solution adopted by the present invention is: A dynamic weighted sampling federated learning algorithm for MEC systems includes the following steps:
[0006] S1. Collect local data of terminal devices through Internet of Things devices;
[0007] S2. Preprocess and extract features from the locally collected data of the terminal device, and set the threshold for the size of the sample data volume;
[0008] S3. Through the dynamic weighted sampling algorithm, dynamically adjust the sampling strategy according to the size of the device sample data volume;
[0009] S4. Through the federated learning framework, use the stochastic gradient descent algorithm to train the model on the terminal device, and upload the trained model parameters to the central server;
[0010] S5. Through the weighted average algorithm, weight and aggregate the uploaded model parameters according to the size of the device sample data volume to generate a global model;
[0011] S6. Set the initial number of iterations according to the size of the local sample data set of each terminal device, and dynamically adjust the number of iterations;
[0012] S7. Analyze the global model parameters in real time through communication technology, display key indicators in the form of charts, and record the model parameter data during the system training process through logging technology.
[0013] A further improvement of the technical solution of the present invention lies in: in S1, the process of collecting the local data of the terminal device through the Internet of Things device includes:
[0014] In a multi-user collaborative mobile edge computing system, the terminal devices are deployed in the same network environment and connected to the MEC server. The terminal devices include smart phones, tablets, and sensor nodes. Each terminal device automatically collects various types of data related to its operations during its operation to form the local sample data set of the device , and record its computing rate.
[0015] A further improvement of the technical solution of the present invention lies in: in S2, the process of preprocessing the locally collected data of the terminal device includes:
[0016] Adopt the 3σ principle to remove the noise data in the local sample data set and the device computing rate, use the linear interpolation method to fill in the missing values in the local sample data set, record the computing rate of each terminal device, check whether it is within a reasonable range. If there is a terminal device whose computing rate deviates from the expected value, use statistical methods to identify and remove the outliers, and fill in the missing computing rate data of the terminal device with the mean value of the terminal device computing rate.
[0017] A further improvement of the technical solution of the present invention lies in: in S2, the process of extracting features from the locally collected data of the terminal device includes:
[0018] Select useful features from the original data of the collected local sample dataset, convert the time series data into frequency domain features through Fourier transform, select the calculation rate mean as the feature, and perform normalization processing.
[0019] A further improvement of the technical solution of the present invention lies in that: in the S2, the process of setting the sample data volume size threshold includes:
[0020] Based on the Pareto principle, set the sample data volume size threshold to , set as the 80th percentile of the sample dataset size. If , then the device belongs to a large sample. If , then the device belongs to a small sample.
[0021] A further improvement of the technical solution of the present invention lies in that: in the S3, through the dynamic weighted sampling algorithm, the process of dynamically adjusting the sampling strategy according to the size of the device sample data includes:
[0022] Set the initial sampling ratio to control the number of devices selected to participate in training in each iteration. For large sample devices, use the dynamic sampling method to gradually increase the sampling sample number according to the sample variance. For small sample devices, use the local sample dataset for training;
[0023] According to the calculation rate and sampling sample size of the device, calculate the local update training time and communication time of each device. The central server receives the local update model parameters uploaded by the terminal device and performs weighted averaging to obtain a new global model.
[0024] A further improvement of the technical solution of the present invention lies in that: in the S4, through the federated learning framework, the process of using the stochastic gradient descent algorithm to perform model training on the terminal device and uploading the trained model parameters to the central server includes:
[0025] Each terminal device obtains the initial global model parameters from the central server as its initial local model parameters, performs model training on its local dataset using the stochastic gradient descent algorithm. In each iteration, the terminal device extracts a batch of samples from its local sample dataset and updates the model parameters based on this batch of samples. According to the calculation rate and sampling sample size of the device, calculate the local update training time and communication time of each device. After the terminal device completes local training, it uploads its updated local model parameters to the central server. The terminal device uploads the model parameters obtained from local training to the central server, and the central server receives the local update model parameters uploaded by all terminal devices.
[0026] A further improvement of the technical solution of the present invention lies in: in S5, the central server uses the weighted average algorithm to weighted aggregate the uploaded model parameters according to the size of the device sample data volume. The process of generating the global model includes:
[0027] Calculate the weight of each terminal device so that the influence of different devices on the global model is proportional to their sample data volume. The larger the sample data volume, the greater the calculation weight for the server to update the global model; the smaller the sample data volume, the smaller the calculation weight for the server to update the global model. The central server performs weighted averaging on the uploaded local model parameters according to the device weights to generate a new global model. The central server distributes the generated new global model back to each terminal device for the next round of local training.
[0028] A further improvement of the technical solution of the present invention lies in: in S6, the initial number of iterations is set according to the size of the local sample data set of each terminal device. The process of dynamically adjusting the number of iterations includes:
[0029] Monitor the change rate of the loss function in each round of training to adjust the remaining number of iterations of each terminal device. Set the global maximum number of iterations, and calculate the initial number of iterations according to the size of the local sample data set and the average value of the sample data volume of each device. After each round of training, calculate the change rate of the loss function. If then reduce the remaining number of iterations. If then increase the remaining number of iterations. Update the remaining number of iterations, set the loss function change threshold, and stop training when the change of the loss function is less than this loss function change threshold for 5 consecutive rounds. Among them, represents the average value of the collected terminal device sample data set size, and are adjustment coefficients.
[0030] A further improvement of the technical solution of the present invention lies in: in S7, the global model parameters are analyzed in real time through communication technology, and the key indicators are displayed in the form of charts. The process of recording the model parameter data during the system training process through the logging technology includes:
[0031] The central server receives the local updated model parameters uploaded by the terminal device, calculates its weight according to the sample data volume of each device, generates new global model parameters, calculates the loss function value and key indicators of the global model. The key indicators include accuracy and precision to evaluate the performance and convergence of the model. Display the key indicators in the form of charts, use a line chart to display the change trend of the loss function, and a bar chart to display the contribution degree of different terminal devices to monitor the convergence state of the model;
[0032] Initialize the log file, record the timestamp, device number, sample dataset size, local model parameters, global model parameters, loss function value, and key metrics at the end of each iteration, and regularly save the log file to a persistent storage medium. After the training is completed, extract useful information by reading the log file for research and optimization.
[0033] Due to the above technical solutions, the technical progress achieved by the present invention compared with the prior art is as follows:
[0034] 1. The present invention provides a dynamic weighted sampling federated learning algorithm for MEC systems. Through the dynamic weighted sampling strategy, the sampling strategy is dynamically adjusted according to the size of the device sample data volume, effectively solving the problems of data heterogeneity and device heterogeneity, and improving the efficiency and accuracy of model training. This feature enables the algorithm to better adapt to datasets of different scales and qualities, thereby enhancing the generalization ability of the global model.
[0035] 2. The present invention provides a dynamic weighted sampling federated learning algorithm for MEC systems. The model is trained on the terminal device through the federated learning framework and the stochastic gradient descent algorithm, and the trained model parameters are uploaded to the central server for weighted aggregation, realizing the protection of data privacy and the effective utilization of computing resources. This distributed learning method not only reduces the bandwidth consumption of data transmission but also reduces the computing pressure on the central server, improving the scalability and robustness of the system.
[0036] 3. The present invention provides a dynamic weighted sampling federated learning algorithm for MEC systems. By dynamically adjusting the number of iterations and real-time analyzing the global model parameters, key metrics are presented in the form of charts, and the model parameter data during the system training process is recorded through the logging technology, providing comprehensive monitoring and tuning means. This helps users timely understand the system training status, discover and solve potential problems, and further optimize the model performance and system efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0038] Figure 1 It is a flowchart of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0039] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0040] The embodiments are as Figure 1 shown. The present invention provides a dynamic weighted sampling federated learning algorithm for an MEC system, including the following steps:
[0041] S1. Collect the local data of the terminal devices through the Internet of Things devices. In a multi-user collaborative mobile edge computing system, the terminal devices are deployed in the same network environment and connected to the MEC server. The terminal devices include smartphones, tablets, and sensor nodes. Each terminal device automatically collects various types of data related to its operations during its operation to form the local sample data set of the device and record its computing rate.
[0042] S2. Preprocess and extract features from the collected local data of the terminal devices, and set the threshold of the sample data volume. Use the 3σ principle to remove the noise data in the local sample data set and the device computing rate, use the linear interpolation method to fill the missing values in the local sample data set, record the computing rate of each terminal device, check whether it is within a reasonable range. If there is a terminal device whose computing rate deviates from the expected value, use statistical methods to identify and remove the outliers, fill the missing computing rate data of the terminal device with the mean value of the terminal device computing rate, select useful features from the original data of the collected local sample data set, convert the time series data into frequency domain features through Fourier transform, select the mean value of the computing rate as the feature, and perform normalization processing. Based on the Pareto principle, set the threshold of the sample data volume size to set as the 80th percentile of the sample data set size. If then the device belongs to a large sample. If then the device belongs to a small sample.
[0043] S3. Through the dynamic weighted sampling algorithm, dynamically adjust the sampling strategy according to the size of the device sample data volume, set the initial sampling ratio to control the number of devices selected to participate in training in each iteration. For large-sample devices, adopt the dynamic sampling method, and gradually increase the number of sampled samples according to the sample variance. For small-sample devices, use the local sample data set for training. Calculate the local update training time and communication time of each device according to the computing rate and sampled sample size of the device. The central server receives the local updated model parameters uploaded by the terminal devices and performs weighted averaging to obtain a new global model;
[0044] S4. Through the federated learning framework, use the stochastic gradient descent algorithm to perform model training on the terminal devices and upload the trained model parameters to the central server. Each terminal device obtains the initial global model parameters from the central server as its initial local model parameters, and uses the stochastic gradient descent algorithm to perform model training on its local data set. In each iteration, the terminal device extracts a batch of samples from its local sample data set and updates the model parameters based on this batch of samples. Calculate the local update training time and communication time of each device according to the computing rate and sampled sample size of the device. After the terminal device completes local training, it uploads its updated local model parameters to the central server. The terminal device uploads the model parameters obtained from local training to the central server, and the central server receives the local updated model parameters uploaded by all terminal devices;
[0045] S5. Through the weighted averaging algorithm, perform weighted aggregation on the uploaded model parameters according to the size of the device sample data volume to generate a global model. Calculate the weight of each terminal device so that the influence of different devices on the global model is proportional to their sample data volume. The larger the sample data volume, the greater the computing weight for the server to update the global model. The smaller the sample data volume, the smaller the computing weight for the server to update the global model. The central server performs weighted averaging on the uploaded local model parameters according to the device weights to generate a new global model, and the central server distributes the generated new global model back to each terminal device for the next round of local training;
[0046] S6. Set the initial number of iterations according to the size of the local sample data set of each terminal device, dynamically adjust the number of iterations, monitor the change rate of the loss function in each round of training to adjust the remaining number of iterations of each terminal device, set the global maximum number of iterations, and calculate the initial number of iterations according to the size of the local sample data set of each device and the average value of the sample data volume , after each round of training, calculate the change rate of the loss function , if , then reduce the remaining number of iterations , if , then increase the remaining number of iterations , update the remaining number of iterations, set the threshold for the change in the loss function, and stop training when the change in the loss function is less than the threshold for five consecutive rounds. Among them, represents the average value of the sample data set size of the acquisition terminal device, and is the adjustment coefficient;
[0047] S7. Analyze the global model parameters in real time through communication technology, display the key indicators in the form of charts, record the model parameter data during the system training process through logging technology. The central server receives the locally updated model parameters uploaded by the terminal devices, calculates their weights according to the sample data volume of each device, generates new global model parameters, calculates the loss function value and key indicators of the global model. The key indicators include accuracy and precision to evaluate the performance and convergence of the model, display the key indicators in the form of charts, use a line chart to show the change trend of the loss function, and a bar chart to show the contribution degree of different terminal devices to monitor the convergence state of the model. Initialize the log file, record the timestamp, device number, sample data set size, local model parameters, global model parameters, loss function value and key indicators after each round of iteration, and regularly save the log file to the persistent storage medium. After the training is completed, extract useful information from the log file for research and optimization.
[0048] As described above, it is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A dynamic weighted sampling federated learning algorithm for MEC systems, characterized in that, It includes the following steps: S1. Collect the local data of the terminal device through the Internet of Things device; S2. Preprocess and extract features from the collected local data of the terminal device, and set the threshold of the sample data volume size; S3. Through the dynamic weighted sampling algorithm, dynamically adjust the sampling strategy according to the size of the device sample data volume; S4. Through the federated learning framework, use the stochastic gradient descent algorithm to perform model training on the terminal device, and upload the trained model parameters to the central server; S5. Through the weighted average algorithm, weight and aggregate the uploaded model parameters according to the size of the device sample data volume to generate a global model; S6. Set the initial number of iterations according to the size of the local sample data set of each terminal device, and dynamically adjust the number of iterations; S7. Real-time analyze the global model parameters through communication technology, display the key indicators in the form of charts, and record the model parameter data during the system training process through logging technology.
2. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 1, wherein: In the S1, the process of collecting the local data of the terminal device through the Internet of Things device includes: In a multi-user collaborative mobile edge computing system, terminal devices are deployed in the same network environment and connected to the MEC server. The terminal devices include smartphones, tablets, and sensor nodes. Each terminal device automatically collects various types of data related to its operations during its operation, forming the local sample data set of the device. , and records its computing rate.
3. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 2, wherein: In the S2, the process of preprocessing the collected local data of the terminal device includes: Adopt the 3σ principle to remove the noise data in the local sample data set and the device calculation rate, use the linear interpolation method to fill in the missing values in the local sample data set, record the calculation rate of each terminal device, check whether it is within a reasonable range, if there is a terminal device whose calculation rate deviates from the expected value, then use statistical methods to identify and remove the outliers, and fill in the missing calculation rate data of the terminal device with the mean value of the terminal device calculation rate.
4. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 3, characterized in that: In the S2, the process of extracting features from the collected local data of the terminal device includes: Select useful features from the original data of the collected local sample data set, convert the time series data into frequency domain features through Fourier transform, select the mean value of the calculation rate as the feature, and perform normalization processing.
5. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 4, characterized in that: In the S2, the process of setting the threshold of the sample data volume size includes: Set the threshold for the sample data volume size based on the Pareto principle to be , and set to be the 80th percentile of the sample data set size. If , then the device belongs to a large sample. If , then the device belongs to a small sample.
6. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 5, characterized in that: In the S3, the process of dynamically adjusting the sampling strategy according to the size of the device sample data volume through the dynamic weighted sampling algorithm includes: Set the initial sampling ratio to control the number of devices selected to participate in training in each iteration. For large-sample devices, adopt the dynamic sampling method, and gradually increase the number of sampling samples according to the sample variance. For small-sample devices, use the local sample data set for training; According to the calculation rate and sampling sample size of the device, calculate the local update training time and communication time of each device. The central server receives the local update model parameters uploaded by the terminal device and performs weighted average to obtain a new global model.
7. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 6, wherein: In the S4, the process of performing model training on the terminal device through the federated learning framework using the stochastic gradient descent algorithm and uploading the trained model parameters to the central server includes: Each terminal device obtains the initial global model parameters from the central server as its initial local model parameters, and uses the stochastic gradient descent algorithm to train the model on its local dataset. In each iteration, the terminal device extracts a batch of samples from its local sample dataset and updates the model parameters based on this batch of samples. According to the computing rate and sampling sample size of the device, the local update training time and communication time of each device are calculated. After the terminal device completes local training, it uploads its updated local model parameters to the central server. The terminal device uploads the model parameters obtained from local training to the central server, and the central server receives the local updated model parameters uploaded by all terminal devices.
8. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 7, wherein: In step S5, the central server uses the weighted average algorithm to perform weighted aggregation on the uploaded model parameters according to the size of the device sample data volume. The process of generating the global model includes: Calculating the weight of each terminal device so that the influence of different devices on the global model is proportional to their sample data volume. The larger the sample data volume, the greater the computing weight for the server to update the global model; the smaller the sample data volume, the smaller the computing weight for the server to update the global model. The central server performs weighted averaging on the uploaded local model parameters according to the device weights to generate a new global model. The central server distributes the generated new global model back to each terminal device for the next round of local training.
9. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 8, characterized in that: In step S6, the initial number of iterations is set according to the size of the local sample dataset of each terminal device. The process of dynamically adjusting the number of iterations includes: Monitor the change rate of the loss function in each round of training to adjust the remaining number of iterations for each terminal device. Set the global maximum number of iterations, and calculate the initial number of iterations based on the size of the local sample dataset of each device and the average of the sample data volume. After each round of training, calculate the change rate of the loss function. If then reduce the remaining number of iterations. If then increase the remaining number of iterations. Update the remaining number of iterations, set the loss function change threshold. When the change of the loss function is less than this loss function change threshold for 5 consecutive rounds, stop training. Among them, represents the average of the sizes of the sample datasets of the acquisition terminal devices, and are adjustment coefficients.
10. The dynamic weighted sampling federated learning algorithm for the MEC system according to claim 9, wherein: In step S7, the global model parameters are analyzed in real time through communication technology, and the key indicators are displayed in the form of charts. The process of recording the model parameter data during the system training process through the logging technology includes: The central server receives the local updated model parameters uploaded by the terminal devices, calculates their weights according to the sample data volume of each device, generates new global model parameters, calculates the loss function value and key indicators of the global model. The key indicators include accuracy and precision to evaluate the performance and convergence of the model. The key indicators are displayed in the form of charts. A line chart is used to display the change trend of the loss function, and a bar chart is used to display the contribution degrees of different terminal devices to monitor the convergence state of the model; Initialize the log file, record the timestamp, device number, sample dataset size, local model parameters, global model parameters, loss function value and key indicators at the end of each round of iteration, and regularly save the log file to the persistent storage medium. After the training is completed, useful information is extracted by reading the log file for research and optimization.