Neural Network Model Quantization Method

By obtaining the initial parameter sensitivity feature information of the neural network layer and generating reference parameter information, combined with the quantization strategy and storage threshold, the problem of large quantization error in the existing technology is solved, and the error is reduced and the model accuracy is improved under high quantization ratio. degree effect.

CN118171698BActive Publication Date: 2024-10-01ALIBABA CLOUD FEITIAN (HANGZHOU) CLOUD COMPUTING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410591591.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-13
Publication Date
2024-10-01
Estimated Expiration
2044-05-13

AI Technical Summary

Technical Problem

Existing quantization methods, while maintaining a high quantization ratio, lead to large quantization errors and affect the effect of the model.

Method used

By obtaining the initial parameter sensitivity feature information of the neural network layer, the reference parameter information is generated, and the neural network layer is quantified based on the quantization strategy. Combined with the target storage threshold and the initial volume of the model, the quantification result of the neural network model is determined to reduce the quantization error. .

Benefits of technology

While maintaining a high quantization ratio, the quantization error is reduced, the model's requirements for storage devices are reduced, and the accuracy and applicability of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118171698B_ABST
    Figure CN118171698B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a neural network model quantization method, wherein the neural network model quantization method includes: obtaining a quantization data set, and determining the initial parameter sensitivity characteristic information of each neural network layer according to the quantization data set; generating reference parameter information according to the initial parameter sensitivity characteristic information corresponding to each neural network layer; quantizing each reference parameter information based on at least one quantization strategy to generate at least one neural network layer quantization result corresponding to each neural network layer; determining the neural network model quantization result corresponding to the neural network model according to the target storage threshold of the target storage device and the initial volume of the neural network model, as well as the quantization results of each neural network layer corresponding to each neural network layer. Parameter information is generated by the sensitivity of the parameter information in the neural network layer to the quantization ratio and the parameter information is quantized according to multiple preset quantization strategies, thereby reducing the requirements of the storage device for the model with higher accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of computer technology, and in particular to a neural network model quantization method, a neural network model quantization method applied to a cloud device, a computing device, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the development of large-scale industry data pre-training and instruction fine-tuning technology, large models have shown good results in specific fields. However, the scale of these models is usually very large and requires a lot of computing power and storage resources.

[0003] Currently, although existing quantization methods can quantize large models to a higher quantization ratio, this often leads to a larger quantization error. When the model is of the same size after quantization, the effect is not as good as quantizing a smaller model to a relatively lower quantization ratio. This is because a higher quantization ratio will lead to a larger quantization error. Therefore, in order to solve this problem, a neural network model quantization method is needed that can reduce the quantization error while maintaining a higher quantization ratio. Summary of the invention

[0004] In view of this, the embodiments of this specification provide a neural network model quantization method, a neural network model quantization method applied to a cloud device. One or more embodiments of this specification also involve a neural network model quantization device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.

[0005] According to a first aspect of an embodiment of this specification, a neural network model quantization method is provided, wherein the neural network model includes at least one neural network layer, including:

[0006] Acquire a quantized data set, and determine initial parameter sensitivity characteristic information of each neural network layer according to the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, the sample data set is a data set used to train the neural network model, and the initial parameter sensitivity characteristic information is used to characterize the sensitivity of each parameter in the neural network layer to the quantization ratio;

[0007] Generate reference parameter information based on the initial parameter sensitivity characteristic information corresponding to each neural network layer;

[0008] quantizing each reference parameter information based on at least one quantization strategy to generate at least one neural network layer quantization result corresponding to each neural network layer;

[0009] The neural network model quantization result corresponding to the neural network model is determined based on the target storage threshold of the target storage device and the initial volume of the neural network model, as well as the quantization results of each neural network layer corresponding to each neural network layer.

[0010] According to a second aspect of an embodiment of this specification, a neural network model quantization method applied to a cloud device is provided, including:

[0011] A neural network quantization instruction sent by a receiving terminal side device, and determining a target neural network model based on the neural network quantization instruction, wherein the target neural network model includes at least one target neural network layer;

[0012] Acquire a quantized data set, and obtain initial parameter sensitivity characteristic information of each target neural network layer determined according to the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, the sample data set is a data set used to train the target neural network model, and the initial parameter sensitivity characteristic information is used to characterize the sensitivity of each parameter in the target neural network layer to the quantization ratio;

[0013] Generate reference parameter information based on the initial parameter sensitivity characteristic information corresponding to each neural network layer;

[0014] quantizing each reference parameter information based on at least one quantization strategy to generate at least one target neural network layer quantization result corresponding to each target neural network layer;

[0015] Determine the neural network model quantization result corresponding to the neural network model according to the target storage threshold of the target storage device and the initial volume of the neural network model, and the quantization results of each neural network layer corresponding to each neural network layer, wherein the target storage device is the storage device of the end-side device;

[0016] Obtain model parameters corresponding to the quantization results of the target neural network model, and send the model parameters to the terminal side device.

[0017] According to a third aspect of an embodiment of this specification, a computing device is provided, including:

[0018] Memory and processor;

[0019] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the above-mentioned neural network model quantization method and the neural network model quantization method applied to cloud devices are implemented.

[0020] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned neural network model quantization method and the neural network model quantization method applied to cloud devices.

[0021] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned neural network model quantization method and the neural network model quantization method applied to a cloud device.

[0022] An embodiment of the present specification implements obtaining a quantized data set, and determining initial parameter sensitivity characteristic information of each neural network layer based on the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, the sample data set is a data set used to train the neural network model, and the initial parameter sensitivity characteristic information is used to characterize the sensitivity of each parameter in the neural network layer to the quantization ratio; generating reference parameter information based on the initial parameter sensitivity characteristic information corresponding to each neural network layer; quantizing each reference parameter information based on at least one quantization strategy to generate at least one neural network layer quantization result corresponding to each neural network layer; determining the neural network model quantization result corresponding to the neural network model based on a target storage threshold of a target storage device and the initial volume of the neural network model, as well as each neural network layer quantization result corresponding to each neural network layer.

[0023] By applying the scheme of the embodiments of the present specification, reference parameter information is obtained based on initial parameter sensitivity feature information that characterizes the sensitivity of each parameter in the neural network layer to the quantization ratio. This allows the obtained reference parameter information to carry the sensitivity of each parameter to the degree of compression. Since the sensitivity of each parameter to the degree of compression is carried in the reference parameter information, the parameter information is quantized through multiple preset quantization strategies to generate quantization results with multiple different quantization ratios and quantization errors for each neural network layer, thereby avoiding the situation where the quantization strategy cannot be accurately set when the sensitivity of each parameter is unknown, resulting in the inability to accurately reduce the quantization error. This further achieves maintaining a higher quantization ratio and reducing the quantization error when quantizing the model, thereby reducing the requirements of the storage device for the higher accuracy model. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 is a flowchart of a neural network model quantization method provided by an embodiment of this specification;

[0025] Figure 2 is a flowchart of a neural network model quantization method applied to a cloud device provided by an embodiment of this specification;

[0026] Figure 3 is an architecture diagram of a neural network model quantization system provided by an embodiment of this specification;

[0027] Figure 4 is a processing flow chart of a text processing model quantization method provided by an embodiment of this specification;

[0028] Figure 5 It is a structural schematic diagram of a neural network model quantization device provided by an embodiment of this specification;

[0029] Figure 6 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION

[0030] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.

[0031] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0032] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0033] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0034] In one or more embodiments of this specification, a large model refers to a deep learning model with large-scale model parameters, which usually contains hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than 10 trillion model parameters. A large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as a large-scale language model (LLM), a multi-modal pre-training model, etc.

[0035] When the big model is used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. The big model can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the big model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.

[0036] First, the terms involved in one or more embodiments of this specification are explained.

[0037] Model quantization: is a technique to reduce the storage and computational requirements of neural network models. By reducing the number of bits required to represent each weight, quantization can effectively reduce the size of the model and increase its running speed. This usually involves converting floating-point weights to integers with lower bit depths, such as converting 32-bit floating-point numbers to integers with 8 bits or less. Although it may slightly affect model accuracy, this effect can be mitigated through subsequent fine-tuning. Quantization makes the model more suitable for deployment on resource-constrained devices.

[0038] In this specification, a neural network model quantization method is provided, and a neural network quantization method applied to a cloud device. This specification also involves a neural network model quantization device, a computing device, and a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.

[0039] See also Figure 1 , Figure 1 A flowchart of a neural network model quantization method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.

[0040] Step 102: Obtain a quantized data set, and determine initial parameter sensitivity characteristic information of each neural network layer based on the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, the sample data set is a data set used to train the neural network model, and the initial parameter sensitivity characteristic information is used to characterize the sensitivity of each parameter in the neural network layer to the quantization ratio.

[0041] In practical applications, the neural network model is a deep learning model that has been trained and has multiple neural network layers, the neural network layer has a network layer with a neural network structure, the quantized data set is a set consisting of at least one data in the sample data used to train the neural network model, the sample data set is a set consisting of sample data used to train the neural network model, and the initial parameter sensitivity feature information is the feature information of the local curvature of the parameters in the neural network layer.

[0042] Specifically, the initial parameter sensitivity feature information can be understood as the feature information of the sensitivity of each parameter in the neural network layer to the quantization ratio by calculating the feature information of the local curvature of the parameters in the neural network layer. Since the local curvature reflects how the loss function changes when the parameter changes slightly, a high curvature means that the loss function is very sensitive to small changes in the parameter. The higher the sensitivity of the parameter to the quantization ratio, the greater the impact of the quantization loss of the model caused by the quantization of the parameter.

[0043] The neural network model can be a model of any neural network structure with any number of parameters, for example, an image processing model for image processing tasks such as graphic recognition, image segmentation, and image generation, a text processing model for text processing tasks such as text classification and text generation, or a multimodal processing model for generating images based on text, summarizing information in images, generating videos based on text, etc., a large model for knowledge question and answer, etc. This specification does not impose any restrictions on this.

[0044] Since the closer the data distribution of the quantized data set is to the data distribution of the sample data set during training, the more accurate the initial parameter sensitivity characteristic information obtained by the model calculation is, the more accurate the quantized data set is randomly confirmed in the sample data set used to train the neural network model. This can ensure that the initial parameter sensitivity characteristic information obtained is as accurate as possible and maintain sufficient randomness, thereby improving the effect of quantizing the model.

[0045] Furthermore, initial parameter sensitivity characteristic information of each neural network layer is determined based on the quantized data set, including: determining a first neural network layer, and obtaining first input characteristic information of the first neural network layer based on the quantized data set; and generating first initial parameter sensitivity characteristic information corresponding to the first neural network layer based on the first input characteristic information.

[0046] In actual applications, the first neural network layer is any one of the neural network layers, the first input feature information is the input feature information of the first neural network layer, the input feature information is the feature information input into the neural network layer after quantization data processing, and the first initial parameter sensitivity feature information is the initial parameter sensitivity feature information of the first neural network layer.

[0047] Specifically, confirming the input data of the first neural network layer based on the quantized data set can be understood as inputting each data in the quantized data set into the neural network model one by one, and obtaining a single input data of the neural network layer based on each quantized data, and then merging the obtained single input data to obtain the input data of the neural network layer. The input data can be fused in a manner of calculating similarity and fusion based on the similarity, and the fusion result is regarded as the input data of the neural network layer. It can also be a matrix fusion method of directly performing addition calculation and then normalization processing. After the above input data are fused, the fusion result is regarded as the input data of the neural network layer. This specification does not impose any restrictions on this.

[0048] Obtaining the input data of the neural network layer during the model quantization process through a quantized data set composed of multiple data pieces is conducive to more accurate evaluation and adaptation to the distribution characteristics of the data. It can ensure that the quantization strategy is not based only on the characteristics of a single data point, but on a wider data set, so as to more effectively determine the parameter sensitivity characteristic information of each neural network layer, reduce quantization errors, and ensure that the model can still capture key data features after quantization.

[0049] Furthermore, based on the first input feature information, first initial parameter sensitivity feature information corresponding to the first neural network layer is generated, including: transposing the first input feature information to determine first input feature transposition information; and generating first initial parameter sensitivity feature information based on preset regularization matrix information, the first input feature information and the first input feature transposition information.

[0050] In practical applications, the first input feature transposition information is the input feature transposition information corresponding to the first neural network layer.

