# A Methodology to Design Quantized Deep Neural Networks for Automatic Modulation Recognition
## 4 Design Methodology for Quantization Selection  
As seen in previous sections, robust DL models are typically used.Nevertheless, due to the size/complexity of such models, signal processing must be performed in machines with high computational power, which is not the characteristic of the devices composing the radio access, edge, or far-edge networks. In Section 2, we saw how quantization helps to reduce the computational cost of implementing a robust DL model; however, in Section 3, we showed that only few works focus on quantization of DL models for radio signals. Moreover, we could verify that there is no general approach or methodology that guides researchers and radio practitioners in selecting the degree of quantization of a model DL to achieve a desired trade-off level between performance and the model's complexity. To start the description of the proposed methodology, let us consider an experiment with three design factors, where each element has three possible levels. Then, using a complete factorial design, we would need to run the same experiment \(3^{3}-1=26\) times to determine which design factor impacts the response variable (i.e., the outcome) the most. Translating this small example to the field of DL model quantization, if we have three quantifiable parameters (e.g., the input, the activation layers, and the weights), each in the range of 1 to 32 bits, it gives \(32^{3}-1=32,767\) possible combinations. Evaluating the impact of each parameter's quantization level regarding the accuracy and inference cost is prohibitively time- and resource-consuming. Based on a fractional factorial design [34], our methodology allows reducing the number of experiments concerning quantifiable parameters. We divide the methodology into four stages. After each stage, we measure the trade-off between the model's performance metric (e.g., accuracy) and its inference cost (e.g., space in memory, number of operations) regarding the unquantized model. It is worth mentioning that it is possible to include a preprocessing of the input signals to reduce their size before applying this methodology, such as dimensionality-reduction methods or averaged filters. Figure 3 illustrates a detailed block diagram of the developed methodology. During the first stage, we identify the dominant parameter in the quantization. To perform this, we select a subset of representative levels and evaluate all the possible combinations over that subset (i.e., screening). That evaluation is made regarding the model accuracy and the NICS (i.e., the outputs). Accuracy is the ratio between the number of correct and the total number of predictions in all classes. The NICS calculation is obtained by comparing the weight bits, total activation bits, and BOPS against the reference model, as described in Equation (5). Figure 3: Proposed methodology based on fractional factorial design. \[NICS=0.5*(bops/bops_baseline)+0.5*(w_{bits}/w_{bits\_baseline}) \tag{5}\]  
where \(bops\) and \(bops_baseline\) are the BOPS of the evaluated (quantized) and the reference (non-quantized) model, respectively. Similarly, \(w_{bits}\) and \(w_{bits\_baseline}\) are the total bits used by the weights in the evaluated and the reference models, respectively. Note that previous information can help refine the selection of subsets. For instance, [35; 36] showed that an 8-bit quantized CNN model achieves an accuracy close to that of an unquantized model for AMR. Then, a reduced subset of quantization levels can be used (i.e., from 1- to 8-bit quantization). Once we obtain the performance and the inference cost for each combination of the subset, we apply [PERSON]'s correlation coefficient (see Equation (6)) to identify which quantized parameter (i.e., input, activations, and weights) has the highest impact on the output, i.e., the dominant parameter. We use [PERSON]'s correlation, where \(n\) is the number of observations and \(D\) is the variable of interest, since it allows for correlation variables that bear a nonlinear relationship.