An adaptive model segmentation method in multi-modal large model end-edge cloud collaborative reasoning
By employing an adaptive segmentation method for delayed prediction networks in multimodal large-scale edge-cloud collaborative inference, the basic network parameters and low-rank matrix branches are separated. Local timing and online updates are used to solve the problems of forgetting and synchronization errors in delayed prediction networks, thereby improving the stability and efficiency of the system.
Patent Information
- Application Number
- CN202611276969.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-11-24
AI Technical Summary
In existing multimodal large-scale model edge-cloud collaborative inference, delayed prediction networks are prone to forgetting prediction capabilities in historical environments, the lack of a unified clock among multiple devices leads to synchronization errors, and fine-grained timing overhead is large, making it difficult to continuously execute on resource-constrained devices.
A delay prediction network is used to separate the basic network parameters and the low-rank matrix branch. The actual execution delay is obtained through local timing. Only the low-rank matrix branch is updated online to generate an adaptive model segmentation method, avoiding cross-device clock synchronization and performing fine-grained timing only when deviation is triggered.
It enables continuous adaptation in dynamic environments, avoids predictive forgetting, improves the accuracy and response speed of delay measurement, and reduces resource consumption.
Smart Images

Figure CN123159526A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of edge-cloud collaborative reasoning technology, specifically to an adaptive model segmentation method in multimodal large-scale edge-cloud collaborative reasoning. Background Technology
[0002] In multimodal large-scale model collaborative inference at the edge and cloud, model segmentation is typically used to divide the computation graph into edge, cloud, and terminal subgraphs to improve execution efficiency. However, most existing model segmentation methods rely on static environment assumptions or global clock synchronization, making it difficult to adapt to the dynamic changes in available computing power, network bandwidth, and communication latency of terminal devices in actual deployments.
[0003] Existing online adaptive segmentation methods suffer from the following main problems in multi-device collaborative scenarios: First, delay prediction networks are prone to forgetting their prediction capabilities under changing environments; second, the lack of a unified clock among multiple devices makes timestamp-based delay measurement susceptible to synchronization errors; and third, fine-grained timing of all operators incurs significant runtime overhead, making continuous execution difficult on resource-constrained terminal devices. These issues limit the stability and deployment efficiency of multimodal large-scale model edge-cloud collaborative inference. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides an adaptive model segmentation method for multimodal large-scale edge-cloud collaborative inference, which solves the problems mentioned in the background.
[0005] To achieve the above objectives, the technical solution of the present invention is as follows: Firstly, an adaptive model segmentation method for multimodal large-scale model edge-cloud collaborative inference includes the following steps: A segmentation strategy generation network is deployed in the terminal device. The segmentation strategy generation network includes a delay prediction network and a search module. The delay prediction network has basic network parameters and a low-rank matrix branch. The basic network parameters are used to extract the common delay benchmark value under different operating environment information, and the low-rank matrix branch is used to fit the delay deviation caused by the change of operating environment information. The output layer of the latency prediction network consists of a feature extraction main network and three prediction heads. The three prediction heads are used to predict the execution latency of terminal devices, edge nodes and cloud devices, respectively, and the three prediction heads share the same low-rank matrix branch. When an inference request is received, the current operating environment information and operator features are obtained. The operating environment information and operator features are then input into the delay prediction network to obtain the prediction execution delay of each operator in the computation graph that constitutes the multimodal large model on the terminal device, edge node and cloud device respectively. The search module generates an operator allocation scheme based on the predicted execution latency and the topology of the computation graph. The operator allocation scheme specifies the execution device for each operator in the computation graph. The computation graph is divided according to the operator allocation scheme, generating end-side subgraphs, edge-side subgraphs and cloud-side subgraphs, and distributed to the corresponding devices for inference execution; The actual execution delay of each operator is returned by the receiving terminal device, edge node and cloud device. The actual execution delay is obtained by each device based on local timing and is the difference between the end time and the start time of the operator execution, without relying on cross-device clock synchronization. Compare the actual execution delay with the predicted execution delay, and initiate online parameter updates when the comparison result meets the preset deviation trigger condition; During the online parameter update process, the basic network parameters of the delay prediction network are frozen, and the parameters of the low-rank matrix branch are updated with the goal of reducing the deviation between the predicted execution delay and the actual execution delay.
[0006] Secondly, an adaptive model segmentation system for multimodal large-scale model edge-cloud collaborative inference, configured in a terminal device, includes: The inference module is used to manage the collaborative inference process between the edge and cloud. The strategy module contains a segmentation strategy generation network, which includes a delay prediction network and a search module. The delay prediction network has basic network parameters and a low-rank matrix branch. The basic network parameters are used to extract the common delay baseline value under different operating environment information, and the low-rank matrix branch is used to fit the delay deviation caused by changes in operating environment information. The delay prediction network is used to generate the predicted execution delay of each operator on terminal devices, edge nodes, and cloud devices based on the current operating environment information and operator characteristics. The search module is used to generate an operator allocation scheme based on the predicted execution delay and the topology of the computation graph. The distribution module is used to segment and distribute the computation graph according to the operator allocation scheme; The processing module is used to receive the actual execution delay of each operator on the device, returned from the terminal device, edge node and cloud device; the actual execution delay is obtained by each device based on local timing and is the difference between the end time and the start time of the operator execution, without relying on cross-device clock synchronization. The comparison module is used to compare the actual execution delay with the predicted execution delay output by the delay prediction network, and send an online update command when the comparison result meets the preset deviation trigger condition; The update module is used to freeze the basic network parameters of the delay prediction network after receiving an online update instruction, and update the parameters of the low-rank matrix branch with the goal of reducing the deviation between the predicted execution delay and the actual execution delay.
[0007] This invention provides an adaptive model segmentation method for multimodal large-scale edge-cloud collaborative inference. Compared with existing technologies, it has the following advantages: By separating the basic network parameters of the delay prediction network from the low-rank matrix branch, the basic network parameters are responsible for the common delay baseline value of the environment, while the low-rank matrix branch is responsible for the delay deviation. During online updates, the basic network parameters are frozen and only the low-rank matrix branch is updated, which can continuously adapt to environmental changes while avoiding forgetting the prediction ability in historical environments.
[0008] By timing locally on each device and recording only the start and end times of operator execution, without relying on cross-device clock synchronization, the impact of multi-device clock deviations on delay measurement is avoided, thus improving the accuracy of online data updates.
[0009] Under normal circumstances, only lightweight timing is performed on key edge operators. Fine-grained timing is then enabled on the edge and cloud sides after a deviation is triggered. The first update is performed using the edge delay, and the second update is performed after receiving the full delay. This reduces the overhead of continuous monitoring and improves the response speed in dynamic environments. Attached Figure Description
[0010] Figure 1 This is a flowchart illustrating an adaptive model segmentation method for multimodal large-scale edge-cloud collaborative inference according to the present invention.
[0011] Figure 2 This is a schematic diagram of the delay prediction network structure in the adaptive model segmentation method for multimodal large model edge-cloud collaborative inference of the present invention.
[0012] Figure 3 This is a system block diagram of an adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to the present invention. Detailed Implementation
[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] Please see Figures 1 to 3 As shown, the embodiments of the present invention provide the following technical solutions: As an embodiment of the present invention: This invention provides an adaptive model segmentation method for multimodal large-scale model edge-cloud collaborative inference. This method operates in an edge-cloud collaborative inference system comprised of terminal devices, edge nodes, and cloud devices. In this embodiment, terminal devices refer to devices with limited computing power, such as mobile terminals, IoT terminals, in-vehicle computing units, and edge gateways. Edge nodes refer to edge servers deployed at the network edge or computing nodes on the base station side. Cloud devices refer to computing nodes in a cloud data center. The terminal devices, edge nodes, and cloud devices are connected via wired or wireless networks.
[0015] The method includes the following steps: S1. Deploy a segmentation strategy generation network in the terminal device, wherein the segmentation strategy generation network consists of a delay prediction network and a search module.
[0016] The latency prediction network is used to generate the prediction execution latency of each operator in the computation graph on the terminal device, edge node, and cloud device, based on the operating environment information and operator features. Operator features include at least one of the following: operator type, shape of operator input tensor, shape of operator output tensor, operator computational cost, operator memory usage, and operator parameter scale. The operator type is represented using one-hot encoding or a learnable discrete feature embedding vector. Continuous quantities are standardized according to their respective statistical ranges and then concatenated. The operating environment information includes at least one of the following: available computing power of the terminal device, network bandwidth from the terminal device to the edge node, and network latency from the terminal device to the cloud device.
[0017] The search module generates an operator assignment scheme based on the prediction execution latency of the latency prediction network output and the topology of the computation graph. The operator assignment scheme specifies which device—terminal device, edge node, or cloud device—will execute each operator in the computation graph that constitutes the multimodal large model.
[0018] Multimodal large models refer to visual language models, image-text generation models, speech-language fusion models, etc. The computational graph of a multimodal large model consists of multiple operators. These operators include convolution operators, fully connected operators, attention operators, normalization operators, activation operators, pooling operators, embedding operators, encoding operators, and decoding operators. The computational graph represents the data dependencies between these operators.
[0019] S2. The delay prediction network employs a multilayer perceptron network. The multilayer perceptron network contains multiple linear transformation layers. In this embodiment, the last linear transformation layer of the feature extraction main network contains the original weight matrix, bias vector, first low-rank matrix, and second low-rank matrix; other linear transformation layers only contain the original weight matrix and bias vector. The first and second low-rank matrices constitute the low-rank matrix branch of that linear transformation layer. The rank of the low-rank matrix branch is less than the dimension of the original weight matrix of the corresponding linear transformation layer.
[0020] It should be noted that the rank of the low-rank matrix branch is set according to the dimension of the original weight matrix of the linear transformation layer. For example, when the dimension of the original weight matrix is 512, the rank of the low-rank matrix branch can be set to 8, 16, or 32, but it cannot exceed one-quarter of the minimum dimension of the original weight matrix, that is, it cannot exceed 128. The purpose of the low-rank matrix branch is to fit the delay deviation caused by changes in the operating environment information with a smaller number of parameters.
[0021] The forward computation process for each linear transform layer of the delayed prediction network is as follows: S2-1. The input vector, formed by concatenating operator features and runtime environment information, is multiplied by the original weight matrix to obtain the original weighted vector.
[0022] S2-2. Add the original weighted vector to the bias vector to obtain the baseline output vector.
[0023] S2-3. Calculate the product of the second low-rank matrix and the input vector to obtain the low-rank intermediate vector.
[0024] S2-4. Calculate the product of the first low-rank matrix and the low-rank intermediate vector to obtain the low-rank correction term.
[0025] S2-5. Add the reference output vector to the low-rank correction term to obtain the output vector of the linear transformation layer.
[0026] The original weight matrix and bias vector are the basic network parameters. The first and second low-rank matrices are the parameters of the low-rank matrix branch. The basic network parameters are used to extract the common latency baseline value under different operating environment information. The parameters of the low-rank matrix branch are used to fit the latency deviation caused by changes in operating environment information.
[0027] The output layer of the delay prediction network adopts a multi-task structure. The output layer consists of a main feature extraction network and three prediction heads. These three prediction heads correspond to delay prediction performed on the terminal device, edge node, and cloud device, respectively. The main feature extraction network extracts features from the input data to obtain a shared feature vector. This shared feature vector is then input into the three prediction heads, which output the prediction execution delays for their respective operators on the terminal device, edge node, and cloud device.
[0028] In this embodiment, the low-rank matrix branch is appended to the last linear transformation layer of the main feature extraction network; the output of the low-rank matrix branch is simultaneously input into the three prediction heads as shared features. Therefore, the terminal device prediction head, the edge node prediction head, and the cloud device prediction head share the same low-rank matrix branch.
[0029] S3. The delay prediction network undergoes initial training before deployment. During the initial training phase, training data encompassing various operating environment information is used to jointly optimize the parameters of the basic network and the low-rank matrix branch. The training data is constructed as follows: By simulating different terminal device computing power consumption, network bandwidth conditions, and communication latency conditions, actual execution latency samples of operators covering various operating environment information are generated. Each operating environment information corresponds to an environment identifier. Each training sample includes operator features, environment identifier, operating environment information, and the actual execution latency of the operator on the corresponding device under that operating environment information. Operator features include operator type, input tensor shape, output tensor shape, computational cost, memory consumption, etc. Operating environment information includes available computing power of the terminal device, network bandwidth from the terminal device to the edge node, and network latency from the terminal device to the cloud device, etc.
[0030] During training, batches are constructed based on environment grouping. Each training batch contains samples with the same set of operator identifiers under various runtime environment conditions.
[0031] During the joint optimization process, the variance of the output corresponding to the basic network parameters under different operating environment information is minimized through the training strategy, and the delay deviation caused by the change of operating environment information is fitted by the low-rank matrix branch.
[0032] Specifically, the predicted execution delay output by the delay prediction network is decomposed into a delay baseline component and a delay deviation component. The calculation steps for the predicted execution delay are as follows: S3-a1: Input the operator features and operating environment information into a computation path that only involves the original weight matrix and bias vector to obtain the delay reference value components.
[0033] S3-a2: Input the operator characteristics and operating environment information into the calculation path involving the low-rank matrix branch to obtain the delay bias component.
[0034] S3-a3: Add the delay baseline component and the delay deviation component to obtain the predicted execution delay.
[0035] Separation loss is also introduced, and the calculation steps for separation loss are as follows: S3-b1. For the same operator, obtain the delay reference value component calculated using only the original weight matrix and bias vector under each operating environment information.
[0036] S3-b2. Calculate the average value of the delay baseline components under all operating environment information of the operator to obtain the mean delay baseline value.
[0037] S3-b3. For each type of operating environment information, calculate the difference between the delay reference value component and the mean delay reference value under that operating environment information to obtain the reference deviation corresponding to that operating environment information.
[0038] S3-b4. Calculate the square of the benchmark deviation corresponding to each type of operating environment information to obtain the squared value of the benchmark deviation corresponding to that operating environment information.
[0039] S3-b5. Sum the squared values of the baseline deviations under all operating environment information to obtain the sum of squared baseline deviations.
[0040] S3-b6. Divide the sum of squared baseline deviations by the total number of operating environment information to obtain the separation loss.
[0041] Prediction error loss measures the overall deviation between predicted execution latency and actual execution latency. Mean squared error is used to calculate prediction error loss. The calculation steps for prediction error loss are as follows: S3-c1. For each training sample, calculate the difference between the predicted execution delay and the actual execution delay corresponding to that sample to obtain the single-sample error.
[0042] S3-c2. Squaring the single-sample error yields the single-sample squared error.
[0043] S3-c3: Sum the squared errors of the individual samples of all training samples to obtain the total sum of squared errors.
[0044] S3-c4. Divide the sum of squared errors by the number of training samples to obtain the prediction error loss.
[0045] The total loss is obtained by weighted summation of prediction error loss and separation loss. The calculation steps for the total loss are as follows: S3-d1: Multiply the separation loss by the preset separation loss weighting coefficient to obtain the weighted separation loss.
[0046] S3-d2. Add the prediction error loss to the weighted separation loss to obtain the total loss.
[0047] During training and updates, an alternating update strategy is adopted: During the calculation of the separation loss, the gradient backpropagation of the first low-rank matrix and the second low-rank matrix is stopped, and only the original weight matrix and bias vector are updated.
[0048] In the process of calculating the prediction error loss, both the basic network parameters and the parameters of the low-rank matrix branches are updated.
[0049] S4. When the terminal device receives a multimodal large model inference request, it performs the following steps: S4-1. Obtain information about the current operating environment.
[0050] The current operating environment information includes the available computing power of the terminal device, the network bandwidth from the terminal device to the edge node, and the network latency from the terminal device to the cloud device. The available computing power of the terminal device can be obtained by reading its current computing resource utilization. The network bandwidth from the terminal device to the edge node can be obtained through network interface statistics or link probing. The network latency from the terminal device to the cloud device can be obtained by sending probe packets and calculating the round-trip time.
[0051] After obtaining the current operating environment information, the components of each operating environment information are normalized / standardized: the available computing power of the terminal device is normalized to [0,1] according to its theoretical maximum computing power or rated computing power; the network bandwidth is normalized to [0,1] according to the maximum available bandwidth of the link; the network latency is normalized to the preset maximum tolerable latency using min-max normalization or Z-score standardization; the computational load, memory usage, parameter scale, etc. in the operator features are also standardized according to their respective statistical ranges. After the above processing, the input vector of the delay prediction network is dimensionless or has a uniform scale in each dimension, avoiding the influence of dimensional differences on subsequent calculations.
[0052] S4-2. Extract the operator features of each operator in the computation graph.
[0053] Operator features include at least one of the following: operator type, operator input tensor shape, operator output tensor shape, operator computational cost, operator memory usage, and operator parameter scale. Operator features can be obtained from the static description information of the computation graph, or they can be pre-computed and cached when the model is loaded.
[0054] S4-3. Input the current operating environment information and operator characteristics into the delay prediction network to obtain the prediction execution delay of each operator on the terminal device, edge node and cloud device respectively.
[0055] S4-4. The search module generates an operator allocation scheme based on the predicted execution delay and the topology of the computation graph.
[0056] In this embodiment, the search module employs a beam search algorithm. The beam search algorithm maintains multiple candidate operator allocation schemes, selects and retains several candidates with the highest overall scores at each step, and finally outputs a complete operator allocation scheme. The overall score can be the negative of the sum of the total inference delay, transmission delay, and execution delay, or it can be a weighted sum of the total inference delay and communication overhead.
[0057] The search width of the beam search algorithm can be set according to actual needs. A larger search width results in search results closer to the optimal solution, but takes longer. A smaller search width results in faster search speed, but the results may deviate from the optimal solution. In this embodiment, the beam search width can be set to an integer between 3 and 10.
[0058] S4-5. Divide the computation graph according to the operator allocation scheme to generate end-side subgraphs, edge-side subgraphs, and cloud-side subgraphs.
[0059] Specifically, each operator in the computation graph is traversed, and the operator is assigned to an end-side subgraph, edge-side subgraph, or cloud-side subgraph according to the operator allocation scheme. During the partitioning process, communication operators need to be inserted at cross-device execution edges. The communication operators are responsible for transmitting the output tensor of the operator in the upstream device to the input of the operator in the downstream device. Communication operators can include data packing operators, serialization operators, sending operators, receiving operators, deserialization operators, and data unpacking operators.
[0060] S4-6. Distribute the terminal subgraph, edge subgraph, and cloud subgraph to the terminal device, edge node, and cloud device respectively for inference.
[0061] Terminal devices execute operators in the end-side subgraph, edge nodes execute operators in the edge-side subgraph, and cloud devices execute operators in the cloud-side subgraph. Each device executes the operators sequentially according to the topological order of the subgraphs. When a communication operator is encountered, the device sends intermediate data to downstream devices or receives intermediate data from upstream devices.
[0062] When the real-time requirements of the inference request exceed a preset level, the search module can use a greedy search or reuse the historical search cache to generate an operator allocation scheme. The greedy search directly selects the candidate with the highest current score at each step, without retaining multiple candidates, resulting in a faster search speed. The historical search cache stores historical runtime environment information and corresponding operator allocation schemes. When the current runtime environment information is similar to historical runtime environment information, the historical operator allocation scheme is directly reused. The similarity judgment between the current runtime environment information and historical runtime environment information uses Euclidean distance or cosine similarity. If the distance is below a preset distance threshold or the cosine similarity is above a preset similarity threshold, they are considered similar.
[0063] S5. During the execution of their respective subgraphs, each device collects the execution delay of the operators.
[0064] In this embodiment, a timing module is embedded during the inference runtime of each device. The timing module is used to collect the actual execution latency of the operator.
[0065] The actual execution latency is obtained independently by each device based on its local time. Specifically, before an operator begins execution, the current local time is recorded as the start time of the operator's execution. After the operator finishes execution, the current local time is recorded as the end time of the operator's execution. Subtracting the start time from the end time yields the actual execution latency of the operator. Since the difference is calculated using only the local clock within a single device, and does not involve cross-device clock comparisons, it does not rely on cross-device clock synchronization.
[0066] Under normal circumstances, the timing module continuously collects the actual execution latency of only at least one key operator executed on the terminal device. A key operator can be the operator with the highest computational cost, the highest memory usage, or the operator with the greatest impact on overall inference latency in the terminal subgraph. For example, a key operator could be the convolution operator or the fully connected operator with the largest input tensor size in the terminal subgraph. Multiple key operators can also be selected for continuous monitoring.
[0067] The terminal device continuously collects the actual execution latency of key operators and compares it with the corresponding predicted execution latency output by the latency prediction network. The comparison method can be to calculate the mean absolute percentage error or to compare the deviation statistics in multiple consecutive inferences.
[0068] The preset deviation trigger conditions include one of the following two situations: Scenario 1: The mean absolute percentage error between the actual execution delay and the corresponding predicted execution delay exceeds a set threshold. The set threshold can be set to 10%, 15%, or 20%.
[0069] Scenario 2: The statistical indicator of deviation in multiple consecutive inferences exceeds the tolerance limit. The statistical indicator can be a moving average, standard deviation, or median. The tolerance limit can be set based on historical normal deviation levels.
[0070] When the comparison result meets the preset deviation trigger condition, the terminal device starts the online parameter update process.
[0071] After initiating the online parameter update process, the terminal device sends a fine-grained timing command to the edge nodes and cloud devices. The command specifies the range of operators for which fine-grained timing needs to be enabled. Upon receiving the command, the timing modules on the edge nodes and cloud devices enable fine-grained timing for all operators to be executed on the respective devices. Specifically, for each operator, the start and end times are recorded, the actual execution delay is calculated, and the actual execution delay is returned to the terminal device.
[0072] S6. After starting the online parameter update process, while waiting for the edge node and cloud device to return the fine-grained actual execution delay, the terminal device first uses the actual execution delay of the key operator on the edge side to perform the first update of the low-rank matrix branch.
[0073] The loss function updated in the first update is calculated solely based on the actual execution latency observed at the endpoint. The loss function is the deviation between the predicted execution latency and the actual execution latency. The steps for calculating the loss function are as follows: S6-a1, Obtain the predicted execution delay and actual execution delay of the key operators on the end side.
[0074] S6-a2. Calculate the difference between the predicted execution delay and the actual execution delay to obtain the single operator bias.
[0075] S6-a3. Squaring the single operator deviation yields the single operator squared deviation.
[0076] S6-a4. Sum the single operator squared deviations of all end-side critical operators to obtain the total end-side squared deviations.
[0077] S6-a5. Divide the sum of the squared deviations of the end sides by the number of key operators on the end sides to obtain the first update loss.
[0078] The gradient calculation for the first update only applies to the parameters of the low-rank matrix branch, namely the first and second low-rank matrices. The basic network parameters do not participate in the gradient update.
[0079] The first update leverages the parameter sharing of the same low-rank matrix branch used by the latency prediction network to predict execution latency for terminal devices, edge nodes, and cloud devices. Since the three prediction heads for the terminal device, edge node, and cloud device share the same low-rank matrix branch, the loss gradient calculated using the actual execution latency at the edge will simultaneously affect the parameters of the low-rank matrix branch influencing the predicted execution latency output of both edge nodes and cloud devices during backpropagation. In this way, the actual execution latency at the edge updates the parameters of the low-rank matrix branch, thereby indirectly correcting the prediction execution latency at both the edge and cloud sides.
[0080] After the terminal device receives the full, fine-grained actual execution delay returned by the edge node and / or cloud device, the terminal device performs the second update.
[0081] The second update incorporates historical samples from the experience replay buffer. In the second update, the loss function is calculated simultaneously based on the dimensions of the terminal device, edge node, and cloud device with obtained actual execution latency.
[0082] The specific steps for the second update are as follows: S6-b1, Maintain the experience replay buffer. The experience replay buffer stores historical runtime environment information and the corresponding actual execution latency. Runtime environment information includes the available computing power of the terminal device, the network bandwidth from the terminal device to the edge node, and the network latency from the terminal device to the cloud device. Actual execution latency includes the operator identifier, the actual device that executed the operator, and the actual execution latency of the operator.
[0083] S6-b2. Store the runtime environment information and actual execution delay obtained in the current inference into the experience replay buffer.
[0084] S6-b3. Sample historical samples from the experience playback buffer. The sampling method can be uniform random sampling, time-decay weighted sampling, or sampling weighted by similarity to runtime environment information.
[0085] S6-b4. Combine the historical samples obtained from sampling with the actual execution delay obtained from the current inference to form a mixed training set.
[0086] S6-b5. Calculate the deviation between the predicted execution latency output by the latency prediction network and the corresponding actual execution latency in the mixed training set to obtain the second update loss. This loss function is calculated only for the device dimension where the actual execution latency has been obtained. That is, if an operator only has the actual execution latency of the terminal device and not the actual execution latency of the edge node or cloud device, then the loss calculation only uses the deviation between the predicted execution latency and the actual execution latency of the terminal device.
[0087] S6-b6, Calculate the gradient of the second update loss with respect to the parameters of the low-rank matrix branch.
[0088] The parameters of the low-rank matrix branch are updated based on the gradient. During the update process, the basic network parameters of the delayed prediction network remain frozen.
[0089] During online parameter updates, the objective is to minimize the deviation between the predicted execution latency and the actual execution latency. Only the parameters of the low-rank matrix branch are updated. The basic network parameters remain frozen during the online update process and do not participate in gradient updates.
[0090] S7. During the online parameter update process, when the average absolute percentage error between the actual execution delay and the predicted execution delay of the edge key operator exceeds the second preset threshold, or when the overall prediction deviation of the fine-grained actual execution delay returned by the edge, cloud and end exceeds the second preset threshold, it is determined that a sudden change in the environment has occurred. The second preset threshold is a threshold greater than the preset deviation trigger condition, used to distinguish between normal deviation and sudden environmental change.
[0091] When a sudden change in the environment is detected, a decay weight is applied to the historical samples in the experience replay buffer. The decay weight uses an exponential decay method, with the decay factor ranging from 0 to 1. For example, the decay factor can be set to 0.9. Each time a decay is applied to a historical sample, the weight of the historical sample is multiplied by the decay factor to obtain the new weight.
[0092] In subsequent updates, older samples with decay weights below a preset threshold are gradually discarded. The preset threshold can be set to 0.1. When the decay weight of a historical sample falls below 0.1, the sample is removed from the experience replay buffer.
[0093] If, within the preset observation window, the moving average of the deviation remains below a second preset threshold, the attenuation is revoked, and the original weights of the historical samples are restored. The preset observation window can be set to several online update cycles. For example, the observation window can be set to five consecutive online updates. The moving average can be obtained by calculating the arithmetic mean of the most recent deviation values.
[0094] S8. During the online parameter update process, if the deviation between the actual execution delay and the predicted execution delay still does not meet the preset convergence condition after multiple consecutive online parameter updates, then consider increasing the rank of the low-rank matrix branch.
[0095] The preset convergence condition can be that the moving average of the deviation is lower than the preset convergence threshold, or that the decrease in deviation is lower than the preset minimum decrease.
[0096] Specifically, increasing the rank of a low-rank matrix branch requires the following conditions to be met simultaneously: Condition 1: After multiple consecutive online parameter updates, the deviation still fails to meet the preset convergence condition. "Multiple consecutive updates" can be set to 3, 5, or 10 consecutive updates.
[0097] Condition two: The number of samples in the experience replay buffer is greater than a set threshold. The set threshold can be determined based on the current rank of the low-rank matrix branch and the dimension of the original weight matrix of the linear transformation layer. For example, when the dimension of the original weight matrix is 512, the sample number threshold can be set to 512.
[0098] When both of the above conditions are met, the rank of the low-rank matrix branch is increased. The increased rank does not exceed one-quarter of the minimum dimension of the weight matrix of the linear transformation layer.
[0099] The specific steps of the rank expansion operation are as follows: S8-1. Keep the basic network parameters unchanged.
[0100] S8-2. Add new column vectors to the existing first low-rank matrix and new row vectors to the existing second low-rank matrix. The new dimensions are initialized with minimal random values. These minimal random values can be sampled from a Gaussian distribution with a mean of 0 and a standard deviation of 0.01.
[0101] S8-3. Use the loss function with L2 regularization in subsequent updates. The L2 regularization term is the sum of the squares of the parameters of the low-rank matrix branch multiplied by the regularization coefficient. The regularization coefficient can be set to 0.0001.
[0102] S8-4. Use the reduced learning rate in subsequent updates. The reduced learning rate can be set to 0.5 times the original learning rate.
[0103] If the number of samples in the experience replay buffer does not reach the set threshold, online parameter updates continue, and the process is repeated after each newly acquired actual execution delay is added to the buffer. The rank of the low-rank matrix branch is then increased only after the number of samples meets the threshold.
[0104] During the waiting period, the model can continue to learn through low-capacity branches and will not get stuck in a permanent deadlock.
[0105] As a second embodiment of the present invention: This embodiment also provides an adaptive model segmentation system for multimodal large-scale model edge-cloud collaborative inference. The system is installed in a terminal device and includes an inference module, a strategy module, a distribution module, a processing module, a comparison module, and an update module.
[0106] The inference module is used to manage the edge-cloud collaborative inference process.
[0107] The inference module receives inference requests and coordinates the calling relationships between the strategy module, distribution module, processing module, comparison module, and update module.
[0108] The strategy module contains a segmentation strategy generation network.
[0109] The segmentation strategy generation network comprises a delay prediction network and a search module. The delay prediction network has basic network parameters and a low-rank matrix branch. The basic network parameters are used to extract common delay baseline values under different operating environment information.
[0110] The low-rank matrix branch is used to fit the latency deviation caused by changes in runtime environment information. The latency prediction network is used to generate the predicted execution latency of each operator on terminal devices, edge nodes, and cloud devices based on the current runtime environment information and operator characteristics. The search module is used to generate an operator allocation scheme based on the predicted execution latency and the topology of the computation graph.
[0111] The distribution module is used to segment and distribute the computation graph according to the operator allocation scheme.
[0112] The distribution module traverses the operators in the computation graph, assigns operators to end-side subgraphs, edge-side subgraphs, or cloud-side subgraphs according to the operator allocation scheme, and inserts communication operators at cross-device execution edges. During distribution, the end-side subgraph is sent to the terminal device for local execution, the edge-side subgraph is sent to the edge node via the network, and the cloud-side subgraph is sent to the cloud device via the network.
[0113] The processing module is used to receive the actual execution latency of each operator on the device, returned from the terminal device, edge node, and cloud device.
[0114] The actual execution delay is obtained by each device based on local timing and is the difference between the end time of operator execution and the start time of execution, without relying on cross-device clock synchronization.
[0115] The comparison module is used to compare the actual execution delay with the predicted execution delay output by the delay prediction network, and sends an online update command when the comparison result meets the preset deviation trigger condition.
[0116] The update module is used to freeze the basic network parameters of the delay prediction network after receiving the online update instruction, and update the parameters of the low-rank matrix branch with the goal of reducing the deviation between the predicted execution delay and the actual execution delay.
[0117] As an embodiment of the present invention: This embodiment also provides a computer-readable storage medium storing a computer program that is executed by a processor, comprising the steps of an adaptive model segmentation method in multimodal large-model edge-cloud collaborative inference.
[0118] As an embodiment of the present invention: This embodiment also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. The feature is that when the processor executes the program, it implements the steps of an adaptive model segmentation method in multimodal large model edge-cloud collaborative inference.
[0119] Furthermore, any content not described in detail in this specification is existing technology known to those skilled in the art.
[0120] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "include," "contain," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0121] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
[0122] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. An adaptive model segmentation method for multimodal large-scale model edge-cloud collaborative inference, characterized in that, Includes the following steps: A segmentation strategy generation network is deployed in the terminal device. The segmentation strategy generation network includes a delay prediction network and a search module. The delay prediction network has basic network parameters and a low-rank matrix branch. The basic network parameters are used to extract the common delay benchmark value under different operating environment information, and the low-rank matrix branch is used to fit the delay deviation caused by the change of operating environment information. When receiving an inference request, obtain the current operating environment information and operator characteristics; By inputting runtime environment information and operator features into the delay prediction network, the prediction execution delay of each operator in the computation graph that constitutes the multimodal large model is obtained on the terminal device, edge node and cloud device respectively. The search module generates an operator allocation scheme based on the predicted execution latency and the topology of the computation graph, that is, it specifies the execution device for each operator in the computation graph; The computation graph is divided according to the operator allocation scheme, generating end-side subgraphs, edge-side subgraphs and cloud-side subgraphs, and distributed to the corresponding execution devices for inference; Receive fine-grained actual execution latency from edge nodes and / or cloud devices, with the actual execution latency obtained from local timing on each device; Compare the actual execution delay with the predicted execution delay, and initiate online parameter updates when the preset deviation trigger condition is met; During online parameter updates, the basic network parameters of the delay prediction network are frozen, and the parameters of the low-rank matrix branch are updated with the goal of reducing the deviation between the predicted execution delay and the actual execution delay.
2. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 1, characterized in that, In the initial training phase, the delay prediction network utilizes training data covering various operating environment information to jointly optimize the parameters of the basic network parameters and the parameters of the low-rank matrix branch. During the joint optimization process, the training strategy minimizes the variance of the output corresponding to the basic network parameters under different operating environment information, and the low-rank matrix branch fits the delay deviation caused by changes in operating environment information.
3. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 1, characterized in that, The latency prediction network is a multilayer perceptron network, and the search module adopts the beam search algorithm. The operating environment information includes the available computing power of the terminal device, the network bandwidth from the terminal device to the edge node, and the network latency from the terminal device to the cloud device. The output layer of the latency prediction network consists of a feature extraction main network and three prediction heads. The three prediction heads are used to predict the execution latency on the terminal device, the edge node, and the cloud device, respectively, and the three prediction heads share the same low-rank matrix branch. The low-rank matrix branch consists of the first low-rank matrix and the second low-rank matrix; the last linear transformation layer of the feature extraction main network contains a low-rank matrix branch, which is shared by the three prediction heads. The rank of the low-rank matrix branch is less than the dimension of the weight matrix of the linear transformation layer.
4. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 1, characterized in that, The methods for receiving actual execution delays and initiating online parameter updates are as follows: A timing module is embedded in the inference runtime of each device; under normal circumstances, the timing module continuously collects the actual execution latency of at least one key operator executed on the terminal device and compares the actual execution latency of at least one key operator with the corresponding predicted execution latency. When the comparison result meets the preset deviation trigger condition, the command is sent to the edge node and cloud device to enable the timing module to start fine-grained timing for all operators to be executed on the corresponding device, record the start time and end time of each operator, calculate the actual execution delay of the operator and return it to the terminal device; Before receiving the fine-grained actual execution latency returned by the edge node and / or cloud device, the low-rank matrix branch is updated first using the actual execution latency of the edge-side key operator. The first update utilizes the parameter sharing of the same low-rank matrix branch shared by the terminal device, edge node and cloud device in the latency prediction network. The loss gradient calculated by the actual execution latency of the edge is applied simultaneously to the parameters of the low-rank matrix branch that affects the predicted execution latency output of the edge node and cloud device, so as to indirectly correct the predicted execution latency of the edge and cloud sides. After receiving the full, fine-grained actual execution latency returned by edge nodes and / or cloud devices, a second update is performed by combining historical samples in the experience replay buffer. In the second update, the loss is calculated based on the dimensions of the terminal device, edge node, and cloud device for which the actual execution latency has been obtained.
5. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 1, characterized in that, The preset deviation trigger conditions are as follows: The mean absolute percentage error between the actual execution delay and the corresponding predicted execution delay exceeds a set threshold; or, in multiple consecutive inferences, the moving average, standard deviation, or median of the difference or absolute percentage error between the actual execution delay and the corresponding predicted execution delay of the same end-side key operator exceeds the tolerance value.
6. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 3, characterized in that, To reduce the discrepancy between predicted and actual execution latency, the parameters of the low-rank matrix branch are updated as follows: Maintain an experience replay buffer to store historical runtime environment information and the corresponding actual execution latency; Historical samples are sampled from the experience replay buffer and combined with the actual execution latency obtained from the current inference to form a mixed training set; The loss function is the deviation between the predicted execution latency output by the latency prediction network and the corresponding actual execution latency in the mixed training set. The loss function is calculated only for the device dimension where the actual execution latency has been obtained. Calculate the gradient of the loss function with respect to the parameters of the low-rank matrix branch, and update the parameters of the low-rank matrix branch based on the gradient, while keeping the basic network parameters of the delayed prediction network frozen.
7. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 6, characterized in that, When the deviation between the actual execution delay and the predicted execution delay exceeds the second preset threshold, it is determined that a sudden change has occurred in the environment. A decay weight is applied to the historical samples in the experience replay buffer, and old samples with a decay weight lower than the preset threshold are gradually discarded in subsequent updates. If the sliding average of the deviation remains below the second preset threshold within the preset observation window, the attenuation of the historical samples that have not yet been discarded is revoked, and the original weights of the historical samples that have not yet been discarded are restored.
8. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 6, characterized in that, The delay prediction network includes a linear transformation layer, with a low-rank matrix branch set in the linear transformation layer. If, after multiple consecutive online parameter updates, the deviation between the actual execution delay and the predicted execution delay still does not meet the preset convergence condition, and the number of samples in the experience replay buffer is greater than a set threshold, then the rank of the low-rank matrix branch is increased, and the increased rank does not exceed one-quarter of the minimum dimension of the weight matrix of the linear transformation layer. If the number of samples in the experience replay buffer does not reach the set threshold, online parameter updates will continue, and the process will be checked again after each new actual execution delay is added to the buffer, until the number of samples meets the threshold and the rank of the low-rank matrix branch is increased.
9. The adaptive model segmentation method in multimodal large-scale model edge-cloud collaborative inference according to claim 1, characterized in that, When the real-time requirements of the inference request are higher than the preset level, the search module adopts a greedy search or reuses the historical search cache to generate operator allocation scheme.
10. An adaptive model segmentation system for multimodal large-scale model edge-cloud collaborative inference, the system being used to execute the adaptive model segmentation method for multimodal large-scale model edge-cloud collaborative inference as described in any one of claims 1-9, characterized in that, The system includes: The inference module is used to manage the collaborative inference process between the edge and cloud. The strategy module includes a segmentation strategy generation network, which comprises a delay prediction network and a search module. The delay prediction network has basic network parameters and a low-rank matrix branch. The basic network parameters are used to extract the common delay benchmark value under different operating environment information, and the low-rank matrix branch is used to fit the delay deviation caused by changes in operating environment information. The delay prediction network is used to generate the predicted execution delay of each operator on terminal devices, edge nodes, and cloud devices based on the current operating environment information and operator characteristics; The search module is used to generate operator allocation schemes based on the predicted execution delay and the topology of the computation graph; The distribution module is used to segment and distribute the computation graph according to the operator allocation scheme; The processing module is used to receive the actual execution delay of each operator on the device, returned from the terminal device, edge node and cloud device; the actual execution delay is obtained by each device based on local timing and is the difference between the end time and the start time of the operator execution, without relying on cross-device clock synchronization. The comparison module is used to compare the actual execution delay with the predicted execution delay output by the delay prediction network, and send an online update command when the comparison result meets the preset deviation trigger condition; The update module is used to freeze the basic network parameters of the delay prediction network after receiving an online update instruction, and update the parameters of the low-rank matrix branch with the goal of reducing the deviation between the predicted execution delay and the actual execution delay.