[0051] In one embodiment provided in this specification, the calculation method of the initial parameter sensitivity characteristic information is as shown in Formula 1:

[0052] ...Formula 1

[0053] Among them, H is the initial parameter sensitivity feature information, X is the input feature information, and X T is the input feature transposition information, λ is a random weight used to avoid numerical problems that may arise when the model is quantized later, and is preferably set to 0.01, and I is the unit matrix, that is, the regularization matrix information.

[0054] Calculating the quantization sensitivity of each parameter using the initial parameter sensitivity characteristic information obtained in the above manner can provide specific information about the possible impact of the quantization operation on the model performance. The initial parameter sensitivity characteristic information reflects the local curvature of the loss function in the parameter space, where a large eigenvalue indicates that the parameter at the corresponding position is very sensitive to small changes. Therefore, through this initial parameter sensitivity characteristic information, it is possible to determine which parameters are more susceptible to quantization errors, which helps to optimize the quantization strategy and thus improve the quantization accuracy of the model.

[0055] Step 104: Generate reference parameter information based on the initial parameter sensitivity feature information corresponding to each neural network layer.

[0056] In practical applications, the initial parameter information is a matrix formed by parameters in the neural network structure in the neural network layer, and the reference parameter information is a matrix generated after processing the initial parameter information according to the sensitivity of each parameter in the neural network structure to the quantization ratio.

[0057] Generating reference parameter information according to initial parameter sensitivity characteristic information can be understood as processing the initial parameter information according to the initial parameter sensitivity characteristic information to generate reference parameter information carrying the sensitivity of each parameter in the neural network layer to the quantization ratio.

[0058] Specifically, the method of generating reference parameter information may be to reorder the parameters in the initial parameter information to generate reference parameter information, or to set corresponding indexes for the parameters in the initial parameter information according to the above-mentioned initial parameter sensitivity characteristic information to generate reference parameter information carrying index information, and so on. This specification does not impose any restrictions on this.

[0059] According to the sensitivity of each parameter to the quantization ratio, reference parameter information carrying the sensitivity of each parameter in the neural network layer to the quantization ratio is generated from the initial parameter information, so that more detailed quantization control can be achieved through different quantization strategies when the model is quantized, thereby reducing the quantization error caused by quantization.

[0060] Furthermore, reference parameter information is generated based on the initial parameter sensitivity characteristic information corresponding to each neural network layer, including: determining the parameter sensitivity order information corresponding to each neural network layer based on the initial parameter sensitivity characteristic information corresponding to each neural network layer; sorting the initial parameter information of each neural network layer based on the parameter sensitivity order information to generate reference parameter information.

[0061] In practical applications, the parameter sensitivity order information is order information based on the order of the sensitivity of each parameter to the quantization ratio.

[0062] Specifically, the reference parameter information can be understood as a matrix after the initial parameter information is reordered according to the sensitivity of each parameter in the neural network structure to the quantization ratio. That is to say, the initial parameter information is reordered according to the sensitivity of each parameter in the neural network structure to the quantization ratio to generate new reference parameter information. Since the new reference parameter information is determined according to the sensitivity of each parameter in the neural network structure to the quantization ratio, quantizing the new reference parameter information when the model is subsequently quantized can make quantization decisions based on the sensitivity of each parameter to the quantization ratio, rather than blindly quantizing all the original initial parameter information, so that the quantized model can retain the performance of the original model as much as possible, while achieving effective use of storage space. Therefore, using the sensitivity of each parameter in the neural network structure to the quantization ratio to process the initial parameter information to generate new reference parameter information can achieve more detailed quantization control through different quantization strategies when the model is quantized, thereby reducing the quantization error caused by quantization.

[0063] Taking into account that the sensitivity of each acquired parameter to the quantization ratio is more obvious in the entire row or column of the matrix of parameter information and parameter sensitivity feature information, and operating on the rows or columns in the matrix can further reduce the resource consumption caused by quantizing the model, the parameter sensitivity order information includes channel sensitivity order information; according to the initial parameter sensitivity feature information corresponding to each neural network layer, the parameter sensitivity order information corresponding to each neural network layer is determined, including: determining a second neural network layer, and based on the second initial parameter sensitivity feature information corresponding to the second neural network layer, determining the second channel sensitivity order information corresponding to the second neural network layer.

[0064] In practical applications, the second neural network layer is any one of the neural network layers in the neural network model, the second initial parameter sensitivity feature information is the initial parameter sensitivity feature information corresponding to the second neural network layer, the second channel sensitivity order information is the channel sensitivity order information corresponding to the second neural network layer, the channel sensitivity order information is the sensitivity of each parameter channel information composed of parameters to the quantization ratio, the parameter channel information is the data of an entire row or column in the matrix corresponding to the parameter information, each data in the matrix corresponding to the parameter information is the parameter value in the neural network structure in the neural network layer, and the row or column in the matrix corresponding to the parameter information is the channel corresponding to the neural network structure in the neural network layer.

[0065] Specifically, the parameter information can be understood as a matrix representing the parameters in the neural network result in the neural network layer, and each value in the matrix is ​​a parameter value. The parameter channel information in the corresponding parameter information can be understood as a vector of an entire row or column in the matrix. Similarly, each value in the vector is a parameter value.

[0066] In one embodiment provided in the present specification, the ranking information of the sensitivity of each column to the quantization ratio is determined by determining the value on the diagonal from the upper right corner to the lower left corner in the initial parameter sensitivity feature information as the sensitivity of each column (parameter channel) to the quantization ratio.

[0067] Since the features in the initial parameter sensitivity feature information that characterize the sensitivity of each channel to the quantization ratio are easier to obtain, and operating on the rows or columns in the matrix can further reduce the resource consumption caused by quantizing the model, the features (channel sensitivity order information) that characterize the sensitivity of each channel to the quantization ratio are obtained in the initial parameter sensitivity feature information to achieve subsequent quantization processing of each neural network layer.

[0068] Furthermore, the initial parameter information of each neural network layer is sorted based on the sensitivity order information of each parameter to generate reference parameter information, including: determining the second channel position corresponding to each second parameter channel information of the second neural network layer based on the second channel sensitivity order information; and rearranging each second parameter channel information based on the second channel position corresponding to each second parameter channel information to generate second reference parameter information.

[0069] In practical applications, the second channel position is the position of the channel composed of each parameter value in the second neural network layer after being sorted according to the sensitivity of the channel to the quantization ratio. Specifically, the confirmation method of each quantization channel position can be to arrange each quantization channel from large to small according to the sensitivity of the quantization channel to the quantization ratio, and the quantization channel with a greater sensitivity corresponds to a position closer to the front; or it can be arranged from small to large according to the sensitivity of the quantization channel to the quantization ratio, and the quantization channel with a smaller sensitivity corresponds to a position closer to the front. This manual does not impose any restrictions on this.

[0070] In one embodiment provided in the present specification, the quantization channels are arranged from large to small according to their sensitivity to the quantization ratio. The quantization channels with greater sensitivity correspond to the front positions. Based on this, the positions of the quantization channels are determined, and then the quantization channels are rearranged according to the determined positions, and a new matrix after rearrangement is obtained as reference quantization information.

[0071] By rearranging the channels according to their sensitivity to the quantization ratio, the resource consumption caused by quantizing the model can be further reduced, thereby enabling subsequent quantization processing of each neural network layer.

[0072] Step 106: Quantize each reference parameter information based on at least one quantization strategy to generate at least one neural network layer quantization result corresponding to each neural network layer.

[0073] In practical applications, the quantization strategy is a strategy for quantizing the neural network layer, and the quantization result of the neural network layer is the neural network structure after the neural network layer is quantized.

[0074] Specifically, the quantization strategy can be understood as selecting different quantization ratios according to the different sensitivity of each channel to the quantization ratio. Since each neural network layer occupies a different proportion in the neural network model and has different importance, and considering the consumption caused by quantizing the neural network, the same multiple strategies are used to quantize each neural network layer, which can reduce the time and manpower costs required for quantizing the neural network.

[0075] The reference parameter information may be quantized by maximum and minimum values, or by setting a group of indexed vectors for quantization, etc., and this specification does not impose any restrictions on this. Considering the quantization efficiency when quantizing the model, preferably, a group of indexed vectors (for the convenience of description, the group of indexed vectors is referred to as a codebook below) is used for quantization. The specific method is to obtain a group of parameter channels according to a preset length, regard the parameters at the same position of the parameter channel as a group of vectors, and then obtain the corresponding index of the vector with a high similarity to the group of vectors in the above codebook, and use the index as the value of the corresponding position in the above group of parameter channels. The above operation is performed on the values ​​of each position in the group of vector channels, so that a group of parameter channels can be quantized into a vector, and each value in the vector is the index corresponding to each vector in the above codebook.

[0076] It should be noted that the quantization ratio of the model is usually expressed in bits. Since the data length of the model parameters before quantization is usually 32 bits, xbits here means that the model parameters are quantized to a length of x. For example, a quantization ratio of 1bit means that the parameter length in the model is quantized to 1, that is, the size of the compressed model is 1 / 32 of the original.

[0077] It should be noted that since x parameters are quantized together through the codebook, an x-dimensional codebook set is required, which includes y x-dimensional vectors, and when y=2 16 When x=8, the model can be quantized to 2 bits, that is, the parameters in the model can be quantized into integer data with a length of 2.

[0078] By quantizing the parameters through multiple preset quantization strategies, the consumption caused by quantizing the neural network can be fully considered, and the time cost and manpower cost required for quantizing the neural network can be reduced.

[0079] In an embodiment provided in this specification, if 3 and 4 bits are to be implemented, the value of y can be simply set to 2 24 and 2 32To achieve 3bits and 4bits quantization. However, considering that this setting will cause the vectors in the codebook set to increase exponentially, it not only increases the space required to store the codebook, but also increases the time to search for the closest vector during quantization, which leads to low efficiency when quantizing the model. Therefore, the confirmation method of the quantization result includes the following steps: confirming the parameter information to be quantized, the reference quantization accuracy corresponding to the parameter information to be quantized, and at least one initial quantization accuracy, wherein the initial quantization accuracy is less than or equal to the reference quantization accuracy; determining a first initial quantization accuracy, and quantizing the parameter to be quantized according to the first initial quantization accuracy to obtain a first initial quantization result; judging whether the quantization accuracy corresponding to the first initial quantization result is the same as the reference quantization accuracy; if the same, determining the first initial quantization result as the quantization result corresponding to the parameter information to be quantized; if different, determining the residual parameter information according to the parameter information to be quantized and the first initial quantization result; determining a second initial quantization accuracy, and quantizing the residual parameter information according to the second initial quantization accuracy to update the first initial quantization result; continuing to perform the step of judging whether the quantization accuracy corresponding to the first initial quantization result is the same as the reference quantization accuracy.

[0080] In practical applications, the parameter information to be quantized is the parameter information that needs to be quantized, the initial quantization accuracy is the quantization accuracy provided by the basic quantization table, the first initial quantization accuracy and the second initial quantization accuracy are any one of the initial quantization accuracy, and the first initial quantization result is the quantization result obtained after quantization according to the selected quantization accuracy.

[0081] Specifically, the parameter information to be quantized can be understood as information that needs to be quantized at any scale, for example, parameter information included in multiple quantization channels that need to be quantized, parameter information included in the entire deep learning network, parameter information corresponding to a designated area, etc. This specification does not impose any restrictions on this.

[0082] The initial quantization accuracy can be understood as the quantization accuracy corresponding to the codebook set with fewer vectors. By using a codebook set with fewer vectors to quantize the parameters with higher accuracy, the problem of low quantization efficiency caused by the geometric increase of the codebook due to the improvement of quantization accuracy can be effectively avoided.

[0083] In an embodiment provided in the present specification, quantization based on 3 bits is decomposed into a 2-bit quantization and a 1-bit quantization to achieve, wherein firstly, a 2-bit quantization is performed on the parameter information to be quantized, and then the residual parameter after subtracting the parameter information to be quantized and the first initial quantization result is quantized for the remaining 1-bit, or firstly, a 1-bit quantization is performed on the parameter information to be quantized, and then the residual parameter after subtracting the parameter information to be quantized and the first initial quantization result is quantized for the remaining 2-bit, and finally a quantization result with a quantization accuracy of 3 bits is generated, and the quantization result is determined as the quantization result corresponding to the parameter information to be quantized, wherein the quantization accuracy corresponding to the 3-bit quantization is the reference quantization accuracy, and the quantization accuracy corresponding to the 1-bit quantization and the 2-bit quantization is the initial quantization accuracy.

