A model segmentation method and related device

By generating a segmentation strategy for the neural network model through a second model and evaluating the segmentation strategy based on the relationship between encoding and loss, the problem of poor generalization and resource waste caused by human intervention in the existing technology is solved, and efficient and highly generalizable model segmentation is achieved.

CN114707643BActive Publication Date: 2026-02-10HUAWEI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210375732.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-11
Publication Date
2026-02-10
Estimated Expiration
2042-04-11

AI Technical Summary

Technical Problem

Existing technologies involve excessive human intervention in the computational graph segmentation strategy of neural network models, resulting in poor generalization of the segmentation strategy and it may not be the optimal segmentation strategy. Furthermore, the large amount of input data of the trained model leads to long segmentation time and high resource consumption.

Method used

The computation graph of the neural network model is processed by the second model to generate a segmentation strategy. The feasibility of the segmentation strategy is evaluated based on the correspondence between encoding and loss, avoiding human intervention and applicable to neural network models of various structures.

Benefits of technology

It achieves efficient segmentation of neural network models with various structures, generates optimal segmentation strategies, and reduces data processing time and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114707643B_ABST
    Figure CN114707643B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a model splitting method and a related device. When the model splitting is performed, too much human intervention can be avoided, and the factors considered are more comprehensive. The model splitting can be implemented for neural network models of various structures, and optimal splitting strategies that fit actual applications can be formulated for neural network models of various structures. The method of the present application comprises: obtaining a first calculation graph of a first model; processing the first calculation graph by a second model to obtain a processing result, the processing result being used to determine a first splitting strategy of the first calculation graph; determining a first loss to be paid after the first splitting strategy acts on the first calculation graph based on a corresponding relationship between the calculation graph, the splitting strategy and the loss; and if the first loss is less than a preset threshold, splitting the first calculation graph based on the first splitting strategy to obtain a plurality of sub-calculation graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to a model segmentation method and related equipment. Background Technology

[0002] With the rapid development of technology, more and more fields can use neural network models of AI technology to achieve data processing. For example, neural network models can be used to achieve various data processing tasks such as image classification, text summarization, speech recognition, and function solving.

[0003] Neural network models can be represented as computational graphs, which typically contain multiple interconnected nodes. Each node corresponds to at least one neuron in a layer of the model, thus representing a portion of the computations that the neural network model can perform. When processing data using the computational graph of a neural network model, multiple nodes are usually run one by one, which can lead to queuing and congestion, resulting in low data processing efficiency. To solve this problem, the computational graph can be partitioned into multiple sub-computational graphs, allowing for parallel computation of these sub-computational graphs and improving data processing efficiency.

[0004] Currently, computation graph segmentation strategies are usually developed based on expert experience, which involves a lot of human intervention and often considers only a few factors. As a result, the segmentation strategies are often only applicable to computation graphs representing neural network models with certain specific structures, and the segmentation strategies obtained in this way may not be the optimal segmentation strategies for the computation graph. Summary of the Invention

[0005] This application provides a model segmentation method and related equipment. When performing model segmentation, it can avoid excessive human intervention and consider more comprehensive factors. It can segment neural network models of various structures and formulate optimal segmentation strategies that fit practical applications for various types of neural network models.

[0006] A first aspect of this application provides a model segmentation method, the method comprising:

[0007] When it is necessary to segment the first model, the first computational graph of the first model can be obtained first. The first model is the neural network model to be segmented. The first model can perform certain data processing functions; for example, it can be used for image data classification, text data summarization, or speech data recognition. The first computational graph of the first model typically contains multiple connected nodes. In these nodes, each node corresponds to at least one neuron in the same layer of the first model. Since neurons in the first model can be considered computational units, one node in the first computational graph can represent a portion of the computations that the first model can perform.

[0008] After obtaining the first computational graph of the first model, the first computational graph can be input into the second model to process the first computational graph and obtain the processing result for the first computational graph. The processing result for the first computational graph usually contains the probabilities of multiple segmentation strategies (also called segmentation behaviors). Therefore, among these multiple segmentation strategies, the segmentation strategy with the highest probability can be determined as the first segmentation strategy for the first computational graph.

[0009] After obtaining the first segmentation strategy for the first computational graph, the first loss required after the first segmentation strategy is applied to the first computational graph of the first model can be obtained. Specifically, after obtaining the first segmentation strategy for the first computational graph, the correspondence between the computational graph, the segmentation strategy, and the loss (also known as cost) can be obtained first. This correspondence can be used to evaluate whether the segmentation strategy output by the second model is feasible. Then, based on this correspondence, the first loss required after the first segmentation strategy is applied to the first computational graph of the first model can be obtained, thereby determining whether the first loss is less than a preset threshold, and thus determining whether the first segmentation strategy is feasible.

[0010] If the initial loss incurred after applying the first segmentation strategy to the first computation graph is less than a preset threshold, it indicates that the first segmentation strategy is feasible. Therefore, the first computation graph can be segmented based on the first segmentation strategy to obtain multiple sub-computation graphs. In each of these sub-computation graphs, at least one node of the first computation graph is included. Thus, the segmentation of the first computation graph is completed, which is equivalent to completing the segmentation of the first model.

[0011] As can be seen from the above method, after obtaining the first computational graph of the first model, the first computational graph can be processed by the second model to obtain the processing result, which is used to determine the first segmentation strategy of the first computational graph. Then, based on the correspondence between the computational graph, the segmentation strategy, and the loss, the first loss required after the first segmentation strategy is applied to the first computational graph can be determined. If the first loss is less than a preset threshold, the first computational graph is segmented based on the first segmentation strategy to obtain multiple sub-computational graphs. In the aforementioned process, the first segmentation strategy of the first computational graph is obtained by the second model itself by processing the first computational graph. After obtaining the first segmentation strategy, the first loss required after the first segmentation strategy is applied to the first computational graph can also be estimated, thereby evaluating whether the first segmentation strategy is feasible. This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models with various structures (with strong generalization) and can formulate optimal segmentation strategies for various neural network models that fit practical applications (with better model segmentation effect).

[0012] In one possible implementation, the first computation graph contains multiple nodes, each node representing a portion of the computation achievable by the first model. The method further includes: encoding the multiple nodes of the first computation graph to obtain multiple first codes corresponding one-to-one with each node; and processing the first computation graph through a second model to obtain a processing result, including processing the multiple first codes through the second model to obtain a processing result. In the aforementioned implementation, before inputting the first computation graph into the second model, for any given node in the first computation graph, the node can be encoded first to obtain a first code corresponding to that node. It is worth noting that the data volume of the first code corresponding to that node is much smaller than the data volume of the node itself, thus reducing the amount of input data to the second model. Similarly, for the other nodes besides the first node, the same operation can be performed, thus obtaining first codes corresponding to the other nodes. In this way, multiple first codes corresponding one-to-one with the multiple nodes of the first computation graph can be obtained. After obtaining the multiple first codes corresponding one-to-one with the multiple nodes of the first computation graph, these multiple first codes can be input into the second model for processing to obtain a processing result. Specifically, the processing result typically contains the probabilities of encoding multiple segmentation strategies. Therefore, among these multiple encodings, the encoding with the highest probability can be determined as the second encoding, and the segmentation strategy indicated by the second encoding can be determined as the first segmentation strategy for the first computation graph. Since the input of the second model is not multiple nodes of the first computation graph, but multiple first encodings corresponding one-to-one with these nodes, the number of first encodings is much smaller than the data volume of the nodes themselves. In this way, the amount of data that the neural network model needs to process can be effectively reduced, the time spent by the model to obtain the segmentation strategy can be reduced, and the resources occupied by the model in obtaining the segmentation strategy can be saved.

[0013] In one possible implementation, the correspondence between the computation graph, the segmentation strategy, and the loss is the same as the correspondence between encoding and loss. Based on this correspondence, determining the first loss required after the first segmentation strategy is applied to the first computation graph includes: fusing multiple first and second codes to obtain a third code; and determining the first loss required after the first segmentation strategy is applied to the first computation graph based on the correspondence between encoding and loss and the third code. In the aforementioned implementation, the correspondence between the computation graph, the segmentation strategy, and the loss can be represented as a correspondence between encoding and loss. For example, this correspondence can be a curve on a two-dimensional coordinate system, where the horizontal axis represents the code obtained by fusing the encoding of the nodes in the computation graph with the encoding of the segmentation strategy, and the vertical axis represents the loss, etc. Therefore, the first loss required after the first segmentation strategy is applied to the first computation graph can be obtained as follows: first, fusing multiple first and second codes to obtain a third code. After obtaining the third code, the loss corresponding to the third code can be accurately determined from the correspondence between encoding and loss; this loss is the first loss required after the first segmentation strategy is applied to the first computation graph.

[0014] In one possible implementation, fusing multiple first and second codes to obtain a third code includes: performing iterative operations on multiple first and second codes using a graph kernel algorithm to obtain the third code. In the aforementioned implementation, when fusing multiple first and second codes, the fusion operation can be implemented using a graph kernel algorithm (Weisfeiler-Lehman (WL) graph kernel algorithm). This involves first adding (or concatenating) multiple first and second codes, and then performing iterative operations based on the graph kernel algorithm on the added (or concatenated) code to accurately obtain the third code.

[0015] In one possible implementation, the correspondence between the computation graph, the splitting strategy, and the loss is usually pre-deployed. This correspondence can be constructed based on the second computation graph of the third model, the second splitting strategy for the second computation graph, and the second loss required after the second splitting strategy is applied to the second computation graph. Here, the second computation graph of the third model is the training data of the second model (i.e., the data used in the training process of the second model), and the second splitting strategy for the second computation graph and the second loss required after the second splitting strategy is applied to the second computation graph are both known data, i.e., real data.

[0016] In one possible implementation, since the first partitioning strategy can be used to partition the first computation graph into multiple sub-computation graphs, the first loss can refer to the loss required to achieve data processing (i.e., the data processing that the first model can achieve) through these multiple sub-computation graphs. For example, the first loss can refer to the time required to achieve data processing through these multiple sub-computation graphs, or the resources (e.g., computing resources, storage resources, and communication resources) occupied by achieving data processing through these multiple sub-computation graphs, etc.

[0017] In one possible implementation, the method further includes: if the first loss is greater than or equal to a preset threshold, then the first computation graph is not segmented. In the aforementioned implementation, if the first loss required after the first segmentation strategy is applied to the first computation graph is greater than or equal to the preset threshold, it indicates that the first segmentation strategy is not feasible. Therefore, not segmenting the first computation graph makes the solution more comprehensive.

[0018] A second aspect of this application provides a method for evaluating a model's segmentation strategy, the method comprising:

[0019] When training the fourth model (i.e., the neural network model to be trained), a batch of training data can be obtained first. This batch of training data includes the second computation graph of the third model. The second computation graph contains multiple nodes, and each node corresponds to at least one neuron in the same layer of the third model. That is, a node can be used to represent a part of the operations that the third model can perform. Since the second computation graph of the third model is used as training data, the second segmentation strategy (the true segmentation strategy) for the second computation graph and the second loss (the true loss) required after the second segmentation strategy is applied to the second computation graph are both known data.

[0020] After obtaining the second computational graph of the third model, the second segmentation strategy for the second computational graph, and the second loss required after the second segmentation strategy is applied to the second computational graph, a correspondence between the computational graph, the segmentation strategy, and the loss can be constructed based on this information. This correspondence can be used to evaluate whether the segmentation strategy output by the second model is feasible. For example, this correspondence can be used to obtain the first loss required after the first segmentation strategy is applied to the first computational graph of the first model, thereby determining whether the first loss is less than a preset threshold, so as to determine whether the first segmentation strategy is feasible.

