Intelligent model optimization method based on chip architecture perception operator actual measurement feedback

Through the measured and replacing the operator in the smart model on the target hardware platform, the optimization model is used to optimize the optimization of the optimization process in the existing technology, and the efficient intelligent model optimization is achieved.

CN119378630AActive Publication Date: 2025-01-28北京麟卓信息科技有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411960626.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-01-28
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

When the existing technology improves the execution efficiency of intelligent models, it is necessary to conduct in-depth research on deep learning architecture, model structure and chip architecture design during the model training and deployment stages, resulting in the implementation of optimization methods being time-consuming and difficult.

Method used

By performing a smart model universal operator on the target hardware platform, forming a preferred universal operator library, and the measured operators in the model to optimize the model on the target hardware platform, form a list of eliminating operators according to the results of the feedback, use preferred universal operators The operator in the library replaces the operator in the list of elimination of the operator to achieve the reconstruction of the operator to optimize the model.

Benefits of technology

In the target hardware platform, the intelligent model optimization that can perceive the chip architecture has been achieved, the model execution efficiency is improved, the optimization process is simplified, and the time consumption and difficulty are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SMS_2
    Figure SMS_2
  • Figure SMS_3
    Figure SMS_3
  • Figure SMS_9
    Figure SMS_9
Patent Text Reader

Abstract

The invention discloses an intelligent model optimization method for sensing operator actual measurement feedback based on a chip architecture, which comprises the following steps of: performing performance test on general operators on a target hardware platform, selecting operators with short execution time to establish an optimal general operator library, and performing actual measurement on each operator in a model to be optimized on the target hardware platform; forming a rejecting operator list according to a feedback result, and replacing operators in the rejecting operator list with operators in the preferable general operator library; and testing the to-be-optimized model by adopting the constructed test data to form a first operator sequence and a second operator sequence, performing constant fusion and redundant operator removal on the to-be-optimized model, and finally performing operator reconstruction on the to-be-optimized model based on the first operator sequence and the second operator sequence to complete optimization. And intelligent model optimization capable of sensing the chip architecture is realized on the basis of operator actual measurement feedback in a target hardware platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent model optimization, and specifically relates to an intelligent model optimization method based on measured feedback of a chip architecture perception operator. Background Art

[0002] In a computing environment for artificial intelligence applications, the design and architecture of AI chips determine their adaptability and performance to different operators. According to the characteristics of different chip architectures, common AI chips can be divided into the following types, including neural network processing units (NPUs), graphics processing units (GPUs), tensor processing units (TPUs), and dedicated deep learning accelerators (DLAs). These chips have significant differences in adaptable operators, performance, and optimization methods. In order to improve the execution efficiency of intelligent models, methods such as model compression, model quantization, operator optimization, and parallel computing are usually used to accelerate model reasoning. However, these methods require in-depth research on deep learning architectures, model structures, and chip architecture design optimization methods during the model training stage or the model deployment stage. Therefore, the implementation of these optimization methods is time-consuming and difficult. Summary of the invention

[0003] In view of this, the present invention provides an intelligent model optimization method based on chip architecture-aware operator measured feedback, which realizes chip architecture-aware intelligent model optimization based on operator measured feedback in a target hardware platform.

[0004] The present invention provides an intelligent model optimization method based on chip architecture perception operator measured feedback, comprising the following steps:

[0005] Step 1: Execute the general operators of the intelligent model on the target hardware platform, and form a preferred general operator library from the operators with the shortest execution time among the same type of operators; take the operator set required to be executed from the input node to the output node in the model to be optimized as the backbone sequence, and form an operator list from the operators therein, and save the operator name, operator input, operator output, operator parameters and the video memory capacity of the target hardware platform in the operator list;

[0006] Step 2: Record the execution time of the operators in the operator list on the target hardware platform, form a list of eliminated operators from the operators that cannot be executed, and delete the operators in the eliminated operator list from the operator list; select similar operators from the preferred general operator library as replacement operators according to the types of the operators in the eliminated operator list, and add the replacement operators to the operator list; add operator parameters to the operators in the operator list to build a test data set, traverse all the data in the test data set in each round of testing, set the number of test rounds r and the number of tests t to 0, and set the data access method for the operator input;