[0084] In another embodiment provided in the present specification, 5-bit quantization is divided into two 2-bit quantizations and one 1-bit quantization. First, the parameter information to be quantized is quantized with 2 bits to generate a first initial quantization result. Then, the residual parameter after subtracting the parameter information to be quantized from the first initial quantization result is quantized with 2 bits to update the first initial quantization result. Finally, the residual parameter after subtracting the parameter information to be quantized from the updated first initial quantization result is quantized with 2 bits to update the first initial quantization result. The first initial quantization result is determined as the quantization result corresponding to the parameter information to be quantized, wherein the quantization accuracy corresponding to the 5-bit quantization is the reference quantization accuracy, and the quantization accuracy corresponding to the 1-bit quantization and 2-bit quantization is the initial quantization accuracy.

[0085] Furthermore, each reference parameter information is quantized based on at least one quantization strategy to generate at least one neural network layer quantization result corresponding to each neural network layer, including: determining a third neural network layer and a target quantization strategy, and obtaining a target quantization accuracy ratio corresponding to the target quantization strategy; quantizing the third reference parameter information corresponding to the third neural network layer based on the target quantization accuracy ratio to generate a third neural network layer quantization result corresponding to the third neural network layer.

[0086] In practical applications, the third neural network layer is any one of the neural network layers in the neural network model, the target quantization strategy is any one of the quantization strategies, and the target quantization accuracy ratio is the quantization accuracy ratio specified in the target quantization strategy. In an embodiment provided in this specification, since the reference parameter information is parameter information arranged from large to small according to the sensitivity of the parameter to the quantization ratio, a quantization accuracy ratio 1 is specified: the first 25% uses 4-bit quantization, the last 75% uses 2-bit quantization, and the quantization accuracy ratio 2 is specified: the first 40% uses 4-bit quantization, and the last 60% uses 2-bit quantization, wherein the quantization loss corresponding to the quantization result obtained by the quantization accuracy ratio 1 is smaller, and the quantization ratio corresponding to the quantization result obtained by the quantization accuracy ratio 2 is larger, compared with the commonly used random setting of the quantization accuracy ratio, for example, the quantization accuracy ratio 3: the first 75% uses 2-bit, and the last 25% uses 4-bit quantization, compared with the quantization result obtained by the above-mentioned quantization accuracy ratio 1, the quantization loss corresponding to the quantization result corresponding to the quantization accuracy ratio 1 is smaller, and the quantization ratio is also higher.

[0087] Specifically, the quantization accuracy ratio is the ratio of each quantization accuracy required for quantization when the neural network layer is quantized. Since the reference parameter information for quantization is the parameter information arranged from small to large or from large to small according to the sensitivity of the parameter to the quantization ratio, the quantization strategy that minimizes the impact on the performance of the neural network can be achieved through the ratio of quantization accuracy. This method can guide the application of different accuracy to different parameters during the quantization process, thereby optimizing the trade-off between the overall performance and size of the model. Through such an optimized quantization strategy, the effectiveness of the model can be maintained while improving its operational efficiency and applicability.

[0088] Furthermore, the third reference parameter information corresponding to the third neural network layer is quantized based on the target quantization accuracy ratio to generate a third neural network layer quantization result corresponding to the third neural network layer, including: determining at least one quantization region parameter information and the quantization accuracy corresponding to each quantization region parameter information in the third reference parameter information according to the target quantization accuracy ratio, wherein the quantization region parameter information includes at least one parameter information, and the third reference parameter information is obtained by initial parameter sensitivity characteristic information; determining the target quantization region parameter information and the target quantization accuracy corresponding to the target quantization region parameter information; generating a region quantization result corresponding to the target quantization region parameter information based on the target quantization accuracy and the target quantization region parameter information; generating the third neural network layer quantization result according to each region quantization result.

[0089] In practical applications, the quantization region parameter information is the parameter of a region that needs to be quantized with the same quantization accuracy, and the target quantization region parameter information is any one of the quantization region parameter information.

[0090] Specifically, the quantization area parameter information can be understood as the information of the adjacent areas that need to pass the same quantization precision in the neural network layer. Taking the parameters stored in the neural network layer in the form of a matrix as an example, the quantization area is explained. The parameters stored in the neural network layer are 10*10 matrices. According to the quantization precision ratio, 25% is quantized with an accuracy of 4 bits and 75% is quantized with an accuracy of 1 bit. Then, the 5*5 matrix with subscripts (0, 0) to (4, 4) is used as a quantization area parameter information, and its corresponding quantization precision is 4 bits. The 5*5 matrix with subscripts (0, 5) to (4, 9) is used as another quantization area parameter information, and its corresponding quantization precision is 1 bit. The 5*5 matrix with subscripts (5, 0) to (9, 4) is used as another quantization area parameter information, and its corresponding quantization precision is 1 bit. The 5*5 matrix with subscripts (5, 5) to (9, 9) is used as another quantization area parameter information, and its corresponding quantization precision is 1 bit.

[0091] In an embodiment provided in the present specification, the parameters stored in the neural network layer are stored in the form of vectors as an example to explain the quantization area. The parameters stored in the neural network layer are vectors of length 40. According to the quantization accuracy ratio, 25% are quantized with an accuracy of 4 bits, 50% are quantized with an accuracy of 2 bits, and 25% are quantized with an accuracy of 1 bit. The vectors with a length of 10 from sequence numbers 0 to 9 are used as quantization area parameter information, and the corresponding quantization accuracy is 4 bits. The vectors with a length of 20 from sequence numbers 10 to 29 are used as quantization area parameter information, and the corresponding quantization accuracy is 2 bits. The vectors with a length of 10 from sequence numbers 30 to 39 are used as quantization area parameter information, and the corresponding quantization accuracy is 1 bit.

[0092] By determining each quantization area from the reference quantization parameter information through a preset quantization accuracy ratio, and quantizing the parameters in the quantization area according to their corresponding quantization accuracy, the model can achieve a balance between accuracy and efficiency. This differentiated quantization method allows higher accuracy to be used for more sensitive parameters, while lower accuracy can be used for parameters with less impact. In this way, while minimizing the performance loss of the model, the storage requirements of the model can be significantly reduced and the computing speed can be increased, so that better neural network models can run on devices with limited resources.

[0093] Furthermore, the third reference parameter information corresponding to the third neural network layer is quantized based on the target quantization accuracy ratio to generate a third neural network layer quantization result corresponding to the third neural network layer, including: determining at least one target quantization interval and a target quantization accuracy corresponding to each target quantization interval according to the target quantization accuracy ratio and the third reference parameter information, wherein the target quantization interval is an interval corresponding to the parameter channel information quantized based on the same quantization accuracy in the reference parameter information; and generating a third neural network layer quantization result corresponding to the third neural network layer based on each target quantization accuracy, each quantization interval and the third reference parameter information.

[0094] In practical applications, the target quantization interval is the interval corresponding to the quantization channel using the same precision, and the target quantization accuracy is the quantization accuracy corresponding to the target quantization interval.

[0095] Specifically, the quantization result of the neural network layer is generated according to each target quantization precision, each quantization interval and the reference parameter information. It can be understood that after determining the parameter channel using the same quantization precision from the reference parameter information through each quantization interval, the determined parameters are quantized using the quantization precision corresponding to the quantization interval.

[0096] In an embodiment provided in the present application, the reference parameter information has 128 parameter channels of 0-127. When the quantization accuracy ratio is: the first 25% uses 4-bit quantization and the last 75% uses 2-bit quantization, the quantization accuracy corresponding to the quantization interval 0-31 is determined to be 4 bits, and the quantization accuracy for the quantization interval 32-127 is 2 bits, that is, the first 32 quantization channels are quantized using a quantization accuracy of 4 bits, and the last 96 channels are quantized using 2 bits.

[0097] By determining quantization intervals of different precisions and quantizing each parameter channel separately, a balance between accuracy and efficiency of the model can be achieved. This differentiated quantization method allows higher precision to be used for more sensitive parameters, while lower precision can be used for parameters with less impact. In this way, while minimizing the loss of model performance, the storage requirements of the model can be significantly reduced and the computing speed can be increased, thereby enabling better neural network models to run on devices with limited resources.

[0098] Taking into account that simply quantizing the parameter channels will result in a quantization result with a high quantization error, by dividing the parameter channels into multiple groups and quantizing the multiple groups, it is possible to take into account the errors of the previously quantized channel groups when quantizing the subsequent channel groups, thereby reducing the accumulation of the overall quantization error. Therefore, the reference parameter information includes at least one parameter channel group, and the parameter channel group includes at least one parameter channel information; based on each target quantization precision, each quantization interval and the third reference parameter information, a third neural network layer quantization result corresponding to the third neural network layer is generated, including: determining at least one third reference parameter channel group in the third reference parameter information based on each target quantization precision; determining the third reference channel group quantization precision corresponding to each third reference parameter channel group; quantizing each third reference parameter channel group based on the quantization precision of each third reference channel group, and generating a third channel group quantization result corresponding to each third reference parameter channel group; generating the third neural network layer quantization result according to the quantization result of each third channel group.

[0099] In actual applications, the third reference parameter channel group is the reference parameter channel group corresponding to the third neural network layer, the third channel group quantization result is the channel group quantization result corresponding to each third reference parameter channel group, the third reference channel group quantization accuracy is the quantization accuracy corresponding to each third reference parameter channel group, the reference parameter channel group is a matrix composed of a preset number of channels, the channel group quantization result is the result obtained after quantizing the matrix composed of the above multiple parameter channels, and the reference channel group quantization accuracy is the quantization accuracy corresponding to each channel group.

[0100] The quantization results corresponding to each reference channel group can be determined by confirming the quantization accuracy corresponding to each channel confirmed above. Specifically, the channel group quantization accuracy corresponding to each reference channel group confirmed according to the quantization accuracy corresponding to each channel is divided into two cases. If the goal of this model quantization is to reduce the quantization loss, then the quantization accuracy corresponding to the reference parameter channel group is determined to be the quantization accuracy with higher quantization accuracy among the quantization accuracy corresponding to each reference parameter channel in the channel group. If the goal of this model quantization is to increase the quantization ratio, then the quantization accuracy corresponding to the reference parameter channel group is determined to be the quantization accuracy with lower quantization accuracy among the quantization accuracy corresponding to each reference parameter channel in the channel group.

[0101] In an embodiment provided by the present application, the reference parameter information has 144 parameter channels, and the reference parameter information is divided into 18 reference parameter channel groups with 8 channels as a group. Since the quantization ratio used is that the first 25% of the vectors are quantized using 4 bits and the last 75% are quantized using 2 bits, it is confirmed that the first 36 vectors are quantized according to the corresponding target channel sensitivity group with a 4-bit quantization rate as a group vector, so the 18 reference parameter channel groups and the channel numbers contained therein are confirmed as: channel group 1 [0,7], ..., channel group 5 [32,39], ..., channel group 18 [136,143]. It can be seen that channel group 5 includes both channels quantized with 4 bits and channels quantized with 2 bits. Since the goal of performing this model quantization is to reduce the quantization loss, it is confirmed that channel group 5 is quantized using 4 bits, and then it is confirmed that channel groups 1-5 are quantized according to 4 bits, and channel groups 6-18 are quantized according to 2 bits.

[0102] Specifically, the reference parameter channel group can be understood as dividing each channel in the reference parameter information into individual channels according to a fixed number, and then quantizing each channel one by one. This step-by-step quantization process allows compensation for the errors introduced in the previous quantization step, making the subsequent quantization more accurate and improving the performance of the entire model after quantization. This strategy optimizes the quantization process and helps achieve more efficient compression while maintaining model accuracy.

[0103] Further, quantizing each third reference parameter channel group based on the quantization accuracy of each third reference channel group, generating a third channel group quantization result corresponding to each third reference parameter channel group, including: determining third initial parameter sensitivity feature information and third parameter sensitivity order information corresponding to the third neural network layer; sorting the third initial parameter sensitivity feature information according to the third parameter sensitivity order information to generate third reference parameter sensitivity feature information, wherein the parameter sensitivity feature information includes at least one channel sensitivity feature information; determining a third reference channel sensitivity feature information group corresponding to each third reference parameter channel group, wherein the channel sensitivity feature information group includes at least one channel sensitivity feature information;

