CPU resource allocation optimization method in knowledge distillation period based on edge calculation
By establishing a digital model of the time dependence between communication and computing in the edge computing environment, using a dynamic resource allocation framework to optimize CPU resource allocation, the problem of resource competition in the knowledge distillation process in edge devices is solved, and system efficiency and model training performance are improved. .
Patent Information
- Application Number
- CN202410627848.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-05-20
AI Technical Summary
In the edge computing environment, limited resources during the knowledge distillation process lead to resource competition between communication and computing tasks, resulting in inefficient model training performance, making it difficult to achieve the optimal allocation of resources, and affecting the operating efficiency of the model.
By establishing a digital model of the time dependence between communication and computing in the knowledge distillation process, a dynamic resource allocation framework is proposed to optimize CPU resource allocation, realize parallel scenarios of communication and computing tasks, and adopt a stage-based time management strategy to dynamically adjust CPU core allocation. , to maximize resource utilization.
It effectively optimizes the knowledge distillation process in edge devices, improves system efficiency, reduces resource competition, improves model training performance, and achieves approximately optimal allocation of resources.
Smart Images

Figure CN118626249A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge distillation based on edge computing, and specifically introduces a dynamic resource management method to perform an approximately optimal resource scheduling method for limited communication and computing resources in the process of knowledge distillation in an edge environment, thereby improving the operating efficiency of the edge model. Background Art
[0002] Model personalization in edge computing is very important for edge devices to solve practical local tasks. However, it also introduces its own drawbacks, such as model drift, where model performance degrades due to changes in the local environment. Although large-scale models are better able to adapt to environmental changes, their computational requirements often exceed the available resources on edge devices. Federated learning, as a collaborative approach, mitigates model drift by training on local data and aggregating updates across multiple devices. However, it requires extensive communication resources and consistent client participation, which can be problematic in resource-constrained edge environments, posing challenges to model quality and security.
[0003] In view of the limitations of the above two methods for solving model drift on edge devices, knowledge distillation (KD), as an effective model compression method, provides a feasible way to solve these problems. KD involves transferring knowledge from a comprehensive and complex model to a streamlined, edge-adapted model, thereby retaining complex model performance within the scope of edge device capabilities, which provides an excellent solution for model personalization and model drift.
[0004] While addressing the above limitations, the KD process also brings its own set of challenges, especially the resource contention between computation and communication in resource-constrained edge environments. In resource-constrained edge environments, this competition becomes more pronounced as edge devices struggle to balance the ingestion of distilled knowledge from larger and more complex models with the computational demands of local training programs. This balancing act can lead to resource bottlenecks that have the potential to undermine the benefits of KD: slower communication due to contention for data transfer, or computational delays due to over-scaling of processing power.
[0005] In the context of knowledge distillation in edge computing, communication tasks involve transmitting data between teacher and student models, and computing tasks include model training and reasoning. Competition for CPU resources in the process of completing communication and computing tasks may lead to inefficient student model training performance. Therefore, optimizing CPU resource scheduling in edge knowledge distillation is of great significance to improving the communication and computing efficiency of edge devices. Summary of the invention
[0006] In order to overcome the deficiencies in the above-mentioned background technology, the present invention proposes a CPU resource allocation optimization method within the knowledge distillation cycle based on edge computing.
[0007] This paper explores the resource contention problem in edge computing, focusing on the complex balance between communication and computing in devices with limited resources. The goal is to optimally configure communication resources and computing resources in edge computing, maximize the time savings of the knowledge distillation process, and improve system efficiency.
[0008] In order to achieve the above technical objectives, the present invention provides the following technical solutions:
[0009] A CPU resource allocation optimization method within a knowledge distillation cycle based on edge computing, comprising the following steps:
[0010] (1) Establish a digital model for the temporal dependency between communication and computation by knowledge distillation in edge environments;
[0011] (2) Construct a parallel scenario of communication and computing tasks in the iterative process of knowledge distillation in edge computing, and propose a time optimization task in the entire KD cycle;
[0012] (3) Propose a strategy to optimize time management: adopt a framework based on dynamic resource allocation to achieve a near-optimal solution;
[0013] (4) Simulation experiments are conducted to evaluate the effectiveness of the optimization method in KD based on actual edge environments.
[0014] Furthermore, in step (1), considering the impact of CPU cores on the total time scheduling required for knowledge distillation, a series of control experiments were conducted on the Raspberry Pi and Jetson Xavier NX platforms to quantitatively evaluate the changes in the time required for communication and computing tasks under different CPU core allocations. Based on the experimental results, the following function fitting representing the relationship between communication time and computing time and CPU core allocation is proposed:
[0015] ① Computation: The time required for computing tasks in edge devices depends on the allocation of CPU cores. The relationship between the required computing time and the number of CPU cores allocated to communication can be approximated by the following function:
[0016]
[0017] Where f(x,c) is the computation time required to compute workload x on c CPU cores allocated to the communication task. The constants a1 and a2 reflect the effect of CPU allocation on computation time. In this equation, computation time increases as the number of CPU cores available for communication tasks increases. This highlights the linear reduction in computational resources as more CPU cores are allocated from computation tasks;
[0018] ② Communication: The marginal benefits of communication tasks in edge devices in terms of CPU core allocation are diminishing. The time required for communication tasks can be approximated by the following function:
[0019]
[0020] Where g(y,c) represents the time required for a communication task with data volume y and c CPU cores allocated for communication. b1·c means that the communication speed increases linearly with the number of cores, while b2·log(b3·c) means that the improvement decreases logarithmically with the number of allocated cores. The constants b1, b2, and b3 define specific characteristics of this relationship. The formula shows that initially, increasing the number of cores c dedicated to communication can significantly reduce the communication time, but after a certain point, the effect becomes less significant.
[0021] Furthermore, in step (2), it is assumed that the iterative process of knowledge distillation in the edge computing environment involves N Comm and Comp task cycles, each cycle consisting of Forward and Backward tasks. The parallel execution of Comm and Comp tasks highlights the inherent resource contention and its impact on the speed of the two processes, so a time optimization task around N cycles is proposed, including:
[0022] ① Propose constraints: Consider that Comm is a continuous process, the distillation temperature coefficient T transmits logit data from the cloud, and the calculation involves forward and backward propagation, where backward depends on logits. Use the following constraints to construct a time optimization problem:
[0023] 1) Comm is uninterrupted, and logits are transmitted from the teacher model in the cloud, which requires continuous allocation of resources for data transmission until the communication task is completed;
[0024] 2) Each Backward in the Comp sequence depends on the logits of the corresponding Comm cycle. If Comm has not yet completed, the Backward must wait, resulting in a delay, such as t″;
[0025] 3) When time is greater than t end When , it means that all Comm tasks have been completed. At this time, all computing resources will be allocated to Comp tasks, that is, there are only Comm tasks in stage t″;
[0026] ②Time calculation: In the complex coordination of the system Comm and Comp, the time calculation is a key factor, especially when considering the interdependence between various calculation processes. In order to facilitate a thorough analysis, a stage-based approach is adopted to split the timeline before each reverse calculation. Assuming there are N reverse calculation instances, N+1 different time periods are determined for analysis:
[0027] 1) Figure 1 The first time period in is denoted as t1. represents the computing load of forwarding 1, It represents the communication load of the first communication cycle Comm. The duration of t1 can be expressed as:
[0028]
[0029] In this formula, and They represent the functions of quantizing the forward propagation completion time and the communication cycle, respectively. refers to After completion, reallocate the number of cores Complete the remaining calculations The duration of t1 is determined by whether the forward propagation time is less than the communication time. If it is smaller, it means that the subsequent communication cycle (for i>1) will overlap with Forward1;
[0030] 2) For t2 to t N Time periods, consider three cases. The first case, as shown in t2, consists of overlapping time t′ and computing time t″. The second case, as shown in t3, shows that communication and computing are completed in parallel. The third case, as shown in t N As shown, it occurs when there is no communication task, resulting in the reallocation of kernel resources to facilitate computing tasks. The time periods in the three cases are shown as follows:
[0031] 1. The first scenario: Communication and computing tasks overlap. For a general time period t i , which is expressed as follows:
[0032]
[0033]
[0034] 2. The second scenario: communication and computation are completed in parallel. For a general time period t i , which is expressed as follows:
[0035]
[0036]
[0037] 3. The third scenario: All communication tasks have been completed, and only the computing task remains. In this case, all resources can be redistributed to Comp. Then, for time period t i , which is expressed as follows:
[0038]
[0039] 3) For the last time period t N+1 , since there is no additional Comm task, the required time is dedicated to BackwardN. It can be expressed mathematically as follows:
[0040]
[0041] Total calculation time T total , which represents the total duration of the KD process across N segments of Comm and Comp tasks. total The optimization of T depends on an effective CPU core resource allocation strategy, and the main goal is to minimize T by optimizing the core utilization of each segment. total , ensuring that from t1 to t N The sum of the time is as short as possible. This concept can be expressed mathematically as:
[0042]
[0043] In this formula, t i (c i ) means that on a given CPU core c i The time spent in the i-th segment under the allocation condition.
[0044] In the step (3), for the three communication tasks and computing task scenarios within the knowledge distillation cycle constructed in step (2), dynamic resource allocation is used to optimize the time of each segment of the entire cycle.
[0045] Furthermore, in step (3), the content of the time optimization scheme includes the following steps:
[0046] ①Introduce state representation: define S i,j,k To indicate the state of completing the i, j, k rounds of Comm, Forward and Backward loops, state S i,j,k The time can be expressed as T(S i,j,k );
[0047] ② Propose the optimization target minT(S N,N,N ): Aims to find the final value T(S N,N,N), thereby optimizing the entire process in N cycles of Comm, Forward, and Backward;
[0048] ③ Conduct policy management on the core allocation of the CPU: Propose two constraint problems of the core allocation model, which are defined by the function Φ(S i,j,k ) and related conditions as:
[0049]
[0050]
[0051] In this function, in any state S i,j,k The total number of allocated cores does not exceed the total number of available cores c total . Among them, c comm (S) and c comp (S) represent the number of cores allocated to Comm and Comp in state S i,j,k . The function Alloc(S) dynamically determines the allocation according to the current state S i,j,k . Strategically manage the CPU allocation through three specific conditions to optimize the system performance: If i < j, that is, when Comm has not ended yet after the Backward of the corresponding previous Comp task ends, it should be ensured that all available cores are dedicated to Comm, corresponding to the first scenario proposed in step (2); If i = N, that is, when all Comm tasks are completed, redirect all resources to Comp, corresponding to the third scenario proposed in step (2); In other cases, the core allocation needs to be dynamically adjusted to adapt to the real-time changes of task requirements and system performance, corresponding to the second scenario proposed in step (2);
[0052] Among them, the specific steps for dynamically adjusting the core allocation are as follows:
[0053] 1) Allocate all the total number of CPU cores to Comp;
[0054] 2) Obtain the communication calculation and time under the given corresponding cores from the f and g formulas, and take the maximum value as the current required time;
[0055] 3) Compare the current time with the minimum time, take the smaller value and update it as the minimum time, and record the number of CPU cores currently allocated to Comm and Comp respectively;
[0056] 4) Change the CPU core allocation method, gradually increase the number of cores allocated to Comm, and loop through the above steps 2) and 3) until all allocation methods are iterated, and finally obtain the core allocation method with the lowest time consumption;
[0057] ④ Propose the state transition equation: Si,j,k The state transition at depends on the core allocation, and its mathematical expression is as follows:
[0058]
[0059] Where Δ represents the time transfer, which is defined as the shortest interval between three different time periods: the minimum completion time of the Comm, Forward, and Backward phases in a given cycle. Variables i′, j′, and k′ represent the time transfer in S i,j,k +Δ time is the number of times Comm, Forward, and Backward loops are completed respectively;
[0060] ⑤Time calculation, find the minimum value T(S N,N,N ), the steps are as follows:
[0061] 1) Time is initialized to T(S 0,0,0 )=0;
[0062] 2) According to Φ(S i,j,k ) to allocate the kernel, and c total Assigned to C Comm and c Comp ;
[0063] 3) Determine the time transfer amount Δ by the f and g formula;
[0064] 4) Update the current state to S i,j,k +Δ, i.e. S i′,j′k′ ;
[0065] 5) Based on Δ, c Comm and c Comp Update communication and computation task workloads;
[0066] 6) Repeat steps 2), 3), 4), and 5) until the KD cycle ends.
[0067] Furthermore, in step (4), a series of experiments are conducted to simulate the actual KD process based on the edge environment through a large amount of data fitting results, and the performance of the optimization scheme in different simulation scenarios is evaluated by comparing with the common method:
[0068] ① Simulation of the KD process in an actual edge environment: Using datasets of different batch sizes as input for teacher model inference and student model training, we obtain logits of different sizes and the corresponding number of communications and calculations. We use these empirical sampling data as input for the simulation framework and function (f and g) fitting (Comm and Comp workloads);
[0069] ② Set different Comm to Comp workload ratios, set them to 1:1 and 1:2 respectively, to closely simulate actual operations; and configure Comm and Comp workloads to reflect real operating data;
[0070] ③Change key parameters, such as the total number of CPU cores c total :In the c total Experiments were conducted with the number of CPU cores set to 6, 8, 10, and 12 to examine how changes in CPU core availability affect the effectiveness of resource allocation policies;
[0071] ④ Conduct 1000 experiments on each configuration random allocation algorithm, and compare the optimization scheme of the present invention with the commonly used allocation scheme:
[0072] 1) Random allocation: Considering the dependency of KD based on edge environment, CPU resources are randomly allocated in case of parallel Comm and Comp tasks;
[0073] 2) Priority-based allocation: CPU resources are exclusively allocated to Comm and Comp tasks at any given time, regardless of parallel contention;
[0074] We obtain excellent experimental results: under different workload distributions and different total number of available CPUs, the time spent by the optimization scheme can achieve near-optimal performance.
[0075] This paper deeply studies the complex challenges of the KD process in the context of edge computing, and provides unique insights into the impact of CPU core allocation on the speed of communication and computation on resource-limited edge devices. It emphasizes the ideal dependencies and constraints in edge-based KD, and introduces a dynamic resource allocation solution, changing key parameters such as the number of CPU cores and data volume through simulation experiments.
[0076] The beneficial effects of the present invention are: constructing a communication and computing task time model within the knowledge distillation cycle in a limited resource edge environment, and proposing a corresponding dynamic resource optimization method with good robustness. The constructed framework can provide further exploration and innovation for optimizing edge computing operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 (a) and Figure 1 (b) is a trend diagram of the communication and computing time under different CPU core allocations of the present invention and the change with the number of cores allocated to communication, where Figure 1 (a) is the trend of the computing time during training with bathsize = 16 and the communication time during data transmission with 1MB when 1, 2, and 3 CPU cores are allocated to the communication task in Pi. Figure 1(b) is the trend of computation time during training with bathsize = 128 and communication time during data transmission of 5MB when 1, 2, and 3 CPU cores are allocated for communication tasks in NX;
[0078] Figure 2 A scenario diagram of computing and communication tasks within the knowledge distillation cycle based on edge computing of the present invention;
[0079] Figure 3 A trend chart showing the time required for communication and calculation of the KD in the simulated actual edge environment of the present invention as a function of the number of cores allocated to the calculation;
[0080] Figure 4 (a) and Figure 4 (b) is a diagram showing the comparison of the optimization scheme proposed by the present invention with the kernel effects of priority allocation and random allocation, where Figure 4 (a) is a diagram showing the effect when the workload ratio of Comm to Comp is set to 1:1. Figure 4 (b) is a graph showing the effect when the workload ratio of Comm to Comp is set to 2:1;
[0081] Figure 5 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0082] In order to more clearly describe the technical content of the present invention, further description is given below in conjunction with specific examples.
[0083] Reference Figure 1 to Figure 5 , a CPU resource allocation optimization method within a knowledge distillation cycle based on edge computing, comprising the following steps:
[0084] (1) Establish a digital model for the temporal dependency between communication and computation by knowledge distillation in edge environments;
[0085] (2) Construct a parallel scenario of communication and computing tasks in the iterative process of knowledge distillation in edge computing, and propose a time optimization task in the entire KD cycle;
[0086] (3) Propose a strategy to optimize time management: adopt a framework based on dynamic resource allocation to achieve a near-optimal solution;
[0087] (4) Simulation experiments are conducted to evaluate the effectiveness of the optimization method in KD based on actual edge environments.
[0088] Furthermore, in step (1), considering the impact of CPU cores on the total time required for knowledge distillation, a series of control experiments were conducted on the Raspberry Pi and Jetson Xavier NX platforms to quantitatively evaluate the changes in the time required for communication and computing tasks under different CPU core allocations, such as Figure 1 (a) and Figure 1 (b) Based on the experimental results, the following function fitting is proposed to represent the relationship between communication time and computing time and CPU core allocation:
[0089] ① Computation: The time required for computing tasks in edge devices depends on the allocation of CPU cores. The relationship between the required computing time and the number of CPU cores allocated to communication can be approximated by the following function:
[0090]
[0091] Where f(x,c) is the computation time required to compute workload x on c CPU cores allocated to the communication task. The constants a1 and a2 reflect the effect of CPU allocation on computation time. In this equation, computation time increases as the number of CPU cores available for communication tasks increases. This highlights the linear reduction in computational resources as more CPU cores are allocated from computation tasks;
[0092] ② Communication: The marginal benefits of communication tasks in edge devices in terms of CPU core allocation are diminishing. The time required for communication tasks can be approximated by the following function:
[0093]
[0094] Where g(y,c) represents the time required for a communication task with data volume y and c CPU cores allocated for communication. b1·c means that the communication speed increases linearly with the number of cores, while b2·log(b3·c) means that the improvement decreases logarithmically with the number of allocated cores. The constants b1, b2, and b3 define specific characteristics of this relationship. The formula shows that initially, increasing the number of cores c dedicated to communication can significantly reduce the communication time, but after a certain point, the effect becomes less significant.
[0095] Furthermore, in step (2), it is assumed that the iterative process of knowledge distillation in the edge computing environment involves N Comm and Comp task cycles, each cycle consisting of Forward and Backward tasks. The parallel execution of Comm and Comp tasks highlights the inherent resource contention and its impact on the speed of the two processes, so a time optimization task around N cycles is proposed, including:
[0096] ① Propose constraints: Consider that Comm is a continuous process, the distillation temperature coefficient T transmits logit data from the cloud, and the calculation involves forward and backward propagation, where backward depends on logits. Use the following constraints to construct a time optimization problem:
[0097] 1) Comm is uninterrupted, and logits are transmitted from the teacher model in the cloud, which requires continuous allocation of resources for data transmission until the communication task is completed;
[0098] 2) Each Backward in the Comp sequence depends on the logits of the corresponding Comm cycle. If Comm has not yet completed, the Backward must wait, resulting in a delay, such as t″;
[0099] 3) When time is greater than t end When , it means that all Comm tasks have been completed. At this time, all computing resources will be allocated to Comp tasks, that is, there are only Comm tasks in stage t″;
[0100] ②Time calculation: In the complex coordination of the system Comm and Comp, time calculation is a key factor, especially when considering the interdependence between various calculation processes. In order to facilitate a thorough analysis, a stage-based approach is adopted to split the timeline before each reverse calculation. Assuming there are N reverse calculation instances, N+1 different time periods are determined for analysis, such as Figure 2 As shown:
[0101] 1) Figure 1 The first time period in is denoted as t1. represents the computing load of forwarding 1, It represents the communication load of the first communication cycle Comm. The duration of t1 can be expressed as:
[0102]
[0103] In this formula, and They represent the functions of quantizing the forward propagation completion time and the communication cycle, respectively. refers to After completion, reallocate the number of cores Complete the remaining calculations The duration of t1 is determined by whether the forward propagation time is less than the communication time. If it is smaller, it means that the subsequent communication cycle (for i>1) will overlap with Forward1;
[0104] 3) For t2 to tN Time periods, consider three cases. The first case, as shown in t2, consists of overlapping time t′ and computing time t″. The second case, as shown in t3, shows that communication and computing are completed in parallel. The third case, as shown in t N As shown, it occurs when there is no communication task, resulting in the reallocation of kernel resources to facilitate computing tasks. The time periods in the three cases are shown as follows:
[0105] 1. The first scenario: Communication and computing tasks overlap. For a general time period t i , which is expressed as follows:
[0106]
[0107]
[0108] 2. The second scenario: communication and computation are completed in parallel. For a general time period t i , which is expressed as follows:
[0109]
[0110]
[0111] 3. The third scenario: All communication tasks have been completed, and only the computing task remains. In this case, all resources can be redistributed to Comp. Then, for time period t i , which is expressed as follows:
[0112]
[0113] 3) For the last time period t N+1 , since there is no additional Comm task, the required time is dedicated to BackwardN. It can be expressed mathematically as follows:
[0114]
[0115] Total calculation time T total , which represents the total duration of the KD process across N segments of Comm and Comp tasks. total The optimization of T depends on an effective CPU core resource allocation strategy, and the main goal is to minimize T by optimizing the core utilization of each segment. total , ensuring that from t1 to t N The sum of the time is as short as possible. This concept can be expressed mathematically as:
[0116]
[0117] In this formula, t i (ci ) means that on a given CPU core c i The time spent in the i-th segment under the allocation condition.
[0118] In the step (3), for the three communication tasks and computing task scenarios within the knowledge distillation cycle constructed in step (2), dynamic resource allocation is used to optimize the time of each segment of the entire cycle.
[0119] Furthermore, in step (3), the content of the time optimization scheme includes the following steps:
[0120] ①Introduce state representation: define S i,j,k To indicate the state of completing the i, j, k rounds of Comm, Forward and Backward loops, state S i,j,k The time can be expressed as T(S i,j,k );
[0121] ② Propose the optimization target minT(S N,N,N ): Aims to find the final value T(S N,N,N ), thereby optimizing the entire process in N cycles of Comm, Forward, and Backward;
[0122] ③ Manage the core allocation strategy of the CPU: Two constraints of the core allocation model are proposed, and the function Φ(S i,j,k ) and the associated conditions are defined as:
[0123]
[0124]
[0125] In this function, at any state S i,j,k The total number of cores allocated does not exceed the total number of available cores c total Among them, c comm (S) and c comp (S) indicates state S i,j,k The function Alloc(S) allocates the number of cores to Comm and Comp according to the current state S i,j,kDynamic determination of allocation. Strategically manage the CPU allocation through three specific conditions to optimize system performance: If i < j, that is, when Comm has not ended after the Backward of the corresponding previous Comp task has ended, ensure that all available cores are dedicated to Comm, corresponding to the first scenario proposed in step (2); If i = N, that is, when all Comm tasks are completed, redirect all resources to Comp, corresponding to the third scenario proposed in step (2); In other cases, it is necessary to dynamically adjust the core allocation to adapt to the real-time changes in task requirements and system performance, corresponding to the second scenario proposed in step (2);
[0126] Among them, the specific steps for dynamically adjusting the core allocation are as follows:
[0127] 1) Allocate all the total number of CPU cores to Comp;
[0128] 2) Obtain the communication calculation and time under the given corresponding cores from the f and g formulas, and take the maximum value as the current required time;
[0129] 3) Compare the current time with the minimum time, take the smaller value and update it as the minimum time, and record the number of current CPU cores allocated to Comm and Comp respectively;
[0130] 4) Change the CPU core allocation method, gradually increase the number of cores allocated to Comm, and loop through the above steps 2) and 3) until all allocation methods have been iterated, and finally obtain the core allocation method with the lowest time consumption;
[0131] ④ Propose the state transition equation: s i,j,k The state transition at depends on the core allocation, and its mathematical expression is as follows:
[0132]
[0133] Among them, Δ represents the time transition amount, defined as the shortest interval between three different time periods: the minimum completion time of the Comm, Forward, and Backward phases within a given period. The variable i ′ , j ′ , k ′ represent the respective completion times of the Comm, Forward, and Backward loops at the S i,j,k +Δ moment;
[0134] ⑤ Time calculation, find the minimum value T(S N,N,N ), the steps are as follows:
[0135] 1) Initialize the time as T(S 0,0,0 ) = 0;
[0136] 2) According to Φ(S i,j,k ) to allocate the kernel, and c total Assign to c Comm and c Comp ;
[0137] 3) Determine the time transfer amount Δ by the f and g formula;
[0138] 4) Update the current state to S i,j,k +Δ, i.e. S i′,j′,k′ ;
[0139] 5) Based on Δ, c Comm and c Comp Update communication and computation task workloads;
[0140] 6) Repeat steps 2), 3), 4), and 5) until the KD cycle ends.
[0141] Furthermore, in step (4), a series of experiments are conducted to simulate the actual KD process based on the edge environment through a large amount of data fitting results, and the performance of the optimization scheme in different simulation scenarios is evaluated by comparing with the common method:
[0142] ① Simulation of the KD process in the actual edge environment: Use datasets of different batch sizes as input for teacher model inference and student model training to obtain logits of different sizes and the corresponding number of communications and calculations. Use these empirical sampling data as input for the simulation framework and function (f and g) fitting (Comm and Comp workloads), such as Figure 3 As shown;
[0143] ② Set different Comm to Comp workload ratios, set them to 1:1 and 1:2 respectively, to closely simulate actual operations; and configure Comm and Comp workloads to reflect real operating data;
[0144] ③Change key parameters, such as the total number of CPU cores c total :In the c total Experiments were conducted with the number of CPU cores set to 6, 8, 10, and 12 to examine how changes in CPU core availability affect the effectiveness of resource allocation policies;
[0145] ④ Conduct 1000 experiments on each configuration random allocation algorithm, and compare the optimization scheme of the present invention with the commonly used allocation scheme:
[0146] 1) Random allocation: Considering the dependency of KD based on edge environment, CPU resources are randomly allocated in case of parallel Comm and Comp tasks;
[0147] 2) Priority-based allocation: CPU resources are exclusively allocated to Comm and Comp tasks at any given time, regardless of parallel contention;
[0148] Excellent experimental results were obtained, such as Figure 4 (a) and Figure 4 (b) shows the time taken by the optimization scheme to achieve near-optimal performance under different workload distributions and different total number of available CPUs.
[0149] The contents described in the embodiments of this specification are merely an enumeration of the implementation forms of the inventive concept. The protection scope of the present invention should not be regarded as limited to the specific forms described in the embodiments. The protection scope of the present invention also extends to equivalent technical means that can be conceived by those skilled in the art based on the inventive concept.
Claims
1. A CPU resource allocation optimization method within a knowledge distillation cycle based on edge computing, comprising the following steps: (1) Establish a digital model for the temporal dependency between communication and computation by knowledge distillation in edge environments; (2) Construct a parallel scenario of communication and computing tasks in the iterative process of knowledge distillation in edge computing, and propose a time optimization task in the entire KD cycle; (3) Propose a strategy to optimize time management: adopt a framework based on dynamic resource allocation to achieve a near-optimal solution; (4) Simulation experiments are conducted to evaluate the effectiveness of the optimization method in KD based on actual edge environments.
2. The CPU resource allocation optimization method in the knowledge distillation cycle based on edge computing according to claim 1, characterized in that: In step (1), considering the impact of CPU cores on the total time required for knowledge distillation, a series of control experiments were conducted on the RaspberryPi and Jetson Xavier NX platforms to quantitatively evaluate the changes in the time required for communication and computing tasks under different CPU core allocations. Based on the experimental results, the following function fitting representing the relationship between communication time and computing time and CPU core allocation is proposed: ① Computation: The time required for computing tasks in edge devices depends on the allocation of CPU cores; the relationship between the required computing time and the number of CPU cores allocated to communication can be approximated by the following function: Where f(x,c) is the computation time required to compute workload x on c CPU cores allocated to the communication task; constants a1 and a2 reflect the effect of CPU allocation on computation time; in this equation, computation time increases with the number of CPU cores available for communication tasks; this highlights the linear reduction in computational resources as more CPU cores are allocated from computation tasks; ② Communication: The marginal benefits of communication tasks in edge devices in terms of CPU core allocation are diminishing. The time required for communication tasks can be approximated by the following function: Where g(y,c) represents the time required for a communication task with data volume y and c CPU cores allocated for communication; b1·c means that the communication speed increases linearly with the number of cores; and b2·log(b3·c) means that the improvement decreases logarithmically with the number of allocated cores; constants b1, b2, and b3 define specific characteristics of this relationship; the formula shows that initially, increasing the number of cores c dedicated to communication can significantly reduce the communication time, but after a certain point, the effect becomes insignificant.
3. A CPU resource allocation optimization method within a knowledge distillation cycle based on edge computing as claimed in claim 1, characterized in that, in step (2), it is assumed that the iterative process of knowledge distillation in an edge computing environment involves N Comm and Comp task cycles, each cycle consisting of Forward and Backward tasks; the parallel execution of Comm and Comp tasks highlights the inherent resource contention and its impact on the speed of the two processes, and therefore a time optimization task around N cycles is proposed, specifically including: ① Propose constraints: Consider that Comm is a continuous process, the distillation temperature coefficient T transmits logit data from the cloud, and the calculation involves forward and backward propagation, where backward depends on logits. Use the following constraints to construct a time optimization problem: 1) Comm is uninterrupted, and logits are transmitted from the teacher model in the cloud, which requires continuous allocation of resources for data transmission until the communication task is completed; 2) Each Backward in the Comp sequence depends on the logits of the corresponding Comm cycle; if Comm has not yet completed, Backward must wait, resulting in a delay, such as t"; 3) When time is greater than t end When t”, it means that all Comm tasks have been completed. At this time, all computing resources will be allocated to Comp tasks, that is, there are only Comm tasks in stage t”; ②Time calculation: In the complex coordination of the system Comm and Comp, the calculation of time is a key factor, especially when considering the interdependence between various calculation processes; in order to facilitate a thorough analysis, a stage-based approach is adopted to split the timeline before each reverse calculation; assuming that there are N reverse calculation instances, N+1 different time periods are determined for analysis: 1) The first time period is denoted as t1. represents the computing load of forwarding 1, represents the communication load of the first communication cycle Comm; the duration of t1 can be expressed as: In this formula, and Respectively represent the functions of quantizing the forward propagation completion time and the communication cycle; It means in After completion, reallocate the number of cores Complete the remaining calculations The time required; the criterion for determining the duration of t1 depends on whether the forward propagation time is less than the communication time; it is worth noting that if If it is smaller, it means that the subsequent communication cycle (for i>1) will overlap with Forward1; 2) For t2 to t N We consider three cases: the first case, as shown in t2, consists of overlapping time t' and computation time t"; the second case, as shown in t3, indicates that communication and computation are completed in parallel; the third case, as shown in t N As shown, it occurs when there is no communication task, resulting in the reallocation of kernel resources to facilitate computing tasks; the time periods in the three cases are shown as follows:
1. The first scenario: Communication and computing tasks overlap; for a general time period t i , which is expressed as follows:
2. The second scenario: communication and computation are completed in parallel; for a general time period t i , which is expressed as follows:
3. The third scenario: All communication tasks have been completed, and only the computing task remains. At this time, all resources are allowed to be redistributed to Comp. Then for time period t i , which is expressed as follows: 3) For the last time period t N+1 , since there is no additional Comm task, the required time is dedicated to BackwardN; it can be expressed mathematically as follows: Total calculation time T total , which represents the total duration of the KD process across N segments of Comm and Comp tasks; T total The optimization of T depends on an effective CPU core resource allocation strategy, and the main goal is to minimize T by optimizing the core utilization of each segment. total , ensuring that from t1 to t N The sum of the times is as short as possible; this concept can be expressed mathematically as: In this formula, t i (c i ) means that on a given CPU core c i The time spent in the i-th segment under the allocation condition.
4. The CPU resource allocation optimization method in the knowledge distillation cycle based on edge computing according to claim 3, characterized in that: In step (3), for the three communication tasks and computing task scenarios in the knowledge distillation cycle constructed in step (2), dynamic resource allocation is used to optimize the time of each segment of the entire cycle; the content of the time optimization plan includes the following steps: ①Introduce state representation: define S i,j,k To indicate the state of completing the i, j, k rounds of Comm, Forward and Backward loops, state S i,j,k The time can be expressed as T(S i,j,k ); ② Propose the optimization target minT(S N,N,N ): Aims to find the final value T(S N,N,N ), thereby optimizing the entire process in N cycles of Comm, Forward, and Backward; ③ Manage the core allocation strategy of the CPU: Two constraints of the core allocation model are proposed, and the function Φ(S i,j,k ) and the associated conditions are defined as: In this function, for any state S i,j,k the total number of allocated cores does not exceed the total number of available cores c total ; where c comm (S) and c comp (S) represent the number of cores allocated to Comm and Comp in state S i,j,k ; the function Alloc(S) dynamically determines the allocation according to the current state S i,j,k Strategically manage CPU allocation through three specific conditions to optimize system performance: If i < j, that is, when Comm has not ended after the Backward of the previous Comp task, all available cores should be dedicated to Comm, corresponding to the first scenario proposed in step (2); If i = N, that is, when all Comm tasks are completed, redirect all resources to Comp, corresponding to the third scenario proposed in step (2); In other cases, the core allocation needs to be dynamically adjusted to adapt to the real-time changes of task requirements and system performance, corresponding to the second scenario proposed in step (2); The specific steps for dynamically adjusting core allocation are as follows: 1) Allocate all CPU cores to Comp; 2) The communication calculation and time under the given corresponding kernel are obtained from the formulas f and g, and the maximum value is taken as the current required time; 3) Compare the current time with the minimum time, take the smaller value and update it as the minimum time, and record the number of CPU cores currently allocated to Comm and Comp respectively; 4) Change the CPU core allocation method, gradually increase the number of cores allocated to Comm, and repeat the above steps 2) and 3) until all allocation methods are iterated and finally the core allocation method with the lowest time consumption is obtained; ④Propose the state transfer equation: S i,j,k The state transition at depends on the core allocation, and its mathematical expression is as follows: Where Δ represents the time transfer, which is defined as the shortest interval between three different time periods: the minimum completion time of the Comm, Forward, and Backward phases in a given cycle, and the variables i', j', and k' represent the time transfer in S i,j,k +Δ time is the number of times Comm, Forward, and Backward loops are completed respectively; ⑤Time calculation, find the minimum value T(S N,N,N ), the steps are as follows: 1) Time is initialized to T(S 0,0,0 )=0; 2) According to Φ(S i,j,k ) to allocate the kernel, and c total Assign to c Comm and c Comp ; 3) Determine the time transfer amount Δ by the f and g formula; 4) Update the current state to S i,j,k +Δ, i.e. S i',j',k' ; 5) Based on Δ, c Comm and c Comp Update communication and computation task workloads; 6) Repeat steps 2), 3), 4), and 5) until the KD cycle ends.
5. The CPU resource allocation optimization method in the knowledge distillation cycle based on edge computing as described in claim 4 is characterized in that: In step (4), a series of experiments are conducted to simulate the actual KD process based on the edge environment through a large amount of data fitting results. Compared with the common method, the performance of the optimization scheme in different simulation scenarios is evaluated: ① Simulation of the KD process in an actual edge environment: Using datasets of different batch sizes as input for teacher model inference and student model training, we obtain logits of different sizes and the corresponding number of communications and calculations. We use these empirical sampling data as input for the simulation framework and function (f and g) fitting (Comm and Comp workloads); ② Set different Comm to Comp workload ratios, setting them to 1:1 and 1:2 respectively to closely simulate actual operations; at the same time, configure the Comm and Comp workloads to reflect real operating data. ③Change key parameters, such as the total number of CPU cores c total :In the c total Experiments were conducted with the number of CPU cores set to 6, 8, 10, and 12 to examine how changes in CPU core availability affect the effectiveness of resource allocation policies; ④ Conduct 1000 experiments on each configuration random allocation algorithm, and compare the optimization scheme of the present invention with the commonly used allocation scheme: 1) Random allocation: Considering the dependency of KD based on edge environment, CPU resources are randomly allocated in case of parallel Comm and Comp tasks; 2) Priority-based allocation: CPU resources are exclusively allocated to Comm and Comp tasks at any given time, regardless of parallel contention; We obtain excellent experimental results: under different workload distributions and different total number of available CPUs, the time spent by the optimization scheme can achieve near-optimal performance.
Citation Information
Patent Citations
Dependent task scheduling method for dynamic vehicle-mounted network
CN116761263A
Heterogeneous edge multi-user application system and method based on edge calculation and knowledge distillation
CN117149436A
Wireless communication resource allocation method based on federated learning and optimization theory
CN117793928A
Intrusion detection method under group learning architecture fused with knowledge distillation
CN117812593A
Cited By
Efficient large model training optimization method based on dynamic resource allocation and knowledge distillation
CN119849594A
Efficient large model training optimization method based on dynamic resource allocation and knowledge distillation
CN119849594B
Edge model scheduling method and system fusing graph nerve and hybrid expert model
CN119883660A