[0007] Step 3, select the test data in the test data set as the current test data, update the value of the current test data, and expand the size of each operator input; if the size of the operator input in the current test data is not greater than the first size, use the L1 cache of the target hardware platform to load the current test data; if the size of the operator input in the current test data is greater than the first size and less than the second size, use the L3 cache of the target hardware platform to complete the loading; if the size of the operator input in the current test data is greater than or equal to the second size, divide the operator input into multiple operator inputs of smaller sizes and use the L2 cache of the target hardware platform to complete the loading; then complete the test of each operator in the operator list Lop, record the execution time of each operator, and let t increment by 1;

[0008] Step 4: If t is less than the set number of times, execute step 3; otherwise, after changing the data access method, let r increase by 1 and execute step 5;

[0009] Step 5: If there is unselected data in the test data set, execute step 3; otherwise, execute step 3 when r is not greater than the set number of rounds, and execute step 6 when r is greater than the set number of rounds;

[0010] Step 6: According to the obtained execution time of each operator, operators with the same function and operator input size are sorted from small to large according to the execution time to obtain a first operator sequence, and the same operator with different operator inputs and different operator parameters is sorted from small to large according to the execution time to obtain a second operator sequence corresponding to the operator;

[0011] Step 7: record the operator whose operator input in the model to be optimized is a constant operator, record the operator sequence in which both the starting operator and the ending operator are constant operators and the operator between the starting operator and the ending operator does not change the output of the starting operator as a constant operator sequence, and replace the constant operator sequence with the starting operator; record the operator at the end of the operator sequence outside the backbone sequence in the model to be optimized and does not affect the model output as a redundant operator, record the operator closest to the backbone sequence as a near-backbone operator, and eliminate the operator sequence with redundant operators and near-backbone operators as endpoints;

[0012] Step 8: traverse the model to be optimized, replace the lower-ranked operators with the operators with the higher-ranked operators according to the first operator sequence, and then select the best operator input and operator parameters according to the second operator sequence corresponding to the higher-ranked operators to replace the currently used operator input and operator parameters to obtain an intermediate model; train the intermediate model, and if the accuracy does not reach the set threshold, execute step 9, otherwise the intermediate model is the optimized model recorded as the result model, and this process ends;

[0013] Step 9: Select the operator on the backbone sequence, use operator combination to replace or increase operator parameters to improve the calculation accuracy of the operator, and then train the model. If the accuracy does not reach the set threshold, execute step 8. Otherwise, the intermediate model is the optimized model and recorded as the result model, ending this process.

[0014] Furthermore, the data access mode includes a row-first mode and a column-first mode.

[0015] Furthermore, in step 3, a set time interval is waited between the tests of the two operators.

[0016] Furthermore, the expansion of the size of each operator input in step 3 is implemented in the following manner for matrix multiplication operators: the current value of the first dimension data of the operator input is replaced by the sum of the current value and the incremental value, and the incremental value is ±2 n , n is an integer, and the value of n makes the video memory occupied by the matrix multiplication operator no larger than the video memory capacity of the target hardware platform.

[0017] Furthermore, the expansion of the size of each operator input in step 3 is implemented for activation type operators as follows: adding or reducing an incremental value for the dimension to be calculated, and the value range of the incremental value is [M×0.1-m_in, M×0.2-m_in], where m_in is the size of the original input data, and M is the video memory capacity of the target hardware platform.

[0018] Furthermore, the set number of times is 5.

[0019] Furthermore, adjacent convolution operators and batch normalization operators in the result model are fused.

[0020] Furthermore, after each modification of the model to be optimized, a unit error test is performed, including:

[0021] The replaced operator and its two adjacent operators are taken as test target A, and the replaced original operator and its two adjacent operators are taken as test target B;