[0104] Based on each third reference parameter channel group, each third reference channel sensitivity group and the third reference channel group quantization accuracy, a quantization result of each third channel group is determined.

[0105] In actual applications, the third initial parameter sensitivity feature information is the initial parameter sensitivity feature information corresponding to the third neural network layer, the third parameter sensitivity order information is the parameter sensitivity order information corresponding to the third neural network layer, the third reference parameter sensitivity feature information is the sorted third initial parameter sensitivity feature information, the third reference channel sensitivity feature information group is the matrix corresponding to each third reference parameter channel group in the third reference parameter sensitivity feature information, the reference parameter sensitivity feature information is the parameter sensitivity feature information after sorting the sensitivity of each parameter to the compression ratio, and the reference channel sensitivity feature information group is the matrix corresponding to the reference parameter channel group in the current neural network layer in the reference channel sensitivity feature information.

[0106] Specifically, the method of reordering the initial parameter sensitivity characteristic information into the reference parameter sensitivity characteristic information is the same as the method of ordering the initial parameter information into the reference parameter information, and this specification will not be repeated. The reference channel sensitivity characteristic information group can be understood as the sensitivity characteristic information corresponding to each channel in each reference parameter channel group. Since the reference parameter sensitivity characteristic information is ordered in the same order as the above-mentioned reference parameter information, the multiple reference channel sensitivity characteristic information at the corresponding position of the reference parameter channel group is the reference channel sensitivity group.

[0107] By combining the reference parameter channel group and the reference channel sensitivity group corresponding to each reference parameter channel group to quantize each reference parameter channel group, the error correction value of the previous channel group quantization can be calculated through the reference channel sensitivity corresponding to each channel group, which can make subsequent quantization more accurate and improve the performance of the entire model after quantization.

[0108] Furthermore, based on each third reference parameter channel group, each third reference channel sensitivity group and the quantization accuracy of the third reference channel group, the quantization result of each third channel group is determined, including: processing the third reference parameter information and the third reference parameter sensitivity characteristic information based on a preset incoherent processing strategy to generate third target parameter information and third target parameter sensitivity characteristic information; determining the third target parameter channel group corresponding to each third reference parameter channel group in the third target parameter information, wherein the third target parameter channel group has the same quantization accuracy as the corresponding third reference parameter channel group; determining each third target channel sensitivity group corresponding to each third reference channel sensitivity group in the third target parameter sensitivity characteristic information; and determining the quantization result of each third channel group based on each third target parameter channel group, each third target channel sensitivity group and the quantization accuracy of the third reference channel group.

[0109] In practical applications, the irrelevant processing strategy is a strategy for performing irrelevant processing on parameter information and parameter sensitivity characteristic information corresponding to the parameter information. The target parameter information is the reference parameter information after irrelevant processing, the target parameter sensitivity characteristic information is the reference parameter sensitivity characteristic information after irrelevant processing, and the target parameter channel group is the parameter channel group in the target parameter information corresponding to the reference parameter channel group.

[0110] Specifically, the irrelevant processing strategy for irrelevant processing of the reference parameter information and the reference parameter sensitivity feature information may be regularization processing, convolution decomposition, orthogonalization processing, etc., and this specification does not impose any limitation on this.

[0111] In one embodiment provided in this specification, the reference parameter information and the reference parameter sensitivity characteristic information are processed by a preset irrelevant processing strategy as shown in Formula 2:

[0112] ...Formula 2

[0113] Among them, U and V are two random orthogonal matrices, is the target parameter information, W` is the reference parameter information, is the target parameter sensitivity characteristic information, and H` is the reference parameter sensitivity characteristic information.

[0114] By applying decorrelation technology, the interdependence between the elements in the parameter information and the values ​​in the parameter sensitivity feature information can be reduced, which helps to reduce the errors in the quantization process. This method optimizes the relationship between parameters so that each parameter is processed more independently during quantization, thereby reducing the error accumulation caused by the interaction between parameters and reducing the quantization error of the quantization result.

[0115] Since the target parameter information is a matrix representing the parameters in the neural network structure in the neural network layer, which includes n vectors, the third target parameter information includes n third target parameter channel groups, and the third target parameter sensitivity feature information includes n third target channel sensitivity groups, where n is a positive integer greater than or equal to 1;

[0116] Further, based on each third target parameter channel group, each third target channel sensitivity group and the quantization accuracy of the third reference channel group, the quantization result of each third channel group is determined, including the following steps: quantizing the first third target parameter channel group based on the quantization accuracy of the third reference channel group corresponding to the third target parameter channel group to obtain the first third target parameter channel group quantization result; obtaining the parameter channel group to be quantized according to the quantization results of the first to i-1 third target parameter channel groups, the first to i-1 third target parameter channel groups and the first to i-1 third target channel sensitivity groups and the i-th third target parameter channel group, wherein i is greater than or equal to 2 and less than a positive integer of n; quantizing the parameter channel group to be quantized according to the quantization accuracy of the third reference channel group corresponding to the i-th third target parameter channel group to generate the i-th third target parameter channel group quantization result; incrementing i by 1 and judging whether i is greater than n, if not, continuing to execute the step of obtaining the parameter channel group to be quantized according to the quantization results of the 1st to i-1 third target parameter channel groups, the 1st to i-1 third target parameter channel groups, the 1st to i-1 third target channel sensitivity groups and the i-th third target parameter channel group, and if so, determining the third channel group quantization result corresponding to the i-th third target parameter channel group as the i-th third target parameter channel quantization result.

[0117] In practical applications, the parameter channel group to be quantized is a matrix that needs to be quantized. Specifically, since quantizing only the current parameter channel group will result in a large error in the quantization result, in order to further reduce the quantization error, the current parameter channel group (that is, the third target parameter channel group of the i-th parameter channel group) and the quantization results of each channel group before the current parameter channel group, as well as the matrices before quantization of each channel group and the channel sensitivity groups corresponding to each channel group are used to determine the matrix to be quantized (that is, the parameter channel group to be quantized). This can effectively introduce errors in the previous quantization steps and compensate for them, making subsequent quantization more accurate and improving the performance of the entire model after quantization. This strategy optimizes the quantization process and helps to achieve more efficient compression while maintaining model accuracy.

[0118] Furthermore, according to the quantization results of the 1st to i-1th third target parameter channel groups, the 1st to i-1th third target parameter channel groups, the 1st to i-1th third target channel sensitivity groups and the i-th third target parameter channel group, a parameter channel group to be quantized is obtained, including: obtaining a mixed parameter channel group quantization result according to the quantization results of the 1st to i-1th third target parameter channel groups, obtaining a mixed target parameter channel group according to the 1st to i-1th third target parameter channel groups and obtaining a mixed target channel sensitivity group according to the 1st to i-1th third target channel sensitivity groups; determining a mixed parameter error according to the mixed parameter channel group quantization result and the mixed target parameter channel group; determining mixed error correction information according to the mixed target channel sensitivity group and the mixed parameter error; and combining the i-th third target parameter channel group and the mixed error correction information to generate a parameter channel group to be quantized.

[0119] In actual applications, the mixed target parameter channel group is a matrix after mixing the parameter channel group before the parameter channel group currently being quantized, the mixed parameter channel group quantization result is a matrix after mixing the quantization result corresponding to the parameter channel group before the parameter channel group currently being quantized, the mixed target channel sensitivity group is a matrix after mixing the channel sensitivity group corresponding to the parameter channel group before the parameter channel group currently being quantized, the mixed parameter error is an error matrix quantized according to the parameter channel group before the parameter channel group currently being quantized, and the mixed error correction information is a matrix after correcting the error according to the channel sensitivity groups corresponding to the parameter channel groups before the parameter channel group currently being quantized.

[0120] Specifically, the above-mentioned mixed target parameter channel group, mixed parameter channel group quantization result, and mixed target channel sensitivity group can all be obtained by matrix mixing methods such as simple addition, simple multiplication, weighted sum, convolution, orthogonal merging, etc., and this specification does not impose any restrictions on this.

[0121] In one embodiment provided in this specification, the quantization method of the current parameter channel is as shown in Formula 3:

[0122] ...Formula 3

[0123] in, is the channel group quantization result corresponding to the i-th target parameter channel group, Q represents the process of quantization according to the quantization accuracy of the i-th target parameter channel group, is the i-th target parameter channel group, is the mixed target parameter channel group, Quantize the result for the mixed parameter channel group, is the mixed target channel sensitivity group.

[0124] Each reference parameter channel group is quantized by combining the reference parameter channel group and the reference channel sensitivity group corresponding to each reference parameter channel group, and the error correction value of the previous channel group quantization is calculated by the reference channel sensitivity corresponding to each channel group, which can make subsequent quantization more accurate and improve the performance of the entire model after quantization.

[0125] Step 108: Determine the neural network model quantization result corresponding to the neural network model based on the target storage threshold of the target storage device and the initial volume of the neural network model, as well as the quantization results of each neural network layer corresponding to each neural network layer.

[0126] In practical applications, the target storage device is a storage device for storing the quantized neural network model, the target storage threshold is the maximum storage space that can be occupied by the quantized neural network model, and the initial volume is the storage space occupied by the neural network model before quantization.

[0127] Specifically, the target storage device can be understood as a storage device for storing the quantized neural network model. The storage device is a device for storing the neural network model that is divided out from the device that needs to use the neural network model. For example, a designated hard disk is selected as a storage device in a terminal device, and multiple hard disks are selected as storage devices in multiple servers. It can also be a storage device when the neural network model needs to be stored and transported, such as a CD, a mobile hard disk, a magnetic tape, etc., which can be used to store data. This manual does not impose any restrictions on this.

[0128] Since different storage devices have different storage performances, and different storage performances also correspond to maximum storage thresholds, the storage threshold can be determined by the read and write rate of the corresponding storage device, or by the storage space of the corresponding storage device. This description does not impose any limitations on the specific method of determining the target storage threshold.

[0129] Determining the quantization result of the model by the storage threshold of the storage device can ensure the applicability and efficiency of the model on a specific device. Since the quantization result of the model is determined by the storage threshold of the storage device, the quantization process will be adjusted according to the size of the available storage space to ensure that the model achieves better performance without exceeding the storage limit. In turn, it can meet the constraints of memory and storage while retaining the accuracy and functionality of the original model as much as possible, making the model more efficient when running in a resource-constrained environment. At the same time, it also allows devices with storage devices with different storage performance to run neural network models with higher accuracy.

[0130] Furthermore, according to the target storage threshold of the target storage device and the initial volume of the neural network model, as well as the quantization results of each neural network layer corresponding to each neural network layer, the neural network model quantization result corresponding to the neural network model is determined, including: determining the target quantization ratio of the neural network model according to the target storage threshold of the target storage device and the initial volume of the neural network model; determining the neural network model quantization result corresponding to the neural network model based on the target quantization ratio and the quantization results of each neural network layer corresponding to each neural network layer.

[0131] In practical applications, the target quantization ratio is the ratio of the quantized volume of the neural network model to the initial volume.

[0132] The method of determining the quantization result of the neural network model according to the target quantization ratio obtained by calculation can be to combine the quantization results of each neural network layer of each neural network layer to generate multiple quantization results of the neural network model to be confirmed, and obtain the model quantization ratio and model quantization error corresponding to each quantization result of the neural network model to be confirmed, and then use the target quantization ratio as a benchmark to find the quantization result of the neural network model to be confirmed with a smaller quantization error under the premise of meeting the target quantization ratio as the quantization result of the neural network model. It is also possible to calculate the quantization ratio and quantization error corresponding to multiple results of each layer, and then confirm the quantization result of the neural network model with the above-mentioned multiple quantization ratios and quantization errors.

[0133] Determining the quantization results of the model by the storage threshold of the storage device ensures the applicability and efficiency of the model on a specific device. This approach means that the quantization process is adjusted according to the size of the available storage space to ensure that the model achieves good performance without exceeding the storage limit. The result is a customized model that not only meets the constraints of memory and storage, but also retains the accuracy and functionality of the original model as much as possible, making the model more efficient when running in a resource-constrained environment, and also allowing devices with storage devices with different storage performance to run neural network models with high accuracy.

