## 3 Learning Malware Detection
### Model Architecture
#### 3.1.1 Faster Spatial-Asymmetric Attention Module  
SAM is known for its capability of refining features with global-local attention. It has significantly impacted reconstructing nona-Bayer images with real-world image noises. Despite showing significant performance gain, the SAM is computationally expensive. Explicitly, it leverages a \(9\times 9\) square convolution for pursuing global attention from a given input. On the downside, malware classification suffers substantially from data limitations, and our target platform is mostly edge devices. Consequently, utilizing such computationally expensive blocks for malware classification counters two-fold limitations: (i) a large number of trainable parameters leads to overfitting, and (ii) significantly slower computation time with high temperature. To address both limitations, we propose to replace the large kernel convolution with small kernel dilation convolution [72] as shown in Figure 4. Table 1 compares the proposed FSAM and SAM modules. It helps reduce the trainable parameters of the original SAM by 83% without affecting the performance. We pursue Faster SAM as follows:  
\[\mathbf{F_{V}} =\tau(\mathbf{C_{S}}([\mathbf{Z_{A}}(\mathbf{A_{V}}(\mathbf{X})); \mathbf{Z_{M}}(\mathbf{A_{V}}(\mathbf{X}))])) \tag{1}\] \[\mathbf{F_{H}} =\tau(\mathbf{C_{S}}([\mathbf{Z_{A}}(\mathbf{A_{H}}(\mathbf{X})); \mathbf{Z_{M}}(\mathbf{A_{H}}(\mathbf{X}))])) \tag{2}\]  
In this context, the functions \(\mathbf{A}(\cdot)\) and \(\mathbf{C}(\cdot)\) denote the asymmetric convolution operation and square convolution, respectively, while \(\tau\) represents the sigmoid activation function. Additionally, \(\mathbf{Z_{A}}\) and \(\mathbf{Z_{M}}\) refer to the average pooling and max pooling operations, which generate two 2D feature maps denoted as \(\mathbf{X_{A}}\in\mathbb{R}^{1\times H\times W}\) and \(\mathbf{X_{M}}\in\mathbb{R}^{1\times H\times W}\), respectively. These mapped features are then concatenated and presented as a 2D map.  
Overall, the aggregated bi-directional attention over a given feature of malware is obtained as:  
\[\mathbf{F_{C}}=\mathbf{F_{V}}+\mathbf{F_{H}} \tag{3}\]  
A squeeze-extractor descriptor [73] has also been utilized to pursue a global descriptor as follows:  
\[\mathbf{F_{G}}=\mathbf{M_{F}}(\mathbf{Z_{G}}(\mathbf{C_{D}}(\mathbf{X}))) \tag{4}\]  
where \(\mathbf{M_{F}}\) and \(\mathbf{Z_{G}}\) represent consecutive fully connected layers and global pooling operations, respectively. Additionally, \(\mathbf{C_{D}}\) in Equation (4) denotes the proposed small kernel dilated convolution operation. This operation plays a crucial role in reducing the trainable parameters of the proposed Faster SAM module by 83% compared to its base module.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Module** & **Input** & **Square Kernel** & **Dilation** & **Param. (M)** & **Comp. (GFlops)** \\ \hline SAM & \(128\times 5\times 5\) & \(9\times 9\) & \(1\) & \(1.43\) & \(0.0713\) \\ FSAM & \(128\times 5\times 5\) & \(3\times 3\) & \(4\) & \(\mathbf{0.25}\) & \(\mathbf{0.0123}\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Comparison between proposed FSAM and well-known SAM module. Our FSAM is 83% lighter compared to the original SAM module.