[0022] Input the set number of test data into the test target A and the test target B respectively. If the test target A runs normally, calculate the mean values ​​aveA and aveB of the test output data of the test target A and the test target B respectively, and calculate the error between aveA and aveB;

[0023] When the error is less than the threshold, the replacement is determined to be successful; when the error is not less than the threshold, the replacement is determined to have failed; if the test target A cannot operate normally, the replacement is determined to have failed.

[0024] Furthermore, error testing is performed on the result model and the model to be optimized, including:

[0025] Input the set number of test data into the result model and the model to be optimized respectively. If the result model works normally, calculate the mean of the test output data of the result model and the model to be optimized respectively, and calculate the error between the two.

[0026] When the error is less than the threshold, the optimization is judged to be successful; when the error is not less than the threshold, the optimization is judged to have failed; if the result model cannot run normally, the optimization is judged to have failed.

[0027] Beneficial effects:

[0028] The present invention performs performance tests on general operators on a target hardware platform, selects operators with short execution time to establish a preferred general operator library, performs actual tests on each operator in a model to be optimized on the target hardware platform, forms a list of eliminated operators based on feedback results, and replaces the operators in the list of eliminated operators with operators in the preferred general operator library; the model to be optimized is tested using constructed test data to form a first operator sequence and a second operator sequence, constant fusion and redundant operator removal are performed on the model to be optimized, and finally, the operator reconstruction is performed on the model to be optimized based on the first operator sequence and the second operator sequence to complete the optimization, thereby realizing intelligent model optimization that can perceive the chip architecture based on the actual measured feedback of operators in the target hardware platform. DETAILED DESCRIPTION

[0029] The present invention is described in detail with reference to the following embodiments.

[0030] The present invention provides an intelligent model optimization method based on chip architecture perception operator measured feedback, and its core idea is: perform performance tests on general operators on a target hardware platform, select operators with short execution time to establish a preferred general operator library, perform actual tests on each operator in the model to be optimized on the target hardware platform, form a list of eliminated operators based on the feedback results, and use operators in the preferred general operator library to replace operators in the eliminated operator list; use the constructed test data to test the model to be optimized to form a first operator sequence and a second operator sequence, perform constant fusion and redundant operator removal on the model to be optimized, and finally perform operator reconstruction on the model to be optimized based on the first operator sequence and the second operator sequence to complete the optimization.

[0031] The present invention provides an intelligent model optimization method based on chip architecture perception operator measured feedback, which specifically includes the following steps:

[0032] Step 1: Build an operator performance test environment on the target hardware platform, execute the general operator of the intelligent model to obtain the operator execution time, and form the preferred general operator library of the target hardware platform from the operator with the shortest execution time among similar operators. Get the input nodes and output nodes of the model to be optimized, and use the operator set to be executed from the input node to the output node as the backbone sequence. Form an operator list Lop from all operators in the operator set. The operator list Lop stores the operator name, operator input Lop_in, operator output Lop_out, operator parameter Lop_par, and the target hardware platform video memory capacity M. Among them, the general operator of the intelligent model is the operator commonly used in the existing intelligent model.

[0033] Step 2: Execute all operators in the operator list Lop in the operator performance test environment of the target hardware platform, record the execution time of all operators, form a list of eliminated operators from the operators that cannot be executed, and delete the operators in the eliminated operator list from the operator list Lop; select similar operators as replacement operators in the preferred general operator library according to the types of operators in the eliminated operator list, and add the replacement operators to the operator list Lop; add operator parameters to expand the operator list for the operators in the operator list Lop, and build a test data set for the operators in the operator list Lop; each round of testing traverses all data in the test data set, sets the number of test rounds r and the number of tests t to 0, and sets the data access mode of the operator input, where the data access mode includes row priority mode and column priority mode.