[0134] Furthermore, based on the target quantization ratio and the quantization results of each neural network layer corresponding to each neural network layer, the neural network model quantization result corresponding to the neural network model is determined, including: determining the neural network layer quantization effect corresponding to the quantization result of each neural network layer, wherein the neural network layer quantization effect includes the neural network layer quantization ratio and the neural network layer quantization loss; based on the quantization ratio of each neural network layer and the neural network layer quantization result, determining at least one neural network model quantization effect corresponding to the neural network model, wherein the neural network model quantization effect includes the neural network model quantization ratio and the neural network model quantization result; determining the target neural network model quantization effect among the neural network model quantization effects based on the target quantization ratio, and determining the neural network model quantization result according to the target neural network model quantization effect.

[0135] In practical applications, the quantization effect of the neural network layer is the effect obtained by the quantization results of each neural network layer in the neural network layer, the quantization ratio of the neural network layer is the ratio between the space occupied by the neural network layer after quantization and the initial space occupied by the neural network layer, and the quantization loss of the neural network layer is the difference between the data generated based on the same data after the quantization of the neural network layer and before the quantization of the neural network layer.

[0136] Specifically, the method for determining the quantization result of the entire model according to the quantization ratio and quantization loss corresponding to the above-mentioned quantization results can be to set a corresponding quantization weight for each layer, and the quantization weight represents the sensitivity of the neural network layer to the quantization ratio, and then perform weighted processing on the ratio of each layer according to the set weight, and then determine the quantization result of the neural network model according to the quantization ratio after weighted processing and the target quantization ratio.

[0137] By determining the quantization results of the entire neural network model through the quantization effects of different quantization results of each layer, the sensitivity of each neural network layer to the quantization ratio can be fully considered, and then under the same quantization ratio, the more sensitive neural network layer can use a lower compression ratio, thereby further reducing the compression error of the neural network model, making subsequent quantization more accurate and improving the performance of the entire model after quantization.

[0138] Furthermore, based on the target quantization ratio, the target neural network model quantization effect is determined in the quantization effects of each neural network model, including: obtaining the quantization ratio corresponding to the quantization effect of each neural network model, and determining the quantization ratio order information corresponding to the quantization effect of each neural network model according to the quantization ratio corresponding to the quantization effect of each neural network model; determining the quantization effect of each neural network model as the quantization effect of the neural network model to be judged, and determining the reference neural network quantization effect in the quantization effects of each neural network model to be judged according to the quantization ratio order information; obtaining the reference quantization ratio corresponding to the reference neural network quantization effect, and judging the relationship between the reference quantization ratio and the target quantization ratio; if the reference quantization ratio is greater than the target quantization ratio, then determining At least one neural network model quantization effect whose quantization ratio is less than the reference quantization ratio is determined as the neural network model quantization effect to be judged, and the step of determining the reference neural network quantization effect among the neural network model quantization effects to be judged according to the quantization ratio sequence information is continued; if the reference quantization ratio is less than the target quantization ratio, at least one neural network model quantization effect whose quantization ratio is greater than the reference quantization ratio is determined as the neural network model quantization effect to be judged, and the step of determining the reference neural network quantization effect among the neural network model quantization effects to be judged according to the quantization ratio sequence information is continued; if the reference quantization ratio is equal to the target quantization ratio, the reference neural network quantization effect is the target neural network model quantization effect.

[0139] In practical applications, the quantization effect of the neural network model to be judged can be understood as a quantization effect divided from the quantization effects of each neural network model according to the quantization ratio sequence information, and the reference quantization ratio is the middle value of the quantization ratio of the quantization effect of the neural network model to be judged.

[0140] Specifically, the method of searching for the desired target neural network quantization effect can be understood as sorting the quantization effects of multiple neural network models according to the quantization ratio, searching for the quantization effect with the middle value of the quantization ratio, and then comparing the reference quantization ratio found with the target quantization ratio actually to be achieved. Since the quantization effect of the neural network to be judged for comparison is sorted according to the quantization ratio, when the middle value is greater than the target value to be achieved, it means that the target value is to the left of the quantization effect of the middle value after the sequential sorting, that is, it is necessary to judge the quantization effect that is less than the middle value; when the middle value is less than the target value to be achieved, it means that the target value is to the right of the quantization effect of the middle value after the sequential sorting, that is, it is necessary to judge the quantization effect that is greater than the middle value, until the quantization effect with the same quantization ratio as the target quantization ratio is found.

[0141] By excluding half of the search interval after each comparison, the number of comparisons is greatly reduced, thereby improving the efficiency of determining the target quantization effect.

[0142] Furthermore, the quantization effect of the neural network layer corresponding to the quantization result of each neural network layer is determined, including: processing the quantization result of each neural network layer based on a preset parameter position restoration strategy to generate a reference neural network layer quantization result, wherein the parameter position restoration strategy is determined according to a preset irrelevant processing strategy and corresponding parameter sensitivity order information; determining the quantization effect of the neural network layer corresponding to the quantization result of each neural network layer according to the initial parameter information corresponding to each neural network layer and the reference neural network layer quantization result.

[0143] In practical applications, the parameter position restoration strategy is a strategy for restoring the position of each parameter in the quantization result after quantization to the original position.

[0144] Specifically, the parameter position restoration strategy includes a coherent restoration strategy and a reordering strategy. When performing parameter position restoration, the order of using the coherent restoration strategy and the reordering strategy will be determined according to the order of sorting and incoherent processing during the above-mentioned model quantization. For example, when performing quantization, the parameters are first sorted, and then incoherent processing is performed. Then the parameter position restoration strategy here is to first use the coherent restoration strategy for coherent restoration, and then use the reordering strategy for reordering. The weights or matrices used in the coherent restoration strategy are determined according to the weights or matrices used when performing incoherent processing, and the order of rearrangement by the reordering strategy is determined according to the original positions corresponding to the parameters in the above-mentioned parameter sensitivity order information.

[0145] In one embodiment provided in this specification, because the sorting process is performed first and then the irrelevant process is performed, the irrelevant process strategy used in quantization processes the reference parameter information and the reference parameter sensitivity characteristic information as shown in Formula 2, and accordingly, the coherent restoration strategy used is shown in Formula 4:

[0146] ...Formula 4

[0147] Among them, U and V are two random orthogonal matrices that are the same as U and V in formula 2, UT is the matrix after U is transposed, and W` q For the matrix after the coherent processing strategy but not yet sorted, is the quantization result of the neural network layer. After the above coherent restoration strategy is used for restoration, W` is restored according to the parameter sensitivity order information corresponding to the neural network layer. q Reverse rearrangement to obtain W q , the above W q That is the quantization result of the reference neural network layer.

[0148] Since the initial parameter information is sorted and irrelevantly processed when the model is quantized as mentioned above, when it is necessary to compare the results output before and after the model quantization, it is necessary to restore the positions of each parameter in the quantization results after quantization to the original positions in order to achieve a more accurate comparison and to more accurately obtain the quantization error of the model.

[0149] By applying the scheme of the embodiments of this specification, the initial parameter information corresponding to each neural network layer is sorted by the initial parameter sensitivity characteristic information that characterizes the sensitivity of each parameter in the neural network layer to the quantization ratio, and the initial parameter sensitivity characteristic information is sorted at the same time, and then the reference parameter information and the reference sensitivity characteristic information after sorting are irrelevantly processed, and then the channels in the above two irrelevant information are grouped to achieve quantization processing of each channel group in turn, so that the error that has been quantized can be taken into account when the model is quantized and then corrected according to the error, thereby reducing the quantization loss of the model after quantization.

[0150] Subsequently, the parameter information after quantization sorting is quantized by multiple preset quantization strategies to generate multiple quantization results with different quantization ratios and quantization errors for each neural network layer. Since the order of the information to be quantized represents the sensitivity of the quantization parameter to the quantization ratio, it avoids the situation where the quantization strategy cannot be accurately set when the sensitivity of each parameter is unknown, resulting in the inability to accurately reduce the quantization error. This achieves maintaining a high quantization ratio and reducing the quantization error when quantizing the model, thereby reducing the requirements of the storage device for the higher accuracy model.

[0151] Corresponding to the above method embodiment, this specification also provides a neural network model quantization method embodiment applied to a cloud device, see Figure 2 , Figure 2 A flowchart of a neural network model quantization method applied to a cloud device provided according to an embodiment of the present specification is shown, which specifically includes the following steps.

[0152] Step 202: receiving a neural network quantization instruction sent by a terminal-side device, and determining a target neural network model based on the neural network quantization instruction, wherein the target neural network model includes at least one target neural network layer.

[0153] Step 204: Obtain a quantized data set, and obtain initial parameter sensitivity characteristic information of each target neural network layer determined based on the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, and the sample data set is a data set used to train the target neural network model, and the initial parameter sensitivity characteristic information is used to characterize the sensitivity of each parameter in the target neural network layer to the quantization ratio.

[0154] Step 206: Generate reference parameter information based on the initial parameter sensitivity feature information corresponding to each neural network layer.

[0155] Step 208: Quantize each reference parameter information based on at least one quantization strategy to generate at least one target neural network layer quantization result corresponding to each target neural network layer.

[0156] Step 210: Determine the neural network model quantization result corresponding to the neural network model based on the target storage threshold of the target storage device and the initial volume of the neural network model, as well as the quantization results of each neural network layer corresponding to each neural network layer, wherein the target storage device is the storage device of the end-side device.

[0157] Step 212: Obtain model parameters corresponding to the quantization results of the target neural network model, and send the model parameters to the terminal side device.

[0158] In actual applications, the end-side device is a device that needs to use a quantized neural network model, the cloud device is a model that quantizes the model, and the neural network quantization instruction is an instruction for the end-side device to obtain the quantized model. Specifically, the end-side device usually has a smaller storage device, and because the storage space required for a neural network model with better effects is greater than the storage performance of the storage device of the end-side device, the end-side device cannot use the neural network model with better effects, so the end-side device is required to send a quantization instruction for the required model, which may include an identifier of the target model or a description of the target model, and may also include a target storage threshold of the storage device in the end-side device that sends the instruction.

[0159] Subsequently, the target neural network model is determined based on the above-mentioned model quantization instruction, and the target neural network model is quantized through the above-mentioned neural network quantization method. Subsequently, the model parameters are obtained according to the confirmed quantization results, and finally the model parameters are sent to the end-side device, so that the end-side device can run the neural network model that originally had high requirements for storage devices.

[0160] The above is a schematic scheme of a neural network model quantization method applied to a cloud device in this embodiment. It should be noted that the technical scheme of the neural network model quantization method applied to a cloud device belongs to the same concept as the technical scheme of the neural network model quantization method described above. For details not described in detail in the technical scheme of the neural network model quantization method applied to a cloud device, please refer to the description of the technical scheme of the neural network model quantization method described above.

[0161] By applying the scheme of the embodiments of this specification, the model required by the end-side device can be quantized by receiving the quantization instruction of the end-side device and determining the quantization model that needs to be quantized according to the quantization instruction. And by generating parameter information based on the sensitivity of the parameter information in the neural network layer to the quantization ratio and quantizing the parameter information according to multiple preset quantization strategies, it is avoided that the quantization strategy cannot be accurately set when the sensitivity of each parameter is unknown, resulting in the inability to accurately reduce the quantization error, thereby achieving a high quantization ratio and reducing the quantization error when quantizing the model, and then sending the quantized model parameters to the end-side device, so that the model stored in the end-side device has a higher accuracy when the same storage device has the same target storage threshold, and also reduces the requirements of the storage device for the end-side device to store the target accuracy model.

[0162] See also Figure 3 , Figure 3 An architecture diagram of a neural network model quantization system provided by an embodiment of the present specification is shown. The neural network model quantization system may include a client 100 and a server 200;

[0163] The client 100 is used to send a model quantization instruction to the server 200;