[0021] The second model trained by the above method can be used to process the first computation graph of the first model to obtain a first segmentation strategy for the first computation graph. Furthermore, the correspondence between the computation graph, the segmentation strategy, and the loss constructed by the above method is also used to estimate the first loss required after the first segmentation strategy is applied to the first computation graph, thereby evaluating whether the first segmentation strategy is feasible. It can be seen that the embodiments of this application provide a new model segmentation method (framework). This model segmentation method can avoid excessive human intervention and consider more comprehensive factors. It can achieve model segmentation for neural network models with various structures (with strong generalization) and can formulate optimal segmentation strategies for neural network models with various structures that fit actual applications (with better model segmentation effect).

[0022] In one possible implementation, the second computation graph contains multiple nodes, with each node representing a portion of the computations achievable by the third model. Based on the second computation graph, the second partitioning strategy, and the second loss, the correspondence between the computation graph, the partitioning strategy, and the loss is constructed by: encoding the multiple nodes of the second computation graph to obtain multiple fourth codes corresponding one-to-one with each node; encoding the second partitioning strategy to obtain a fifth code; fusing the multiple fourth codes and the fifth code to obtain a sixth code; and constructing the correspondence between the code and the loss based on the sixth code and the second loss. In the aforementioned implementation, the correspondence between the computation graph, the partitioning strategy, and the loss can be presented as a correspondence between the code and the loss. Therefore, the correspondence between the code and the loss can be constructed in the following way: among the multiple nodes of the second computation graph, for any given node, the node can be encoded first to obtain the fourth code corresponding to that node. It is worth noting that the amount of data in the fourth code corresponding to that node is much smaller than the amount of data in the node itself, thus reducing the amount of input data for the fourth model. Similarly, for all nodes other than the one mentioned, the same operations performed on that node can be executed, thus obtaining a fourth code corresponding to the remaining nodes. This results in multiple fourth codes corresponding one-to-one with multiple nodes in the second computation graph. Furthermore, the second partitioning strategy for the second computation graph can be encoded to obtain a fifth code, which indicates the second partitioning strategy for the second computation graph. The multiple fourth codes corresponding one-to-one with multiple nodes in the second computation graph and the fifth code indicating the second partitioning strategy are then merged to obtain a sixth code.

[0023] In one possible implementation, fusing multiple fourth and fifth codes to obtain a sixth code involves iteratively operating a graph kernel algorithm on the multiple fourth and fifth codes to obtain the sixth code. In the aforementioned implementation, the fusion of multiple fourth and fifth codes can be achieved using a graph kernel algorithm. This involves first adding (or concatenating) the multiple fourth and fifth codes, and then performing iterative operations based on the graph kernel algorithm on the added (or concatenated) code to obtain the sixth code.

[0024] In one possible implementation, the method further includes: processing the second computational graph using a fourth model to obtain a processing result, the processing result being used to determine a third segmentation strategy for the second computational graph; obtaining a target loss based on the second and third segmentation strategies, the target loss being used to indicate the difference between the second and third segmentation strategies; and updating the parameters of the fourth model based on the target loss until the model training conditions are met, thus obtaining the second model. In the aforementioned implementation, after obtaining the second computational graph for the third model, the second computational graph can be input into the fourth model to process it and obtain a processing result. This processing result typically contains probabilities of multiple segmentation strategies, so the segmentation strategy with the highest probability among these multiple segmentation strategies can be determined as the third segmentation strategy for the second computational graph. A third segmentation strategy for the second computational graph is obtained. Since the second segmentation strategy for the second computational graph is known, a pre-defined target loss function can be used to calculate both the second and third segmentation strategies for the second computational graph, yielding a target loss. The target loss indicates the difference between the second and third segmentation strategies for the second computational graph. Based on the target loss, the parameters of the fourth model are updated, resulting in the updated fourth model. Subsequently, another batch of training data can be acquired to continue training the updated fourth model until the model training conditions are met (e.g., target loss convergence), thus obtaining the second model.

[0025] In one possible implementation, processing the second computation graph using a fourth model yields the following results: encoding multiple nodes of the second computation graph to obtain multiple fourth codes corresponding one-to-one with each node; and processing these multiple fourth codes using the fourth model to obtain the final processing result. In this implementation, for any given node in the second computation graph, the node can be encoded first to obtain a corresponding fourth code. Notably, the amount of data in the fourth code corresponding to this node is much smaller than the amount of data in the node itself, thus reducing the amount of input data to the fourth model. Similarly, for the remaining nodes, the same operations can be performed, resulting in fourth codes corresponding to the other nodes. In this way, multiple fourth codes corresponding one-to-one with each node in the second computation graph can be obtained. After obtaining multiple fourth codes that correspond one-to-one with multiple nodes of the second computation graph, these multiple fourth codes can be input into the fourth model to process them and obtain the processing result. The processing result usually contains the probabilities of the codes of multiple segmentation strategies. Therefore, the segmentation strategy indicated by the code with the highest probability can be determined as the third segmentation strategy for the second computation graph.

[0026] In one possible implementation, the third model is used to implement data processing, and the second loss is the time required to implement data processing through multiple sub-computation graphs, which are obtained by partitioning the second sub-computation graph based on a second partitioning strategy. In the aforementioned implementation, since the second partitioning strategy can be used to partition the second computation graph into multiple sub-computation graphs, the second loss can refer to the loss incurred in implementing data processing (i.e., the data processing that the third model can implement) through these multiple sub-computation graphs. For example, the second loss can be the time required to run these multiple sub-computation graphs to implement data processing, or the resources (computing resources, storage resources, communication resources, etc.) occupied by running these multiple sub-computation graphs to implement data processing, etc.

[0027] A third aspect of this application provides a model segmentation apparatus, comprising: an acquisition module for acquiring a first computational graph of a first model; a processing module for processing the first computational graph using a second model to obtain a processing result, the processing result being used to determine a first segmentation strategy for the first computational graph; a determination module for determining a first loss required after the first segmentation strategy is applied to the first computational graph; and a segmentation module for segmenting the first computational graph based on the first segmentation strategy to obtain multiple sub-computational graphs if the first loss is less than a preset threshold.

[0028] As can be seen from the above device, after obtaining the first computational graph of the first model, the first computational graph can be processed by the second model to obtain the processing result, which is used to determine the first segmentation strategy of the first computational graph. Then, based on the correspondence between the computational graph, the segmentation strategy, and the loss, the first loss required after the first segmentation strategy is applied to the first computational graph can be determined. If the first loss is less than a preset threshold, the first computational graph is segmented based on the first segmentation strategy to obtain multiple sub-computational graphs. In the aforementioned process, the first segmentation strategy of the first computational graph is obtained by the second model itself by processing the first computational graph. After obtaining the first segmentation strategy, the first loss required after the first segmentation strategy is applied to the first computational graph can also be estimated, thereby evaluating whether the first segmentation strategy is feasible. This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models with various structures (with strong generalization) and can formulate optimal segmentation strategies for various neural network models that fit practical applications (with better model segmentation effect).

[0029] In one possible implementation, the first computation graph contains multiple nodes, and each node represents a portion of the computation that can be performed by the first model. The device further includes: an encoding module for encoding the multiple nodes of the first computation graph to obtain multiple first codes that correspond one-to-one with the multiple nodes; and a processing module for processing the multiple first codes through a second model to obtain a processing result.

[0030] In one possible implementation, a determination module is used to determine the first loss required after the first partitioning strategy is applied to the first computation graph, based on the correspondence between the computation graph, the partitioning strategy, and the loss.

[0031] In one possible implementation, the correspondence between the computation graph, the segmentation strategy, and the loss is the correspondence between the encoding and the loss. The processing result is used to determine the second encoding, which is used to indicate the first segmentation strategy of the first computation graph. The determining module is used to: fuse multiple first and second encodings to obtain a third encoding; and based on the correspondence between the encoding and the loss and the third encoding, determine the first loss required after the first segmentation strategy is applied to the first computation graph.

[0032] In one possible implementation, a determination module is used to iteratively operate on multiple first and second codes using a graph kernel algorithm to obtain a third code.

[0033] In one possible implementation, the correspondence between the computation graph, the splitting strategy, and the loss is constructed based on the second computation graph of the third model, the second splitting strategy of the second computation graph, and the second loss required after the second splitting strategy is applied to the second computation graph. The second computation graph is the training data of the second model, and the second splitting strategy and the second loss are known data.

[0034] In one possible implementation, the first model is used to implement data processing, and the first loss is the time required to implement data processing through multiple sub-computation graphs.

[0035] In one possible implementation, the device further includes a non-segmentation module, configured not to segment the first computation graph if the first loss is greater than or equal to a preset threshold.

[0036] A fourth aspect of this application provides a model segmentation strategy evaluation device, comprising: a first acquisition module, configured to acquire a second computation graph of a third model, a second segmentation strategy of the second computation graph, and a second loss required after the second segmentation strategy is applied to the second computation graph, wherein the second computation graph is training data of the second model, and the second segmentation strategy and the second loss are known data; and a construction module, configured to construct a correspondence between the computation graph, the segmentation strategy, and the loss based on the second computation graph, the second segmentation strategy, and the second loss, wherein the correspondence is used to acquire the first loss required after the first segmentation strategy is applied to the first computation graph of the first model, wherein the first segmentation strategy is obtained by the second model processing the first computation graph.

[0037] The second model trained by the above-mentioned device can be used to process the first computation graph of the first model to obtain a first segmentation strategy for the first computation graph. The correspondence between the computation graph, the segmentation strategy and the loss constructed by the above-mentioned device is also used to estimate the first loss required after the first segmentation strategy is applied to the first computation graph, thereby evaluating whether the first segmentation strategy is feasible. It can be seen that the embodiments of this application provide a new model segmentation method (framework). This model segmentation method can avoid too much human intervention and consider more comprehensive factors. It can realize model segmentation for neural network models with various structures (with strong generalization) and can formulate the optimal segmentation strategy for neural network models with various structures that fit the actual application (with better model segmentation effect).

[0038] In one possible implementation, the second computation graph contains multiple nodes, each node representing a portion of the computations that the third model can perform. The construction module is used to: encode the multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes, and encode the second segmentation strategy to obtain a fifth code; fuse the multiple fourth codes and the fifth code to obtain a sixth code; and construct the correspondence between the code and the loss based on the sixth code and the second loss.

[0039] In one possible implementation, a module is constructed to iteratively operate on multiple fourth and fifth codes using a graph kernel algorithm to obtain a sixth code.

[0040] In one possible implementation, the device further includes: a processing module for processing the second computation graph through a fourth model to obtain a processing result, the processing result being used to determine a third segmentation strategy for the second computation graph; a second acquisition module for acquiring a target loss based on the second and third segmentation strategies, the target loss being used to indicate the difference between the second and third segmentation strategies; and an update module for updating the parameters of the fourth model based on the target loss until the model training conditions are met to obtain the second model.

[0041] In one possible implementation, the processing module is used to: encode multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes; and process these multiple fourth codes through a fourth model to obtain the processing result.

[0042] In one possible implementation, the third model is used to implement data processing, and the second loss is the time required to implement data processing through multiple sub-computation graphs, which are obtained by dividing the second sub-computation graph based on the second partitioning strategy.

[0043] A fifth aspect of this application provides a model segmentation apparatus, which includes a memory and a processor. The memory stores code, and the processor is configured to execute the code. When the code is executed, the model segmentation apparatus performs the following steps: obtaining a first computational graph of a first model; processing the first computational graph using a second model to obtain a processing result, the processing result being used to determine a first segmentation strategy for the first computational graph; determining a first loss required after the first segmentation strategy is applied to the first computational graph; if the first loss is less than a preset threshold, segmenting the first computational graph based on the first segmentation strategy to obtain multiple sub-computational graphs.

