Skip to content
Open access

Lightweight CNN with Multi-Head Attention for Image-Based Malware Classification

Aug 2026 · Zanco Journal of Pure and Applied Sciences · 0 citations

Abstract

This paper introduces a compact convolutional neural network (CNN) architecture integrated with a multi-head attention mechanism to enhance feature discrimination in malware family classification. The novelty lies in combining attention-based refinement within a lightweight framework that achieves comparable accuracy to larger model while maintaining computational efficiency. The integrated multi-head attention module emphasizes small yet highly discriminative regions, which often correspond to obfuscated or subtly modified code segments that traditional models overlook. In contrast to reverse engineering or handcrafted feature methods, the framework is fully automated and computationally efficient, requiring only 2.03 M parameters approximately one-fifth of the baseline CNN while reducing training time by 42% and inference latency by 37% on the same hardware configuration. Experiments were conducted on the widely used Malimg dataset, which comprises 9,342 grayscale images across 25 malware families, under multiple train–test splits (50/50 to 90/10). The results consistently demonstrate superior performance relative to the baseline CNN, the model achieving an average accuracy of 98.7 ± 0.3% across five randomized train–test splits, with a peak performance of 99% on the 80/20 partition. Data partitions were strictly disjoint to prevent leakage between training and test sets. Furthermore, the proposed model attains high weighted Precision, Recall, and F1 scores (≈0.99) and enhanced macro-averaged performance (up to 0.97), particularly enhancing classification for minority families that the baseline misclassified or failed to detect. Confusion matrix analysis further highlights that residual misclassifications occur primarily in families with limited samples or high morphological similarity. Comparative evaluation against recent studies confirms the superiority of the proposed approach in terms of both accuracy and computational efficiency. Despite these strengths, limitations remain, including dependence on labeled datasets, restricted interpretability, and the need for validation on more diverse, real-world malware corpora.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.