[0164] The server 200 is used to determine a target neural network model based on the neural network quantization instruction, wherein the target neural network model includes at least one target neural network layer; obtain a quantization data set, and obtain initial parameter sensitivity feature information of each target neural network layer determined according to the quantization data set, wherein the quantization data set is a data set determined based on a sample data set, and the sample data set is a data set used to train the target neural network model, and the initial parameter sensitivity feature information is used to characterize the sensitivity of each parameter in the target neural network layer to the quantization ratio; generate reference parameter information according to the initial parameter sensitivity feature information corresponding to each neural network layer; quantize each reference parameter information based on at least one quantization strategy, and generate at least one target neural network layer quantization result corresponding to each target neural network layer; determine the neural network model quantization result corresponding to the neural network model according to the target storage threshold of the target storage device and the initial volume of the neural network model, and the quantization results of each neural network layer corresponding to each neural network layer, wherein the target storage device is the storage device of the client 100; obtain model parameters corresponding to the quantization result of the target neural network model; send the model parameters to the client 100;

[0165] The client 100 is also used to receive the model parameters sent by the server 200.

[0166] By applying the scheme of the embodiments of this specification, the model required by the client can be quantized by receiving the quantization instruction of the client and determining the quantization model that needs to be quantized according to the quantization instruction. And by generating parameter information based on the sensitivity of the parameter information in the neural network layer to the quantization ratio and quantizing the parameter information according to multiple preset quantization strategies, it is avoided that the quantization strategy cannot be accurately set when the sensitivity of each parameter is unknown, resulting in the inability to accurately reduce the quantization error, thereby achieving a high quantization ratio and reducing the quantization error when quantizing the model, and then sending the quantized model parameters to the client, so that the model stored by the client has a higher accuracy when the same storage device has the same target storage threshold, and also reduces the requirements of the client for the storage device to store the target accuracy model.

[0167] The neural network model quantization system may include multiple clients 100 and a server 200, wherein the client 100 may be referred to as a terminal device and the server 200 may be referred to as a cloud device. A communication connection may be established between multiple clients 100 through the server 200. In the neural network model quantization scenario, the server 200 is used to provide neural network model quantization services between multiple clients 100. Multiple clients 100 may serve as a sender or a receiver, respectively, and realize communication through the server 200.

[0168] The user can interact with the server 200 through the client 100 to receive data sent by other clients 100, or send data to other clients 100, etc. In the neural network model quantization scenario, the user can publish a data stream to the server 200 through the client 100, and the server 200 generates model parameters according to the data stream and pushes the model parameters to other clients that establish communication.

[0169] The client 100 and the server 200 are connected via a network. The network provides a medium for a communication link between the client 100 and the server 200. The network may include various connection types, such as wired or wireless communication links or optical fiber cables, etc. The data transmitted by the client 100 may need to be encoded, transcoded, compressed, etc. before being released to the server 200.

[0170] The client 100 can be a browser, an APP (Application), or a web application such as an H5 (HyperText Markup Language 5, Hypertext Markup Language Version 5) application, or a light application (also known as a mini-program, a lightweight application) or a cloud application, etc. The client 100 can be based on the software development kit (SDK, Software Development Kit) of the corresponding service provided by the server 200, such as based on the real-time communication (RTC, Real Time Communication) SDK development and acquisition. The client 100 can be deployed in an electronic device and needs to rely on the device to run or some APPs in the device to run. For example, the electronic device can have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications can also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0171] The server 200 may include servers that provide various services, such as servers that provide communication services to multiple clients, servers for background training that support models used on clients, and servers that process data sent by clients. It should be noted that the server 200 can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server for basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0172] It is worth noting that the neural network model quantization method provided in the embodiments of this specification is generally executed by the server, but in other embodiments of this specification, the client may also have similar functions to the server, thereby executing the neural network model quantization method provided in the embodiments of this specification. In other embodiments, the neural network model quantization method provided in the embodiments of this specification may also be jointly executed by the client and the server.

[0173] The following combination Figure 4 Taking the application of the neural network model quantization method provided in this specification in the quantization of text processing models as an example, the neural network model quantization method is further described. Figure 4 A processing flow chart of a text processing model quantization method provided by an embodiment of this specification is shown, which specifically includes the following steps.

[0174] Step 402: Randomly select 512 pieces of data from the sample text used to train the text processing model as a quantitative data set.

[0175] Step 404: Determine the initial parameter matrices corresponding to the two neural network layers of the text processing model, each parameter matrix has 144 channels, and each channel has 64 parameters.

[0176] Step 406: Calculate and obtain the initial parameter sensitivity matrices corresponding to the two neural network layers according to the quantized data set, and determine the sensitivity of each channel to quantization according to the initial parameter sensitivity matrix.

[0177] Step 408: Reorder the initial parameter matrix corresponding to each neural network layer in descending order according to the sensitivity of the channels to obtain a sorted reference parameter matrix, and at the same time reorder the initial parameter sensitivity matrix in the same order to obtain a sorted reference parameter sensitivity matrix.

[0178] Step 410: Perform incoherent processing on the reference parameter matrix and the reference parameter sensitivity matrix by using two random orthogonal matrices to obtain a target parameter matrix and a target parameter sensitivity matrix with reduced correlation.

[0179] Step 412: Divide the target parameter matrix and the target parameter sensitivity matrix into 18 target parameter channel groups and target channel sensitivity groups, respectively, with 8 channels as a group.

[0180] Step 414: Obtain preset compression strategy 1: the first 25% is quantized using a 4-bit quantization rate, the middle 50% is quantized using a 3-bit quantization rate, and the last 25% is quantized using a 2-bit quantization rate. And preset compression strategy 2: the first 25% is quantized using a 4-bit quantization rate, and the last 75% is quantized using a 2-bit quantization rate.

[0181] Step 416: Based on the above compression strategy 1, the first 5 groups of vectors in the above 18 target parameter channel groups are quantized at a quantization rate of 4 bits according to the corresponding target channel sensitivity groups, the middle 9 groups are quantized at a quantization rate of 3 bits, and the last 4 groups are quantized at a quantization rate of 2 bits, and the quantization results A1 corresponding to the above first neural network layer and the quantization results B1 corresponding to the second neural network layer are obtained respectively.

[0182] Step 418: Based on the above compression strategy 2, the first 5 groups of vectors in the above 18 target parameter channel groups are quantized at a quantization rate of 4 bits according to the corresponding target channel sensitivity groups, and the remaining 13 groups are quantized at a quantization rate of 2 bits, and the quantization results A2 corresponding to the above first neural network layer and the quantization results B2 corresponding to the second neural network layer are obtained respectively.

[0183] Step 420: Combine the above four quantization results respectively to obtain the quantization results of the candidate models: A1+B1, A1+B2, A2+B1, A2+B2, and calculate the quantization rate and quantization error corresponding to each quantization result of the candidate models respectively.

[0184] Step 422: Based on the preset storage threshold of 10G and the text processing model of 160G, it is determined that the required compression rate is 95%. Combined with the number of bits for text processing: 32 bits, it is determined that the required quantization rate is 2 bits.

[0185] Step 424: Taking the quantization rate of 2 bits as the maximum value, obtain the quantization result with the minimum quantization error: A1+B2, and determine that A1+B2 is the quantization result of the text processing model.

[0186] By applying the scheme of the embodiments of the present specification, parameter information is generated through the sensitivity of parameter information in the neural network layer to the quantization ratio and the parameter information is quantized according to multiple preset quantization strategies. Since the order of the information to be quantized represents the sensitivity of the quantization parameters to the quantization ratio, the situation in which the quantization error cannot be accurately reduced due to the inability to accurately set the quantization strategy when the sensitivity of each parameter is unknown is avoided, thereby achieving maintaining a high quantization ratio and reducing the quantization error when quantizing the text processing model, thereby reducing the requirements of the storage device for the text processing model with higher accuracy, and thus enabling a device with a storage device with smaller storage space to have higher accuracy when performing text processing tasks such as text classification, language translation, text generation, etc.

[0187] Corresponding to the above method embodiment, this specification also provides a neural network model quantization device embodiment, Figure 5 FIG. 1 shows a schematic diagram of a neural network model quantization device provided by an embodiment of the present specification. Figure 5 As shown, the device comprises:

[0188] The sensitivity feature acquisition module 502 is configured to acquire a quantized data set, and determine the initial parameter sensitivity feature information of each neural network layer according to the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, the sample data set is a data set used to train the neural network model, and the initial parameter sensitivity feature information is used to characterize the sensitivity of each parameter in the neural network layer to the quantization ratio;

[0189] The parameter generation module 504 is configured to generate reference parameter information according to the initial parameter sensitivity characteristic information corresponding to each neural network layer;

[0190] A neural network layer quantization module 506 is configured to quantize each reference parameter information based on at least one quantization strategy to generate at least one neural network layer quantization result corresponding to each neural network layer;

[0191] The model quantization module 508 is configured to determine the neural network model quantization result corresponding to the neural network model based on the target storage threshold of the target storage device and the initial volume of the neural network model, as well as the quantization results of each neural network layer corresponding to each neural network layer.

[0192] Optionally, the sensitivity feature acquisition module 502 is further configured to: determine a first neural network layer, and obtain first input feature information of the first neural network layer based on the quantized data set; and generate first initial parameter sensitivity feature information corresponding to the first neural network layer based on the first input feature information.

[0193] Optionally, the sensitivity feature acquisition module 502 is further configured to: transpose the first input feature information to determine first input feature transposition information; and generate first initial parameter sensitivity feature information based on preset regularization matrix information, the first input feature information and the first input feature transposition information.

[0194] Optionally, the parameter sensitivity order information includes channel sensitivity order information; the parameter generation module 504 is further configured to: determine a second neural network layer, and based on the second initial parameter sensitivity feature information corresponding to the second neural network layer, determine the second channel sensitivity order information corresponding to the second neural network layer.

[0195] Optionally, the parameter information of the neural network layer includes at least one parameter channel information, and the parameter channel information includes a parameter value of at least one neural network layer; the parameter generation module 504 is further configured to: determine the second channel position corresponding to each second parameter channel information of the second neural network layer based on the second channel sensitivity order information; rearrange each second parameter channel information based on the second channel position corresponding to each second parameter channel information, and generate second reference parameter information.

[0196] Optionally, the parameter generation module 504 is further configured to: determine the parameter sensitivity order information corresponding to each neural network layer according to the initial parameter sensitivity feature information corresponding to each neural network layer; sort the initial parameter information of each neural network layer based on the parameter sensitivity order information to generate reference parameter information.

[0197] Optionally, the neural network layer quantization module 506 is further configured to: determine a third neural network layer and a target quantization strategy, and obtain a target quantization accuracy ratio corresponding to the target quantization strategy; quantize the third reference parameter information corresponding to the third neural network layer based on the target quantization accuracy ratio, and generate a third neural network layer quantization result corresponding to the third neural network layer.

[0198] Optionally, the neural network layer quantization module 506 is further configured to: determine at least one quantization area parameter information and the quantization accuracy corresponding to each quantization area parameter information in the third reference parameter information according to the target quantization accuracy ratio, wherein the quantization area parameter information includes at least one parameter information, and the third reference parameter information is obtained by initial parameter sensitivity characteristic information; determine the target quantization area parameter information and the target quantization accuracy corresponding to the target quantization area parameter information; based on the target quantization accuracy and the target quantization area parameter information, generate a regional quantization result corresponding to the target quantization area parameter information; and generate the third neural network layer quantization result according to each regional quantization result.

[0199] Optionally, the neural network layer quantization module 506 is further configured to: confirm the parameter information to be quantized, the reference quantization accuracy corresponding to the parameter information to be quantized, and at least one initial quantization accuracy, wherein the initial quantization accuracy is less than or equal to the reference quantization accuracy; determine a first initial quantization accuracy, and quantize the parameter to be quantized according to the first initial quantization accuracy to obtain a first initial quantization result; determine whether the quantization accuracy corresponding to the first initial quantization result is the same as the reference quantization accuracy; if they are the same, determine that the first initial quantization result is the quantization result corresponding to the parameter information to be quantized; if they are different, determine the residual parameter information according to the parameter information to be quantized and the first initial quantization result; determine a second initial quantization accuracy, and quantize the residual parameter information according to the second initial quantization accuracy to update the first initial quantization result; continue to execute the step of determining whether the quantization accuracy corresponding to the first initial quantization result is the same as the reference quantization accuracy.

[0200] Optionally, the parameter information of the neural network layer includes at least one parameter channel information, and the parameter channel information includes the parameter value of at least one neural network layer; the neural network layer quantization module 506 is further configured to: determine at least one target quantization interval and the target quantization accuracy corresponding to each target quantization interval according to the target quantization accuracy ratio and the third reference parameter information, wherein the target quantization interval is the interval corresponding to the parameter channel information quantized based on the same quantization accuracy in the reference parameter information; based on each target quantization accuracy, each quantization interval and the third reference parameter information, generate a third neural network layer quantization result corresponding to the third neural network layer.