[0044] As can be seen from the above device, after obtaining the first computational graph of the first model, the first computational graph can be processed by the second model to obtain the processing result, which is used to determine the first segmentation strategy of the first computational graph. Then, based on the correspondence between the computational graph, the segmentation strategy, and the loss, the first loss required after the first segmentation strategy is applied to the first computational graph can be determined. If the first loss is less than a preset threshold, the first computational graph is segmented based on the first segmentation strategy to obtain multiple sub-computational graphs. In the aforementioned process, the first segmentation strategy of the first computational graph is obtained by the second model itself by processing the first computational graph. After obtaining the first segmentation strategy, the first loss required after the first segmentation strategy is applied to the first computational graph can also be estimated, thereby evaluating whether the first segmentation strategy is feasible. This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models with various structures (with strong generalization) and can formulate optimal segmentation strategies for various neural network models that fit practical applications (with better model segmentation effect).

[0045] In one possible implementation, the model segmentation device is further used to encode multiple nodes of the first computation graph to obtain multiple first codes that correspond one-to-one with the multiple nodes; the model segmentation device is used to process the multiple first codes through a second model to obtain a processing result.

[0046] In one possible implementation, determining the first loss required after the first partitioning strategy is applied to the first computation graph includes: determining the first loss required after the first partitioning strategy is applied to the first computation graph based on the correspondence between the computation graph, the partitioning strategy and the loss.

[0047] In one possible implementation, the correspondence between the computation graph, the segmentation strategy, and the loss is the correspondence between the encoding and the loss. The processing result is used to determine the second encoding, which is used to indicate the first segmentation strategy of the first computation graph. The model segmentation device is used to: fuse multiple first and second encodings to obtain a third encoding; and determine the first loss required after the first segmentation strategy is applied to the first computation graph based on the correspondence between the encoding and the loss and the third encoding.

[0048] In one possible implementation, the model segmentation device is used to iteratively operate on multiple first and second codes using a graph kernel algorithm to obtain a third code.

[0049] In one possible implementation, the correspondence between the computation graph, the splitting strategy, and the loss is constructed based on the second computation graph of the third model, the second splitting strategy of the second computation graph, and the second loss required after the second splitting strategy is applied to the second computation graph. The second computation graph is the training data of the second model, and the second splitting strategy and the second loss are known data.

[0050] In one possible implementation, the first model is used to implement data processing, and the first loss is the time required to implement data processing through multiple sub-computation graphs.

[0051] In one possible implementation, the model segmentation device is further configured to not segment the first computation graph if the first loss is greater than or equal to a preset threshold.

[0052] A sixth aspect of this application provides a model segmentation strategy evaluation device, which includes a memory and a processor. The memory stores code, and the processor is configured to execute the code. When the code is executed, the model segmentation strategy evaluation device performs the following steps: obtaining a second computation graph of a third model, a second segmentation strategy of the second computation graph, and a second loss required after the second segmentation strategy is applied to the second computation graph. The second computation graph is the training data of the second model, and the second segmentation strategy and the second loss are known data. Based on the second computation graph, the second segmentation strategy, and the second loss, a correspondence between the computation graph, the segmentation strategy, and the loss is constructed. The correspondence is used to obtain the first loss required after the first segmentation strategy is applied to the first computation graph of the first model. The first segmentation strategy is obtained by the second model processing the first computation graph.

[0053] The second model trained by the above-mentioned device can be used to process the first computation graph of the first model to obtain a first segmentation strategy for the first computation graph. The correspondence between the computation graph, the segmentation strategy and the loss constructed by the above-mentioned device is also used to estimate the first loss required after the first segmentation strategy is applied to the first computation graph, thereby evaluating whether the first segmentation strategy is feasible. It can be seen that the embodiments of this application provide a new model segmentation method (framework). This model segmentation method can avoid too much human intervention and consider more comprehensive factors. It can realize model segmentation for neural network models with various structures (with strong generalization) and can formulate the optimal segmentation strategy for neural network models with various structures that fit the actual application (with better model segmentation effect).

[0054] In one possible implementation, the second computation graph contains multiple nodes, each node representing a portion of the computations that the third model can perform. The model's segmentation strategy evaluation device is used to: encode the multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes, and encode the second segmentation strategy to obtain a fifth code; fuse the multiple fourth codes and the fifth code to obtain a sixth code; and construct a correspondence between the code and the loss based on the sixth code and the second loss.

[0055] In one possible implementation, the model's segmentation strategy evaluation device is used to iteratively operate on multiple fourth and fifth codes using a graph kernel algorithm to obtain a sixth code.

[0056] In one possible implementation, the model's segmentation strategy evaluation device is further configured to: process the second computational graph using the fourth model to obtain a processing result, the processing result being used to determine a third segmentation strategy for the second computational graph; obtain a target loss based on the second and third segmentation strategies, the target loss being used to indicate the difference between the second and third segmentation strategies; and update the parameters of the fourth model based on the target loss until the model training conditions are met, thereby obtaining the second model.

[0057] In one possible implementation, the model's segmentation strategy evaluation device is used to: encode multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes; and process these multiple fourth codes through a fourth model to obtain the processing result.

[0058] In one possible implementation, the third model is used to implement data processing, and the second loss is the time required to implement data processing through multiple sub-computation graphs, which are obtained by dividing the second sub-computation graph based on the second partitioning strategy.

[0059] A seventh aspect of this application provides a circuit system including a processing circuit configured to perform the method described in the first aspect, any possible implementation of the first aspect, or the method described in the second aspect.

[0060] An eighth aspect of this application provides a chip system including a processor for calling a computer program or computer instructions stored in a memory to cause the processor to perform the method described in the first aspect, any possible implementation of the first aspect, or the method described in the second aspect.

[0061] In one possible implementation, the processor is coupled to the memory via an interface.

[0062] In one possible implementation, the chip system also includes a memory that stores computer programs or computer instructions.

[0063] A ninth aspect of this application provides a computer storage medium storing a computer program that, when executed by a computer, causes the computer to perform the method described in the first aspect, any possible implementation of the first aspect, or the method described in the second aspect.

[0064] A tenth aspect of this application provides a computer program product storing instructions that, when executed by a computer, cause the computer to perform the method described in the first aspect, any possible implementation of the first aspect, or the method described in the second aspect.

[0065] In this embodiment, after obtaining the first computational graph of the first model, the first computational graph can be processed by the second model to obtain the processing result, which is used to determine the first segmentation strategy of the first computational graph. Then, based on the correspondence between the computational graph, the segmentation strategy, and the loss, the first loss required after the first segmentation strategy is applied to the first computational graph can be determined. If the first loss is less than a preset threshold, the first computational graph is segmented based on the first segmentation strategy to obtain multiple sub-computational graphs. In the aforementioned process, the first segmentation strategy of the first computational graph is obtained by the second model processing the first computational graph itself. After obtaining the first segmentation strategy, the first loss required after the first segmentation strategy is applied to the first computational graph can also be estimated, thereby evaluating whether the first segmentation strategy is feasible. This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models of various structures (with strong generalization) and can formulate optimal segmentation strategies for various neural network models that fit actual applications (with better model segmentation effect).

[0066] Furthermore, the input to the second model is not multiple nodes of the first computation graph, but multiple first codes corresponding one-to-one with these nodes. The number of first codes is much smaller than the data volume of the nodes themselves. In this way, the amount of data that the neural network model needs to process can be effectively reduced, the time spent by the model to obtain the segmentation strategy can be reduced, and the resources occupied by the model to obtain the segmentation strategy can be saved. Attached Figure Description

[0067] Figure 1 A structural diagram illustrating the main framework of artificial intelligence;

[0068] Figure 2a A schematic diagram of the model segmentation system provided in the embodiments of this application;

[0069] Figure 2bAnother structural schematic diagram of the model segmentation system provided in the embodiments of this application;

[0070] Figure 2c A schematic diagram of the related equipment for model segmentation processing provided in the embodiments of this application;

[0071] Figure 3 A schematic diagram of the system 100 architecture provided in the embodiments of this application;

[0072] Figure 4 A schematic flowchart of the model segmentation method provided in the embodiments of this application;

[0073] Figure 5 A schematic diagram of a first computational graph provided in an embodiment of this application;

[0074] Figure 6 A flowchart illustrating the segmentation strategy provided in the embodiments of this application;

[0075] Figure 7 A flowchart illustrating the graph kernel algorithm provided in this application embodiment;

[0076] Figure 8 A flowchart illustrating the method for evaluating the segmentation strategy of a model provided in an embodiment of this application;

[0077] Figure 9 A schematic diagram of the second computational graph provided in an embodiment of this application;

[0078] Figure 10 A schematic diagram of the candidate segmentation strategy provided in the embodiments of this application;

[0079] Figure 11 Another schematic diagram of the candidate segmentation strategy provided in the embodiments of this application;

[0080] Figure 12 A schematic diagram of the model segmentation device provided in the embodiments of this application;

[0081] Figure 13 A schematic diagram of the structure of the model segmentation strategy evaluation device provided in the embodiments of this application;

[0082] Figure 14 A schematic diagram of the structure of the execution device provided in the embodiments of this application;

[0083] Figure 15 A schematic diagram of the structure of the training device provided in the embodiments of this application;

[0084] Figure 16 This is a schematic diagram of the structure of a chip provided in an embodiment of this application. Detailed Implementation

[0085] This application provides a model segmentation method and related equipment. When performing model segmentation, it can avoid excessive human intervention and consider more comprehensive factors. It can segment neural network models of various structures and formulate optimal segmentation strategies that fit practical applications for various types of neural network models.

[0086] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.

[0087] With the rapid development of technology, more and more fields can use neural network models of AI technology to achieve data processing. For example, neural network models can be used to achieve various data processing tasks such as image classification, text summarization, speech recognition, and function solving.

[0088] The data processing process of a neural network model can be viewed as the process by which the neural network model performs calculations on the data. Therefore, a neural network model can be represented in the form of a computation graph. A computation graph typically contains multiple interconnected nodes, with each node corresponding to at least one neuron in a certain layer of the model. Thus, a node can represent a portion of the computations that the neural network model can perform. When an electronic device processes data through the computation graph of a neural network model, the processor usually runs multiple nodes of the computation graph one by one, which may cause queuing and congestion, resulting in low data processing efficiency. To solve this problem, the processor of the electronic device can pre-divide the computation graph and store the resulting sub-computation graphs in multiple registers of the processor. Therefore, during data processing, the processor can perform parallel operations on these multiple sub-computation graphs, thereby improving data processing efficiency.

[0089] Currently, computation graph segmentation strategies are usually developed based on expert experience, which involves a lot of human intervention and often considers only a few factors. As a result, the segmentation strategies are often only applicable to computation graphs representing certain specific neural network models (i.e., poor generalization). Moreover, the segmentation strategies obtained in this way may not be the optimal segmentation strategies for the computation graphs of neural network models (poor segmentation effect).

[0090] Furthermore, related technologies can also process the computation graph representing a certain neural network model through a trained neural network model to obtain the segmentation strategy of the computation graph of the neural network model. However, the input of a trained neural network model is often the computation graph of the entire neural network model, which usually has a large amount of data, resulting in a long time consumption and a large amount of resources in the process of obtaining the segmentation strategy.

[0091] To address the aforementioned issues, this application provides a model segmentation method that can be implemented in conjunction with artificial intelligence (AI) technology. AI technology is a discipline that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence. AI technology achieves optimal results by perceiving the environment, acquiring knowledge, and using that knowledge. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce new intelligent machines that can react in a way similar to human intelligence. Using artificial intelligence for data processing is a common application of AI.

[0092] First, the overall workflow of the artificial intelligence system is described; please refer to [link / reference]. Figure 1 , Figure 1 This is a structural diagram illustrating the main framework of artificial intelligence. The following explanation of the AI ​​framework is based on two dimensions: the "Intelligent Information Chain" (horizontal axis) and the "IT Value Chain" (vertical axis). The "Intelligent Information Chain" reflects a series of processes from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. In this process, data undergoes a condensation process of "data—information—knowledge—wisdom." The "IT Value Chain" reflects the value that artificial intelligence brings to the information technology industry, from the underlying infrastructure of human intelligence and information (provided and processed by technology) to the industrial ecosystem of the system.

