Towards Quantum Machine Learning for Malicious Code Analysis
Jesus Lopez 2 , Saeefa Rubaiyet Nowmi 2 , Viviana Cadena 2 , and Mohammad Saidur Rahman 2 · 2025
Read Towards Quantum Machine Learning for Malicious Code Analysis by Jesus Lopez 2 , Saeefa Rubaiyet Nowmi 2 , Viviana Cadena 2 , and Mohammad Saidur Rahman 2 (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-19381.txt.
Introduction
Jesus Lopez and co-authors test in 2025 whether quantum machine learning can sort malware as well as classical tools. Classical models already do much of this work, but quantum methods might spot patterns they miss. The field is young, and malware is a mostly untested ground for it. The team built two hybrid models that mix quantum circuits with classical layers.
Both models encode malware features as angles in quantum states. One reads out all its qubits and feeds data through repeatedly, capturing tangled patterns. The other uses quantum convolution and pooling to train faster with fewer active qubits. On five public malware data sets, binary sorting scored high, up to about ninety-six percent on one set. Sorting into many families varied far more by set. The first model won on complex tasks; the second trained faster at some cost to accuracy.
Catalog record
| CREATOR | Jesus Lopez 2 , Saeefa Rubaiyet Nowmi 2 , Viviana Cadena 2 , and Mohammad Saidur Rahman 2 |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 31 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2508-19381
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Towards Quantum Machine Learning for Malicious Code Analysis Jesus Lopez 2 , Saeefa Rubaiyet Nowmi 2 , Viviana Cadena 2 , and Mohammad Saidur Rahman 2 Abstract Classical machine learning (CML) has been extensively studied for malware classification. With the emergence of quantum computing, quantum machine learning (QML) presents a paradigm-shifting opportunity to improve malware detection, though its application in this domain remains largely unexplored. In this study, we investigate two hybrid quantum-classical models — a Quantum Multilayer Perceptron (QMLP) and a Quantum Convolutional Neural Network (QCNN), for malware classification. Both models utilize angle embedding to encode malware features into quantum states. QMLP captures complex patterns through full qubit measurement and data re-uploading, while QCNN achieves faster training via quantum convolution and pooling layers that reduce active qubits. We evaluate both models on five widely used malware datasets — API-Graph, EMBER-Domain, EMBER-Class, AZ-Domain, and AZ-Class, across binary and multiclass classification tasks. Our results show high accuracy for binary classification — 95–96% on API-Graph, 91–92% on AZ-Domain, and 77% on EMBER-Domain. In multiclass settings, accuracy ranges from 91.6–95.7% on API-Graph, 41.7–93.6% on AZ-Class, and 60.7–88.1% on EMBER-Class. Overall, QMLP outperforms QCNN in complex multiclass tasks, while QCNN offers improved training efficiency at the cost of reduced accuracy. Availability. The implementation is available at https://iqsec-lab.github.io/qml-malware_classification/ . I Introduction Quantum Machine Learning (QML) is an emerging, interdisciplinary field of research that seeks to solve complex problems across a wide range of domains by leveraging the power of quantum computing [ 1 , 2 , 3 ] . Within this field, one of the most actively studied areas is Quantum Neural Networks (QNNs) [ 3 ] . QNNs are quantum analogs of classical neural networks; instead of neurons and weighted connections, they use quantum circuits composed of parameterized gates to learn from quantum-encoded inputs [ 4 , 5 ] . While QNNs are promising, many QNNs are limited by Noisy Intermediate-Scale Quantum (NISQ) devices [ 6 ] , which suffer from high error rates, limited qubit counts and shallow circuit depths [ 7 ] . Despite these limitations, QNNs have shown potential in learning complex quantum-encoded patterns with fewer parameters than classical networks. As a result, current research efforts focus on building QNN architectures that are more robust and better suited to NISQ-era devices. Most QNN models have primarily focused on MNIST image classification [ 8 , 9 ] . MNIST provides benchmarks for testing models that are relatively easier to encode into quantum circuits. However, due to the current hardware limitations, the full 28\times 28 images cannot be encoded directly and have to be downsized to more feasible dimensions, such as 4\times 4 in order to fit the number of qubits used in a quantum circuit [ 10 ] . Quantum simulators such as PennyLane [ 11 ] and TensorFlow Quantum [ 12 ] struggle with large datasets as they have to compute each sample in a circuit [ 6 ] . Despite the significant reduction in resolution, the model still yields promising results even when MNIST images are downsized to 4\times 4 , demonstrating the robustness of the approach [ 13 , 8 ] . Even though QML has been widely studied in domains such as computer vision [ 13 ] , chemistry [ 14 ] , and material discovery [ 15 ] , its applicability and effectiveness in malicious code analysis remain largely unexplored. As such, in this work, we explore two of the most widely adapted QML models — Quantum Convolutional Neural Networks (QCNN) [ 16 ] and Quantum Multilayer Perceptrons (QMLP) [ 13 ] , to assess their broader applicability and effectiveness for malicious code (i.e., malware) classification. Unlike images, malware datasets often contain high-dimensional binary feature vectors derived from static characteristics such as API calls and their relationships, permissions, and intent filtering [ 17 , 18 , 19 ] . We have implemented both Quantum Multilayer Perceptron (QMLP) and Quantum Convolutional Neural Network (QCNN) architectures within the PennyLane [ 11 ] simulator. These models, originally developed for image classification, are evaluated on five benchmark malware datasets — API-Graph [ 18 ] , EMBER-Class [ 20 ] , EMBER-Domain [ 17 ] , AZ-Class [ 21 , 22 ] , and AZ-Domain [ 21 , 22 ] . These datasets comprise both Windows [ 17 , 20 ] and Android [ 18 , 21 , 22 ] malicious and benign applications. Crucially, their feature sets contain various API-call graphs, offering a more complex and structured input format compared to traditional image data. In summary, the contributions of this paper are as follows: • We extensively evaluated Quantum Multilayer Perceptron (QMLP) and Quantum Convolutional Neural Network (QCNN) models across five diverse malware datasets, encompassing both multi-class and binary classification scenarios. • This study provides an in-depth analysis of how the architectural design choices of QMLP and QCNN impact their accuracy and overall performance in malware classification across various datasets. • We observe that the QCNN model, by leveraging convolution and pooling mechanisms, offers improved time efficiency. However, this comes at the cost of reduced accuracy across most datasets except for the API-Graph dataset, where QCNN slightly outperforms QMLP in multiclass classification. II Preliminaries In this section, we discuss the details of architectures and the workflows of the Quantum Multilayer Perceptron (QMLP) and Quantum Convolutional Neural Network (QCNN) used in our experiments. II-A QMLP The major two components of QMLP are — a parameterized quantum circuit (called a QNode) and a classical fully connected layer that produces the final output. The quantum circuit consists of 16 qubits representing one of the principal component from the malware dataset. The input features are encoded into the quantum system using RX rotation gates, which convert classical values into quantum states. After the data encoding, the circuit applies a set of trainable quantum rotation gates ( Rot gates) to each qubit. These act like learnable weights in a neural network, letting the model adjust and transform the quantum states as needed. After that, CRX gates are used to entangle the qubits in a ring-like pattern, connecting each qubit to its neighbor. This entanglement step helps the circuit capture relationships between features across the entire input. To improve the model’s capacity to learn deeper patterns, this whole process — RX encoding, rotations, and CRX entanglement, is repeated a second time with a new set of parameters. The final step in the quantum circuit is to measure the Pauli-Z expectation values from all 16 qubits, which results in a 16-dimensional feature vector that represents the learned quantum information. Figure 1(a) depicts the quantum circuit used for the QMLP model and Figure 2 depicts the workflow of the QMLP. This quantum-generated vector is then passed into a classical linear layer, which maps it to the target class space. A log-softmax function is applied to generate the final class probabilities. To make the model compatible with batch processing in PyTorch, we use a custom QLayer wrapper that runs the quantum circuit on each sample in the batch and stacks the results together. Because of PennyLane’s integration with PyTorch through the TorchLayer interface, we are able to train the entire model end-to-end using Adam optimization function. This approach allows us