[0201] Optionally, the reference parameter information includes at least one parameter channel group, and the parameter channel group includes at least one parameter channel information; the neural network layer quantization module 506 is further configured to: determine at least one third reference parameter channel group in the third reference parameter information based on each target quantization precision; determine the third reference channel group quantization precision corresponding to each third reference parameter channel group; quantize each third reference parameter channel group based on the quantization precision of each third reference channel group, and generate a third channel group quantization result corresponding to each third reference parameter channel group; generate the third neural network layer quantization result according to the quantization result of each third channel group.

[0202] Optionally, the neural network layer quantization module 506 is further configured to: determine the third initial parameter sensitivity characteristic information and third parameter sensitivity order information corresponding to the third neural network layer; sort the third initial parameter sensitivity characteristic information according to the third parameter sensitivity order information to generate third reference parameter sensitivity characteristic information, wherein the parameter sensitivity characteristic information includes at least one channel sensitivity characteristic information; determine a third reference channel sensitivity characteristic information group corresponding to each third reference parameter channel group, wherein the channel sensitivity characteristic information group includes at least one channel sensitivity characteristic information; and determine the quantization result of each third channel group based on each third reference parameter channel group, each third reference channel sensitivity group and the quantization accuracy of the third reference channel group.

[0203] Optionally, the neural network layer quantization module 506 is further configured to: process the third reference parameter information and the third reference parameter sensitivity characteristic information based on a preset incoherent processing strategy to generate third target parameter information and third target parameter sensitivity characteristic information; determine a third target parameter channel group corresponding to each third reference parameter channel group in the third target parameter information, wherein the third target parameter channel group has the same quantization accuracy as the corresponding third reference parameter channel group; determine each third target channel sensitivity group corresponding to each third reference channel sensitivity group in the third target parameter sensitivity characteristic information; and determine the quantization result of each third channel group based on the quantization accuracy of each third target parameter channel group, each third target channel sensitivity group and the third reference channel group.

[0204] Optionally, the third target parameter information includes n third target parameter channel groups, and the third target parameter sensitivity feature information includes n third target channel sensitivity groups, where n is a positive integer greater than or equal to 1; the neural network layer quantization module 506 is further configured to: quantize the first third target parameter channel group based on the third reference channel group quantization accuracy corresponding to the third target parameter channel group to obtain the first third target parameter channel group quantization result; obtain the parameters to be quantized according to the quantization results of the first to i-1 third target parameter channel groups, the first to i-1 third target parameter channel groups, the first to i-1 third target channel sensitivity groups and the i-th third target parameter channel group. Channel group, wherein i is a positive integer greater than or equal to 2 and less than n; quantizing the parameter channel group to be quantized according to the third reference channel group quantization accuracy corresponding to the i-th third target parameter channel group, generating the i-th third target parameter channel group quantization result; increasing i by 1 and judging whether i is greater than n, if not, continuing to execute the step of obtaining the parameter channel group to be quantized according to the quantization results of the 1st to i-1 third target parameter channel groups, the 1st to i-1 third target parameter channel groups, the 1st to i-1 third target channel sensitivity groups and the i-th third target parameter channel group, and if so, determining the third channel group quantization result corresponding to the i-th third target parameter channel group as the i-th third target parameter channel quantization result.

[0205] Optionally, the neural network layer quantization module 506 is further configured to: obtain a mixed parameter channel group quantization result based on the quantization results of the 1st to i-1th third target parameter channel groups, obtain a mixed target parameter channel group based on the 1st to i-1th third target parameter channel groups and obtain a mixed target channel sensitivity group based on the 1st to i-1th third target channel sensitivity groups; determine a mixed parameter error based on the mixed parameter channel group quantization result and the mixed target parameter channel group; determine mixed error correction information based on the mixed target channel sensitivity group and the mixed parameter error; and combine the i-th third target parameter channel group and the mixed error correction information to generate a parameter channel group to be quantized.

[0206] Optionally, the model quantization module 508 is further configured to: determine a target quantization ratio of the neural network model based on a target storage threshold of the target storage device and an initial volume of the neural network model; and determine a neural network model quantization result corresponding to the neural network model based on the target quantization ratio and the quantization results of each neural network layer corresponding to each neural network layer.

[0207] Optionally, the model quantization module 508 is further configured to: determine the neural network layer quantization effect corresponding to the quantization result of each neural network layer, wherein the neural network layer quantization effect includes the neural network layer quantization ratio and the neural network layer quantization loss; determine at least one neural network model quantization effect corresponding to the neural network model based on the quantization ratio of each neural network layer and the neural network layer quantization result, wherein the neural network model quantization effect includes the neural network model quantization ratio and the neural network model quantization result; determine the target neural network model quantization effect among the neural network model quantization effects based on the target quantization ratio, and determine the neural network model quantization result according to the target neural network model quantization effect.

[0208] Optionally, the model quantization module 508 is further configured to: obtain the quantization ratio corresponding to the quantization effect of each neural network model, and determine the quantization ratio order information corresponding to the quantization effect of each neural network model according to the quantization ratio corresponding to the quantization effect of each neural network model; determine the quantization effect of each neural network model as the quantization effect of the neural network model to be judged, and determine the reference neural network quantization effect in the quantization effect of each neural network model to be judged according to the quantization ratio order information; obtain the reference quantization ratio corresponding to the reference neural network quantization effect, and judge the relationship between the reference quantization ratio and the target quantization ratio; if the reference quantization ratio is greater than the target quantization ratio, then determine that the quantization ratio is less than the reference quantization ratio. The step of determining the reference neural network quantization effect among the quantization effects of the neural network models to be judged according to the quantization ratio sequence information is continued; if the reference quantization ratio is less than the target quantization ratio, at least one neural network model quantization effect whose quantization ratio is greater than the reference quantization ratio is determined as the quantization effect of the neural network model to be judged, and the step of determining the reference neural network quantization effect among the quantization effects of the neural network models to be judged according to the quantization ratio sequence information is continued; if the reference quantization ratio is equal to the target quantization ratio, the reference neural network quantization effect is the target neural network model quantization effect.

[0209] Optionally, the model quantization module 508 is further configured to: process the quantization results of each neural network layer based on a preset parameter position restoration strategy to generate a reference neural network layer quantization result, wherein the parameter position restoration strategy is determined according to a preset irrelevant processing strategy and corresponding parameter sensitivity order information; determine the neural network layer quantization effect corresponding to the quantization result of each neural network layer according to the initial parameter information corresponding to each neural network layer and the reference neural network layer quantization result.

[0210] The above is a schematic scheme of a neural network model quantization device of this embodiment. It should be noted that the technical scheme of the neural network model quantization device and the technical scheme of the neural network model quantization method described above belong to the same concept, and the details not described in detail in the technical scheme of the neural network model quantization device can be found in the description of the technical scheme of the neural network model quantization method described above.

[0211] The scheme of the embodiments of the present specification is applied, and the parameter information in the neural network layer is obtained through the sensitivity feature acquisition module, and then the parameter generation module generates the parameter information using the sensitivity to the quantization ratio, and then the neural network layer quantization module and the model quantization module are used to quantize the above parameter information according to multiple preset quantization strategies. Since the parameter information to be quantized is generated according to the sensitivity of the quantization ratio, wherein each parameter carries the sensitivity of the quantization parameter to the quantization ratio, it avoids the situation where the quantization strategy cannot be accurately set when the sensitivity of each parameter is unknown, resulting in the inability to accurately reduce the quantization error, thereby achieving a higher quantization ratio and reducing the quantization error when quantizing the model, thereby reducing the requirements of the storage device for the higher accuracy model.

[0212] Figure 6 The block diagram of a computing device 600 according to an embodiment of the present specification is shown. The components of the computing device 600 include but are not limited to a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and the database 650 is used to store data.

[0213] The computing device 600 also includes an access device 640 that enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).

[0214] In one embodiment of the present specification, the above components of the computing device 600 and Figure 6 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 6 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0215] The computing device 600 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 600 may also be a mobile or stationary server.

[0216] Among them, the processor 620 is used to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-mentioned neural network model quantization method and the neural network model quantization method applied to the cloud.

[0217] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the neural network model quantization method and the neural network model quantization method applied to the cloud belong to the same concept. For details not described in detail in the technical scheme of the computing device, please refer to the description of the technical scheme of the neural network model quantization method and the neural network model quantization method applied to the cloud.

[0218] An embodiment of the present specification also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned neural network model quantization method and the neural network model quantization method applied to the cloud.

[0219] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the neural network model quantization method and the neural network model quantization method applied to the cloud belong to the same concept. For details not described in detail in the technical scheme of the storage medium, please refer to the description of the technical scheme of the neural network model quantization method and the neural network model quantization method applied to the cloud.

[0220] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned neural network model quantization method and the neural network model quantization method applied to the cloud.

[0221] The above is a schematic scheme of a computer program of this embodiment. It should be noted that the technical scheme of the computer program and the technical scheme of the neural network model quantization method and the neural network model quantization method applied to the cloud belong to the same concept. For details not described in detail in the technical scheme of the computer program, please refer to the description of the technical scheme of the neural network model quantization method and the neural network model quantization method applied to the cloud.

[0222] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0223] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0224] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.

[0225] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0226] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can understand and use this specification well. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A method for quantizing a neural network model, wherein the neural network model includes at least one neural network layer, and the method includes: Acquire a quantized data set, and determine initial parameter sensitivity characteristic information of each neural network layer according to the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, the sample data set is a data set used to train the neural network model, and the initial parameter sensitivity characteristic information is used to characterize the sensitivity of each parameter in the neural network layer to the quantization ratio; According to the initial parameter sensitivity characteristic information corresponding to each neural network layer, the parameter sensitivity sequence information corresponding to each neural network layer is determined, and the initial parameter information of each neural network layer is sorted based on the parameter sensitivity sequence information to generate reference parameter information; Determine a target quantization accuracy ratio corresponding to a third neural network layer and the third neural network layer; quantize the third reference parameter information corresponding to the third neural network layer based on the target quantization accuracy ratio, and generate a third neural network layer quantization result corresponding to the third neural network layer and the target quantization accuracy ratio, wherein the quantization accuracy ratio represents the ratio of each quantization accuracy required for quantization when quantizing the reference parameter information corresponding to the neural network layer, and each neural network layer corresponds to at least one quantization accuracy ratio; The neural network model quantization result corresponding to the neural network model is determined according to the target storage threshold of the target storage device and the initial volume of the neural network model, as well as the quantization results of each neural network layer corresponding to each neural network layer and each quantization precision ratio.

2. The method as claimed in claim 1, wherein the parameter information of the neural network layer includes at least one parameter channel information, the parameter channel information includes at least one parameter value of the neural network layer, the parameter information of the neural network layer is a matrix composed of the parameters in the neural network layer, the parameter value is each value in the matrix corresponding to the parameter information of the neural network layer, and the parameter channel information is the entire row or column in the matrix corresponding to the parameter information of the neural network layer; Quantizing the third reference parameter information corresponding to the third neural network layer based on the target quantization accuracy ratio, and generating a third neural network layer quantization result corresponding to the third neural network layer and the target quantization accuracy ratio, including: Determine at least one target quantization interval and a target quantization accuracy corresponding to each target quantization interval according to the target quantization accuracy ratio and the third reference parameter information corresponding to the third neural network layer, wherein the target quantization interval is an interval corresponding to the parameter channel information quantized based on the same quantization accuracy in the reference parameter information; Based on each target quantization precision, each target quantization interval and the third reference parameter information, a third neural network layer quantization result corresponding to the ratio of the third neural network layer to the target quantization precision is generated.