[0093] (1) Infrastructure

[0094] Infrastructure provides computing power to support artificial intelligence systems, enabling communication with the external world and providing support through a basic platform. This communication occurs through sensors; computing power is provided by intelligent chips (hardware acceleration chips such as CPUs, NPUs, GPUs, ASICs, and FPGAs); and the basic platform includes distributed computing frameworks and related platform guarantees and support, which may include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to acquire data, and this data is provided to intelligent chips in the distributed computing system provided by the basic platform for computation.

[0095] (2) Data

[0096] The data at the next layer of infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data from traditional devices, including business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.

[0097] (3) Data processing

[0098] Data processing typically includes methods such as data training, machine learning, deep learning, search, reasoning, and decision-making.

[0099] Among them, machine learning and deep learning can perform intelligent information modeling, extraction, preprocessing, and training on data, including symbolization and formalization.

[0100] Reasoning refers to the process in which, in a computer or intelligent system, the machine thinks and solves problems by simulating human intelligent reasoning, based on reasoning control strategies and using formalized information. Typical functions include search and matching.

[0101] Decision-making refers to the process of making decisions based on intelligent information after reasoning, and it typically provides functions such as classification, sorting, and prediction.

[0102] (4) General ability

[0103] After the data processing mentioned above, the results of the data processing can be used to form some general capabilities, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0104] (5) Smart Products and Industry Applications

[0105] Intelligent products and industry applications refer to products and applications of artificial intelligence systems in various fields. They are the encapsulation of overall artificial intelligence solutions, productizing intelligent information decision-making and realizing practical applications. Their application areas mainly include: intelligent terminals, intelligent transportation, intelligent healthcare, autonomous driving, smart cities, etc.

[0106] The following sections will introduce several application scenarios for this application.

[0107] Figure 2a This is a schematic diagram of a model segmentation system provided in an embodiment of this application. The model segmentation system includes user equipment and data processing equipment. The user equipment includes smart terminals such as mobile phones, personal computers, or information processing centers. The user equipment is the initiator of data sequence processing; as the initiator of data sequence processing requests, requests are typically initiated by the user through the user equipment.

[0108] The aforementioned data processing equipment can be cloud servers, network servers, application servers, management servers, or other devices or servers with data processing capabilities. The data processing equipment receives text processing requests from smart terminals through an interactive interface, and then performs text processing through a storage device for storing data and a processor for data processing, employing methods such as machine learning, deep learning, search, reasoning, and decision-making. The storage device in the data processing equipment can be a general term, including local storage and a database storing historical data. The database can be located on the data processing equipment or on other network servers.

[0109] exist Figure 2a In the model segmentation system shown, the user device can receive user instructions. For example, the user device can acquire a neural network model to be segmented based on user input / selection, and then send a request to the data processing device. This causes the data processing device to perform a model segmentation application on the model acquired by the user device, thereby obtaining the processing result for the model. For instance, the user device can acquire a neural network model to be segmented based on user input, and then send a processing request to the data processing device. This causes the data processing device to represent the model as a computational graph, process the computational graph, and obtain the processing result, i.e., the segmentation strategy for the computational graph. Based on this segmentation strategy, the computational graph is then segmented into multiple sub-computational graphs, thus completing the segmentation of the computational graph (equivalent to completing the model segmentation).

[0110] exist Figure 2a In this process, the data processing device can execute the model segmentation method of the embodiments of this application.

[0111] Figure 2b This is another structural schematic diagram of the model segmentation system provided in the embodiments of this application. Figure 2b In this context, the user equipment (UE) directly functions as a data processing device. This UE can directly acquire input from the user and process it directly through its own hardware. The specific process is similar to... Figure 2a Similar to the description above, it will not be repeated here.

[0112] exist Figure 2b In the model segmentation system shown, the user device can receive the neural network model to be segmented from the user. For example, the user device can obtain a neural network model selected by the user in the user device, and then the user device itself performs a model segmentation application on the model (for example, converting the model into a computation graph and processing the computation graph of the model) to obtain the processing result for the model, that is, the segmentation strategy for the computation graph of the model. Based on the segmentation strategy, the computation graph of the model is then segmented into multiple sub-computation graphs, thereby completing the segmentation of the computation graph of the model (equivalent to completing the segmentation of the model).

[0113] exist Figure 2b In this application, the user equipment itself can execute the model segmentation method of the embodiments of this application.

[0114] Figure 2c A schematic diagram of the related equipment for model segmentation processing provided in the embodiments of this application.

[0115] The above Figure 2a and Figure 2b The user equipment in the context can specifically be Figure 2c Local device 301 or local device 302 in the system. Figure 2a The data processing equipment in the middle can specifically be Figure 2c The execution device 210 in the process includes a data storage system 250 that can store the data to be processed by the execution device 210. The data storage system 250 can be integrated into the execution device 210 or set up in the cloud or on other network servers.

[0116] Figure 2a and Figure 2b The processor in the system can perform data training / machine learning / deep learning using neural network models or other models (e.g., support vector machine-based models), and then use the data to train or learn the model to perform model segmentation applications, thereby obtaining the corresponding processing results.

[0117] Figure 3 A schematic diagram of the system 100 architecture provided in this application embodiment, in Figure 3 In the process, the execution device 110 is configured with an input / output (I / O) interface 112 for data interaction with external devices. Users can input data to the I / O interface 112 through the client device 140. The input data in this embodiment may include various scheduled tasks, callable resources, and other parameters.

[0118] During the preprocessing of input data by the execution device 110, or during the calculation module 111 of the execution device 110 performing calculations and other related processing (such as implementing the neural network function in this application), the execution device 110 may call data, code, etc. in the data storage system 150 for corresponding processing, or store the data, instructions, etc. obtained from the corresponding processing into the data storage system 150.

[0119] Finally, I / O interface 112 returns the processing result to client device 140, thereby providing it to the user.

[0120] It is worth noting that the training device 120 can generate corresponding target models / rules based on different training data for different objectives or tasks. These target models / rules can then be used to achieve the aforementioned objectives or complete the aforementioned tasks, thereby providing the user with the required results. The training data can be stored in the database 130 and originates from training samples collected by the data acquisition device 160.

[0121] exist Figure 3 In the scenario shown, the user can manually provide input data, which can be done through the interface provided by I / O interface 112. Alternatively, the client device 140 can automatically send input data to I / O interface 112. If user authorization is required for the client device 140 to automatically send input data, the user can set the corresponding permissions in the client device 140. The user can view the output results of the execution device 110 on the client device 140, which can be presented in various forms such as display, sound, or animation. The client device 140 can also act as a data acquisition terminal, collecting the input data and output results of the input I / O interface 112 as new sample data and storing them in the database 130. Alternatively, data can be collected directly from the I / O interface 112 without going through the client device 140, using the input data and output results of the input I / O interface 112 as new sample data and storing them in the database 130.

[0122] It is worth noting that, Figure 3 This is merely a schematic diagram of a system architecture provided in an embodiment of this application. The positional relationships between the devices, components, modules, etc., shown in the diagram do not constitute any limitation. For example, in Figure 3 In this context, the data storage system 150 is an external memory relative to the execution device 110. However, in other cases, the data storage system 150 can also be placed within the execution device 110. For example... Figure 3 As shown, a neural network can be trained using training device 120.

[0123] This application also provides a chip including a neural network processor (NPU). This chip can be configured as follows: Figure 3 The execution device 110 shown is used to perform the calculations of the calculation module 111. This chip can also be located in, for example... Figure 3 The training device 120 shown is used to complete the training work of the training device 120 and output the target model / rules.

[0124] The Neural Processing Unit (NPU) is a coprocessor mounted on the main central processing unit (CPU) (host CPU), where tasks are assigned by the CPU. The core of the NPU is the computation circuitry, which is controlled by a controller to retrieve data from memory (weight memory or input memory) and perform calculations.

[0125] In some implementations, the arithmetic circuitry includes multiple process engines (PEs). In some implementations, the arithmetic circuitry is a two-dimensional pulsating array. The arithmetic circuitry can also be a one-dimensional pulsating array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuitry is a general-purpose matrix processor.

[0126] For example, suppose we have an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from the weight memory and caches it in each PE (Process Equipment) of the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from the input memory and performs matrix operations with matrix B. The partial or final result of the obtained matrix is ​​stored in the accumulator.

[0127] Vector computation units can further process the output of computational circuits, such as vector multiplication, vector addition, exponentiation, logarithmic operations, size comparisons, etc. For example, vector computation units can be used for computation in non-convolutional / non-FC layers of neural networks, such as pooling, batch normalization, and local response normalization.

[0128] In some implementations, the vector computation unit can store the processed output vector into a unified buffer. For example, the vector computation unit can apply a nonlinear function to the output of the arithmetic circuit, such as a vector of accumulated values, to generate activation values. In some implementations, the vector computation unit generates normalized values, merged values, or both. In some implementations, the processed output vector can be used as activation input to the arithmetic circuit, for example, for use in subsequent layers of a neural network.

[0129] The unified memory is used to store input data and output data.

[0130] The weight data is directly transferred from the external memory to the input memory and / or unified memory, stored in the weight memory, and stored in the unified memory to the external memory through the direct memory access controller (DMAC).

[0131] The bus interface unit (BIU) is used to enable interaction between the main CPU, DMAC, and instruction fetch memory via a bus.

[0132] The instruction fetch buffer, connected to the controller, is used to store the instructions used by the controller.

[0133] The controller is used to invoke instructions cached in the memory to control the operation of the computing accelerator.

[0134] Generally, the unified memory, input memory, weight memory, and instruction fetch memory are all on-chip memories, while external memory is memory outside the NPU. This external memory can be double data rate synchronous dynamic random access memory (DDRSDRAM), high bandwidth memory (HBM), or other readable and writable memories.

[0135] Since the embodiments of this application involve a large number of neural network applications, for ease of understanding, the relevant terms and concepts such as neural networks involved in the embodiments of this application will be introduced below.

[0136] (1) Neural Network

[0137] A neural network can be composed of neural units, which can be operational units that take xs and an intercept of 1 as inputs, and whose output can be:

[0138]

[0139] Where s = 1, 2, ..., n, where n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of this activation function can be used as the input of the next convolutional layer. The activation function can be the sigmoid function. A neural network is a network formed by connecting many of the above-mentioned individual neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field, which can be a region composed of several neural units.

[0140] The work of each layer in a neural network can be described by the mathematical expression y = a(Wx + b). From a physical perspective, the work of each layer in a neural network can be understood as transforming the input space (the set of input vectors) to the output space (i.e., from the row space to the column space of a matrix) through five operations on the input space. These five operations include: 1. Dimensionality increase / decrease; 2. Magnification / scaling; 3. Rotation; 4. Translation; 5. "Bending". Operations 1, 2, and 3 are performed by Wx, operation 4 by +b, and operation 5 by a(). The term "space" is used here because the objects being classified are not individual things, but a class of things, and space refers to the set of all individuals of this class of things. Here, W is the weight vector, and each value in this vector represents the weight value of a neuron in that layer of the neural network. This vector W determines the spatial transformation from the input space to the output space mentioned above; that is, the weights W of each layer control how the space is transformed. The purpose of training a neural network is to ultimately obtain the weight matrix of all layers of the trained neural network (a weight matrix formed by the vectors W of many layers). Therefore, the training process of a neural network is essentially about learning how to control the transformation space, and more specifically, learning the weight matrix.