[0034] Among them, the way to add operator parameters to the operators in the operator list Lop includes: for the convolution operator, add operator parameters including convolution kernel size KH×KW, step size S, padding boundary P and expansion rate; for the matrix multiplication operator, add the multiplied matrix; for the activation function operator, such as Leaky Relu, add operator parameter α; for the pooling operator, add operator parameters such as pooling window size, step size and padding boundary. For example, for a two-dimensional convolution operator, if the convolution kernel size KH×KW in the Lop_par of the operator is set to 1*1 and 3*3, 5*5 can be added, the step size S is usually 1 and 2, and the padding boundary P is usually 0 and 1. Taking the two-dimensional convolution operator as an example, the operator parameters are shown in the following table.

[0035] Table 1 Operator parameters of two-dimensional convolution operator

[0036] Serial number Convolution kernel size KH×KW Step length S Fill border P Expansion rate D 1 1*1 1 0 1 2 1*1 1 1 1 3 3*3 1 0 1 4 3*3 1 1 1 5 3*3 2 1 1 6 5*5 1 1 1 ... ... ... ... ...

[0037] Step 3, select the test data in the test data set as the current test data, randomly update the value of the current test data, and expand the size of each operator input in the current test data; if the size of the operator input in the current test data is not greater than the first size, use the L1 cache of the target hardware platform to load the current test data; if the size of the operator input in the current test data is greater than the first size and less than the second size, use the L3 cache of the target hardware platform to complete the loading; if the size of the operator input in the current test data is greater than or equal to the second size, divide the operator input into multiple matrices of smaller sizes and use the L2 cache of the target hardware platform to complete the loading; then complete the test of each operator in the operator list Lop, record the execution time of each operator, and let t increment by 1.

[0038] Furthermore, in order to increase the time interval between different operator tests to avoid cache hits, after completing the test of a certain operator, wait for a set time interval before executing the test of the next operator.

[0039] Among them, the size of each operator input in the current test data is expanded, and the rules for expanding the size are different for different operators. Generally, operators can be classified into matrix multiplication operators, activation operators, and mathematical operators.

[0040] The operator input of the matrix multiplication operator is generally a two-dimensional to four-dimensional matrix, the more common ones are two-dimensional matrices (W, H) and four-dimensional matrices (B, Cin, W, H), where W is the width of the matrix, i.e. the number of columns, H is the height of the matrix, i.e. the number of rows, B is the batch size, and Cin is the number of input channels. It can be seen that the first dimension data in the four-dimensional matrix is ​​the batch size and generally takes a value of 1, the second dimension data is related to the convolution channel, and the third and fourth dimension data are consistent with the data in the two-dimensional matrix. The expansion method of the operator input of the matrix multiplication operator in the present invention is: replace the current value of the first dimension data with the sum of the current value and the incremental value, and the incremental value is ±2 n , n is an integer increasing or decreasing.

[0041] For example, the matrix multiplication operator is represented as C=A×B, where A is a two-dimensional input matrix (W, H), B is an operator parameter matrix (H, M), and C is an output matrix Lop_out (W, M). The operator input expansion method of the present invention is used to replace the value of each element of W in A with the current value and 2 n Where n is the value that satisfies the condition (sizeof(A)+sizeof(B)+sizeof(C))≤M, and sizeof() is the data size of the matrix.

[0042] For the matrix multiplication operator whose operator input is a four-dimensional matrix, the convolution kernel is KH×KW×Cin×Cout, the input matrix is ​​Hin×Win×Cin, the output matrix is ​​Hout×Wout×Cout, the input video memory is I=Hin×Win×Cin, the convolution kernel video memory is K=KH×KW×Cin×Cout, and the output video memory is O=Hout×Wout×Cout. Meanwhile, Hout=(Hin+2P-KH) / S+1, Wout=(Win+2P-KW) / S+1, so the total video memory requirement is the sum of I, K and O, which can be expressed as: Hin×Win×Cin+[(Hin+2P-KH) / S+1]×[(Win+2P-KW) / S+1]×Cout+K. The operator input expansion method of the present invention is used to replace the value of each element of Hin or Win in the input matrix with the current value and ±2 n The sum of n is the value that makes the condition Hin×Win×Cin+[(Hin+2P-KH) / S+1]×[(Win+2P-KW) / S+1]×Cout+K≤M hold.