3. The method according to claim 2, wherein the reference parameter information comprises at least one parameter channel group, and the parameter channel group comprises at least one parameter channel information; Based on each target quantization precision, each target quantization interval and the third reference parameter information, generating a third neural network layer quantization result corresponding to the ratio of the third neural network layer to the target quantization precision, including: Determining at least one third reference parameter channel group in the third reference parameter information based on a preset number of channels, wherein the third reference parameter channel group includes a preset number of third parameter channel information, and the third parameter channel information is parameter channel information included in the third reference parameter information; Based on the target quantization accuracy corresponding to each target quantization interval, determine the quantization accuracy corresponding to each third parameter channel information in each target quantization interval, and determine the third reference channel group quantization accuracy corresponding to each third reference parameter channel group according to the quantization accuracy corresponding to each third parameter channel information; quantizing each third reference parameter channel group based on the quantization precision of each third reference channel group, and generating a third channel group quantization result corresponding to each third reference parameter channel group; The third neural network layer quantization result is generated according to the quantization results of each third channel group.

4. The method according to claim 3, quantizing each third reference parameter channel group based on the quantization accuracy of each third reference channel group, and generating a third channel group quantization result corresponding to each third reference parameter channel group, comprises: Determine third initial parameter sensitivity feature information and third parameter sensitivity sequence information corresponding to the third neural network layer, wherein the third parameter sensitivity sequence information is parameter sensitivity sequence information corresponding to the third neural network layer; Sorting the third initial parameter sensitivity feature information according to the third parameter sensitivity sequence information to generate third reference parameter sensitivity feature information, wherein the parameter sensitivity feature information includes at least one channel sensitivity feature information, and the channel sensitivity feature information is an entire row or an entire column in a matrix corresponding to the parameter sensitivity feature information; Determine a third reference channel sensitivity characteristic information group corresponding to each third reference parameter channel group, wherein the channel sensitivity characteristic information group includes at least one channel sensitivity characteristic information; Processing the third reference parameter information and the third reference parameter sensitivity characteristic information based on a preset irrelevant processing strategy to generate third target parameter information and third target parameter sensitivity characteristic information; Determine a third target parameter channel group corresponding to each third reference parameter channel group in the third target parameter information, wherein the third target parameter channel group has the same quantization accuracy as the corresponding third reference parameter channel group, wherein the third target parameter information includes n third target parameter channel groups, and the third target parameter sensitivity feature information includes n third target channel sensitivity groups, where n is a positive integer greater than or equal to 1; Determining third target channel sensitivity groups corresponding to third reference channel sensitivity groups in the third target parameter sensitivity characteristic information; quantizing the first third target parameter channel group based on the quantization accuracy of the third reference channel group corresponding to the third target parameter channel group to obtain a first third target parameter channel group quantization result; Obtaining a mixed parameter channel group quantization result according to the quantization results of the 1st to i-1st third target parameter channel groups, obtaining a mixed target parameter channel group according to the 1st to i-1st third target parameter channel groups, and obtaining a mixed target channel sensitivity group according to the 1st to i-1st third target channel sensitivity groups, wherein the mixed parameter channel group quantization result is a matrix after the quantization results of the 1st to i-1st third target parameter channel groups are mixed, the mixed target parameter channel group is a matrix after the 1st to i-1st third target parameter channel groups are mixed, and the mixed target channel sensitivity group is a matrix after the 1st to i-1st third target channel sensitivity groups are mixed; determining a mixed parameter error according to the mixed parameter channel group quantization result and the mixed target parameter channel group; determining mixed error correction information according to the mixed target channel sensitivity group and the mixed parameter error; combining the i-th third target parameter channel group and the mixed error correction information to generate a parameter channel group to be quantized, wherein i is a positive integer greater than or equal to 2 and less than n; quantizing the parameter channel group to be quantized according to the third reference channel group quantization accuracy corresponding to the i-th third target parameter channel group, and generating a quantization result of the i-th third target parameter channel group; Increment i by 1 and determine whether i is greater than n. If not, continue to execute the step of obtaining the parameter channel group to be quantized according to the quantization results of the 1st to i-1st third target parameter channel groups, the 1st to i-1st third target parameter channel groups, the 1st to i-1st third target channel sensitivity groups and the i-th third target parameter channel group. If so, determine that the third channel group quantization result corresponding to the i-th third target parameter channel group is the i-th third target parameter channel quantization result.

5. The method according to claim 1, quantizing the third reference parameter information corresponding to the third neural network layer based on the target quantization accuracy ratio, and generating a third neural network layer quantization result corresponding to the third neural network layer and the target quantization accuracy ratio, comprising: Determining at least one quantization region parameter information and the quantization precision corresponding to each quantization region parameter information in the third reference parameter information according to the target quantization precision ratio, wherein the quantization region parameter information includes at least one parameter information, and the third reference parameter information is obtained from the initial parameter sensitivity characteristic information; Determining target quantization region parameter information and target quantization accuracy corresponding to the target quantization region parameter information; Based on the target quantization accuracy and the target quantization region parameter information, generating a region quantization result corresponding to the target quantization region parameter information; The third neural network layer quantization result is generated according to the quantization results of each region.

6. The method of claim 1, determining the neural network model quantization result corresponding to the neural network model according to the target storage threshold of the target storage device and the initial volume of the neural network model, and the quantization results of each neural network layer corresponding to each neural network layer and each quantization precision ratio, comprising: Determining a target quantization ratio of the neural network model according to a target storage threshold of a target storage device and an initial volume of the neural network model; Based on the target quantization ratio and the quantization results of each neural network layer corresponding to each neural network layer and each quantization precision ratio, the neural network model quantization result corresponding to the neural network model is determined.

7. The method according to claim 6, determining the neural network model quantization result corresponding to the neural network model based on the target quantization ratio and the quantization results of each neural network layer corresponding to each neural network layer and each quantization precision ratio, comprising: Determine the neural network layer quantization effect of the quantization result corresponding to each neural network layer and each quantization precision ratio, wherein the neural network layer quantization effect includes the neural network layer quantization ratio and the neural network layer quantization loss; Determine at least one neural network model quantization effect corresponding to the neural network model based on the quantization ratio of each neural network layer and the quantization result of the neural network layer, wherein the neural network model quantization effect includes the neural network model quantization ratio and the neural network model quantization result; The target neural network model quantization effect is determined among the quantization effects of each neural network model based on the target quantization ratio, and the neural network model quantization result is determined according to the target neural network model quantization effect.

8. The method of claim 7, wherein the target neural network model quantization effect is determined among the quantization effects of each neural network model based on the target quantization ratio, comprising: Obtaining the quantization ratio corresponding to the quantization effect of each neural network model, and determining the quantization ratio sequence information corresponding to the quantization effect of each neural network model according to the quantization ratio corresponding to the quantization effect of each neural network model; Determine the quantization effect of each neural network model as the quantization effect of the neural network model to be determined, and determine the reference neural network quantization effect among the quantization effects of each neural network model to be determined according to the quantization ratio sequence information; Obtaining a reference quantization ratio corresponding to the reference neural network quantization effect, and determining a relationship between the reference quantization ratio and the target quantization ratio; If the reference quantization ratio is greater than the target quantization ratio, at least one neural network model quantization effect whose quantization ratio is less than the reference quantization ratio is determined as the neural network model quantization effect to be determined, and the step of determining the reference neural network quantization effect among the neural network model quantization effects to be determined according to the quantization ratio sequence information is continued; If the reference quantization ratio is less than the target quantization ratio, at least one neural network model quantization effect whose quantization ratio is greater than the reference quantization ratio is determined as the neural network model quantization effect to be determined, and the step of determining the reference neural network quantization effect among the neural network model quantization effects to be determined according to the quantization ratio sequence information is continued; If the reference quantization ratio is equal to the target quantization ratio, the reference neural network quantization effect is the target neural network model quantization effect.

9. The method of claim 8, wherein determining the neural network layer quantization effect corresponding to each neural network layer quantization result comprises: Processing the quantization results of each neural network layer based on a preset parameter position restoration strategy to generate a reference neural network layer quantization result, wherein the parameter position restoration strategy is determined according to a preset incoherent processing strategy and corresponding parameter sensitivity order information; According to the initial parameter information corresponding to each neural network layer and the quantization result of the reference neural network layer, the quantization effect of the neural network layer corresponding to the quantization result of each neural network layer is determined.

10. The method of claim 1, wherein determining the initial parameter sensitivity characteristic information of each neural network layer according to the quantized data set comprises: Determine a first neural network layer, and obtain first input feature information of the first neural network layer according to the quantized data set; Based on the first input feature information, first initial parameter sensitivity feature information corresponding to the first neural network layer is generated.

11. The method of claim 10, wherein generating first initial parameter sensitivity feature information corresponding to the first neural network layer according to the first input feature information comprises: Transpose the first input feature information to determine first input feature transposed information; First initial parameter sensitivity feature information is generated based on preset regularization matrix information, the first input feature information and the first input feature transposed information.

12. The method of claim 1, wherein the parameter sensitivity order information comprises channel sensitivity order information; According to the initial parameter sensitivity characteristic information corresponding to each neural network layer, the parameter sensitivity sequence information corresponding to each neural network layer is determined, including: Determine a second neural network layer, and based on second initial parameter sensitivity characteristic information corresponding to the second neural network layer, determine second channel sensitivity order information corresponding to the second neural network layer.

13. The method of claim 12, wherein the parameter information of the neural network layer comprises at least one parameter channel information, and the parameter channel information comprises a parameter value of at least one neural network layer; The initial parameter information of each neural network layer is sorted based on the sensitivity order information of each parameter to generate reference parameter information, including: Determine the second channel position corresponding to each second parameter channel information of the second neural network layer based on the second channel sensitivity order information; The second parameter channel information is rearranged based on the second channel position corresponding to each second parameter channel information to generate the second reference parameter information.

14. The method according to any one of claims 1 to 13, wherein the confirmation method of the quantization result corresponding to the neural network layer comprises the following steps: Confirming parameter information to be quantized, reference quantization precision corresponding to the parameter information to be quantized, and at least one initial quantization precision, wherein the initial quantization precision is less than or equal to the reference quantization precision; Determine a first initial quantization precision, and quantize the parameter to be quantized according to the first initial quantization precision to obtain a first initial quantization result, wherein the first initial quantization precision is any one of the initial quantization precisions, and the initial quantization precision is the quantization precision provided by the basic quantization table; Determining whether a quantization precision corresponding to the first initial quantization result is the same as the reference quantization precision; If they are the same, determining that the first initial quantization result is the quantization result corresponding to the parameter information to be quantized; If they are different, determining the residual parameter information according to the parameter information to be quantized and the first initial quantization result; determining a second initial quantization accuracy, and quantizing the residual parameter information according to the second initial quantization accuracy, and updating the first initial quantization result; continuing to execute the step of determining whether the quantization accuracy corresponding to the first initial quantization result is the same as the reference quantization accuracy, wherein the second initial quantization accuracy is any one of the initial quantization accuracy.

15. A neural network model quantization method, applied to a cloud device, comprising: A neural network quantization instruction sent by a receiving terminal side device is used to determine a target neural network model based on the neural network quantization instruction, wherein the target neural network model includes at least one target neural network layer; Acquire a quantized data set, and obtain initial parameter sensitivity characteristic information of each target neural network layer determined according to the quantized data set, wherein the quantized data set is a data set determined based on a sample data set, the sample data set is a data set used to train the target neural network model, and the initial parameter sensitivity characteristic information is used to characterize the sensitivity of each parameter in the target neural network layer to the quantization ratio; According to the initial parameter sensitivity characteristic information corresponding to each neural network layer, the parameter sensitivity sequence information corresponding to each neural network layer is determined, and the initial parameter information of each neural network layer is sorted based on the parameter sensitivity sequence information to generate reference parameter information; Determine a target quantization accuracy ratio corresponding to a third neural network layer and the third neural network layer; quantize the third reference parameter information corresponding to the third neural network layer based on the target quantization accuracy ratio, and generate a third neural network layer quantization result corresponding to the third neural network layer and the target quantization accuracy ratio, wherein the quantization accuracy ratio represents the ratio of each quantization accuracy required for quantization when quantizing the reference parameter information corresponding to the neural network layer, and each neural network layer corresponds to at least one quantization accuracy ratio; Determine the neural network model quantization result corresponding to the neural network model according to the target storage threshold of the target storage device and the initial volume of the neural network model, and the quantization results of each neural network layer corresponding to each neural network layer and each quantization precision ratio, wherein the target storage device is the storage device of the end-side device; Obtain model parameters corresponding to the quantization results of the target neural network model, and send the model parameters to the terminal side device.

16. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 15 are implemented.

17. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 15.

18. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 15.