[0141] Because we want the output of the neural network to be as close as possible to the actual predicted value, we can compare the current network's prediction with the desired target value, and then update the weight vector of each layer of the neural network based on the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring the parameters of each layer in the neural network). For example, if the network's prediction is too high, the weight vector is adjusted to make it predict lower, and this adjustment is continued until the neural network can predict the actual target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value," which is the loss function or objective function. These are important equations used to measure the difference between the predicted value and the target value. Taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so training the neural network becomes the process of minimizing this loss as much as possible.

[0142] (2) Backpropagation algorithm

[0143] Neural networks can employ backpropagation (BP) to correct the parameters of the initial neural network model during training, thereby reducing the reconstruction error loss. Specifically, forward propagation of the input signal to the output generates error loss; this error loss information is then propagated back to update the parameters of the initial neural network model, leading to convergence of the error loss. The backpropagation algorithm is an error-loss-driven backpropagation process aimed at obtaining the optimal parameters of the neural network model, such as the weight matrix.

[0144] (3) Calculation graph

[0145] Computational graphs can serve as a representation of neural networks. A computational graph typically contains multiple connected nodes, where each node corresponds to at least one neuron in the same layer of the neural network. Since a neuron is the computational unit in a neural network, after receiving input, it can use its own parameters to perform calculations on that input to obtain the corresponding output. Therefore, a node can be represented as y = f(x), where x is the input of at least one neuron corresponding to that node, f(x) represents the calculation performed by at least one neuron corresponding to that node, and y is the output of at least one neuron corresponding to that node. It is evident that this node can represent a portion of the computations that a neural network can perform. In this way, neural networks with many parameters can be represented by a relatively simplified computational graph, which is beneficial for processors to run and store neural networks.

[0146] The method provided in this application is described below from the perspectives of neural network training and neural network application.

[0147] The model segmentation strategy evaluation method provided in this application involves data sequence processing and can be applied to data training, machine learning, deep learning, and other methods. It performs symbolic and formal intelligent information modeling, extraction, preprocessing, and training on training data (e.g., the second computation graph of the third model in this application) to ultimately obtain a trained neural network (e.g., the second model in this application). Furthermore, the model segmentation method provided in this application can utilize the trained neural network to input input data (e.g., the first computation graph of the first model in this application) into the trained neural network to obtain output data (e.g., the first segmentation strategy of the first computation graph in this application). It should be noted that the model segmentation strategy evaluation method and the model segmentation method provided in this application are inventions based on the same concept and can be understood as two parts of a system or two stages of an overall process: such as the model training stage and the model application stage.

[0148] Figure 4A flowchart illustrating the model segmentation method provided in this application embodiment is shown below. Figure 4 As shown, the method includes:

[0149] 401. Obtain the first computation graph of the first model.

