I-MAD: Interpretable malware detector using Galaxy Transformer

Miles Q. Li, Benjamin C. M. Fung, Philippe Charland, Steven H. H. Ding

Abstract

Modern malware detection faces two primary challenges: the massive scale of assembly code in executables and the "black box" nature of deep learning models. This paper presents I-MAD (Interpretable MAlware Detector), a framework that employs a hierarchical "Galaxy Transformer" to process long sequences with linear complexity and an Interpretable Feed-Forward Neural Network (IFFNN) to provide actionable explanations. I-MAD achieves a state-of-the-art F1-score of 97.7% and demonstrates significant robustness against temporal shifts in malware evolution.

Introduction

Cybersecurity relies heavily on detecting malicious executables. Traditional signature-based methods are easily circumvented, while standard machine learning models often fail to scale to the hundreds of thousands of instructions found in typical binaries. Furthermore, the lack of transparency in deep learning models hinders human analysts who need to justify remediation actions. I-MAD addresses these issues by combining architectural efficiency with intrinsic interpretability.

Methodology

The Galaxy Transformer Architecture

To overcome the $O(n^2)$ complexity of standard Transformers, I-MAD introduces the Galaxy Transformer. This hierarchical model mirrors the structural organization of software:

  1. Satellite-Planet Transformer: Processes instructions within basic blocks.
  2. Planet-Star Transformer: Aggregates basic blocks into assembly functions.
  3. Star-Galaxy Transformer: Combines function representations into a full executable embedding.

By utilizing a "Star-Plus" topology, the model achieves $O(n)$ complexity, enabling the analysis of large files. Pre-training via Masked Assembly Modeling and Function Clone Detection further enhances the model's grasp of code semantics.

The hierarchical structure of the Galaxy Transformer, showing the transition from Satellite to Galaxy levels.

Interpretable Feed-Forward Neural Network (IFFNN)

The I-MAD framework integrates various features—assembly code embeddings, PE imports, strings, and numerical data—into a unified classifier. The IFFNN replaces standard output layers with a dynamic weighting mechanism. It calculates specific weights for each input feature per prediction, effectively functioning as a high-performance, dynamic logistic regression that exposes the influence of each feature on the final verdict.

Overview of the I-MAD architecture, illustrating the flow from disassembly to feature extraction and interpretable prediction.

Experimental Evaluation

The model was pre-trained on 38.4 million basic blocks and evaluated on a balanced dataset of 230,000 samples (115k benign, 115k malicious).

Performance and Robustness

I-MAD achieved an F1-score of 97.7%, outperforming established baselines. In a temporal evaluation (training on pre-2015 data and testing on post-2017 data), I-MAD maintained 91.5% accuracy, significantly higher than competing models. This indicates a superior ability to generalize to novel malware variants.

Interpretability Analysis

The IFFNN successfully identified critical indicators of maliciousness. For instance, the presence of specific API calls like WriteFile or strings such as Sleep (often used in ransomware to delay execution) were assigned high impact scores, providing analysts with immediate context for the detection.

Conclusion

I-MAD demonstrates that high-performance malware detection and model interpretability are not mutually exclusive. By leveraging a hierarchical transformer and a specialized interpretable layer, the framework provides a scalable and transparent solution for modern cybersecurity challenges. Future research will focus on adversarial robustness and the integration of dynamic behavioral features.

Summary updated

BibTeX
@article{li2021i,
  author = {Miles Q. Li and Benjamin C. M. Fung and Philippe Charland and Steven H. H. Ding},
  title = {{I-MAD: Interpretable malware detector using Galaxy Transformer}},
  journal = {Comput. Secur.},
  year = {2021},
  doi = {10.1016/j.cose.2021.102371},
}
Figure