[0043] The size of the input data of the activation operator is usually 10%~50% of M to ensure the maximum computing performance of the operator, that is, the value range of the input data size is [0.1×M, 0.2×M]. According to the characteristics of the operator, the incremental value is randomly added or reduced for the dimension to be calculated, and the value range of the incremental value is [M×0.1-m_in, M×0.2-m_in], where m_in is the size of the original input data, that is, the size of the storage space required for the input data.

[0044] For example, ReLU does not require intermediate results. The input and output data sizes are both (H, W). Then 2*H*W≤M is applied. Therefore, it is necessary to ensure that H*W≤M / 2 holds and adjust the increment value within the range of [0.1×M,0.5×M].

[0045] The computational complexity of mathematical operators is generally small, and the size of the operator input data should be 10%~33% of M to ensure maximum performance. The input data size is in the range [0.1×M, 0.33×M]. According to the characteristics of the operator, the incremental value is randomly added to the dimension to be operated, and the incremental value is in the range [M×0.1-Lop_in, M×0.33-Lop_in]. For example, for the add operator, the added number is a constant provided by the model, not from an unknown input. The input and output data sizes are both (H, W), then M=3*H*W, ensuring that H*W<=M / 3, and the incremental value is increased or decreased within the range [0.1×M, 0.33×M].

[0046] Step 4: If t is less than the set number of times, execute step 3; otherwise, after changing the data access method, let r increase by 1 and execute step 5.

[0047] The set number of times can be set according to actual conditions, for example, the set number of times can be set to 5.

[0048] Step 5: If there is unselected data in the test data set, execute step 3; otherwise, execute step 3 when r is not greater than the set number of rounds, and execute step 6 when r is greater than the set number of rounds.

[0049] Step 6: According to the execution time of each operator obtained from the test, operators with the same function and operator input size are sorted from small to large according to the execution time to obtain a first operator sequence, and the same operator with different operator inputs and different operator parameters is sorted from small to large according to the execution time to obtain a second operator sequence corresponding to the operator.

[0050] Step 7: Obtain operators whose operator input is a constant in the model to be optimized and record them as constant operators; record the operator sequence in which both the starting operator and the ending operator are constant operators and the operator between the starting operator and the ending operator does not change the output of the starting operator as a constant operator sequence; and replace the constant operator sequence with the starting operator; record the operators at the end of the operator sequence outside the backbone sequence in the model to be optimized and that do not affect the model output as redundant operators; record the operators closest to the backbone sequence as near-backbone operators; and eliminate operator sequences with redundant operators and near-backbone operators as endpoints.

[0051] Step 8, traverse the model to be optimized, replace the operators with lower ranking with the operators with higher ranking according to the first operator sequence, and then select the best operator input and operator parameter combination according to the second operator sequence corresponding to the operators with higher ranking to replace the currently used operator input and operator parameters, complete the replacement of the model to be optimized and obtain the intermediate model; train the intermediate model, if the accuracy does not reach the set threshold, execute step 9, otherwise the intermediate model is the optimized model and recorded as the result model, and end this process.

[0052] Step 9: Select the operator on the backbone sequence, use operator combination to replace or increase operator parameters to improve the calculation accuracy of the operator, and then train the model. If the accuracy does not reach the set threshold, execute step 8. Otherwise, the intermediate model is the optimized model and recorded as the result model, ending this process.

[0053] Define the reconstruction operator training method: In order to ensure consistency before and after simplification, obtain 100 groups of random data ran_in, gradually input them into the operator Lcop before simplification, obtain the output result ran_out of each group of data, save multiple groups of random input and output data L (ran_in, ran_out), and use them as the training data set of the simplified operator Lnop. Train for 100 rounds to obtain the weight and accuracy of Lnop. This accuracy is a configurable parameter.

[0054] Furthermore, adjacent convolution operators and batch normalization operators in the result model can be fused to reduce computational overhead and intermediate data transmission and improve the computational efficiency of the model.