[0150] In this embodiment, when it is necessary to segment the first model, the first computational graph of the first model can be obtained first. The first model is the neural network model to be segmented. The first model can be used to implement data processing functions; for example, it can be used for image data classification, text data summarization, or speech data recognition. The first computational graph of the first model can contain multiple connected nodes. In these multiple nodes, one node corresponds to at least one neuron in the same layer of the first model. Since the neurons in the first model can be considered as computational units (possessing certain computational functions) in the first model, one node in the multiple nodes of the first computational graph can be used to represent a portion of the computations that the first model can perform. For example, as... Figure 5 As shown ( Figure 5 (A schematic diagram of a first computational graph provided in an embodiment of this application) The first model comprises 5 nodes located in 5 layers: layer 1 is the input layer, layer 2 is the convolutional layer, layer 3 is the normalization layer, layer 4 is the activation layer, and layer 5 is the output layer. The 5 neurons located in these 5 layers are used to perform different computations. Specifically, the neurons in layer 1 receive the input data, the neurons in layer 2 perform convolution on the data, the neurons in layer 3 normalize the convolution result, the neurons in layer 4 activate the normalized result, and the neurons in layer 5 weight the activation result and the original input data to obtain the processed data. These five neurons can be represented by five nodes: node 0, node 1, node 2, node 3, and node 4. Node 0 represents the computations that the neurons in the first layer can perform, node 1 represents the computations that the neurons in the second layer can perform, node 2 represents the computations that the neurons in the third layer can perform, node 3 represents the computations that the neurons in the fourth layer can perform, and node 4 represents the computations that the neurons in the fifth layer can perform. Thus, these five connected nodes constitute the first computation graph of the first model.

[0151] It should be understood that Figure 5 The example shown is only illustrative of the first model containing 5 layers of neurons and does not constitute a limitation on the number of layers in the first model in this application.

[0152] It should also be understood that Figure 5 The example shown is only illustrated by the fact that each layer of the first model contains one neuron, and there is no limitation on the number of neurons in each layer of the first model.

[0153] It should also be understood that Figure 5 In the example shown, only one node in the first computation graph is used to represent the computation that a neuron in the first model can perform. In practical applications, a node in the first computation graph can also be used to represent the computation that multiple neurons in the same layer in the first model can perform.

[0154] 402. The first computation graph is processed by the second model to obtain the processing result, which is used to determine the first segmentation strategy of the first computation graph.

[0155] After obtaining the first computation graph of the first model, the first computation graph can be input into the second model (i.e., the trained neural network model used to implement the model segmentation function) to process the first computation graph and obtain the processing result for the first computation graph. This processing result usually contains the probabilities of multiple segmentation strategies (also called segmentation behaviors). Therefore, among these multiple segmentation strategies, the segmentation strategy with the highest probability can be determined as the first segmentation strategy for the first computation graph. As in the example above, after processing the first computation graph of the first model through the second model, the first segmentation strategy for the first computation graph can be obtained. The first segmentation strategy is used to indicate the following: divide the first computation graph into two sub-computation graphs. The first sub-computation graph contains nodes 1, 2, and 3, and the second sub-computation graph contains nodes 0 and 4.

[0156] Specifically, the processing results of the first computation graph can be obtained in the following ways:

[0157] (1) Before inputting the first computation graph into the second model, for any given node in the first computation graph, the node can be encoded first to obtain a first code corresponding to that node. It is worth noting that the amount of data in the first code corresponding to that node is much smaller than the amount of data in the node itself, thus reducing the amount of input data to the second model. Similarly, for the other nodes besides the first node, the same operation can be performed, thus obtaining first codes corresponding to the other nodes. In this way, multiple first codes corresponding one-to-one with the multiple nodes of the first computation graph can be obtained. As in the example above, such as... Figure 6 As shown ( Figure 6 A flowchart illustrating the segmentation strategy provided in this application embodiment. Figure 6 Is Figure 5 Based on the above, after obtaining nodes 0 to 4, nodes 0 to 4 can be encoded respectively to obtain the code 0 of node 0, the code 1 of node 1, the code 2 of node 2, the code 3 of node 3 and the code 4 of node 4.

[0158] (2) After obtaining multiple first codes corresponding one-to-one with multiple nodes of the first computation graph, these multiple first codes can be input into the second model to process them and obtain the processing result. The processing result usually contains the probabilities of the codes of multiple segmentation strategies. Therefore, the code with the highest probability can be determined as the second code, and the segmentation strategy indicated by the second code can be determined as the first segmentation strategy for the first computation graph. As in the example above, after processing codes 1 to 4 through the second model, the processing result can be obtained. The processing result contains the probabilities of code 5, code 6, and code 7. Code 5 is used to indicate segmentation strategy 1, code 6 is used to indicate segmentation strategy 2, and code 7 is used to indicate segmentation strategy 3. Since code 5 has the highest probability, segmentation strategy 1 can be determined as the segmentation strategy for the first computation graph.

[0159] 403. Based on the correspondence between the computation graph, the partitioning strategy and the loss, determine the first loss required after the first partitioning strategy is applied to the first computation graph.

[0160] After obtaining the first partitioning strategy for the first computation graph, the correspondence between the computation graph, the partitioning strategy and the loss (also known as cost) can be obtained, and based on the correspondence, the first loss required after the first partitioning strategy is applied to the first computation graph can be determined.

[0161] It is worth noting that the correspondence between the computation graph, the splitting strategy, and the loss is usually pre-deployed. This correspondence can be constructed based on the second computation graph of the third model (i.e., the neural network model used as training data, which can also be used to implement data processing functions), the second splitting strategy for the second computation graph, and the second loss required after the second splitting strategy is applied to the second computation graph. Here, the second computation graph of the third model is the training data of the second model (i.e., the data used in the training process of the second model), and the second splitting strategy for the second computation graph and the second loss required after the second splitting strategy is applied to the second computation graph are both known data (which can also be called real data).

[0162] It is worth noting that since the first partitioning strategy can be used to partition the first computation graph into multiple sub-computation graphs, the first loss can refer to the loss required to achieve data processing (i.e., the data processing that the first model can achieve) by running these multiple sub-computation graphs. For example, the first loss can be the time required to run these multiple sub-computation graphs to achieve data processing, or the first loss can be the resources (computing resources, storage resources, communication resources, etc.) occupied by running these multiple sub-computation graphs to achieve data processing, etc.

[0163] Specifically, the correspondence between the computation graph, the segmentation strategy, and the loss can be represented as a correspondence between encoding and loss. For example, this correspondence can be a curve on a two-dimensional coordinate system, where the horizontal axis represents the encoding obtained by fusing the encoding of the nodes in the computation graph with the encoding of the segmentation strategy, and the vertical axis represents the loss, and so on. Therefore, the first loss required after the first segmentation strategy is applied to the first computation graph can be obtained in the following way:

[0164] (1) The first codes, which correspond one-to-one with multiple nodes in the first computation graph, and the second codes, which indicate the first segmentation strategy, are fused to obtain the third code. It should be noted that the aforementioned fusion process can be implemented using a graph kernel algorithm (Weisfeiler-Lehman (WL) graph kernel algorithm), for example, as... Figure 7 As shown ( Figure 7 (This is a flowchart of a graph kernel algorithm provided in an embodiment of this application). Multiple first codes and second codes can be added (or concatenated), and then the added (or concatenated) codes can be subjected to iterative operations based on the graph kernel algorithm to obtain a third code.

[0165] (2) After obtaining the third code, the loss corresponding to the third code can be determined in the correspondence between the code and the loss. This loss is the first loss required after the first segmentation strategy is applied to the first computation graph.

[0166] It should be understood that the relevant data when the second model is in the application stage is predicted data, and the relevant data when the second model is in the training stage is real data. That is, the aforementioned first segmentation strategy for the first computation graph can also be understood as the predicted segmentation strategy for the first computation graph, and the first loss required after the first segmentation strategy is applied to the first computation graph can also be understood as the predicted loss required after the first segmentation strategy is applied to the first computation graph. Similarly, the second segmentation strategy for the second computation graph can also be understood as the real segmentation strategy for the second computation graph, and the second loss required after the second segmentation strategy is applied to the second computation graph can also be understood as the real loss required after the second segmentation strategy is applied to the second computation graph.

[0167] 404. Check if the first loss is less than the preset threshold.

[0168] After obtaining the first loss required when the first partitioning strategy is applied to the first computation graph, it can be checked whether the first loss is less than a preset threshold (also known as a preset loss threshold). It should be noted that the size of the preset threshold can be set in various ways. For example, the size of the preset threshold can be set manually according to actual needs. Alternatively, the size of the preset threshold can also be determined based on the loss required to directly process data through the second computation graph without partitioning it. There are no restrictions here.

[0169] 405. If the first loss is less than a preset threshold, the first computation graph is divided based on the first segmentation strategy to obtain multiple sub-computation graphs.

[0170] If the initial loss incurred after applying the first partitioning strategy to the first computation graph is less than a preset threshold, it indicates that the first partitioning strategy is feasible. Therefore, the first computation graph can be partitioned based on the first partitioning strategy to obtain multiple sub-computation graphs. In each of these sub-computation graphs, at least one node of the first computation graph is included. Continuing with the example above, since partitioning strategy 1 divides the first computation graph into a sub-computation graph containing nodes 1, 2, and 3, and a sub-computation graph containing nodes 0 and 4, based on partitioning strategy 1, the first computation graph can be divided into two sub-computation graphs: the first sub-computation graph contains nodes 1, 2, and 3, and the second sub-computation graph contains nodes 0 and 4.

[0171] This completes the partitioning of the first computational graph, which is equivalent to partitioning the first model. If subsequent data processing requirements arise for the first model, these multiple sub-computational graphs can be run in parallel to implement the data processing functionality of the first model.

[0172] 406. If the first loss is greater than or equal to the preset threshold, the first computation graph will not be segmented.

[0173] If the initial loss incurred after applying the first partitioning strategy to the first computational graph is greater than or equal to a preset threshold, it indicates that the first partitioning strategy is infeasible, and therefore the first computational graph is not partitioned. If there is a subsequent need for data processing of the first model, the entire first computational graph can be run directly to realize the data processing function of the first model.

[0174] In this embodiment, after obtaining the first computational graph of the first model, the first computational graph can be processed by the second model to obtain the processing result, which is used to determine the first segmentation strategy of the first computational graph. Then, based on the correspondence between the computational graph, the segmentation strategy, and the loss, the first loss required after the first segmentation strategy is applied to the first computational graph can be determined. If the first loss is less than a preset threshold, the first computational graph is segmented based on the first segmentation strategy to obtain multiple sub-computational graphs. In the aforementioned process, the first segmentation strategy of the first computational graph is obtained by the second model processing the first computational graph itself. After obtaining the first segmentation strategy, the first loss required after the first segmentation strategy is applied to the first computational graph can also be estimated, thereby evaluating whether the first segmentation strategy is feasible. This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models of various structures (with strong generalization) and can formulate optimal segmentation strategies for various neural network models that fit actual applications (with better model segmentation effect).

[0175] Furthermore, the input to the second model is not multiple nodes of the first computation graph, but multiple first codes corresponding one-to-one with these nodes. The number of first codes is much smaller than the data volume of the nodes themselves. In this way, the amount of data that the neural network model needs to process can be effectively reduced, the time spent by the model to obtain the segmentation strategy can be reduced, and the resources occupied by the model to obtain the segmentation strategy can be saved.

[0176] The above is a detailed description of the model segmentation method provided in the embodiments of this application. The following will introduce the evaluation method of the model segmentation strategy provided in the embodiments of this application. Figure 8 A flowchart illustrating the model segmentation strategy evaluation method provided in this application embodiment is shown below. Figure 8 As shown, the method includes:

[0177] 801. Obtain the second computational graph of the third model, the second partitioning strategy of the second computational graph, and the second loss required after the second partitioning strategy is applied to the second computational graph.

[0178] In this embodiment, when training the fourth model (i.e., the neural network model to be trained) is required, a batch of training data can be obtained first. This batch of training data includes the second computation graph of the third model. The second computation graph contains multiple nodes, and each node corresponds to at least one neuron in the same layer of the third model. That is, a node can be used to represent a portion of the operations that the third model can perform. For a description of the second computation graph of the third model, please refer to [link to documentation]. Figure 4 The relevant explanatory parts of the first computation graph of the first model in the illustrated embodiment will not be repeated here.

[0179] It should be noted that since the second computational graph of the third model is used as training data, the second partitioning strategy (the true partitioning strategy) for the second computational graph and the second loss (the true loss) incurred after the second partitioning strategy is applied to the second computational graph are both known data. Since the second partitioning strategy can be used to partition the second computational graph into multiple sub-computational graphs, the second loss can refer to the cost incurred in implementing data processing (i.e., the data processing that the third model can achieve) through these multiple sub-computational graphs. For example, the second loss could be the time required to run these multiple sub-computational graphs to implement data processing, or it could be the resources (computing resources, storage resources, communication resources, etc.) consumed by running these multiple sub-computational graphs to implement data processing, etc.

[0180] It should be noted that there are multiple known candidate partitioning strategies for the second computational graph, and the loss corresponding to each candidate partitioning strategy is known. Therefore, the candidate partitioning strategy with the minimum loss can be determined as the second partitioning strategy for the second computational graph. For example, ... Figure 9 The second calculation diagram shown ( Figure 9 This is a schematic diagram of a second computation graph provided in an embodiment of this application. It includes 4 layers and a total of 12 nodes. The first layer has 4 nodes (nodes 1_1, 1_2, 1_3, and 1_4), the second layer has 2 nodes (nodes 2_1 and 2_2), the third layer has 4 nodes (nodes 3_1, 3_2, 3_3, and 3_4), and the fourth layer has 2 nodes (nodes 4_1 and 4_2). The second computation graph has 2 candidate segmentation strategies. The first candidate segmentation strategy is as follows: Figure 10 As shown ( Figure 10 (A schematic diagram of a candidate segmentation strategy provided in an embodiment of this application) The strategy includes: dividing the second computation graph into two sub-computation graphs. The first sub-computation graph includes nodes 1_1, 1_2, 2_1, 3_1, 3_2, and 4_1. The second sub-computation graph includes nodes 1_3, 1_4, 2_2, 3_3, 3_4, and 4_2. The second candidate segmentation strategy is as follows: Figure 11 As shown ( Figure 11(This is another schematic diagram of a candidate segmentation strategy provided in an embodiment of this application). The strategy includes: dividing the second computation graph into four sub-computation graphs. The first sub-computation graph includes nodes 1_1 and 3_1; the second sub-computation graph includes nodes 1_2, 2_1, 3_2, and 4_1; the third sub-computation graph includes nodes 1_3, 2_2, 3_3, and 4_2; and the fourth sub-computation graph includes nodes 1_4 and 3_4. Since the second candidate segmentation strategy requires less overhead when applied to the second computation graph, it can be used as the second segmentation strategy for the second computation graph.

[0181] 802. The second computation graph is processed by the fourth model to obtain the processing result, which is used to determine the third segmentation strategy of the second computation graph.

[0182] After obtaining the second computational graph for the third model, the second computational graph can be input into the fourth model to process the second computational graph and obtain the processing result. This processing result usually contains the probabilities of multiple segmentation strategies (segmentation behaviors). Therefore, among these multiple segmentation strategies, the segmentation strategy with the highest probability can be determined as the third segmentation strategy (predictive segmentation strategy) for the second computational graph.

[0183] Specifically, the processing results of the second computation graph can be obtained in the following ways:

[0184] (1) Among the multiple nodes in the second computation graph, for any given node, the node can be encoded first to obtain a fourth code corresponding to that node. It is worth noting that the amount of data in the fourth code corresponding to that node is much smaller than the amount of data in the node itself, thus reducing the amount of input data for the fourth model. Similarly, for the other nodes besides that node, the same operation can be performed, thus obtaining a fourth code corresponding to the other nodes. In this way, multiple fourth codes corresponding one-to-one with the multiple nodes in the second computation graph can be obtained.

[0185] (2) After obtaining multiple fourth codes that correspond one-to-one with multiple nodes of the second computation graph, these multiple fourth codes can be input into the fourth model to process these multiple fourth codes and obtain the processing result. The processing result usually contains the probability of the codes of multiple segmentation strategies. Therefore, the segmentation strategy indicated by the code with the highest probability can be determined as the third segmentation strategy for the second computation graph.

[0186] 803. Based on the second and third segmentation strategies, obtain the target loss, which is used to indicate the difference between the second and third segmentation strategies.

[0187] A third segmentation strategy for the second computational graph is obtained. Since the second segmentation strategy for the second computational graph is known, the target loss can be calculated by using a preset target loss function to obtain the target loss. The target loss is used to indicate the difference between the second segmentation strategy and the third segmentation strategy for the second computational graph.

[0188] 804. Based on the target loss, update the parameters of the fourth model until the model training conditions are met, and obtain the second model.

[0189] After obtaining the target loss, the parameters of the fourth model can be updated based on the target loss to obtain the updated fourth model. Then, another batch of training data can be obtained to continue training the updated fourth model (i.e., re-execute steps 802 to 804) until the model training conditions are met (e.g., the target loss converges, etc.), thus obtaining the final model. Figure 4 The second model in the illustrated embodiment.

[0190] When the second model is used in the application phase, it can be used to process the first computational graph of the first model (the neural network model to be segmented) to obtain a first segmentation strategy for the first model. For an introduction to the processing of the first computation of the first model by the second model, please refer to [link to relevant documentation]. Figure 4 The relevant explanatory sections of the illustrated embodiments will not be repeated here.

[0191] 805. Based on the second computation graph, the second segmentation strategy, and the second loss, construct the correspondence between the computation graph, the segmentation strategy, and the loss. The correspondence is used to obtain the first loss required after the first segmentation strategy is applied to the first computation graph of the first model. The first segmentation strategy is obtained by the second model processing the first computation graph.

[0192] After obtaining the second computational graph of the third model, the second segmentation strategy for the second computational graph, and the second loss required after the second segmentation strategy is applied to the second computational graph, a correspondence between the computational graph, the segmentation strategy, and the loss can be constructed based on this information. This correspondence can be used to evaluate whether the segmentation strategy output by the second model is feasible. For example, this correspondence can be used to obtain the first loss required after the first segmentation strategy is applied to the first computational graph of the first model, thereby determining whether the first loss is less than a preset threshold, so as to determine whether the first segmentation strategy is feasible.

[0193] Specifically, the correspondence between computation graph, segmentation strategy, and loss can be represented as the correspondence between encoding and loss. Therefore, the correspondence between encoding and loss can be constructed in the following way:

[0194] (1) Based on step 802, it is known that for multiple nodes of the second computation graph, multiple fourth codes corresponding to these multiple nodes have been obtained. Then, the second segmentation strategy for the second computation graph can also be encoded to obtain the fifth code, that is, the fifth code is used to indicate the second segmentation strategy for the second computation graph.

[0195] (2) The multiple fourth codes corresponding one-to-one with the multiple nodes of the second computation graph and the fifth code used to indicate the second segmentation strategy are fused to obtain the sixth code. It should be noted that the aforementioned fusion process can be implemented by the graph kernel algorithm (Weisfeiler-Lehman (WL) graph kernel algorithm). That is, the multiple fourth codes and the fifth codes are first added (or concatenated), and then the added (or concatenated) codes are subjected to iterative operation based on the graph kernel algorithm to obtain the sixth code.

[0196] (3) Based on the sixth encoding and the second loss required after the second segmentation strategy is applied to the second computation graph, a correspondence between encoding and loss can be constructed. For example, the correspondence can be a curve on a two-dimensional coordinate system, where the horizontal axis of the coordinate system is the encoding after fusing the encoding of the nodes in the computation graph with the encoding of the segmentation strategy, and the vertical axis of the coordinate system is the loss, etc.

[0197] It should be understood that in constructing the correspondence between the computation graph, the splitting strategy, and the loss, not only the current batch of training data is used, but also the next batch of training data, etc. That is, in the training process of the fourth model, each iteration uses a batch of training data, so all these batches of training data can be used to construct the correspondence between the computation graph, the splitting strategy, and the loss.

[0198] The second model trained in this application embodiment can be used to process the first computation graph of the first model to obtain a first segmentation strategy for the first computation graph. Furthermore, the correspondence between the computation graph, segmentation strategy, and loss constructed in this application embodiment is also used to estimate the first loss required after the first segmentation strategy is applied to the first computation graph, thereby evaluating whether the first segmentation strategy is feasible. It can be seen that this application embodiment provides a new model segmentation method (framework). This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models with various structures (with strong generalization) and can formulate optimal segmentation strategies for neural network models with various structures that fit actual applications (with better model segmentation effect).

[0199] Furthermore, the input to the fourth model is not multiple nodes of the second computation graph, but multiple fourth codes that correspond one-to-one with these nodes. The number of fourth codes is much smaller than the data volume of the nodes themselves. In this way, the amount of data that the neural network model needs to process during training can be effectively reduced, the training time can be reduced, and the resources occupied by the model training can be saved.

[0200] The above is a detailed description of the model segmentation strategy evaluation method provided in the embodiments of this application. The following will introduce the model segmentation device and the model segmentation strategy evaluation device provided in the embodiments of this application. Figure 12 A schematic diagram of the model segmentation device provided in the embodiments of this application is shown below. Figure 12 As shown, the device includes:

[0201] Module 1201 is used to acquire the first computational graph of the first model;

[0202] Processing module 1202 is used to process the first computation graph through the second model to obtain processing results, and the processing results are used to determine the first segmentation strategy of the first computation graph;

[0203] The determination module 1203 is used to determine the first loss required after the first segmentation strategy is applied to the first computation graph;

[0204] The segmentation module 1204 is used to segment the first computation graph based on the first segmentation strategy to obtain multiple sub-computation graphs if the first loss is less than a preset threshold.

[0205] In one possible implementation, the first computation graph contains multiple nodes, and each node represents a portion of the computation that can be performed by the first model. The device further includes: an encoding module for encoding the multiple nodes of the first computation graph to obtain multiple first codes that correspond one-to-one with the multiple nodes; and a processing module 1202 for processing the multiple first codes through a second model to obtain a processing result.

[0206] In one possible implementation, the determining module 1203 is used to determine the first loss required after the first segmentation strategy is applied to the first computation graph, based on the correspondence between the computation graph, the segmentation strategy and the loss.

[0207] In one possible implementation, the correspondence between the computation graph, the segmentation strategy, and the loss is the correspondence between the encoding and the loss. The processing result is used to determine the second encoding, which is used to indicate the first segmentation strategy of the first computation graph. The determining module 1203 is used to: fuse multiple first encodings and second encodings to obtain a third encoding; and determine the first loss required after the first segmentation strategy is applied to the first computation graph based on the correspondence between the encoding and the loss and the third encoding.

[0208] In one possible implementation, the determining module 1203 is used to perform iterative operations on multiple first and second codes using a graph kernel algorithm to obtain a third code.

[0209] In one possible implementation, the correspondence between the computation graph, the splitting strategy, and the loss is constructed based on the second computation graph of the third model, the second splitting strategy of the second computation graph, and the second loss required after the second splitting strategy is applied to the second computation graph. The second computation graph is the training data of the second model, and the second splitting strategy and the second loss are known data.

[0210] In one possible implementation, the first model is used to implement data processing, and the first loss is the time required to implement data processing through multiple sub-computation graphs.

[0211] In one possible implementation, the device further includes a non-segmentation module, configured not to segment the first computation graph if the first loss is greater than or equal to a preset threshold.

[0212] In this embodiment, after obtaining the first computational graph of the first model, the first computational graph can be processed by the second model to obtain the processing result, which is used to determine the first segmentation strategy of the first computational graph. Then, based on the correspondence between the computational graph, the segmentation strategy, and the loss, the first loss required after the first segmentation strategy is applied to the first computational graph can be determined. If the first loss is less than a preset threshold, the first computational graph is segmented based on the first segmentation strategy to obtain multiple sub-computational graphs. In the aforementioned process, the first segmentation strategy of the first computational graph is obtained by the second model processing the first computational graph itself. After obtaining the first segmentation strategy, the first loss required after the first segmentation strategy is applied to the first computational graph can also be estimated, thereby evaluating whether the first segmentation strategy is feasible. This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models of various structures (with strong generalization) and can formulate optimal segmentation strategies for various neural network models that fit actual applications (with better model segmentation effect).

[0213] Furthermore, the input to the second model is not multiple nodes of the first computation graph, but multiple first codes corresponding one-to-one with these nodes. The number of first codes is much smaller than the data volume of the nodes themselves. In this way, the amount of data that the neural network model needs to process can be effectively reduced, the time spent by the model to obtain the segmentation strategy can be reduced, and the resources occupied by the model to obtain the segmentation strategy can be saved.

[0214] Figure 13 A schematic diagram of the structure of the model segmentation strategy evaluation device provided in the embodiments of this application is shown below. Figure 13 As shown, the device includes:

[0215] The first acquisition module 1301 is used to acquire the second computation graph of the third model, the second segmentation strategy of the second computation graph, and the second loss required after the second segmentation strategy is applied to the second computation graph. The second computation graph is the training data of the second model, and the second segmentation strategy and the second loss are known data.

[0216] The construction module 1302 is used to construct the correspondence between the computation graph, the splitting strategy and the loss based on the second computation graph, the second splitting strategy and the second loss. The correspondence is used to obtain the first loss required after the first splitting strategy is applied to the first computation graph of the first model. The first splitting strategy is obtained by the second model processing the first computation graph.

[0217] In one possible implementation, the second computation graph contains multiple nodes, and each node represents a portion of the computations that the third model can perform. The construction module 1302 is used to: encode the multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes, and encode the second segmentation strategy to obtain a fifth code; fuse the multiple fourth codes and the fifth code to obtain a sixth code; and construct the correspondence between the code and the loss based on the sixth code and the second loss.

[0218] In one possible implementation, a module is constructed to iteratively operate on multiple fourth and fifth codes using a graph kernel algorithm to obtain a sixth code.

[0219] In one possible implementation, the device further includes: a processing module for processing the second computation graph through a fourth model to obtain a processing result, the processing result being used to determine a third segmentation strategy for the second computation graph; a second acquisition module for acquiring a target loss based on the second and third segmentation strategies, the target loss being used to indicate the difference between the second and third segmentation strategies; and an update module for updating the parameters of the fourth model based on the target loss until the model training conditions are met to obtain the second model.

[0220] In one possible implementation, the processing module is used to: encode multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes; and process these multiple fourth codes through a fourth model to obtain the processing result.

[0221] In one possible implementation, the third model is used to implement data processing, and the second loss is the time required to implement data processing through multiple sub-computation graphs, which are obtained by dividing the second sub-computation graph based on the second partitioning strategy.

[0222] The second model trained in this application embodiment can be used to process the first computation graph of the first model to obtain a first segmentation strategy for the first computation graph. Furthermore, the correspondence between the computation graph, segmentation strategy, and loss constructed in this application embodiment is also used to estimate the first loss required after the first segmentation strategy is applied to the first computation graph, thereby evaluating whether the first segmentation strategy is feasible. It can be seen that this application embodiment provides a new model segmentation method (framework). This model segmentation method can avoid excessive human intervention and considers more comprehensive factors. It can achieve model segmentation for neural network models with various structures (with strong generalization) and can formulate optimal segmentation strategies for neural network models with various structures that fit actual applications (with better model segmentation effect).

[0223] Furthermore, the input to the fourth model is not multiple nodes of the second computation graph, but multiple fourth codes that correspond one-to-one with these nodes. The number of fourth codes is much smaller than the data volume of the nodes themselves. In this way, the amount of data that the neural network model needs to process during training can be effectively reduced, the training time can be reduced, and the resources occupied by the model training can be saved.

[0224] It should be noted that the information interaction and execution process between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of this application, and the resulting technical effects are the same as those of the method embodiment of this application. For details, please refer to the description in the method embodiment shown above in the embodiment of this application, and it will not be repeated here.

[0225] This application also relates to an execution device. Figure 14 This is a schematic diagram of the execution device provided in an embodiment of this application. Figure 14 As shown, the execution device 1400 can specifically manifest as a mobile phone, tablet, laptop, smart wearable device, server, etc., and is not limited here. Among them, the execution device 1400 may be deployed with... Figure 4 The model segmentation device described in the corresponding embodiment is used to implement Figure 4 This corresponds to the model segmentation function in the embodiment. Specifically, the execution device 1400 includes: a receiver 1401, a transmitter 1402, a processor 1403, and a memory 1404 (wherein the execution device 1400 may have one or more processors 1403). Figure 14 (Taking a processor as an example), processor 1403 may include application processor 14031 and communication processor 14032. In some embodiments of this application, receiver 1401, transmitter 1402, processor 1403 and memory 1404 may be connected via a bus or other means.

[0226] Memory 1404 may include read-only memory and random access memory, and provides instructions and data to processor 1403. A portion of memory 1404 may also include non-volatile random access memory (NVRAM). Memory 1404 stores processor and operation instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.

[0227] Processor 1403 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together through a bus system, which may include not only the data bus, but also power buses, control buses, and status signal buses. However, for clarity, all buses are referred to as the bus system in the diagram.

[0228] The methods disclosed in the embodiments of this application can be applied to or implemented by the processor 1403. The processor 1403 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 1403 or by instructions in software form. The processor 1403 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and may further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 1403 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 1404. Processor 1403 reads the information in memory 1404 and, in conjunction with its hardware, completes the steps of the above method.

[0229] Receiver 1401 can be used to receive input digital or character information, and to generate signal inputs related to the settings and function control of the execution device. Transmitter 1402 can be used to output digital or character information through the first interface; transmitter 1402 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; transmitter 1402 may also include a display device such as a display screen.

[0230] In one embodiment of this application, the processor 1403 is used to... Figure 4 In the second model of the corresponding embodiment, a first segmentation strategy is used to generate a first computation graph of the first model, and then the first computation graph is segmented based on the first segmentation strategy to obtain multiple sub-computation graphs, thereby completing the segmentation of the first model.

[0231] This application also relates to a training device. Figure 15 This is a schematic diagram of the structure of a training device provided in an embodiment of this application. Figure 15 As shown, the training device 1500 is implemented by one or more servers. The training device 1500 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1514 (e.g., one or more processors) and memory 1532, and one or more storage media 1530 (e.g., one or more mass storage devices) for storing application programs 1542 or data 1544. The memory 1532 and storage media 1530 can be temporary or persistent storage. The program stored in the storage media 1530 may include one or more modules (not shown in the figure), each module may include a series of instruction operations on the training device. Furthermore, the CPU 1514 may be configured to communicate with the storage media 1530 and execute the series of instruction operations in the storage media 1530 on the training device 1500.

[0232] The training device 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input / output interfaces 1558; or, one or more operating systems 1541, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0233] Specifically, the training equipment can perform Figure 8 The method for evaluating the segmentation strategy of the model in the corresponding embodiment is used, and the constructed computation graph, the correspondence between the segmentation strategy and the loss, and the trained second model are deployed in the aforementioned execution device.

[0234] This application also relates to a computer storage medium storing a program for signal processing, which, when run on a computer, causes the computer to perform steps as performed by the aforementioned execution device, or causes the computer to perform steps as performed by the aforementioned training device.

[0235] This application also relates to a computer program product that stores instructions that, when executed by a computer, cause the computer to perform steps as performed by the aforementioned execution device, or to perform steps as performed by the aforementioned training device.

[0236] The execution device, training device, or terminal device provided in this application embodiment can specifically be a chip. The chip includes a processing unit and a communication unit. The processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in the storage unit to cause the chip within the execution device to execute the data processing method described in the above embodiments, or to cause the chip within the training device to execute the data processing method described in the above embodiments. Optionally, the storage unit can be a storage unit within the chip, such as a register or cache. Alternatively, the storage unit can be a storage unit located outside the chip within the wireless access device, such as a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).

[0237] For details, please refer to Figure 16 , Figure 16 This is a schematic diagram of the chip provided in an embodiment of this application. The chip can be represented as a neural network processor (NPU) 1600. The NPU 1600 is mounted as a coprocessor on the host CPU, and tasks are assigned by the host CPU. The core part of the NPU is the arithmetic circuit 1603, which is controlled by the controller 1604 to retrieve matrix data from the memory and perform multiplication operations.

[0238] In some implementations, the arithmetic circuit 1603 internally includes multiple processing engines (PEs). In some implementations, the arithmetic circuit 1603 is a two-dimensional pulsating array. The arithmetic circuit 1603 can also be a one-dimensional pulsating array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1603 is a general-purpose matrix processor.

[0239] For example, suppose we have an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from the weight memory 1602 and caches it in each PE of the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from the input memory 1601 and performs matrix operations with matrix B. The partial result or the final result of the obtained matrix is ​​stored in the accumulator 1608.

[0240] Unified memory 1606 is used to store input and output data. Weight data is directly transferred to weight memory 1602 via Direct Memory Access Controller (DMAC) 1605. Input data is also transferred to unified memory 1606 via DMAC.

[0241] BIU stands for Bus Interface Unit, which is used for interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1609.

[0242] The Bus Interface Unit (BIU) 1613 is used by the instruction fetch memory 1609 to fetch instructions from external memory, and also by the memory access controller 1605 to fetch the original data of the input matrix A or the weight matrix B from external memory.

[0243] The DMAC is mainly used to move input data from external memory DDR to unified memory 1606, or to weight data to weight memory 1602, or to input data to input memory 1601.

[0244] The vector computation unit 1607 includes multiple processing units that further process the output of the computation circuit 1603 when necessary, such as vector multiplication, vector addition, exponential operations, logarithmic operations, size comparisons, etc. It is mainly used for computation in non-convolutional / fully connected layers of neural networks, such as Batch Normalization, pixel-level summation, and upsampling of the predicted label plane.

[0245] In some implementations, the vector computation unit 1607 can store the processed output vector in the unified memory 1606. For example, the vector computation unit 1607 can apply a linear function, or a nonlinear function, to the output of the computation circuit 1603, such as linearly interpolating the predicted label plane extracted by the convolutional layer, or, for example, accumulating a vector of values ​​to generate activation values. In some implementations, the vector computation unit 1607 generates normalized values, pixel-level summed values, or both. In some implementations, the processed output vector can be used as activation input to the computation circuit 1603, for example, for use in subsequent layers in the neural network.

[0246] The instruction fetch buffer 1609 connected to the controller 1604 is used to store the instructions used by the controller 1604.

[0247] The unified memory 1606, input memory 1601, weight memory 1602, and instruction fetch memory 1609 are all on-chip memories. External memory is proprietary to this NPU hardware architecture.

[0248] The processor mentioned above can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of the above program.

[0249] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0250] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0251] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0252] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

Claims

1. A model segmentation method, characterized in that, include: Obtain the first computation graph of the first model, which is used to implement data processing. The first computation graph contains multiple nodes, and each node represents a portion of the computation that the first model can perform. Encode multiple nodes of the first computation graph to obtain multiple first codes that correspond one-to-one with the multiple nodes; The first computation graph is processed by the second model to obtain a processing result, which is used to determine the first segmentation strategy of the first computation graph. Determine the first loss required after the first segmentation strategy is applied to the first computation graph; If the first loss is less than a preset threshold, the first computation graph is divided based on the first segmentation strategy to obtain multiple sub-computation graphs, where the first loss is the time required to achieve the data processing through the multiple sub-computation graphs. The step of processing the first computation graph using the second model to obtain the processing result includes: The multiple first codes are processed by the second model to obtain the processing result.

2. The method according to claim 1, characterized in that, The determination of the first loss required after the first segmentation strategy is applied to the first computation graph includes: Based on the correspondence between the computation graph, the partitioning strategy, and the loss, the first loss required after the first partitioning strategy is applied to the first computation graph is determined.

3. The method according to claim 2, characterized in that, The correspondence between the computation graph, the segmentation strategy, and the loss is a correspondence between encoding and loss. The processing result is used to determine the second encoding, which indicates the first segmentation strategy of the first computation graph. Determining the first loss required after the first segmentation strategy is applied to the first computation graph based on the correspondence between the computation graph, the segmentation strategy, and the loss includes: The first and second codes are fused together to obtain the third code; Based on the correspondence between the encoding and the loss, and the third encoding, the first loss required after the first segmentation strategy is applied to the first computation graph is determined.

4. The method according to claim 3, characterized in that, The process of fusing the plurality of first codes and second codes to obtain a third code includes: The third code is obtained by iteratively operating the multiple first codes and second codes using a graph kernel algorithm.

5. The method according to any one of claims 1 to 4, characterized in that, The correspondence between the computation graph, the segmentation strategy, and the loss is constructed based on the second computation graph of the third model, the second segmentation strategy of the second computation graph, and the second loss required after the second segmentation strategy is applied to the second computation graph. The second computation graph is the training data of the second model obtained, and the second segmentation strategy and the second loss are known data.

6. The method according to any one of claims 1 to 4, characterized in that, The method further includes: If the first loss is greater than or equal to the preset threshold, then the first computation graph is not segmented.

7. A method for evaluating the segmentation strategy of a model, characterized in that, The method includes: The third model obtains a second computation graph, a second segmentation strategy for the second computation graph, and a second loss required after the second segmentation strategy is applied to the second computation graph. The second computation graph is the training data of the second model, the second segmentation strategy and the second loss are known data, the third model is used to implement data processing, and the second loss is the time required to implement the data processing through multiple sub-computation graphs. The multiple sub-computation graphs are obtained by segmenting the second computation graph based on the second segmentation strategy. Based on the second computation graph, the second segmentation strategy, and the second loss, a correspondence between the computation graph, the segmentation strategy, and the loss is constructed. The correspondence is used to obtain the first loss required after the first segmentation strategy is applied to the first computation graph of the first model. The first segmentation strategy is obtained by the second model processing multiple first codes corresponding to multiple nodes of the first computation graph. The first computation graph contains multiple nodes, and one node represents a part of the computation that the first model can perform.

8. The method according to claim 7, characterized in that, The second computation graph contains multiple nodes, where each node represents a portion of the computations achievable by the third model. The step of constructing the correspondence between the computation graph, the partitioning strategy, and the loss based on the second computation graph, the second partitioning strategy, and the second loss includes: Encode multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes, and encode the second segmentation strategy to obtain a fifth code; The sixth code is obtained by fusing the multiple fourth codes and the fifth code; Based on the sixth encoding and the second loss, a correspondence between encoding and loss is constructed.

9. The method according to claim 8, characterized in that, The fusion of the plurality of fourth codes and the fifth codes to obtain the sixth code includes: The sixth code is obtained by iteratively operating the multiple fourth codes and the fifth code using the graph kernel algorithm.

10. The method according to any one of claims 7 to 9, characterized in that, The method further includes: The second computation graph is processed by the fourth model to obtain the processing result, which is used to determine the third segmentation strategy of the second computation graph. Based on the second segmentation strategy and the third segmentation strategy, a target loss is obtained, which is used to indicate the difference between the second segmentation strategy and the third segmentation strategy; Based on the target loss, the parameters of the fourth model are updated until the model training conditions are met, thus obtaining the second model.

11. A model segmentation device, characterized in that, The device includes: The acquisition module is used to acquire the first computational graph of the first model, the first model is used to implement data processing, and the first computational graph contains multiple nodes, with each node representing a portion of the computation that the first model can perform. The encoding module is used to encode multiple nodes of the first computation graph to obtain multiple first codes that correspond one-to-one with the multiple nodes; The processing module is used to process the first computation graph through the second model to obtain a processing result, and the processing result is used to determine a first segmentation strategy for the first computation graph. The determination module is used to determine the first loss required after the first segmentation strategy is applied to the first computation graph; The segmentation module is used to segment the first computation graph based on the first segmentation strategy to obtain multiple sub-computation graphs if the first loss is less than a preset threshold, wherein the first loss is the time required to realize the data processing through the multiple sub-computation graphs; Specifically, the processing module is used to process the plurality of first codes through the second model to obtain the processing result.

12. The apparatus according to claim 11, characterized in that, The determining module is used to determine the first loss required after the first segmentation strategy is applied to the first computation graph, based on the correspondence between the computation graph, the segmentation strategy and the loss.

13. The apparatus according to claim 12, characterized in that, The correspondence between the computation graph, the segmentation strategy, and the loss is a correspondence between the encoding and the loss. The processing result is used to determine the second encoding, which indicates the first segmentation strategy of the first computation graph. The determining module is used to: The first and second codes are fused together to obtain the third code; Based on the correspondence between the encoding and the loss, and the third encoding, the first loss required after the first segmentation strategy is applied to the first computation graph is determined.

14. The apparatus according to claim 13, characterized in that, The determining module is used to perform iterative operations on the plurality of first codes and second codes using a graph kernel algorithm to obtain a third code.

15. The apparatus according to any one of claims 11 to 14, characterized in that, The correspondence between the computation graph, the segmentation strategy, and the loss is constructed based on the second computation graph of the third model, the second segmentation strategy of the second computation graph, and the second loss required after the second segmentation strategy is applied to the second computation graph. The second computation graph is the training data of the second model obtained, and the second segmentation strategy and the second loss are known data.

16. The apparatus according to any one of claims 11 to 14, characterized in that, The device further includes: The non-segmentation module is configured to not segment the first computation graph if the first loss is greater than or equal to the preset threshold.

17. A device for evaluating the segmentation strategy of a model, characterized in that, The device includes: The first acquisition module is used to acquire the second computation graph of the third model, the second segmentation strategy of the second computation graph, and the second loss required after the second segmentation strategy is applied to the second computation graph. The second computation graph is the acquired training data of the second model. The second segmentation strategy and the second loss are known data. The third model is used to implement data processing. The second loss is the time required to implement the data processing through multiple sub-computation graphs. The multiple sub-computation graphs are obtained by segmenting the second computation graph based on the second segmentation strategy. The construction module is used to construct a correspondence between the computation graph, the splitting strategy and the loss based on the second computation graph, the second splitting strategy and the second loss. The correspondence is used to obtain the first loss required after the first splitting strategy is applied to the first computation graph of the first model. The first splitting strategy is obtained by the second model processing multiple first codes corresponding to multiple nodes of the first computation graph. The first computation graph contains multiple nodes, and one node represents a part of the computation that the first model can realize.

18. The apparatus according to claim 17, characterized in that, The second computation graph contains multiple nodes, where each node represents a portion of the computations achievable by the third model. The building module is used for: Encode multiple nodes of the second computation graph to obtain multiple fourth codes that correspond one-to-one with the multiple nodes, and encode the second segmentation strategy to obtain a fifth code; The sixth code is obtained by fusing the multiple fourth codes and the fifth code; Based on the sixth encoding and the second loss, a correspondence between encoding and loss is constructed.

19. The apparatus according to claim 18, characterized in that, The construction module is used to perform iterative operations on the multiple fourth codes and the fifth codes using a graph kernel algorithm to obtain a sixth code.

20. The apparatus according to any one of claims 17 to 19, characterized in that, The device further includes: The processing module is used to process the second computation graph through the fourth model to obtain the processing result, and the processing result is used to determine the third segmentation strategy of the second computation graph; The second acquisition module is used to acquire a target loss based on the second segmentation strategy and the third segmentation strategy, wherein the target loss is used to indicate the difference between the second segmentation strategy and the third segmentation strategy; The update module is used to update the parameters of the fourth model based on the target loss until the model training conditions are met, thus obtaining the second model.

21. A model segmentation device, characterized in that, The device includes a memory and a processor; The memory stores code, and the processor is configured to execute the code. When the code is executed, the device performs the method as described in any one of claims 1 to 10.

22. A computer storage medium, characterized in that, The computer storage medium stores a computer program that, when executed by a computer, causes the computer to perform the method described in any one of claims 1 to 10.

23. A computer program product, characterized in that, The computer program product stores instructions that, when executed by a computer, cause the computer to perform the method described in any one of claims 1 to 10.

Citation Information

Patent Citations

  • Neural network processing method and device, computer device and storage medium

    CN110674936A

  • Neural network model splitting method and device, storage medium and computer system

    CN111562977A

  • Neural network processing method and apparatus, computer device and storage medium

    US20220383082A1