Transformer large model training method based on cloud-edge collaboration
By adopting cloud-edge collaborative computing and multi-agent reinforcement learning algorithms in Transformer model training, combined with federated learning and differential privacy technology, the bottleneck problem of computing resources and data transmission bandwidth during Transformer model training and inference is solved, and efficient resource utilization and data privacy protection are achieved.
Patent Information
- Application Number
- CN202411813151.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-12-11
AI Technical Summary
The prior art has bottlenecks in computing resources and data transmission bandwidth in the training and inference process of Transformer model, and it is difficult to achieve efficient resource utilization and data privacy protection in a distributed environment.
The Transformer big model training method based on cloud edge collaboration is adopted, combining the multi-agent advantage actor-criticist algorithm and multi-arm slot machine strategy to dynamically adjust data allocation and model structure, and optimize the calculation load distribution and resource utilization. At the same time, federated learning strategies and differential privacy technology are used to ensure data privacy and improve model update efficiency.
It significantly improves the training efficiency and inference response speed of the Transformer model, optimizes resource utilization and real-time response capabilities, ensures data privacy and reduces latency.
Smart Images

Figure CN119294444B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technologies, and in particular to a Transformer large model training method based on cloud-edge collaboration. Background Art
[0002] With the rapid development of artificial intelligence technology, deep learning, especially Transformer-based neural network models, has achieved remarkable results in natural language processing, image recognition and other fields. However, the training and reasoning process of the Transformer model usually requires a large amount of computing resources and data, which places high requirements on hardware facilities. Especially when processing large-scale data, it is difficult to meet performance requirements by relying solely on cloud computing or edge computing. Therefore, cloud-edge collaborative computing has gradually become an effective solution to this problem. Cloud-edge collaborative computing uses the powerful computing power and storage resources of the cloud and the low latency characteristics of edge devices to provide an efficient data processing and model training method.
[0003] In existing technologies, the division of labor between cloud computing and edge computing is relatively clear. Cloud computing is mainly responsible for complex computing tasks and large-scale data processing, while edge computing focuses on real-time data processing and local reasoning. However, relying solely on the cloud for model training and reasoning can easily lead to bottlenecks and high latency in data transmission bandwidth, especially in scenarios that require real-time response, such as autonomous driving and intelligent monitoring. In addition, with the improvement of privacy awareness, how to protect data and update models in a distributed environment to avoid data leakage has also become an important issue.
[0004] Although federated learning, as a distributed machine learning technology, can achieve joint model training among multiple devices without sharing original data, traditional federated learning solutions still face many challenges in practical applications. First, when dealing with complex models such as Transformer, the existing federated learning strategies increase transmission costs and computing overhead due to the huge number of model parameters. Second, traditional federated learning methods usually assume that the computing resources of each node are uniform, but in actual applications, the computing power, storage resources, and network bandwidth of different nodes are often inconsistent, which can easily cause waste or imbalance of system resources.
[0005] During the model training process, the commonly used global synchronization method will cause the overall system performance to degrade due to network delays and differences in computing power between different nodes. In addition, in existing multi-agent systems, the resource allocation and task scheduling strategies are relatively simple, and fail to fully utilize the resources of each node and make intelligent adjustments based on real-time load, bandwidth, energy consumption and other information. These problems manifest themselves in practical applications as low model training efficiency, long response time, and waste of resources.
[0006] In terms of edge computing, existing technologies usually use lightweight models to cope with resource-constrained computing environments, but the accuracy of these models is often insufficient and it is difficult to meet the needs of high-precision tasks. Although model pruning and quantization techniques can reduce the model size and computational complexity to a certain extent, in practical applications, how to reasonably design and deploy lightweight models is still a complex problem. Existing lightweight model design methods mostly rely on static preset parameters, lack a dynamic adjustment mechanism, and cannot adapt to changing environments and task requirements.
[0007] Therefore, how to provide a Transformer large model training method based on cloud-edge collaboration is an issue that technical personnel in this field urgently need to solve. Summary of the invention
[0008] One purpose of the present invention is to propose a Transformer large model training method based on cloud-edge collaboration. The present invention adopts cloud-edge collaborative computing and intelligent scheduling methods, and realizes efficient and privacy-protected large model training and reasoning through a multi-agent advantage actor-critic algorithm combined with a multi-armed bandit strategy. This method effectively utilizes cloud and edge computing resources, optimizes data allocation and computing load, and improves the resource utilization and real-time response capabilities of the system. In addition, the combination of federated learning strategy and differential privacy technology ensures data privacy security, and the enhancement of edge reasoning capabilities significantly reduces latency.
[0009] The Transformer large model training method based on cloud-edge collaboration according to an embodiment of the present invention includes the following steps:
[0010] S1, collect real-time data collected by edge devices, historical data stored in the cloud, third-party data sources and user-generated data to build a data set;
[0011] S2, preprocess the data set, including data cleaning, data enhancement and standardization;
[0012] S3, use data parallel strategy to split the preprocessed data set and distribute it to cloud servers and edge devices, and combine data parallelism and model parallelism technology for distributed training;
[0013] S4. During distributed training, monitor the computing resources and network status of edge devices and cloud servers in real time, dynamically adjust data allocation strategies, and optimize computing load distribution;
[0014] S5, uses a multi-agent advantage actor-critic algorithm combined with a multi-armed bandit strategy to adjust the hierarchical structure of the Transformer model in real time according to system load, bandwidth, and energy consumption data;
[0015] S6. Design model pruning and quantization optimization lightweight models, and combine edge reasoning capabilities on edge devices to perform some model reasoning tasks;
[0016] S7, adopting a federated learning strategy, each edge node independently trains a local model and periodically uploads model updates to the cloud. The cloud server aggregates the model updates and uses differential privacy technology to protect data privacy;
[0017] S8. Use heterogeneous computing resources for hardware acceleration, optimize the execution efficiency of different tasks on heterogeneous hardware platforms, and support collaborative training of multiple Transformer models.
[0018] Furthermore, the S3 specifically includes:
[0019] S31, split the preprocessed data set D into multiple sub-data sets , where i∈{1,2,…,m}, m represents the number of splits of the dataset, and each sub-dataset Including multiple data samples ,in represents the jth input data of the i-th sub-dataset, Represents the label of the jth input data of the i-th sub-dataset;
[0020] S32, based on the data parallel strategy, based on the computing nodes of all cloud servers and edge devices computing power, network bandwidth, and storage resources to Distributed to different computing nodes, where , n represents the number of computing nodes, and the choice of data parallel strategy is:
[0021] ;
[0022] in, represents the amount of data processing allocated to the i-th sub-dataset, represents the computing power of the jth computing node, and M represents the total processing capacity of the data set;
[0023] S33. At each computing node On the Transformer model, the parameter matrix Split into multiple sub-matrices , where k represents the index of the submodule;
[0024] S34, updating model parameters on the computing node;
[0025] S35. The termination conditions of distributed training include reaching a set number of iterations or satisfying a preset convergence criterion.
[0026] Furthermore, the S34 specifically includes:
[0027] ;
[0028] in, represents the model parameters of the kth submodule of the jth computation node at the tth iteration, represents the learning rate of the kth submodule of the jth computing node, represents the gradient of the loss function with respect to the parameters of the kth submodule of the jth computing node, Represents the parameter synchronization weight coefficient.
[0029] Furthermore, the S4 specifically includes:
[0030] S41. Use the monitoring system to obtain the CPU, GPU, memory and storage usage of each computing node of the edge device and cloud server, record the real-time load of computing resources, and calculate the total load of each computing node:
[0031] ;
[0032] in, represents the CPU usage of the i-th computing node, represents the total CPU capacity of the i-th computing node, represents the GPU usage of the i-th computing node, represents the total GPU capacity of the i-th computing node, represents the memory usage of the i-th computing node, represents the total memory capacity of the i-th computing node, represents the storage rate of the i-th computing node, represents the total storage capacity of the i-th computing node;
[0033] S42. Monitor the network bandwidth usage of each node, record network throughput and latency, and calculate the network bandwidth usage rate :
[0034] ;
[0035] in, Indicates the current network transmission rate. Indicates the maximum available network bandwidth;
[0036] S43, real-time collection and analysis of system energy consumption data, calculation of energy consumption of each node :
[0037] ;
[0038] in, represents the CPU power consumption of the i-th computing node, represents the GPU power consumption of the i-th computing node, represents the CPU usage time of the i-th computing node, Indicates the GPU usage time of the i-th computing node;
[0039] S44. Calculate the comprehensive performance index of the i-th computing node :
[0040] ;
[0041] in, represents the total load of the i-th computing node, represents the network bandwidth usage of the i-th computing node, represents the energy consumption of the i-th computing node, represents the maximum load of the i-th computing node, represents the maximum energy consumption of the i-th computing node, , and Represents the weight coefficient, which is set according to the actual needs of the system. By calculating the CPI value of each node, the relative performance of each node is determined;
[0042] S45, dynamically adjusting the data allocation strategy according to the CPI value of each node and the characteristics of the data block;
[0043] Furthermore, the S45 specifically includes:
[0044] ;
[0045] in, represents the amount of data allocated to the i-th computing node, Indicates the total amount of data. Represents the adjusted weight of the i-th computing node:
[0046] ;
[0047] in, represents the idle time of the i-th computing node, represents the total time of the i-th computing node, represents the number of failed tasks of the i-th computing node, represents the total number of tasks of the i-th computing node, and Represents the weight coefficient.
[0048] The above method comprehensively considers the node's CPI value, idle time ratio and task failure rate to balance the resource utilization and load of each node. By adjusting the weight factor, the system can dynamically adjust the data allocation to ensure that the task load between nodes is evenly distributed, optimizing the overall computing performance and resource utilization efficiency.
[0049] Furthermore, the S5 specifically includes:
[0050] S51. Define the system state vector , including current system load, bandwidth usage, energy consumption data, and model structure parameters;
[0051] S52. In the multi-agent dominant actor-critic algorithm, a strategy network and a value network are constructed for each agent. The strategy network generates the action probability distribution, and the value network estimates the value of the state. Each agent operates independently and calculates the value of its own state vector. Choose the best action ;
[0052] S53, at each time step t, the agent calculates the state vector and the parameters of the policy network Calculate the action probability distribution :
[0053] ;
[0054] in, Represents the state vector Next select action The total return expected after Represents the state vector The total return expected after selecting action b';
[0055] S54, combined with the multi-armed bandit strategy, calculates the immediate reward by estimating and updating the historical performance of each action :
[0056] ;
[0057] in, , , and represents the weight coefficient, represents the parameters of the jth layer of the model, and M represents the number of model layers;
[0058] S55. According to the multi-armed bandit strategy, the agent updates the expected reward of each action To choose the best action:
[0059] ;
[0060] in, represents the learning rate, represents the discount factor;
[0061] S56, update the parameters of the policy network and the value network, and use the policy gradient method to update the policy network parameters;
[0062] S57. Intelligent agents optimize system resource allocation and model structure through collaborative learning and strategy updating, so that the system can achieve optimal performance under various resource conditions.
[0063] Furthermore, the S56 specifically includes:
[0064] ;
[0065] in, Represents the policy network parameters The gradient of represents the total reward from time step t to future steps, Represents the state of the value network estimate The value of represents the parameters of the value network, represents the offset of future time steps, Represents the time step Instant rewards received;
[0066] The loss function of the value network is:
[0067] .
[0068] Furthermore, the S6 specifically includes:
[0069] S61, model pruning, calculate each parameter according to the importance of different levels of parameters in the model :
[0070] ;
[0071] in, represents the model parameters, and N represents the total number of parameters;
[0072] S62, model quantization, quantizing the floating-point parameters in the model into fixed-point representation, and mapping the floating-point parameters to the fixed-point range;
[0073] S63. Design a lightweight model. After pruning and quantization, redesign the architecture of the lightweight model, adjust the number of model layers, the number of neurons in each layer, and the type of activation function;
[0074] S64, deploy the optimized lightweight model on the edge device, and assign part of the reasoning tasks to the edge device according to the real-time reasoning requirements, and the remaining complex reasoning tasks are completed by the cloud server;
[0075] S65. After the edge device completes the reasoning task, it uploads the result to the cloud server. The cloud server merges the edge reasoning result with its own reasoning result to form the final output.
[0076] Furthermore, the S62 specifically includes:
[0077] ;
[0078] Among them, round represents the rounding operation, min represents the minimum value of the parameter, max represents the maximum value of the parameter, and b represents the quantization bit width.
[0079] Furthermore, the S7 specifically includes:
[0080] S71. On each edge node, collect and preprocess local data and use lightweight models for local training.
[0081] S72. After the local model training is completed, the edge node generates a model update, including updated model weights and bias parameters, and then uploads these updates to the cloud server in an encrypted manner;
[0082] S73: After receiving model updates from multiple edge nodes, the cloud server verifies these updates and performs weighted average aggregation on the model updates uploaded by all edge nodes to generate a new global model.
[0083] S74. During the aggregation process, the cloud server applies differential privacy technology and adds noise to perturb the model parameters;
[0084] S75. After the aggregation is completed, the cloud server distributes the updated global model parameters back to each edge node. After each edge node receives the updated global model, it applies it to the local model for synchronous update.
[0085] S76. Repeat S71-S75 to update and synchronize the model between the cloud server and the edge node until the global model reaches the predetermined convergence condition or accuracy requirement.
[0086] The beneficial effects of the present invention are:
[0087] Through the Transformer large model training method based on cloud-edge collaboration proposed in the present invention, we have achieved significant beneficial effects. First, by combining cloud computing and edge computing, the present invention effectively solves the performance bottleneck problem under a single computing mode. The powerful computing resources in the cloud make it possible to process large-scale data and train complex models, while the low-latency characteristics of edge devices significantly improve the real-time performance of data processing. By combining data parallelism and model parallelism strategies, the present invention greatly improves the efficiency of distributed training, optimizes the distribution of computing load, reduces the bandwidth requirements for data transmission, and ensures the stable operation of the system under high load conditions.
[0088] Secondly, the present invention introduces a combination of a multi-agent dominant actor-critic algorithm and a multi-armed bandit strategy, which enables the system to dynamically adjust the hierarchical structure and data allocation strategy of the Transformer model according to real-time load, bandwidth, and energy consumption data. This intelligent scheduling mechanism based on reinforcement learning not only improves resource utilization, but also enables the system to adaptively adjust model complexity under resource-constrained environments, thereby optimizing performance. Especially in multi-tasking and resource-heterogeneous environments, this method can effectively balance the resource consumption of different nodes and maximize the overall computing power of the system.
[0089] In addition, through the application of federated learning strategies and differential privacy technologies, the present invention realizes cross-node joint model training while ensuring data privacy. Each edge node independently trains a local model and periodically uploads model updates to the cloud. The cloud server performs weighted average aggregation on the model updates and adds differential privacy noise during the aggregation process. This method not only protects the data privacy of each edge node, but also ensures the convergence and effectiveness of the global model. Compared with traditional centralized training methods, the present invention greatly reduces the risk of data leakage and improves the efficiency of model updates.
[0090] Finally, in terms of edge computing, the present invention enables complex Transformer models to run efficiently on resource-constrained edge devices by designing lightweight models and combining model pruning and quantization optimization techniques. Edge devices use lightweight models to perform some reasoning tasks, reducing data transmission delays and cloud computing pressure, and provide efficient and accurate reasoning services through the combination of edge reasoning and cloud reasoning. This dual reasoning mechanism not only improves the response speed of the system, but also maintains the high accuracy of the model while saving resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0092] Figure 1 This is a flow chart of the Transformer large model training method based on cloud-edge collaboration proposed in the present invention;
[0093] Figure 2 This is the model pruning and quantization optimization flowchart of the Transformer large model training method based on cloud-edge collaboration proposed in the present invention. DETAILED DESCRIPTION
[0094] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.
[0095] refer to Figure 1 and Figure 2 The Transformer large model training method based on cloud-edge collaboration includes the following steps:
[0096] S1, collect real-time data collected by edge devices, historical data stored in the cloud, third-party data sources and user-generated data to build a data set;
[0097] S2, preprocess the data set, including data cleaning, data enhancement and standardization;
[0098] S3, use data parallel strategy to split the preprocessed data set and distribute it to cloud servers and edge devices, and combine data parallelism and model parallelism technology for distributed training;
[0099] S4. During distributed training, monitor the computing resources and network status of edge devices and cloud servers in real time, dynamically adjust data allocation strategies, and optimize computing load distribution;
[0100] S5, uses a multi-agent advantage actor-critic algorithm combined with a multi-armed bandit strategy to adjust the hierarchical structure of the Transformer model in real time according to system load, bandwidth, and energy consumption data;
[0101] S6. Design model pruning and quantization optimization lightweight models, and combine edge reasoning capabilities on edge devices to perform some model reasoning tasks;
[0102] S7, adopting a federated learning strategy, each edge node independently trains a local model and periodically uploads model updates to the cloud. The cloud server aggregates the model updates and uses differential privacy technology to protect data privacy;
[0103] S8. Use heterogeneous computing resources for hardware acceleration, optimize the execution efficiency of different tasks on heterogeneous hardware platforms, and support collaborative training of multiple Transformer models.
[0104] In this implementation, S3 specifically includes:
[0105] S31, split the preprocessed data set D into multiple sub-data sets , where i∈{1,2,…,m}, m represents the number of splits of the dataset, and each sub-dataset Including multiple data samples ,in represents the jth input data of the i-th sub-dataset, Represents the label of the jth input data of the i-th sub-dataset;
[0106] S32, based on the data parallel strategy, based on the computing nodes of all cloud servers and edge devices computing power, network bandwidth, and storage resources to Distributed to different computing nodes, where , n represents the number of computing nodes, and the choice of data parallel strategy is:
[0107] ;
[0108] in, represents the amount of data processing allocated to the i-th sub-dataset, represents the computing power of the jth computing node, and M represents the total processing capacity of the data set;
[0109] S33. At each computing node On the Transformer model, the parameter matrix Split into multiple sub-matrices , where k represents the index of the submodule;
[0110] S34, updating model parameters on the computing node;
[0111] S35. The termination conditions of distributed training include reaching a set number of iterations or satisfying a preset convergence criterion.
[0112] In this implementation manner, the S34 specifically includes:
[0113] ;
[0114] in, represents the model parameters of the kth submodule of the jth computation node at the tth iteration, represents the learning rate of the kth submodule of the jth computing node, represents the gradient of the loss function with respect to the parameters of the kth submodule of the jth computing node, Represents the parameter synchronization weight coefficient.
[0115] In this implementation, S4 specifically includes:
[0116] S41. Use the monitoring system to obtain the CPU, GPU, memory and storage usage of each computing node of the edge device and cloud server, record the real-time load of computing resources, and calculate the total load of each computing node:
[0117] ;
[0118] in, represents the CPU usage of the i-th computing node, represents the total CPU capacity of the i-th computing node, represents the GPU usage of the i-th computing node, represents the total GPU capacity of the i-th computing node, represents the memory usage of the i-th computing node, represents the total memory capacity of the i-th computing node, represents the storage rate of the i-th computing node, represents the total storage capacity of the i-th computing node;
[0119] S42. Monitor the network bandwidth usage of each node, record network throughput and latency, and calculate the network bandwidth usage rate :
[0120] ;
[0121] in, Indicates the current network transmission rate. Indicates the maximum available network bandwidth;
[0122] S43, real-time collection and analysis of system energy consumption data, calculation of energy consumption of each node :
[0123] ;
[0124] in, represents the CPU power consumption of the i-th computing node, represents the GPU power consumption of the i-th computing node, represents the CPU usage time of the i-th computing node, Indicates the GPU usage time of the i-th computing node;
[0125] S44. Calculate the comprehensive performance index of the i-th computing node :
[0126] ;
[0127] in, represents the total load of the i-th computing node, represents the network bandwidth usage of the i-th computing node, represents the energy consumption of the i-th computing node, represents the maximum load of the i-th computing node, represents the maximum energy consumption of the i-th computing node, , and Represents the weight coefficient, which is set according to the actual needs of the system. By calculating the CPI value of each node, the relative performance of each node is determined;
[0128] S45, dynamically adjusting the data allocation strategy according to the CPI value of each node and the characteristics of the data block;
[0129] In this implementation manner, the S45 specifically includes:
[0130] ;
[0131] in, represents the amount of data allocated to the i-th computing node, Indicates the total amount of data. Represents the adjusted weight of the i-th computing node:
[0132] ;
[0133] in, represents the idle time of the i-th computing node, represents the total time of the i-th computing node, represents the number of failed tasks of the i-th computing node, represents the total number of tasks of the i-th computing node, and Represents the weight coefficient.
[0134] The above method comprehensively considers the node's CPI value, idle time ratio and task failure rate to balance the resource utilization and load of each node. By adjusting the weight factor, the system can dynamically adjust the data allocation to ensure that the task load between nodes is evenly distributed, optimizing the overall computing performance and resource utilization efficiency.
[0135] In this implementation manner, S5 specifically includes:
[0136] S51. Define the system state vector , including current system load, bandwidth usage, energy consumption data, and model structure parameters;
[0137] S52. In the multi-agent dominant actor-critic algorithm, a strategy network and a value network are constructed for each agent. The strategy network generates the action probability distribution, and the value network estimates the value of the state. Each agent operates independently and calculates the value of its own state vector. Choose the best action ;
[0138] S53, at each time step t, the agent calculates the state vector and the parameters of the policy network Calculate the action probability distribution :
[0139] ;
[0140] in, Represents the state vector Next select action The total return expected after Represents the state vector The total return expected after selecting action b';
[0141] S54, combined with the multi-armed bandit strategy, calculates the immediate reward by estimating and updating the historical performance of each action :
[0142] ;
[0143] in, , , and represents the weight coefficient, represents the parameters of the jth layer of the model, and M represents the number of model layers;
[0144] S55. According to the multi-armed bandit strategy, the agent updates the expected reward of each action To choose the best action:
[0145] ;
[0146] in, represents the learning rate, represents the discount factor;
[0147] S56, update the parameters of the policy network and the value network, and use the policy gradient method to update the policy network parameters;
[0148] S57. Intelligent agents optimize system resource allocation and model structure through collaborative learning and strategy updating, so that the system can achieve optimal performance under various resource conditions.
[0149] In this implementation manner, the S56 specifically includes:
[0150] ;
[0151] in, Represents the policy network parameters The gradient of represents the total reward from time step t to future steps, Represents the state of the value network estimate The value of represents the parameters of the value network, represents the offset of future time steps, Represents the time step Instant rewards received;
[0152] The loss function of the value network is:
[0153] .
[0154] In this implementation manner, S6 specifically includes:
[0155] S61, model pruning, calculate each parameter according to the importance of different levels of parameters in the model :
[0156] ;
[0157] in, represents the model parameters, and N represents the total number of parameters;
[0158] S62, model quantization, quantizing the floating-point parameters in the model into fixed-point representation, and mapping the floating-point parameters to the fixed-point range;
[0159] S63. Design a lightweight model. After pruning and quantization, redesign the architecture of the lightweight model, adjust the number of model layers, the number of neurons in each layer, and the type of activation function;
[0160] S64, deploy the optimized lightweight model on the edge device, and assign part of the reasoning tasks to the edge device according to the real-time reasoning requirements, and the remaining complex reasoning tasks are completed by the cloud server;
[0161] S65. After the edge device completes the reasoning task, it uploads the result to the cloud server. The cloud server merges the edge reasoning result with its own reasoning result to form the final output.
[0162] In this implementation manner, the S62 specifically includes:
[0163] ;
[0164] Among them, round represents the rounding operation, min represents the minimum value of the parameter, max represents the maximum value of the parameter, and b represents the quantization bit width.
[0165] In this implementation manner, the S7 specifically includes:
[0166] S71. On each edge node, collect and preprocess local data and use lightweight models for local training.
[0167] S72. After the local model training is completed, the edge node generates a model update, including updated model weights and bias parameters, and then uploads these updates to the cloud server in an encrypted manner;
[0168] S73: After receiving model updates from multiple edge nodes, the cloud server verifies these updates and performs weighted average aggregation on the model updates uploaded by all edge nodes to generate a new global model.
[0169] S74. During the aggregation process, the cloud server applies differential privacy technology and adds noise to perturb the model parameters;
[0170] S75. After the aggregation is completed, the cloud server distributes the updated global model parameters back to each edge node. After each edge node receives the updated global model, it applies it to the local model for synchronous update.
[0171] S76. Repeat S71-S75 to update and synchronize the model between the cloud server and the edge node until the global model reaches the predetermined convergence condition or accuracy requirement.
[0172] Embodiment 1:
[0173] In order to verify the feasibility of the present invention in implementation, the present invention is applied to the traffic monitoring system of a smart city. The system has a large amount of real-time data that needs to be processed and analyzed. The traditional centralized cloud computing model often faces network transmission bottlenecks and excessive latency when processing such high-frequency, low-latency data. At the same time, the traffic monitoring system has a large number of cameras and sensors distributed in every corner of the city, and the amount of data collected is huge and diverse. Due to the requirements of data privacy protection, it is impossible to store and process all data in a centralized manner, so there is an urgent need for a solution that can be distributed and efficiently processed and protect data privacy.
[0174] The images and sensor data collected by the edge device in real time are first preprocessed by a local lightweight model, and the key information detected (such as vehicle characteristics, license plate numbers, pedestrian trajectories, etc.) will be extracted and initially analyzed. In this way, abnormal behaviors such as vehicles driving in the wrong direction and congested roads can be quickly screened out, and these key information can be uploaded to the cloud server first. For normal traffic data, the edge device will process and temporarily store it locally and upload it only when necessary, which effectively reduces the bandwidth occupied by data transmission and the processing burden of the cloud server.
[0175] The cloud server is responsible for more complex computing tasks and updating the global model. After receiving the key information uploaded by each edge device, the cloud will conduct further analysis and processing, using the complete Transformer large model for more sophisticated detection and prediction. For example, the cloud can combine data from different intersections to analyze the traffic flow pattern of the entire city, predict possible traffic congestion, and alleviate traffic pressure through intelligent control of traffic lights. In addition, the cloud server can also adjust the task load of the edge device in real time according to the actual situation. For example, when a traffic accident occurs on a certain section of road, the cloud can immediately increase the task priority of the relevant equipment on that section of road to ensure that the data is uploaded and processed in time.
[0176] Throughout the entire process, the intelligent scheduling system and multi-agent reinforcement learning algorithm used in the present invention play a key role. Each edge device can dynamically adjust the priority of tasks and the operation mode of the model based on real-time computing resources, network bandwidth, and energy consumption data. Especially during peak hours, due to the increase in vehicle and pedestrian traffic, edge devices will prioritize key data and reduce unnecessary data transmission. During non-peak hours, idle computing resources can be used for batch processing of data and system self-checking. Through the multi-agent advantage actor-critic algorithm combined with the multi-armed bandit strategy, the system can intelligently learn and optimize resource allocation strategies in various scenarios to ensure that the system can operate with optimal performance in all situations.
[0177] In addition, in order to ensure data privacy and security, the present invention adopts a federated learning strategy and differential privacy technology. When the edge device trains the model locally, it does not need to upload the original data, but only needs to upload the model parameters that have been processed with differential privacy. After receiving these model parameters, the cloud server will perform weighted average aggregation to generate a global model. This method not only effectively protects the privacy of user data, but also can continuously optimize the model performance through multiple iterations. Through this mechanism, the entire intelligent traffic monitoring system can continue to learn and evolve, and continuously improve the efficiency of traffic management and safety monitoring.
[0178] Table 1 Performance comparison between traditional centralized method and cloud-edge collaborative method
[0179] ;
[0180] Table 1 compares the performance of the traditional centralized method and the cloud-edge collaborative method of the present invention in detail in the smart city traffic monitoring system. The traditional centralized method relies on uploading all data to the cloud for processing, which leads to high latency and bandwidth usage. On average, the daily data upload time reaches 4 hours, the cloud processing time is 2 hours, and the total latency is as high as 6 hours. In addition, due to the centralized storage and processing of data, there is a high risk of privacy leakage, which is difficult to meet the high requirements for data security in modern smart cities.
[0181] The cloud-edge collaboration method of the present invention utilizes the real-time processing capabilities of edge devices, greatly reducing the amount of data transmission and processing delays. The daily data upload time is reduced to 1 hour, the cloud processing time is shortened to 1.5 hours, and the total delay time is only 2.5 hours. Through intelligent scheduling and edge reasoning, the resource utilization of the present invention is improved by 30% and energy consumption is reduced by 20%. In addition, the use of federated learning and differential privacy technology effectively protects data privacy, and the global model accuracy is improved by 5% within one month. These improvements not only improve the overall efficiency and security of the system, but also significantly improve the response speed and accuracy of the intelligent traffic monitoring system.
[0182] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A Transformer large model training method based on cloud-edge collaboration, characterized in that: The steps include: S1, collect real-time data collected by edge devices, historical data stored in the cloud, third-party data sources and user-generated data to build a data set; S2, preprocess the data set, including data cleaning, data enhancement and standardization; S3, use data parallel strategy to split the preprocessed data set and distribute it to cloud servers and edge devices, and combine data parallelism and model parallelism technology for distributed training; S4. During distributed training, monitor the computing resources and network status of edge devices and cloud servers in real time, dynamically adjust data allocation strategies, and optimize computing load distribution; S5, uses a multi-agent advantage actor-critic algorithm combined with a multi-armed bandit strategy to adjust the hierarchical structure of the Transformer model in real time according to system load, bandwidth, and energy consumption data; S6. Design model pruning and quantization optimization lightweight models, and combine edge reasoning capabilities on edge devices to perform some model reasoning tasks; S7, adopting a federated learning strategy, each edge node independently trains a local model and periodically uploads model updates to the cloud. The cloud server aggregates the model updates and uses differential privacy technology to protect data privacy; S8. Use heterogeneous computing resources for hardware acceleration, optimize the execution efficiency of different tasks on heterogeneous hardware platforms, and support collaborative training of multiple Transformer models.
2. The Transformer large model training method based on cloud-edge collaboration according to claim 1 is characterized in that: The S3 specifically includes: S31, split the preprocessed data set D into multiple sub-data sets , where i∈{1,2,…,m}, m represents the number of splits of the dataset, and each sub-dataset Including multiple data samples ,in represents the jth input data of the i-th sub-dataset, Represents the label of the jth input data of the i-th sub-dataset; S32, based on the data parallel strategy, based on the computing nodes of all cloud servers and edge devices computing power, network bandwidth, and storage resources to Distributed to different computing nodes, where , n represents the number of computing nodes, and the choice of data parallel strategy is: ; in, represents the amount of data processing allocated to the i-th sub-dataset, represents the computing power of the jth computing node, and M represents the total processing capacity of the data set; S33. At each computing node On the Transformer model, the parameter matrix Split into multiple sub-matrices , where k represents the index of the submodule; S34, updating model parameters on the computing node; S35. The termination conditions of distributed training include reaching a set number of iterations or satisfying a preset convergence criterion.
3. The Transformer large model training method based on cloud-edge collaboration according to claim 2 is characterized in that: The S34 specifically includes: ; in, represents the model parameters of the kth submodule of the jth computation node at the tth iteration, represents the learning rate of the kth submodule of the jth computing node, represents the gradient of the loss function with respect to the parameters of the kth submodule of the jth computing node, Represents the parameter synchronization weight coefficient.
4. The Transformer large model training method based on cloud-edge collaboration according to claim 1 is characterized in that: The S4 specifically includes: S41. Use the monitoring system to obtain the CPU, GPU, memory and storage usage of each computing node of the edge device and cloud server, record the real-time load of computing resources, and calculate the total load of each computing node: ; in, represents the CPU usage of the i-th computing node, represents the total CPU capacity of the i-th computing node, represents the GPU usage of the i-th computing node, represents the total GPU capacity of the i-th computing node, represents the memory usage of the i-th computing node, represents the total memory capacity of the i-th computing node, represents the storage rate of the i-th computing node, represents the total storage capacity of the i-th computing node; S42. Monitor the network bandwidth usage of each node, record network throughput and latency, and calculate the network bandwidth usage rate : ; in, Indicates the current network transmission rate. Indicates the maximum available network bandwidth; S43, real-time collection and analysis of system energy consumption data, calculation of energy consumption of each node : ; in, represents the CPU power consumption of the i-th computing node, represents the GPU power consumption of the i-th computing node, represents the CPU usage time of the i-th computing node, Indicates the GPU usage time of the i-th computing node; S44. Calculate the comprehensive performance index of the i-th computing node : ; in, represents the total load of the i-th computing node, represents the network bandwidth usage of the i-th computing node, represents the energy consumption of the i-th computing node, represents the maximum load of the i-th computing node, represents the maximum energy consumption of the i-th computing node, , and represents the weight coefficient; S45. Dynamically adjust the data allocation strategy according to the CPI value of each node and the characteristics of the data block.
5. The Transformer large model training method based on cloud-edge collaboration according to claim 4 is characterized in that: The S45 specifically includes: ; in, represents the amount of data allocated to the i-th computing node, Indicates the total amount of data. Represents the adjusted weight of the i-th computing node: ; in, represents the idle time of the i-th computing node, represents the total time of the i-th computing node, represents the number of failed tasks of the i-th computing node, represents the total number of tasks of the i-th computing node, and Represents the weight coefficient.
6. The Transformer large model training method based on cloud-edge collaboration according to claim 1 is characterized in that: The S5 specifically includes: S51. Define the system state vector , including current system load, bandwidth usage, energy consumption data, and model structure parameters; S52. In the multi-agent dominant actor-critic algorithm, a strategy network and a value network are constructed for each agent. The strategy network generates the action probability distribution, and the value network estimates the value of the state. Each agent operates independently and calculates the value of its own state vector. Choose the best action ; S53, at each time step t, the agent calculates the state vector and the parameters of the policy network Calculate the action probability distribution : ; in, Represents the state vector Next select action The total return expected after Represents the state vector The total return expected after selecting action b'; S54, combined with the multi-armed bandit strategy, calculates the immediate reward by estimating and updating the historical performance of each action : ; in, , , and represents the weight coefficient, represents the parameters of the jth layer of the model, and M represents the number of model layers; S55. According to the multi-armed bandit strategy, the agent updates the expected reward of each action To choose the best action: ; in, represents the learning rate, represents the discount factor; S56, update the parameters of the policy network and the value network, and use the policy gradient method to update the policy network parameters; S57. Intelligent agents optimize system resource allocation and model structure through collaborative learning and strategy updating.
7. The Transformer large model training method based on cloud-edge collaboration according to claim 6 is characterized in that: The S56 specifically includes: ; in, Represents the policy network parameters The gradient of represents the total reward from time step t to future steps, Represents the state of the value network estimate The value of represents the parameters of the value network, represents the offset of future time steps, Represents the time step Instant rewards received; The loss function of the value network is: 。 8. The Transformer large model training method based on cloud-edge collaboration according to claim 1 is characterized in that: The S6 specifically includes: S61, model pruning, calculate each parameter according to the importance of different levels of parameters in the model : ; in, represents the model parameters, and N represents the total number of parameters; S62, model quantization, quantizing the floating-point parameters in the model into fixed-point representation, and mapping the floating-point parameters to the fixed-point range; S63. Design a lightweight model. After pruning and quantization, redesign the architecture of the lightweight model, adjust the number of model layers, the number of neurons in each layer, and the type of activation function; S64, deploy the optimized lightweight model on the edge device, and assign part of the reasoning tasks to the edge device according to the real-time reasoning requirements, and the remaining complex reasoning tasks are completed by the cloud server; S65. After the edge device completes the reasoning task, it uploads the result to the cloud server. The cloud server merges the edge reasoning result with its own reasoning result to form the final output.
9. The Transformer large model training method based on cloud-edge collaboration according to claim 8 is characterized in that: The S62 specifically includes: ; Among them, round represents the rounding operation, min represents the minimum value of the parameter, max represents the maximum value of the parameter, and b represents the quantization bit width.
10. The Transformer large model training method based on cloud-edge collaboration according to claim 1 is characterized in that: The S7 specifically includes: S71. On each edge node, collect and preprocess local data and use lightweight models for local training. S72. After the local model training is completed, the edge node generates a model update, including updated model weights and bias parameters, and then uploads these updates to the cloud server in an encrypted manner; S73: After receiving model updates from multiple edge nodes, the cloud server verifies these updates and performs weighted average aggregation on the model updates uploaded by all edge nodes to generate a new global model. S74. During the aggregation process, the cloud server applies differential privacy technology and adds noise to perturb the model parameters; S75. After the aggregation is completed, the cloud server distributes the updated global model parameters back to each edge node. After each edge node receives the updated global model, it applies it to the local model for synchronous update. S76. Repeat S71-S75 to update and synchronize the model between the cloud server and the edge node until the global model reaches the predetermined convergence condition or accuracy requirement.
Citation Information
Patent Citations
Intelligent agent strategy learning method with privacy protection in mobile edge computing
CN116546021A
Network anomaly detection method based on federated learning and deep learning
CN118590289A