[0055] In existing models, the convolution operator is usually used in conjunction with the batch normalization operator. The output of the previous layer is calculated by the convolution operator and then input into the batch normalization operator for calculation, and then input into the next layer.

[0056] The calculation formula of the batch normalization operator is as follows:

[0057] Among them, X is the operator input, x i is the input element, Y is the operator output, y i is the output element, is the scaling factor, β is the offset, is the mean of the input data, is the variance of the input data and are constants, and the above parameters can be directly obtained from the model.

[0058] The calculation formula of the convolution operator is: Y = W * X +B, where W is the weight matrix and B is the bias matrix, which is also an existing parameter in the model.

[0059] After fusing the convolution operator with the batch normalization operator, the formula is as follows:

[0060] Except for the operator input X, all other parameters can be calculated before fusion. This achieves the replacement of two calculations with one calculation, thus improving the calculation efficiency.

[0061] Furthermore, in order to ensure the accuracy of the optimized intelligent model, the present invention performs unit error testing during the optimization process, that is, a unit error test is performed on the model every time a replacement is performed. The testing process is:

[0062] The replaced operator and its two adjacent operators are taken as test target A, and the replaced original operator and its two adjacent operators are taken as test target B;

[0063] Input the set number of test data into test target A and test target B respectively. If test target A operates normally, calculate the mean ave of the set number of test output data, obtain aveA and aveB, and use the following formula to calculate the error Dis:

[0064] Dis = |aveA-aveB| / aveB

[0065] When Dis is less than 1%, the replacement is considered successful; when Dis is not less than 1%, the replacement is considered failed; if the test target A cannot operate normally, the replacement is considered failed.

[0066] After the replacement and unit testing are completed, the error test is performed on the overall model of the replaced operator and the original model. The method is the same as above, and the overall test target is input to output. If the error between the two is within 1%, the replacement is successful; if the error is not less than 1%, the replacement fails.

[0067] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An intelligent model optimization method based on chip architecture perception operator measured feedback, characterized in that: The following steps are involved: Step 1: Execute the general operators of the intelligent model on the target hardware platform, and form a preferred general operator library from the operators with the shortest execution time among the same type of operators; take the operator set required to be executed from the input node to the output node in the model to be optimized as the backbone sequence, and form an operator list from the operators therein, and save the operator name, operator input, operator output, operator parameters and the video memory capacity of the target hardware platform in the operator list; Step 2: Record the execution time of the operators in the operator list on the target hardware platform, form a list of eliminated operators from the operators that cannot be executed, and delete the operators in the eliminated operator list from the operator list; select similar operators from the preferred general operator library as replacement operators according to the types of the operators in the eliminated operator list, and add the replacement operators to the operator list; Add operator parameters to operators in the operator list to build a test data set. Each round of testing traverses all data in the test data set, sets the number of test rounds r and the number of tests t to 0, and sets the data access method for operator input; Step 3, select the test data in the test data set as the current test data, update the value of the current test data, and expand the size of each operator input; if the size of the operator input in the current test data is not larger than the first size, use the L1 cache of the target hardware platform to load the current test data; if the size of the operator input in the current test data is larger than the first size and smaller than the second size, use the L3 cache of the target hardware platform to complete the loading; if the size of the operator input in the current test data is larger than or equal to the second size, divide the operator input into multiple operator inputs of smaller sizes and use the L2 cache of the target hardware platform to complete the loading; Then complete the test of each operator in the operator list Lop, record the execution time of each operator, and let t increase by 1; Step 4: If t is less than the set number of times, execute step 3; otherwise, after changing the data access method, let r increase by 1 and execute step 5; Step 5: If there is unselected data in the test data set, execute step 3; otherwise, execute step 3 when r is not greater than the set number of rounds, and execute step 6 when r is greater than the set number of rounds; Step 6: According to the obtained execution time of each operator, operators with the same function and operator input size are sorted from small to large according to the execution time to obtain a first operator sequence, and the same operator with different operator inputs and different operator parameters is sorted from small to large according to the execution time to obtain a second operator sequence corresponding to the operator; Step 7: record the operator whose operator input in the model to be optimized is a constant operator, record the operator sequence in which both the starting operator and the ending operator are constant operators and the operator between the starting operator and the ending operator does not change the output of the starting operator as a constant operator sequence, and replace the constant operator sequence with the starting operator; record the operator at the end of the operator sequence outside the backbone sequence in the model to be optimized and does not affect the model output as a redundant operator, record the operator closest to the backbone sequence as a near-backbone operator, and eliminate the operator sequence with redundant operators and near-backbone operators as endpoints; Step 8: traverse the model to be optimized, replace the lower-ranked operators with the operators with the higher-ranked operators according to the first operator sequence, and then select the best operator input and operator parameters according to the second operator sequence corresponding to the higher-ranked operators to replace the currently used operator input and operator parameters to obtain an intermediate model; train the intermediate model, and if the accuracy does not reach the set threshold, execute step 9, otherwise the intermediate model is the optimized model recorded as the result model, and this process ends; Step 9: Select the operator on the backbone sequence, use operator combination to replace or increase operator parameters to improve the calculation accuracy of the operator, and then train the model. If the accuracy does not reach the set threshold, execute step 8. Otherwise, the intermediate model is the optimized model and recorded as the result model, ending this process.

