# A Methodology to Design Quantized Deep Neural Networks for Automatic Modulation Recognition
## 5 Analysis and Results
### Stage 4: Selection of the Quantization Level per Layer  
In the last stage of the methodology, we propose using the Spearman's correlation coefficient as an indicator for the degree and direction of the relationship of each layer regarding the accuracy and inference cost. Then, since the Spearman's correlation ranges from \(1\) to \(-1\), we map the bit quantization levels from \(4\) to \(-4\) to have an equivalent scale. This way, the highest possible quantization level (\(8\) bits) is never exceeded. Since there are two variables we want to control (accuracy and inference cost), we applied Equation (7) to each of them. As a result, Equations (8) and (9) show how we define the scale to map the quantization bits according to the sign of the ratio. Using these equations, it is possible to determine a configuration that achieves the best compromise between accuracy and cost of inference. In the Equations, \(\beta_{layer}\) is the bit selection from the accuracy perspective, while \(\delta_{layer}\) is the bit selection from the inference cost perspective. \(S_{aM_{1}}\) and \(S_{nM_{2}}\) are the  
Figure 6: [PERSON]’s correlation per layer. Panel (**a**) shows the accuracy and Panel (**b**) shows the NICS against each quantized CNN layer. Note that a correlation is negligible when \(\rho<|0.1|\), low when \(|0.1|<\rho<=|0.3|\), medium when \(|0.3|<\rho<=|0.5|\), and strong or high when \(\rho>|0.5|\). medians of the Spearman coefficient for a given layer, regarding accuracy and inference cost, respectively (see Figure 6). \[\beta_{layer}= \begin{cases}4+\frac{\left(4*\delta_{sM_{l}}\right)+4}{2}&\text{ if }\rho\geqslant 1-\frac{6\sum_{i=1}^{n}Accuracy_{i}^{2}}{n(n^{2}-1)}\\ -4+\frac{\left(4*\delta_{sM_{l}}\right)+4}{2}&\text{Otherwise}\end{cases}  \tag{8}\]  
\[\delta_{layer}= \begin{cases}-4+\frac{\left(4*\delta_{sM_{l}}\right)+4}{2}& \text{if }\rho\geqslant 1-\frac{6\sum_{i=1}^{n}NICS_{l}^{2}}{n(n^{2}-1)}\\ 4+\frac{\left(4*\delta_{sM_{l}}\right)+4}{2}&\text{Otherwise}\end{cases}  \tag{9}\]  
Then, we can select a layer-discriminated quantization level for the model using Equation (10), which is a weighted sum that takes into account the contribution of each variable of interest. \(Q\) is the quantization level to be applied to a given layer, while \(\alpha_{1}\) and \(\alpha_{2}\) represent the importance given to accuracy or inference cost, with \(\alpha_{1}+\alpha_{2}=1\). The result is a quantization level that considers both accuracy and inference cost. \[Q=\left\lfloor\alpha_{1}*\beta_{layer}+\alpha_{2}*\delta_{layer}\right\rfloor \tag{10}\]  
Finally, complementing the analysis methodology with Equations (8)-(10), we select the quantization levels discriminated on each layer in the DNN. Algorithm 3 shows the procedure's pseudocode to perform stages three and four. We call this the LDQ algorithm. In LDQ, we define the necessary steps to determine the degree of quantization of each layer of a DNN for AMR. Note that the first part of the algorithm obtains the resulting accuracy and NICS metrics from the quantized models when varying the quantized values on each layer in Algorithm 2. Between lines 4 and 7, the solutions are mapped, grouping them by layers, and then analyzed with Spearman's correlation (lines 8 and 9). In lines 10 and 11, using Equations (8) and (9), the decision threshold for each layer of the DNN is obtained. Finally, the quantification values are obtained between lines 13 and 17. Note that in this part, the alpha parameters allow different quantification configurations to be obtained depending on the importance assigned to them following Equation (10). ```
0: Set \(E\) from Algorithm 2
0: Set L with the layers of \(M\) to be quantized
0:\(\alpha_{1}\in range[0,1]\) and \(\alpha_{2}\in range[0



### Classification Evaluation

This section evaluates the configurations obtained from the layer discrimination analysis. This exercise aims to determine a suitable model configuration with a low bit size but that simultaneously does not compromise accuracy.