Efficient mixed-precision machine learning model quantization
The method addresses the inefficiencies in existing quantization techniques by grouping operations and estimating SQNRs to determine operation-specific quantization precisions, resulting in improved computational efficiency and accuracy for machine learning models on resource-constrained devices.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- QUALCOMM INC
- Filing Date
- 2024-10-31
- Publication Date
- 2026-05-07
AI Technical Summary
Existing machine learning model quantization techniques often result in sub-optimal performance due to the lack of efficient methods for determining the fine-grained quantization sensitivity of each operation, leading to either increased computational expense or reduced model accuracy, particularly in constrained devices.
A processor-implemented method for generating fine-grained mixed-precision quantization by grouping operations, estimating signal-to-quantization-noise ratios (SQNRs) for operation groups, and updating the model with operation-specific quantization precisions based on these estimates, reducing computational expense while maintaining or improving accuracy.
Enables significant gains in computational efficiency and model accuracy by allowing fine-grained quantization of large models with reduced computational expense, suitable for deployment on constrained devices.
Smart Images

Figure CN2024128799_07052026_PF_FP_ABST
Abstract
Description
EFFICIENT MIXED-PRECISION MACHINE LEARNING MODEL QUANTIZATION
[0001] INTRODUCTION
[0002] Aspects of the present disclosure relate to machine learning.
[0003] A wide variety of machine learning architectures have recently been used to perform innumerable tasks with high accuracy and reliability. For example, computer vision models have been used to perform tasks such as object detection and distance prediction. As another example, language models (e.g., large language models (LLMs) ) have been used to understand and generate textual output in a human-like fashion, such as for use in chat bots. However, many existing model architectures are large (e.g., having thousands, millions, or even billions of parameters) . In addition to the vast computational resources used to train such models, runtime use of such large models also incurs substantial computational expense (e.g., substantial memory overhead due to the large number of parameters) .
[0004] Some conventional approaches to improve accessibility to machine learning (e.g., on edge devices with limited compute) include model quantization. Though quantization can reduce the model size substantially, quantization also introduces inherent error due to the fact that high-precision model parameters are approximated using lower-precision values.
[0005] BRIEF SUMMARY
[0006] Certain aspects of the present disclosure provide a processor-implemented method, comprising: accessing a machine learning model comprising a plurality of operations; generating a plurality of operation groups, each respective operation group comprising a subset of the plurality of operations; determining a plurality of aggregate signal-to-quantization-noise ratios (SQNRs) for the plurality of operation groups; generating a respective estimated SQNR for each respective operation of the plurality of operations based on the plurality of aggregate SQNRs; and updating the machine learning model to use mixed-precision quantization comprising at least two quantization precisions based on the estimated SQNRs.
[0007] Other aspects provide processing systems configured to perform the aforementioned methods as well as those described herein; non-transitory, computer- readable media comprising instructions that, when executed by one or more processors of a processing system, cause the processing system to perform the aforementioned methods as well as those described herein; a computer program product embodied on a computer-readable storage medium comprising code for performing the aforementioned methods as well as those further described herein; and a processing system comprising means for performing the aforementioned methods as well as those further described herein.
[0008] The following description and the related drawings set forth in detail certain illustrative features of one or more aspects.BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The appended figures depict example features of certain aspects of the present disclosure and are therefore not to be considered limiting of the scope of this disclosure.
[0010] FIG. 1 depicts an example workflow for mixed-precision machine learning model quantization, according to some aspects of the present disclosure.
[0011] FIG. 2 depicts example operation groupings for mixed-precision model quantization, according to some aspects of the present disclosure.
[0012] FIG. 3 is a flow diagram depicting an example method for mixed-precision machine learning model quantization, according to some aspects of the present disclosure.
[0013] FIG. 4 is a flow diagram depicting an example method for evaluating aggregated quantization noise to facilitate mixed-precision quantization, according to some aspects of the present disclosure.
[0014] FIG. 5 is a flow diagram depicting an example method for mixed-precision quantization, according to some aspects of the present disclosure.
[0015] FIG. 6 depicts an example processing system configured to perform various aspects of the present disclosure.
[0016] To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the drawings. It is contemplated that elements and features of one aspect may be beneficially incorporated in other aspects without further recitation.DETAILED DESCRIPTION
[0017] Aspects of the present disclosure provide apparatuses, methods, processing systems, and non-transitory computer-readable mediums for providing improved machine learning. Specifically, in some aspects of the present disclosure, techniques for efficient mixed-precision quantization are provided.
[0018] Increasingly, quantization has been used as a valuable technique to reduce model size, latency, and power consumption for machine learning models. For example, these improvements are particularly useful for on-device deployment of models (such as neural networks) . That is, when machine learning models are used on relatively constrained devices (e.g., devices with limited computational resources such as memory and / or limited power, such as due to being powered by battery) , such as edge devices, user equipment (UE) , smartphones, laptops, and the like, reducing the size and expense of such models is particularly valuable (e.g., enabling such models to be deployed on devices that otherwise could not host the models) .
[0019] Generally, quantization involves approximating an original (full-precision) value using a value that can be encoded using fewer bits. For example, a model having parameters stored as sixteen-bit floating-point values may be quantized by approximating each weight using a four-bit integer. As another example, a model that represents activations (e.g., intermediate or internal values generated as input data is passed through the model) using sixteen-bit floating-point values may be quantized to represent this intermediate data using eight bits. That is, as used herein, quantizing a given operation of a machine learning model may include quantizing the parameters (e.g., reducing the bitwidth used to store the parameters of the operation) , quantizing the activations (e.g., reducing the bitwidth used to store the input and / or output of the operation) , or quantizing both the parameters and the activations.
[0020] In many quantization solutions, all operations in the model are quantized to the same precision (e.g., all parameters of all operations are quantized to the same bitwidth, and / or all intermediate data throughout the model are quantized to the same bitwidth) . Generally, different quantization schemes (e.g., different precisions) can result in different impacts on the model performance. Quantizing to a lower bitwidth often reduces latency and computational expense (as compared to higher bitwidths) , but also often results in reduced model accuracy (as compared to higher bitwidths) .
[0021] For example, a first quantization scheme (e.g., W8A16, where the parameters (W) are represented using eight bits and the intermediate data (A) are represented using sixteen bits) may result in a first latency (e.g., five milliseconds) and a first model accuracy (e.g., 80%of the accuracy of the non-quantized model) , while a second quantization scheme (e.g., W8A8, where the parameters (W) are represented using eight bits and the intermediate data (A) are represented using eight bits) may result in a second (smaller) latency (e.g., two milliseconds) and a second (lower) model accuracy (e.g., 20%of the accuracy of the non-quantized model) .
[0022] Suppose, however, that the first scheme is slower than desired, but the second scheme results in lower accuracy than desired. In some solutions, mixed-precision quantization can be used to balance these schemes, where some operations are quantized according to the first scheme and others are quantized according to the second. This can balance the computational improvements with the accuracy impact. In many machine learning model architectures, some operations are substantially more robust to quantization noise than others, which allows mixed-precision quantization to result in significant gains.
[0023] However, determining the sensitivity of a given operation to quantization noise is currently an extremely time-consuming and costly process. For example, if a model comprises L operations and there are N candidate quantization schemes for each, there are NL possible scheme assignments. Evaluating such a vast number of alternatives is not tractable, particularly in modern architectures where L is becoming increasingly large. As discussed below in more detail, sensitivity to quantization noise may be quantified using a variety of techniques, including by determining the signal-to-quantization-noise ratio (SQNR) for an operation.
[0024] In some solutions, coarse-scale mixed-precision is used, where bitwidth assignments are fixed across all operations of the same type (though the bitwidths may differ between types) and / or fixed for all operations within each block or component of the model (though the bitwidths may differ across blocks) . Though use of such coarse mixed-precision can result in some improvements, these approaches still ignore that different operations within a given block and / or of the same type may still have different quantization sensitivities. As a result, such coarse-scale mixed-precision quantization still generally results in sub-optimal performance.
[0025] In some aspects of the present disclosure, techniques are provided to efficiently estimate the fine-grained quantization sensitivity of each operation of a model. These estimations can be performed substantially more efficiently (e.g., more quickly and with less computational expense) than conventional solutions relying on exhaustive evaluation of each operation and quantization scheme. Further, these sensitivity estimations enable fine-grained (e.g., operation-level) quantization decisions (e.g., where each operation is assigned a quantization precision based on the sensitivity of the specific operation) . This fine-scale quantization can result in significant gains (e.g., reduced computational expense with improved model accuracy) , as compared to conventional solutions.
[0026] In some aspects, aggregate quantization sensitivity measures can be determined for multiple groups of operations in the model. Based on these aggregate sensitivities, the individual sensitivities of each specific operation can be estimated. These estimated sensitivities can then be used to generate a mixed-precision quantization profile that is more granular than conventional approaches (resulting in minimized, or at least reduced, model size while maximizing, or at least increasing, model accuracy) and is generated with substantially reduced computational expense, as compared to directly evaluating each operation individually. In some aspects, use of the techniques described herein can enable fine-grained mixed-precision quantization of any size machine learning model, including large machine learning models (e.g., LLMs, large vision models (LVMs) , and the like) . For example, aspects of the present disclosure may enable fine-grained mixed-precision quantization of large models having a substantial number of parameters (e.g., at least a million parameters, at least five million parameters, at least ten million parameters, at least fifty million parameters, at least one hundred million parameters, at least five hundred million parameters, at least a billion parameters, at least ten billion parameters, and the like) and / or a substantial number of operations (e.g., at least one thousand operations, at least five thousand operations, and the like) .
[0027] Example Workflow for Mixed-Precision Machine Learning Model Quantization
[0028] FIG. 1 depicts an example workflow 100 for mixed-precision machine learning model quantization, according to some aspects of the present disclosure.
[0029] In the illustrated example, a trained machine learning model 105 (e.g., a model comprising parameters having values learned during a training phase of the model) is accessed by a quantization system 110. As used herein, “accessing” data may generally include receiving, requesting, retrieving, obtaining, collecting, generating, or otherwise gaining access to the data. For example, the quantization system 110 may receive the machine learning model 105 from another system (e.g., a computing system that trained the model) or may itself train the model.
[0030] Although depicted as a discrete system, in aspects, the operations of the quantization system 110 may be combined or distributed across any number of systems, and may be implemented using hardware, software, or a combination of hardware and software. In the illustrated example, the quantization system 110 includes various components, including a grouping component 115, an SQNR component 125, an estimation component 135, a profile component 145, and a quantization component 155. Though depicted as discrete components for conceptual clarity, the operations performed by each component (and others not illustrated) may be combined or distributed across any number of components.
[0031] In the illustrated example, the grouping component 115 evaluates the machine learning model 105 to generate a set of operation groups 120. Each operation group 120 comprises or corresponds to a set of operations from the machine learning model 105. For example, the machine learning model 105 may comprise a sequence of operations performed on input data to generate model output. In some aspects, some or all of these operations are included within a defined sequence of blocks or other components (e.g., layers of a neural network, transformer blocks, and the like) , where each block may contain one or more operations.
[0032] Generally, the grouping component 115 may use a variety of techniques to generate the operation groups 120. For example, in some aspects, the grouping component 115 may generate the operation groups 120 such that each operation group 120 comprises or corresponds to a specific operation type. That is, the grouping component 115 may assign each operation in the machine learning model 105 to a corresponding operation group 120 based on the specific type of the operation (e.g., the data transformation being applied) , such as a first operation group 120 for all of the softmax operations in the model, a second operation group 120 for all of the convolution operations, a third operation group 120 for all matrix multiplication operations, and the like.
[0033] In some aspects, there may be multiple groups corresponding to a single operation type (e.g., if the number of operations of a given operation type is greater than the maximum group size) . That is, the grouping component 115 may generate a fixed number of operation groups 120 (where the size of each group can be determined by dividing the number of operations by the desired number of groups) and / or may set each operation group 120 to include a fixed number of operations (e.g., where the number groups is determined based on the desired size of each group and the number of operations in the model) , which may result in operations of the same operation type being assigned to different groups, and / or operations of different types being assigned to the same group.
[0034] In some aspects, the grouping component 115 may additionally or alternatively generate the operation groups 120 based on the block or component of the machine learning model 105 to which each operation belongs. For example, in the case of a U-Net architecture, the grouping component 115 may assign all operations of a first downsampling block to a first operation group 120, all operations of a second downsampling block to a second operation group 120, and so on. As another example, the grouping component 115 may assign all operations for a first layer or transformer to a first operation group 120, and so on.
[0035] In some aspects, as discussed above, there may be multiple groups corresponding to a single block of operations (e.g., if the number of operations of a given block is greater than the maximum group size) . That is, the grouping component 115 may generate a fixed number of operation groups 120 (which may or may not match the number of blocks in the model) and / or may set each operation group 120 to include a fixed number of operations. This may result in operations of the same block being assigned to different groups, and / or operations of different blocks being assigned to the same group.
[0036] In some aspects, the grouping component 115 may additionally or alternatively generate the operation groups 120 based on random or pseudo-random sampling. For example, the grouping component 115 may determine the number of operation groups 120 to generate (e.g., based on a hyperparameter) , and may then randomly sample operations to assign to each operation group 120 until all operations have been assigned to a group.
[0037] In some aspects, the grouping component 115 may generate substantially fewer operation groups 120 than there are operations in the machine learning model 105. That is, each operation group 120 may include multiple operations. As a result, the quantization system 110 may use substantially fewer resources to determine the quantization sensitivities, as compared to some conventional approaches. For example, in some aspects, the quantization system 110 may determine quantization sensitivity by performing P forward passes of calibration data (where P is the number of calibration inputs used) for each quantization candidate. If all N operations are evaluated individually, the quantization system 110 may perform N*P forward passes. In contrast, if G operation groups 120 are used, the quantization system 110 may perform G*P forward passes.
[0038] For example, if a given machine learning model has two thousand operations and the grouping component 115 generates forty operation groups 120 (each with fifty operations) , the quantization system 110 may estimate quantization sensitivity for each operation based on 200 forward passes (e.g., forty times five, if five calibration inputs as used, as discussed in more detail below) , whereas some conventional approaches would incur ten thousand forward passes for evaluation. The computational cost of evaluating the quantization sensitivity can thus be reduced substantially in some cases (e.g., by 98%in the above example) .
[0039] In the illustrated example, the operation groups 120 are then evaluated by the SQNR component 125 to generate a set of aggregate SQNRs 130. In some aspects, each aggregate SQNR 130 indicates the SQNR of a corresponding operation group 120. In some aspects, SQNR is a measure that can generally be used to quantify the sensitivity of a given operation (or group thereof) to quantization noise. Although the illustrated example depicts use of SQNR to quantify the quantization sensitivity, in some aspects, other sensitivity measures can be used. Generally, the quantization sensitivity of a given operation refers to the degradation in performance caused by quantization of the given operation.
[0040] For example, in some aspects, the SQNR component 125 (or another component) may process one or more input samples (referred to as calibration samples in some aspects) using the full-precision or non-quantized machine learning model 105 to generate a set of data representing the performance of the non-quantized model. This set of data may include, for example, the final output of the model, the output of each operation and / or each operation group 120 in the model, and the like.
[0041] In the illustrated example, the SQNR component 125 may then quantize a single operation group 120 of the set of operation groups 120 (e.g., quantizing each operation in the group to a specific quantization scheme) . The remaining operations (in other operation groups 120) may be left in their original or full precision. The SQNR component 125 can then process the one or more calibration samples using the model (with the quantized operation group 120) to generate a second set of data (e.g., the final output of the model with the quantized group and / or the output of each operation in the quantized group) .
[0042] In some aspects, the SQNR component 125 may compare these sets of data (e.g., those produced using the non-quantized model and those produced using the partially quantized model) to determine the sensitivity (e.g., the SQNR) of the group that was quantized. For example, the SQNR component 125 may compute a difference value such as using mean squared error (MSE) between each tensor in the first set of data and the corresponding tensor in the second set of data. That is, the SQNR component 125 may generate an aggregate SQNR 130 indicating the SQNR of the given operation group 120, based on observing how much the generated data changed when the operations in the operation group 120 were quantized (where larger discrepancies between the sets of data correlate to a larger aggregate SQNR 130 of the operation group 120) . Generally, the SQNR component 125 may perform such operations to evaluate each operation group 120 to generate a corresponding aggregate SQNR 130 (e.g., sequentially or in parallel) .
[0043] As illustrated, the aggregate SQNRs 130 are then accessed by the estimation component 135, which generates a set of estimated SQNRs 140. The estimated SQNRs 140 generally indicate, for each respective operation of the machine learning model 105, a corresponding estimated SQNR 140. For example, the estimated SQNR 140 of a given operation may be determined based on the (measured) aggregate SQNR 130 of the operation group 120 to which the operation belongs.
[0044] The estimation component 135 may generally use a variety of operations to estimate the SQNR of each operation. For example, in some aspects, the estimation component 135 may solve an optimization problem where the input is the aggregate SQNR 130 of a given operation group 120 and the output is the estimated SQNRs 140 of each operation in the operation group 120.
[0045] In some aspects, the estimation component 135 can perform the optimization based in part on one or more constraints on the solution. For example, in some aspects, the estimation component 135 may seek to minimize (or at least reduce) one or more norms (e.g., the L1 norm) of the estimated SQNRs 140 of a given operation group 120. In some aspects, by minimizing (or reducing) the norm, the estimation component 135 encourages sparsity (e.g., encouraging most of the estimated SQNRs 140 to be low, as most operations are not particularly sensitive to quantization) .
[0046] As another example, in some aspects, the estimation component 135 may constrain the estimated SQNRs 140 to be within a defined range of values, where the range is defined based on a maximum noise (e.g., a value of the largest realistic or expected SQNR, such as forty decibels) and / or a minimum noise (e.g., zero, where the minimum possible quantization sensitivity corresponds to operations that are entirely unaffected) .
[0047] As yet another example, the estimation component 135 may constrain the estimated SQNRs 140 of a given operation group 120 to sum to a total value that is within a defined tolerance (e.g., defined by a hyperparameter) of the aggregate SQNR 130 of the group. That is, the aggregated estimated SQNRs 140 for operations in a given group should approximately match the aggregate SQNR 130 of the group.
[0048] As yet another example, the estimation component 135 may constrain the estimated SQNRs 140 using a non-smoothness parameter (or hyperparameter) such that each pair of operations having the same operation type in adjacent blocks of the machine learning model 105 have similar estimated SQNRs 140 (e.g., within a threshold distance, where the threshold may be a hyperparameter) . That is, the estimation component 135 may seek to ensure that adjacent occurrences of the same operation type have similar estimated SQNRs 140.
[0049] In some aspects, prior to or as part of generating the estimated SQNRs 140, the estimation component 135 may convert one or more of the aggregate SQNRs 130 to a linear domain from the log domain often used to quantify signal-to-noise measures (e.g., measured in decibels) . In some aspects, solving the optimization problem in the log domain may be intractable due to the relatively large values that are common for SQNR values. For example, if the SQNR ranges between zero and forty (and is often at least ten decibels) , the optimization problem may fail to reach a solution without substantial iteration. In contrast, these values are often quite small in the linear domain, so converting the SQNR values to the linear domain can significantly increase the sparsity of the problem, making the optimization tractable.
[0050] Generally, the estimation component 135 may define the optimization problem using a variety of constraints and formulations. In some aspects, for example, the estimation component 135 may use Expression 1 below (e.g., seeking to minimize (or at least reduce) the L1 norm of the sum of each zi, which encourages sparsity in the resulting estimates) , where N is the set of operations in the machine learning model 105, [N] is the size of the set of operations (e.g., the number of operations) , SQNRi is the estimated SQNR 140 of the i-th operation, and τ is a hyperparameter. This formulation of zi represents the estimated SQNRs 140 in the linear domain, as discussed above. minimize ||z||1=∑i∈ [N] zi (1)
[0051] In some aspects, the estimation component 135 may seek to minimize Expression 1 subject to a variety of constraints, as discussed above. For example, these constraints may include a constraint on the range of the estimated SQNRs 140. In some aspects, this range constraint may be defined using Expression 2 below, where U is a hyperparameter.
[0052] As another example, the estimation component 135 may constrain the optimization such that the aggregated estimates are similar to the observed SQNRs for a given group, such as using Expression 3 below, where ε is a tolerance value (e.g., a hyperparameter) to ensure feasibility of finding a solution, ng is the number of operation groups 120 (e.g., the number of blocks, operation types, or other criteria depending on how the operation groups are defined) , Sg, j is the set of operations of the j-th operation group 120, and Rg, j is the observed SQNR (e.g., the aggregate SQNR 130) of the j-th operation group 120.
[0053] As another example, the estimation component 135 may constrain the optimization for smoothness, such that adjacent occurrences of the same operation type have similar estimated SQNRs, such as using Expression 4 below, where is a list of operations of operation type j sorted by the layers or blocks to which the operations belong (e.g., such that adjacent operations in Tj have the same operation type and are in adjacent layers or blocks (or at least where all intervening operations between the adjacent operations have different operation types) and L is a non-smoothness parameter (e.g., a hyperparameter) . That is, the SQNR of adjacent operations (represented as and ) in Tj should be within the tolerance defined by L.
[0054] In some aspects, Expressions 1-4 above may use variable definitions such as to ensure the solution can be found.
[0055] In the illustrated example, the estimation component 135 can thereby generate the estimated SQNRs 140 for each operation of the set of operations in the machine learning model 105. In some aspects, these estimated SQNRs 140 may be represented (and further processed by downstream components) in the linear domain (e.g., zi) or may be converted to the log domain.
[0056] As illustrated, the set of estimated SQNRs 140 are then accessed by the profile component 145, which generates a quantization profile 150 for the machine learning model 105. The quantization profile 150 generally specifies an assigned precision to each operation in the set of operations in the machine learning model 105 (based on the estimated SQNRs 140) . As discussed above, assigning a quantization precision to a given operation may include assigning the parameters of the operation (e.g., the weights) to a given quantization precision (e.g., a given bitwidth and / or encoding format, such as floating point or integer) , assigning the intermediate data received by and / or generated by the given operation (e.g., the activations) to a given precision (e.g., a given bitwidth and / or encoding format) , or both.
[0057] In some aspects, the quantization profile 150 is generally a mixed-precision quantization profile, where each operation in the set of operations may have a different assigned quantization precision regardless of the operation type and / or block to which the operation belongs. That is, the assigned quantization precision for each operation may be determined based on the operation-specific estimated SQNRs 140, rather than based on the operation’s type or location in the model.
[0058] Generally, the profile component 145 may use a variety of techniques to generate the quantization profile. For example, in some aspects, using a sorted list of operations (sorted by the corresponding estimated SQNRs 140) , the profile component 145 may search to find an optimal (or least improved) mix of quantization precisions that achieve (or at least come closest to) one or more desired targets, such as a minimum desired loss in model accuracy, a maximum desired model size, or an optimized balance between model accuracy and size.
[0059] In some aspects, the profile component 145 may assign quantization precisions based on one or more sensitivity threshold hyperparameters. For example, in some aspects, operations having an estimated SQNR 140 below a first threshold may be assigned to a first (e.g., relatively lower) quantization precision such as W8A8, while operations having an estimated SQNR 140 above this threshold may be assigned to a second (e.g., relatively higher) precision, such as W8A16. Generally, any number of thresholds and corresponding quantization precisions may be used, depending on the particular implementation. For example, operations having a sensitivity below a first threshold may be assigned to a lower precision, operations having a sensitivity above the first threshold and less than a second threshold may have an intermediate precision, and operations having a sensitivity above the second threshold may have a highest precision assigned.
[0060] In some aspects, by adjusting the sensitivity threshold (s) , different mixed-precision quantization profiles can be readily generated. In some aspects, the profile component 145 (or another component) can then evaluate these profiles, such as by quantizing the machine learning model 105 according to the assignments, and evaluating the characteristics of the quantized model (e.g., the resulting model size and / or accuracy) .
[0061] In some aspects, the workflow 100 may end with the quantization system 110 outputting or otherwise providing the generated quantization profile 150 (e.g., to the requesting entity) . In the illustrated example, the quantization component 155 may access the quantization profile 150 and the original machine learning model 105 to generate a quantized machine learning model 160 (also referred to in some aspects as updating the machine learning model 105 to use mixed-precision quantization, such as based on the quantization profile 150) . That is, the quantization component 155 may quantize the machine learning model 105 based on the quantization profile 150. For example, for each operation in the machine learning model 105, the quantization component 155 may quantize the corresponding parameters (e.g., weights) to the assigned bitwidth and / or encoding, and may configure the operation or model to use the assigned bitwidth and / or encoding for the input, output, and / or intermediate data associated with the given operation.
[0062] In this way, the quantized machine learning model 160 may be mixed-precision on a fine scale, such that different operations of the same operation type may use different quantization precisions, and / or different operations within the same block of the model may use different quantization precisions. As discussed above, this can substantially reduce the computational expense of using the quantized machine learning model 160 while maintaining or improving model accuracy, as compared to some conventional solutions.
[0063] Example Operation Groupings for Mixed-Precision Model Quantization
[0064] FIG. 2 depicts example operation groupings for mixed-precision model quantization, according to some aspects of the present disclosure.
[0065] In some aspects, the parameters 200 correspond to a machine learning model, such as the machine learning model 105 of FIG. 1. The operations may be grouped by a quantization system, such as the quantization system 110 of FIG. 1 (e.g., by the grouping component 115 of FIG. 1) . Specifically, in the illustrated example, the parameters 200 of the model are represented as a matrix where each row 205A-N in the matrix represents or corresponds to a corresponding block (e.g., layer or other component) in the model and each column 210A-M represents or corresponds to a corresponding operation type in the model.
[0066] That is, the parameters 200 (which may correspond to a subset of the model or may represent the entire model) correspond to a sequence of repeated blocks, where each block performs the same set of operations. Specifically, the block represented by the row 205A performs operations including q11 (which as the same operation type as the other operations in the same column 210A: q21 and qB1) , q12 (which as the same operation type as the other operations in the same column 210B: q22 and qB2) , and q1P (which as the same operation type as the other operations in the same column 210M: q2P and qBP) .
[0067] The illustrated example depicts various grouping techniques that can be used to generate operation groups (e.g., the operation groups 120 of FIG. 1) . For example, as discussed above, the quantization system may use a block-based grouping in some aspects, depicted by the grouping 220 (where the operations q21, q22, and q2P in the row 205B are all part of the same block of the model and are grouped together to form a single operation group for purposes of quantization sensitivity determination) .
[0068] As another example, as discussed above, the quantization system may use an operation type-based grouping in some aspects, depicted by the grouping 215 (where the operations a12, a22, and aB2 in the column 210B all have the same operation type and are grouped together to form a single operation group for purposes of quantization sensitivity determination) .
[0069] As yet another example, as discussed above, the quantization system may use a probabilistic grouping in some aspects, depicted by the grouping 225 (where the operations q1P, qbp, and qB1 in different rows 205 and columns 210 are nevertheless all grouped together to form a single operation group for purposes of quantization sensitivity determination) .
[0070] As discussed above, the quantization system may generally use any suitable technique to generate the operation groups. For example, in some aspects, the quantization system may seek to group operations within a given block to the same group, but may split one or more blocks into multiple groups (e.g., where the operations q11 and q12 may be in a different group than the operation q1P, although all are in the same block corresponding to the row 205A) , such as if the maximum group size is smaller than the number of operations in a given block.
[0071] Similarly, the quantization system may seek to group operations having matching operation types to the same group, but may split one or more sets of operation type into multiple groups (e.g., where the operations q11 and q21 may be in a different group than the operation aB1, although all have the same operation type corresponding to the column 210A) , such as if the maximum group size is smaller than the number of operations of the given operation type.
[0072] Example Method for Mixed-Precision Machine Learning Model Quantization
[0073] FIG. 3 is a flow diagram depicting an example method 300 for mixed-precision machine learning model quantization, according to some aspects of the present disclosure. In some aspects, the method 300 may be performed by a quantization system, such as the quantization system 110 of FIG. 1 and / or the quantization system discussed above with reference to FIG. 2.
[0074] At block 305, the quantization system accesses a machine learning model, such as the machine learning model 105 of FIG. 1. In some aspects, as discussed above, the machine learning model may be a trained model (e.g., trained by the quantization system or by another system) ready for quantization and / or deployment. In some aspects, the machine learning model is encoded in full-precision. That is, the model parameters may be stored or represented in the original or full precision used during training (e.g., floating point) . As discussed above, though this full precision can ensure good model performance (e.g., high accuracy output) , the full precision encodings also incur substantial computational expense during runtime use (e.g., substantial memory overhead, high latency, and the like) .
[0075] At block 310, the quantization system generates a set of operation groups (e.g., the operation groups 120 of FIG. 1) . As discussed above, the machine learning model may generally comprise a set or sequence of operations that are performed to transform or evaluate input data. In some aspects, some or all of these operations may be further delineated into logical blocks of the model, such as upsampling blocks, downsampling blocks, convolution blocks, transformer blocks, layers of a neural network, and the like. Generally, generating the set of operation groups includes delineating the set of operations into the set of operation groups (where each operation group can generally include any number of operations and may or may not coincide with the underlying structure of the model) .
[0076] As discussed above, the quantization system may generally use a variety of techniques to delineate the operations of the machine learning model into the operation groups. For example, in some aspects, the quantization system generates the operation groups based at least in part on the operation types reflected in the model. For example, the quantization system may assign all operations of a first type (e.g., convolution operations) to a first group, operations of a second type (e.g., softmax) to a second group, and so on. In some aspects, as discussed above, the quantization system may divide a single operation type across multiple groups, such as if the groups have a defined maximum size and there are too many operations of the given type to fit into a single group.
[0077] As another example, in some aspects, the quantization system generates the operation groups based at least in part on the block or component of the model to which the operations belong. For example, the quantization system may assign all operations of a first block (e.g., a first downsampling block) to a first group, operations of a second block (e.g., a second downsampling block) to a second group, and so on. In some aspects, as discussed above, the quantization system may divide a single block of operations across multiple groups, such as if the groups have a defined maximum size and there are too many operations in the given block to fit into a single group.
[0078] As yet another example, in some aspects, the quantization system generates the operation groups probabilistically, such as using random sampling. For example, the quantization system may, for each of the operation groups, randomly sample a set of operations to be included in the group.
[0079] At block 315, the quantization system determines operation group SQNRs (e.g., the aggregate SQNRs 130 of FIG. 1) . As discussed above, although operation group SQNRs are depicted for conceptual clarity, in some aspects, the quantization system may generally determine any measure of quantization sensitivity for each operation group. In some aspects, to determine the collective quantization sensitivity of a given group, the quantization system may quantize the operations of the given group (leaving the remaining operations of the model unquantized and in full precision) , and then process one or more samples of calibration data (e.g., example model inputs) to generate intermediate and / or output data. The data generated after the quantization can then be compared against the corresponding data generated before quantization (e.g., when the entire model, including the given operation group, is in full precision) . The difference between the data with and without quantization can be used to quantify the sensitivity of the given operation group to quantization noise, as discussed above. One example method for determining the operation group quantization sensitivities (e.g., SQNRs) is discussed below in more detail with reference to FIG. 4.
[0080] At block 320, the quantization system generates a set of estimated SQNRs (e.g., the estimated SQNRs 140 of FIG. 1) for the set of operations in the model. That is, the quantization system may generate, for each individual operation of the set of operations, a respective estimated SQNR (or other measure of quantization sensitivity) based on the operation group SQNRs (or other measures of quantization sensitivity) determined at block 315. In some aspects, the quantization system may formulate the task as an optimization problem, seeking to find the best values for each estimated SQNR that align with the actual aggregated SQNRs determined for each group (and, in some aspects, satisfying one or more constraints, such as fitting within a defined range) . For example, the quantization system may use the Expressions 1-4 discussed above to generate the estimated SQNRs for each operation.
[0081] At block 325, the quantization system generates a quantization profile based on the estimated SQNRs. As discussed above, the quantization profile may generally specify, for each operation in the machine learning model, a respective quantization scheme or encoding (e.g., the bitwidth and / or format to use for encoding each parameter of the operation and / or the input and / or output of the operation) , where the particular quantization scheme used for each operation is determined based on the corresponding estimated SQNR of the respective operation. That is, the quantization profile may be a mixed-precision profile.
[0082] In some aspects, as discussed above, the quantization system may generate the quantization profile (e.g., the quantization profile 150 of FIG. 1) by comparing each estimated SQNR to one or more sensitivity criteria, such as thresholds (which may be hyperparameters of the quantization system) , where operations having an estimated SQNR above the threshold may be assigned to a first quantization scheme having a relatively higher precision, while operations having an estimated SQNR below the threshold may be assigned to a second quantization scheme having a relatively lower bitwidth (e.g., resulting in lower precision) .
[0083] Although not depicted in the illustrated example, in some aspects, the quantization system (or another system) may then use the (mixed-precision) quantization profile to quantize the machine learning model (e.g., to generate the quantized machine learning model 160 of FIG. 1) . That is, the quantization system may quantize each operation based on the assigned quantization scheme specified in the quantization profile. As discussed above, quantizing an given operation may correspond to quantizing the weights (or other parameters) to the indicated bitwidth and / or encoding format, configuring the operation to use the indicated bitwidth and / or encoding format for the input and / or output of the operation, and the like.
[0084] The quantized machine learning model can then be deployed for runtime use. Advantageously, as discussed above, the operation-specific mixed-precision quantization of the model can enable to model to be implemented on relatively constrained devices (e.g., with restricted memory and / or power resources) without sacrificing substantial model performance.
[0085] Example Method for Evaluating Aggregated Quantization Noise to Facilitate Mixed-Precision Quantization
[0086] FIG. 4 is a flow diagram depicting an example method 400 for evaluating aggregated quantization noise to facilitate mixed-precision quantization, according to some aspects of the present disclosure. In some aspects, the method 400 may be performed by a quantization system, such as the quantization system 110 of FIG. 1 and / or the quantization systems discussed above with reference to FIGS. 2-3. In some aspects, the method 400 provides additional detail for block 315 of FIG. 3.
[0087] At block 405, the quantization system accesses calibration data for the machine learning model. In some aspects, as discussed above, the calibration data may generally include one or more inputs (e.g., samples of input data similar to what the model will be used to process during runtime) . The calibration data may or may not include labels. In some aspects, a relatively small amount of calibration data (e.g., one to five samples) may be used to calibrate the quantization profile.
[0088] At block 410, the quantization system selects an operation group of the model (e.g., one of the operation groups 120 generated by the quantization system) . Generally, the quantization system may use a variety of techniques to select the operation group, including randomly or pseudo-randomly, as the quantization system may evaluate each operation group during the method 400.
[0089] At block 415, the quantization system quantizes the selected operation group based on a quantization scheme (e.g., a defined bitwidth and / or encoding for the parameters, inputs, and / or outputs of the operation) . In some aspects, as discussed above, the quantization system may refrain from quantizing the remaining operations (e.g., those not belonging to the selected group) while evaluating the selected operation group.
[0090] At block 420, the quantization system computes the SQNR (e.g., the aggregate SQNRs 130 of FIG. 1) of the selected quantization group using the calibration data. For example, as discussed above, the quantization system may compare the outputs of the model (generated by processing the calibration data) before and after the selected operation group was quantized. Generally, large differences in the outputs indicate that the group of operations exhibits high sensitivity to quantization noise, while small outputs indicate that the group is robust against quantization.
[0091] At block 425, the quantization system determines whether there is at least one additional quantization scheme remaining to be evaluated for the selected operation group. If so, the method 400 returns to block 415 to quantize the selected group to a new quantization scheme. For example, in some aspects, the quantization system may evaluate the quantization sensitivity of each operation group at multiple quantization precisions. This may allow the quantization system to determine the quantization sensitivity at each level, potentially enabling a more fine-grained precision assignment (e.g., if the quantization system determines that a given operation group is highly sensitive to one quantization scheme, such as a low parameter bitwidth, but is highly robust to another scheme, such as a low input / output bitwidth) . Although the illustrated example depicts a sequential process (selecting and evaluating each scheme iteratively) for conceptual clarity, in some aspects, the quantization system may evaluate multiple schemes entirely or partially in parallel.
[0092] If the quantization system determines that no additional quantization schemes remain to be tested for the selected operation group, the method 400 continues to block 430, where the quantization system determines whether there is at least one additional operation group remaining to be evaluated. If so, the method 400 returns to block 410 to select the next quantization group for evaluation (where the previously selected operation group is returned to the original full precision) . Although the illustrated example depicts a sequential process (selecting and evaluating each operation group iteratively) for conceptual clarity, in some aspects, the quantization system may evaluate multiple groups entirely or partially in parallel.
[0093] If no additional groups remain for evaluation, the method 400 terminates at block 435. In this way, as discussed above, the quantization system may generate aggregated SQNRs for each operation group. These aggregated SQNRs can then be used to estimate the operation-specific SQNRs of each operation. These operation-specific SQNRs can then be used to generate highly granular mixed-precision quantization profiles, as discussed above.
[0094] Example Method for Mixed-Precision Quantization
[0095] FIG. 5 is a flow diagram depicting an example method 500 for mixed-precision quantization, according to some aspects of the present disclosure. In some aspects, the method 500 may be performed by a quantization system, such as the quantization system 110 of FIG. 1 and / or the quantization systems discussed above with reference to FIGS. 2-4.
[0096] At block 505, a machine learning model comprising a plurality of operations is accessed.
[0097] At block 510, a plurality of operation groups is generated, each respective operation group comprising a subset of the plurality of operations.
[0098] At block 515, a plurality of aggregate signal-to-quantization-noise ratios (SQNRs) is determined for the plurality of operation groups.
[0099] At block 520, a respective estimated SQNR is generated for each respective operation of the plurality of operations based on the plurality of aggregate SQNRs.
[0100] At block 525, the machine learning model is updated to use mixed-precision quantization comprising at least two quantization precisions based on the estimated SQNRs.
[0101] In some aspects, generating the plurality of operation groups comprises grouping the plurality of operations based at least in part on a respective operation type of each respective operation of the plurality of operations.
[0102] In some aspects, the plurality of operations is distributed among a plurality of blocks of the machine learning model. In these aspects, generating the plurality of operation groups may involve grouping the plurality of operations based at least in part on the plurality of blocks.
[0103] In some aspects, generating the plurality of operation groups comprises grouping the plurality of operations based at least in part on a random sampling of the plurality of operations.
[0104] In some aspects, determining the plurality of aggregate SQNRs comprises, for a first operation group of the plurality of operation groups: quantizing each operation of the first operation group, and generating one or more model outputs using the quantized operations of the first operation group. Each operation of each remaining operation group of the plurality of operation groups may not be quantized while generating the one or more model outputs.
[0105] In some aspects, generating the estimated SQNRs comprises generating a first set of estimated SQNRs for a first operation group of the plurality of operation groups based on minimizing an L1 norm of the first set of estimated SQNRs.
[0106] In some aspects, generating the first set of estimated SQNRs further comprises constraining the first set of estimated SQNRs to a range defined based at least in part on a maximum noise, wherein the maximum noise is a hyperparameter.
[0107] In some aspects, generating the first set of estimated SQNRs further comprises constraining the first set of estimated SQNRs to sum to within a tolerance of a first aggregate SQNR corresponding to the first operation group, wherein the tolerance is a hyperparameter.
[0108] In some aspects, generating the first set of estimated SQNRs further comprises constraining the first set of estimated SQNRs such that each pair of operations having a matching operation type in adjacent blocks of the machine learning model have respective estimated SQNRs that are within a threshold. The threshold may be a hyperparameter.
[0109] In some aspects, generating the estimated SQNRs comprises converting each of the plurality of aggregate SQNRs to a linear domain.
[0110] In some aspects, updating the machine learning model to use mixed-precision quantization comprises identifying a subset of operations, from the plurality of operations, having respective estimated SQNRs that satisfy one or more sensitivity criteria and assigning each operation of the subset of operations to a first quantization precision. The one or more sensitivity criteria may include one or more hyperparameters,
[0111] In some aspects, the updated machine learning model comprises a first operation of a first operation type quantized to a first quantization precision and a second operation of the first operation type quantized to a second quantization precision.
[0112] In some aspects, the updated machine learning model comprises a first operation in a first block quantized to a first quantization precision and a second operation in the first block quantized to a second quantization precision.
[0113] Example Processing System for Mixed-Precision Quantization
[0114] FIG. 6 depicts an example processing system 600 configured to perform various aspects of the present disclosure, including, for example, the techniques and methods described with respect to FIGS. 1-5. In some aspects, the processing system 600 may correspond to a quantization system (e.g., the quantization system 110 of FIG. 1 and / or the quantization systems discussed above with reference to FIGS. 2-5) . Although depicted as a single system for conceptual clarity, in some aspects, as discussed above, the components described below with respect to the processing system 600 may be distributed across any number of devices or systems.
[0115] The processing system 600 includes a central processing unit (CPU) 602, which in some examples may be a multi-core CPU. Instructions executed at the CPU 602 may be loaded, for example, from a program memory associated with the CPU 602 or may be loaded from a memory partition (e.g., a partition of a memory 624) .
[0116] The processing system 600 also includes additional processing components tailored to specific functions, such as a graphics processing unit (GPU) 604, a digital signal processor (DSP) 606, a neural processing unit (NPU) 608, a multimedia component 610 (e.g., a multimedia processing unit) , and a wireless connectivity component 612.
[0117] An NPU, such as the NPU 608, is generally a specialized circuit configured for implementing the control and arithmetic logic for executing machine learning algorithms, such as algorithms for processing artificial neural networks (ANNs) , deep neural networks (DNNs) , random forests (RFs) , and the like. An NPU may sometimes alternatively be referred to as a neural signal processor (NSP) , tensor processing unit (TPU) , neural network processor (NNP) , intelligence processing unit (IPU) , vision processing unit (VPU) , or graph processing unit.
[0118] NPUs, such as the NPU 608, are configured to accelerate the performance of common machine learning tasks, such as image classification, machine translation, object detection, and various other predictive models. In some examples, a plurality of NPUs may be instantiated on a single chip, such as a system on a chip (SoC) , while in other examples the NPUs may be part of a dedicated neural-network accelerator.
[0119] NPUs may be optimized for training or inference, or in some cases configured to balance performance between both. For NPUs that are capable of performing both training and inference, the two tasks may still generally be performed independently.
[0120] NPUs designed to accelerate training are generally configured to accelerate the optimization of new models, which is a highly compute-intensive operation that involves inputting an existing dataset (often labeled or tagged) , iterating over the dataset, and then adjusting model parameters, such as weights and biases, in order to improve model performance. Generally, optimizing based on a wrong prediction involves propagating back through the layers of the model and determining gradients to reduce the prediction error.
[0121] NPUs designed to accelerate inference are generally configured to operate on complete models. Such NPUs may thus be configured to input a new piece of data and rapidly process this piece of data through an already trained model to generate a model output (e.g., an inference) . In some implementations, the NPU 608 is a part of one or more of the CPU 602, the GPU 604, and / or the DSP 606.
[0122] In some examples, the wireless connectivity component 612 may include subcomponents, for example, for third generation (3G) connectivity, fourth generation (4G) connectivity (e.g., Long-Term Evolution (LTE) ) , fifth generation (5G) connectivity (e.g., New Radio (NR) ) , Wi-Fi connectivity, Bluetooth connectivity, and other wireless data transmission standards. The wireless connectivity component 612 is further coupled to one or more antennas 614.
[0123] The processing system 600 may also include one or more sensor processing units 616 associated with any manner of sensor, one or more image signal processors (ISPs) 618 associated with any manner of image sensor, and / or a navigation processor 620, which may include satellite-based positioning system components (e.g., GPS or GLONASS) as well as inertial positioning system components.
[0124] The processing system 600 may also include one or more input and / or output devices 622, such as screens, touch-sensitive surfaces (including touch-sensitive displays) , physical buttons, speakers, microphones, and the like.
[0125] In some examples, one or more of the processors of the processing system 600 may be based on an ARM or RISC-V instruction set.
[0126] The processing system 600 also includes a memory 624, which is representative of one or more static and / or dynamic memories, such as a dynamic random access memory, a flash-based static memory, and the like. In this example, the memory 624 includes computer-executable components, which may be executed by one or more of the aforementioned processors of the processing system 600.
[0127] In particular, in this example, the memory 624 includes a grouping component 624A, an SQNR component 624B, an estimation component 624C, a profile component 624D, and a quantization component 624E. Although not depicted in the illustrated example, the memory 624 may also include other components, such as a training component to train machine learning models, an inferencing component to manage runtime use of machine learning models, and the like. Though depicted as discrete components for conceptual clarity in FIG. 6, the illustrated components (and others not depicted) may be collectively or individually implemented in various aspects.
[0128] Further, although not depicted in the illustrated example, the memory 624 may also include other data such as training data, calibration data, and the like.
[0129] The processing system 600 further comprises a grouping circuit 626, an SQNR circuit 627, an estimation circuit 628, a profile circuit 629, and a quantization circuit 630. The depicted circuits, and others not depicted (such as an inferencing circuit) , may be configured to perform various aspects of the techniques described herein.
[0130] For example, the grouping component 624A and / or the grouping circuit 626 (which may correspond to the grouping component 115 of FIG. 1) may be used to generate operation groups based on the operations included in the machine learning model. For example, the grouping component 624A and / or the grouping circuit 626 may group the operations based on their operation type, the block to which the operations belong, and the like.
[0131] The SQNR component 624B and / or the SQNR circuit 627 (which may correspond to the SQNR component 125 of FIG. 1) may be used to quantify quantization sensitivity of each operation group (e.g., generating the aggregate SQNRs 130 of FIG. 1) , as discussed above. For example, the SQNR component 624B and / or the SQNR circuit 627 may quantize and evaluate each operation group separately (while each other operation group remains unquantized) to determine the aggregate SQNRs.
[0132] The estimation component 624C and / or the estimation circuit 628 (which may correspond to the estimation component 135 of FIG. 1) may be used to estimate the quantization sensitivity of each operation (e.g., generating the estimated SQNRs 140 of FIG. 1) , as discussed above. For example, the estimation component 624C and / or the estimation circuit 628 may use Expressions 1-4 to estimate the SQNR of each operation based on the determined aggregate SQNRs.
[0133] The profile component 624D and / or the profile circuit 629 (which may correspond to the profile component 145 of FIG. 1) may be used to generate mixed-precision quantization profiles (e.g., the quantization profile 150 of FIG. 1) , as discussed above. For example, the profile component 624D and / or the profile circuit 629 may generate the quantization profile based on the operation-specific estimated SQNRs, such as by comparing each estimated SQNR to one or more thresholds to determine which quantization precision to use for the corresponding operation.
[0134] The quantization component 624E and / or the quantization circuit 630 (which may correspond to the quantization component 155 of FIG. 1) may be used to quantize machine learning models (e.g., to generate the quantized machine learning model 160 of FIG. 1) , as discussed above. For example, the quantization component 624E and / or the quantization circuit 630 may use operation-specific mixed-precision quantization profiles (such as the quantization profile 150 of FIG. 1) to quantize each operation of the machine learning model based on the corresponding quantization precision assignment.
[0135] Though depicted as separate components and circuits for clarity in FIG. 6, the grouping circuit 626, the SQNR circuit 627, the estimation circuit 628, the profile circuit 629, and the quantization circuit 630 may collectively or individually be implemented in other processing devices of the processing system 600, such as within the CPU 602, the GPU 604, the DSP 606, the NPU 608, and the like.
[0136] Generally, the processing system 600 and / or components thereof may be configured to perform the methods described herein.
[0137] Notably, in other aspects, aspects of the processing system 600 may be omitted, such as where the processing system 600 is a server computer or the like. For example, the multimedia component 610, the wireless connectivity component 612, the sensor processing units 616, the ISPs 618, and / or the navigation processor 620 may be omitted in other aspects. Further, aspects of the processing system 600 may be distributed between multiple devices.
[0138] Example Clauses
[0139] Implementation examples are described in the following numbered clauses:
[0140] Clause 1: A method, comprising: accessing a machine learning model comprising a plurality of operations; generating a plurality of operation groups, each respective operation group comprising a subset of the plurality of operations; determining a plurality of aggregate signal-to-quantization-noise ratios (SQNRs) for the plurality of operation groups; generating a respective estimated SQNR for each respective operation of the plurality of operations based on the plurality of aggregate SQNRs; and updating the machine learning model to use mixed-precision quantization comprising at least two quantization precisions based on the estimated SQNRs.
[0141] Clause 2: A method according to Clause 1, wherein generating the plurality of operation groups comprises grouping the plurality of operations based at least in part on a respective operation type of each respective operation of the plurality of operations.
[0142] Clause 3: A method according to any of Clauses 1-2, wherein: the plurality of operations is distributed among a plurality of blocks of the machine learning model, and generating the plurality of operation groups comprises grouping the plurality of operations based at least in part on the plurality of blocks.
[0143] Clause 4: A method according to any of Clauses 1-3, wherein generating the plurality of operation groups comprises grouping the plurality of operations based at least in part on a random sampling of the plurality of operations.
[0144] Clause 5: A method according to any of Clauses 1-4, wherein determining the plurality of aggregate SQNRs comprises, for a first operation group of the plurality of operation groups: quantizing each operation of the first operation group; and generating one or more model outputs using the quantized operations of the first operation group, wherein each operation of each remaining operation group of the plurality of operation groups is not quantized while generating the one or more model outputs.
[0145] Clause 6: A method according to any of Clauses 1-5, wherein generating the estimated SQNRs comprises generating a first set of estimated SQNRs for a first operation group of the plurality of operation groups based on minimizing an L1 norm of the first set of estimated SQNRs.
[0146] Clause 7: A method according to Clause 6, wherein generating the first set of estimated SQNRs further comprises constraining the first set of estimated SQNRs to a range defined based at least in part on a maximum noise, wherein the maximum noise is a hyperparameter.
[0147] Clause 8: A method according to any of Clauses 6-7, wherein generating the first set of estimated SQNRs further comprises constraining the first set of estimated SQNRs to sum to within a tolerance of a first aggregate SQNR corresponding to the first operation group, wherein the tolerance is a hyperparameter.
[0148] Clause 9: A method according to any of Clauses 6-8, wherein generating the first set of estimated SQNRs further comprises constraining the first set of estimated SQNRs such that each pair of operations having a matching operation type in adjacent blocks of the machine learning model have respective estimated SQNRs that are within a threshold, wherein the threshold is a hyperparameter.
[0149] Clause 10: A method according to any of Clauses 1-9, wherein generating the estimated SQNRs comprises converting each of the plurality of aggregate SQNRs to a linear domain.
[0150] Clause 11: A method according to any of Clauses 1-10, wherein updating the machine learning model to use mixed-precision quantization comprises: identifying a subset of operations, from the plurality of operations, having respective estimated SQNRs that satisfy one or more sensitivity criteria, wherein the one or more sensitivity criteria comprise one or more hyperparameters; and assigning each operation of the subset of operations to a first quantization precision.
[0151] Clause 12: A method according to any of Clauses 1-12, wherein the updated machine learning model comprises: a first operation of a first operation type quantized to a first quantization precision, and a second operation of the first operation type quantized to a second quantization precision.
[0152] Clause 13: A method according to any of Clauses 1-13, wherein the updated machine learning model comprises: a first operation in a first block quantized to a first quantization precision, and a second operation in the first block quantized to a second quantization precision.
[0153] Clause 14: A processing system comprising: a memory comprising processor-executable instructions; and one or more processors coupled to the one or more memories and configured to execute the processor-executable instructions and cause the processing system to perform a method in accordance with any of Clauses 1-13.
[0154] Clause 15: A processing system comprising means for performing a method in accordance with any of Clauses 1-13.
[0155] Clause 16: A non-transitory computer-readable medium comprising computer-executable instructions that, when executed by one or more processors of a processing system, cause the processing system to perform a method in accordance with any of Clauses 1-13.
[0156] Clause 17: A computer program product embodied on a computer-readable storage medium comprising code for performing a method in accordance with any of Clauses 1-13.
[0157] Additional Considerations
[0158] The preceding description is provided to enable any person skilled in the art to practice the various aspects described herein. The examples discussed herein are not limiting of the scope, applicability, or aspects set forth in the claims. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. For example, changes may be made in the function and arrangement of elements discussed without departing from the scope of the disclosure. Various examples may omit, substitute, or add various procedures or components as appropriate. For instance, the methods described may be performed in an order different from that described, and various steps may be added, omitted, or combined. Also, features described with respect to some examples may be combined in some other examples. For example, an apparatus may be implemented or a method may be practiced using any number of the aspects set forth herein. In addition, the scope of the disclosure is intended to cover such an apparatus or method that is practiced using other structure, functionality, or structure and functionality in addition to, or other than, the various aspects of the disclosure set forth herein. It should be understood that any aspect of the disclosure disclosed herein may be embodied by one or more elements of a claim.
[0159] As used herein, the word “exemplary” means “serving as an example, instance, or illustration. ” Any aspect described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other aspects.
[0160] As used herein, a phrase referring to “at least one of” a list of items refers to any combination of those items, including single members. As an example, “at least one of: a, b, or c” is intended to cover a, b, c, a-b, a-c, b-c, and a-b-c, as well as any combination with multiples of the same element (e.g., a-a, a-a-a, a-a-b, a-a-c, a-b-b, a-c-c, b-b, b-b-b, b-b-c, c-c, and c-c-c or any other ordering of a, b, and c) .
[0161] As used herein, the term “determining” encompasses a wide variety of actions. For example, “determining” may include calculating, computing, processing, deriving, investigating, looking up (e.g., looking up in a table, a database or another data structure) , ascertaining, and the like. Also, “determining” may include receiving (e.g., receiving information) , accessing (e.g., accessing data in a memory) , and the like. Also, “determining” may include resolving, selecting, choosing, establishing, and the like.
[0162] The methods disclosed herein comprise one or more steps or actions for achieving the methods. The method steps and / or actions may be interchanged with one another without departing from the scope of the claims. In other words, unless a specific order of steps or actions is specified, the order and / or use of specific steps and / or actions may be modified without departing from the scope of the claims. Further, the various operations of methods described above may be performed by any suitable means capable of performing the corresponding functions. The means may include various hardware and / or software component (s) and / or module (s) , including, but not limited to a circuit, an application specific integrated circuit (ASIC) , or processor. Generally, where there are operations illustrated in figures, those operations may have corresponding counterpart means-plus-function components with similar numbering.
[0163] The following claims are not intended to be limited to the aspects shown herein, but are to be accorded the full scope consistent with the language of the claims. Within a claim, reference to an element in the singular is not intended to mean “one and only one” unless specifically so stated, but rather “one or more. ” Unless specifically stated otherwise, the term “some” refers to one or more. No claim element is to be construed under the provisions of 35 U.S.C. § 112 (f) unless the element is expressly recited using the phrase “means for” or, in the case of a method claim, the element is recited using the phrase “step for. ” All structural and functional equivalents to the elements of the various aspects described throughout this disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims. Moreover, nothing disclosed herein is intended to be dedicated to the public regardless of whether such disclosure is explicitly recited in the claims.
Claims
1.A processing system comprising:one or more memories comprising processor-executable instructions; andone or more processors coupled to the one or more memories and configured to execute the processor-executable instructions and cause the processing system to:access a machine learning model comprising a plurality of operations;generate a plurality of operation groups, each respective operation group comprising a subset of the plurality of operations;determine a plurality of aggregate signal-to-quantization-noise ratios (SQNRs) for the plurality of operation groups;generate a respective estimated SQNR for each respective operation of the plurality of operations based on the plurality of aggregate SQNRs; andupdate the machine learning model to use mixed-precision quantization comprising at least two quantization precisions based on the estimated SQNRs.2.The processing system of claim 1, wherein, to generate the plurality of operation groups, the one or more processors are configured to execute the processor-executable instructions and cause the processing system to group the plurality of operations based at least in part on a respective operation type of each respective operation of the plurality of operations.3.The processing system of claim 1, wherein:the plurality of operations is distributed among a plurality of blocks of the machine learning model, andto generate the plurality of operation groups, the one or more processors are configured to execute the processor-executable instructions and cause the processing system to group the plurality of operations based at least in part on the plurality of blocks.4.The processing system of claim 1, wherein, to generate the plurality of operation groups, the one or more processors are configured to execute the processor-executable instructions and cause the processing system to group the plurality of operations based at least in part on a random sampling of the plurality of operations.5.The processing system of claim 1, wherein, to determine the plurality of aggregate SQNRs, the one or more processors are configured to execute the processor-executable instructions and cause the processing system to, for a first operation group of the plurality of operation groups:quantize each operation of the first operation group; andgenerate one or more model outputs using the quantized operations of the first operation group, wherein each operation of each remaining operation group of the plurality of operation groups is not quantized while generating the one or more model outputs.6.The processing system of claim 1, wherein, to generate the estimated SQNRs, the one or more processors are configured to execute the processor-executable instructions and cause the processing system to generate a first set of estimated SQNRs for a first operation group of the plurality of operation groups based on minimizing an L1 norm of the first set of estimated SQNRs.7.The processing system of claim 6, wherein, to generate the first set of estimated SQNRs, the one or more processors are configured to execute the processor-executable instructions and further cause the processing system to constrain the first set of estimated SQNRs to a range defined based at least in part on a maximum noise, wherein the maximum noise is a hyperparameter.8.The processing system of claim 6, wherein, to generate the first set of estimated SQNRs, the one or more processors are configured to execute the processor-executable instructions and further cause the processing system to constrain the first set of estimated SQNRs to sum to within a tolerance of a first aggregate SQNR corresponding to the first operation group, wherein the tolerance is a hyperparameter.9.The processing system of claim 6, wherein, to generate the first set of estimated SQNRs, the one or more processors are configured to execute the processor-executable instructions and further cause the processing system to constrain the first set of estimated SQNRs such that each pair of operations having a matching operation type in adjacent blocks of the machine learning model have respective estimated SQNRs that are within a threshold, wherein the threshold is a hyperparameter.10.The processing system of claim 1, wherein, to generate the estimated SQNRs, the one or more processors are configured to execute the processor-executable instructions and cause the processing system to convert each of the plurality of aggregate SQNRs to a linear domain.11.The processing system of claim 1, wherein, to update the machine learning model to use mixed-precision quantization, the one or more processors are configured to execute the processor-executable instructions and cause the processing system to:identify a subset of operations, from the plurality of operations, having respective estimated SQNRs that satisfy one or more sensitivity criteria, wherein the one or more sensitivity criteria comprise one or more hyperparameters; andassign each operation of the subset of operations to a first quantization precision.12.The processing system of claim 1, wherein the updated machine learning model comprises:a first operation of a first operation type quantized to a first quantization precision, anda second operation of the first operation type quantized to a second quantization precision.13.The processing system of claim 1, wherein the updated machine learning model comprises:a first operation in a first block quantized to a first quantization precision, anda second operation in the first block quantized to a second quantization precision.14.A processor-implemented method for machine learning, comprising:accessing a machine learning model comprising a plurality of operations;generating a plurality of operation groups, each respective operation group comprising a subset of the plurality of operations;determining a plurality of aggregate signal-to-quantization-noise ratios (SQNRs) for the plurality of operation groups;generating a respective estimated SQNR for each respective operation of the plurality of operations based on the plurality of aggregate SQNRs; andupdating the machine learning model to use mixed-precision quantization comprising at least two quantization precisions based on the estimated SQNRs.15.The processor-implemented method of claim 14, wherein generating the plurality of operation groups comprises at least one of:grouping the plurality of operations based at least in part on a respective operation type of each respective operation of the plurality of operations,grouping the plurality of operations based at least in part on a plurality of blocks of the machine learning model, wherein the plurality of operations is distributed among the plurality of blocks, orgrouping the plurality of operations based at least in part on a random sampling of the plurality of operations.16.The processor-implemented method of claim 14, wherein determining the plurality of aggregate SQNRs comprises, for a first operation group of the plurality of operation groups:quantizing each operation of the first operation group; andgenerating one or more model outputs using the quantized operations of the first operation group, wherein each operation of each remaining operation group of the plurality of operation groups is not quantized while generating the one or more model outputs.17.The processor-implemented method of claim 14, wherein generating the estimated SQNRs comprises generating a first set of estimated SQNRs for a first operation group of the plurality of operation groups based on minimizing an L1 norm of the first set of estimated SQNRs.18.The processor-implemented method of claim 17, wherein generating the first set of estimated SQNRs further comprises:constraining the first set of estimated SQNRs to a range defined based at least in part on a maximum noise, wherein the maximum noise is a hyperparameter;constraining the first set of estimated SQNRs to sum to within a tolerance of a first aggregate SQNR corresponding to the first operation group, wherein the tolerance is a hyperparameter; andconstraining the first set of estimated SQNRs such that each pair of operations having a matching operation type in adjacent blocks of the machine learning model have respective estimated SQNRs that are within a threshold, wherein the threshold is a hyperparameter.19.The processor-implemented method of claim 14, wherein updating the machine learning model to use mixed-precision quantization comprises:identifying a subset of operations, from the plurality of operations, having respective estimated SQNRs that satisfy one or more sensitivity criteria, wherein the one or more sensitivity criteria comprise one or more hyperparameters; andassigning each operation of the subset of operations to a first quantization precision.20.A processing system, comprising:means for accessing a machine learning model comprising a plurality of operations;means for generating a plurality of operation groups, each respective operation group comprising a subset of the plurality of operations;means for determining a plurality of aggregate signal-to-quantization-noise ratios (SQNRs) for the plurality of operation groups;means for generating a respective estimated SQNR for each respective operation of the plurality of operations based on the plurality of aggregate SQNRs; andmeans for updating the machine learning model to use mixed-precision quantization comprising at least two quantization precisions based on the estimated SQNRs.