2. The intelligent model optimization method according to claim 1, characterized in that: The data access mode includes a row-first mode and a column-first mode.

3. The intelligent model optimization method according to claim 1, characterized in that: In step 3, a set time interval is waited between the tests of the two operators.

4. The intelligent model optimization method according to claim 1, characterized in that: The implementation method of expanding the size of each operator input in step 3 for matrix multiplication operators is: replacing the current value of the first dimension data of the operator input with the sum of the current value and the incremental value, and the incremental value is ±2 n , n is an integer, and the value of n makes the video memory occupied by the matrix multiplication operator no larger than the video memory capacity of the target hardware platform.

5. The intelligent model optimization method according to claim 1, characterized in that: The implementation method of expanding the size of each operator input in step 3 for activation type operators is: adding or reducing an incremental value for the dimension to be calculated, and the value range of the incremental value is [M×0.1-m_in, M×0.2-m_in], where m_in is the size of the original input data and M is the video memory capacity of the target hardware platform.

6. The intelligent model optimization method according to claim 1, characterized in that: The set number of times is 5.

7. The intelligent model optimization method according to claim 1, characterized in that: Fuse adjacent convolution operators and batch normalization operators in the resulting model.

8. The intelligent model optimization method according to claim 1, characterized in that: Perform unit error testing after each modification of the model to be optimized, including: The replaced operator and its two adjacent operators are taken as test target A, and the replaced original operator and its two adjacent operators are taken as test target B; Input the set number of test data into the test target A and the test target B respectively. If the test target A runs normally, calculate the mean values ​​aveA and aveB of the test output data of the test target A and the test target B respectively, and calculate the error between aveA and aveB; When the error is less than the threshold, the replacement is determined to be successful; when the error is not less than the threshold, the replacement is determined to have failed; if the test target A cannot operate normally, the replacement is determined to have failed.

9. The intelligent model optimization method according to claim 1, characterized in that: Perform error tests on the result model and the model to be optimized, including: Input the set number of test data into the result model and the model to be optimized respectively. If the result model works normally, calculate the mean of the test output data of the result model and the model to be optimized respectively, and calculate the error between the two. When the error is less than the threshold, the optimization is judged to be successful; when the error is not less than the threshold, the optimization is judged to have failed; if the result model cannot run normally, the optimization is judged to have failed.

Citation Information

Patent Citations

  • On-chip execution method and device of quantization neural network model, equipment and medium

    CN115409161A

  • Operator performance optimization method based on accelerator constraint

    CN117349585A

  • Training optimization method for foreign exchange time series prediction

    WO2021082809A1

  • Neural network model optimization method and apparatus, and computing device

    WO2023125628A1

  • Model reasoning acceleration method and apparatus, and electronic device and storage medium

    WO2023197554A1